Skip to content

Commit

Permalink
Code review
Browse files Browse the repository at this point in the history
  • Loading branch information
m-zagorski committed Dec 20, 2024
1 parent 2565ffb commit 96f3e67
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions app/src/main/kotlin/com/wire/android/WireApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ import dagger.Lazy
import dagger.hilt.android.HiltAndroidApp
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.filterIsInstance
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import javax.inject.Inject
Expand Down Expand Up @@ -133,14 +134,14 @@ class WireApplication : BaseApp() {
}

private suspend fun observeRecentlyEndedCall() {
coreLogic.get().getGlobalScope().session.currentSessionFlow().collectLatest { sessionResult ->
if (sessionResult is CurrentSessionResult.Success && sessionResult.accountInfo.isValid()) {
coreLogic.get().getSessionScope(sessionResult.accountInfo.userId).calls.observeRecentlyEndedCallMetadata()
.collect { metadata ->
analyticsManager.get().sendEvent(AnalyticsEvent.RecentlyEndedCallEvent(metadata))
}
coreLogic.get().getGlobalScope().session.currentSessionFlow().filterIsInstance(CurrentSessionResult.Success::class)
.filter { session -> session.accountInfo.isValid() }
.flatMapLatest { session ->
coreLogic.get().getSessionScope(session.accountInfo.userId).calls.observeRecentlyEndedCallMetadata()
}
.collect { metadata ->
analyticsManager.get().sendEvent(AnalyticsEvent.RecentlyEndedCallEvent(metadata))
}
}
}

private fun enableStrictMode() {
Expand Down

0 comments on commit 96f3e67

Please sign in to comment.