Remember flows (#4533)

* Add Konsist test to ensure that the result of a function returning a flow is remembered.

* Remember flows before they are collected by state.

* Fix compilation issue

* Make isOnline a val.

* Make selectedUsers() a val.

* Make flow() a val.

* Make getUserConsent(), didAskUserConsent() and getAnalyticsId() some val.

* Remove Timeline.paginationStatus() and replace by direct access to the underlined flow.

* Simplify test

* userConsentFlow must be initialized before because it's used in observeUserConsent

* Fix test compilation
This commit is contained in:
Benoit Marty
2025-04-04 16:50:43 +02:00
committed by GitHub
parent e557ee2c77
commit a230b83e99
52 changed files with 221 additions and 172 deletions
@@ -84,7 +84,7 @@ class FtueFlowNode @AssistedInject constructor(
moveToNextStepIfNeeded()
})
analyticsService.didAskUserConsent()
analyticsService.didAskUserConsentFlow
.distinctUntilChanged()
.onEach { moveToNextStepIfNeeded() }
.launchIn(lifecycleScope)
@@ -66,7 +66,7 @@ class DefaultFtueService @Inject constructor(
.onEach { updateState() }
.launchIn(sessionCoroutineScope)
analyticsService.didAskUserConsent()
analyticsService.didAskUserConsentFlow
.distinctUntilChanged()
.onEach { updateState() }
.launchIn(sessionCoroutineScope)
@@ -118,7 +118,7 @@ class DefaultFtueService @Inject constructor(
}
private suspend fun needsAnalyticsOptIn(): Boolean {
return analyticsService.didAskUserConsent().first().not()
return analyticsService.didAskUserConsentFlow.first().not()
}
private suspend fun shouldAskNotificationPermissions(): Boolean {