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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
52 changed files with 221 additions and 172 deletions

View file

@ -19,9 +19,9 @@ interface AnalyticsService : AnalyticsTracker, ErrorTracker {
fun getAvailableAnalyticsProviders(): Set<AnalyticsProvider>
/**
* Return a Flow of Boolean, true if the user has given their consent.
* A Flow of Boolean, true if the user has given their consent.
*/
fun getUserConsent(): Flow<Boolean>
val userConsentFlow: Flow<Boolean>
/**
* Update the user consent value.
@ -29,9 +29,9 @@ interface AnalyticsService : AnalyticsTracker, ErrorTracker {
suspend fun setUserConsent(userConsent: Boolean)
/**
* Return a Flow of Boolean, true if the user has been asked for their consent.
* A Flow of Boolean, true if the user has been asked for their consent.
*/
fun didAskUserConsent(): Flow<Boolean>
val didAskUserConsentFlow: Flow<Boolean>
/**
* Store the fact that the user has been asked for their consent.
@ -39,9 +39,9 @@ interface AnalyticsService : AnalyticsTracker, ErrorTracker {
suspend fun setDidAskUserConsent()
/**
* Return a Flow of String, used for analytics Id.
* A Flow of String, used for analytics Id.
*/
fun getAnalyticsId(): Flow<String>
val analyticsIdFlow: Flow<String>
/**
* Update analyticsId from the AccountData.