Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 295c4ee9 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Set the default value of firstTimeEducationShownAt when shared...

Merge "Set the default value of firstTimeEducationShownAt when shared preference is null." into main
parents be7a3b28 1d5b8703
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -113,7 +113,9 @@ constructor(
    private val firstTimeEducationShownAt: Flow<Long?> =
        sharedPreferences
            .flatMapLatestConflated { prefs ->
                prefs?.observeLong(KEY_FIRST_TIME_ONBOARDING_SHOWN_AT, -1L) ?: flowOf(null)
                // If the shared preference is not initialized, set the default value to 0L to avoid
                // showing the first time education.
                prefs?.observeLong(KEY_FIRST_TIME_ONBOARDING_SHOWN_AT, -1L) ?: flowOf(0L)
            }
            .map { if (it == -1L) null else it }
            .distinctUntilChanged()