Skip to content

Commit cba05cd

Browse files
authored
Fix broken site prompt (#5981)
Task/Issue URL: https://app.asana.com/1/137249556945/project/488551667048375/task/1210111594589774?focus=true ### Description ### Steps to test this PR _Feature 1_ - [x] Fresh install the app and skip onboarding - [x] Load a site and refresh 3 times in less than 30s - [x] Check broken site prompt is shown ### UI changes | Before | After | | ------ | ----- | !(Upload before screenshot)|(Upload after screenshot)|
1 parent 4d21e97 commit cba05cd

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

broken-site/broken-site-impl/src/main/java/com/duckduckgo/brokensite/impl/BrokenSitePomptDataStore.kt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ import kotlinx.coroutines.flow.Flow
4343
import kotlinx.coroutines.flow.distinctUntilChanged
4444
import kotlinx.coroutines.flow.firstOrNull
4545
import kotlinx.coroutines.flow.map
46-
import kotlinx.coroutines.flow.mapNotNull
4746

4847
interface BrokenSitePromptDataStore {
4948
suspend fun setMaxDismissStreak(maxDismissStreak: Int)
@@ -80,25 +79,25 @@ class SharedPreferencesDuckPlayerDataStore @Inject constructor(
8079
}
8180

8281
private val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
83-
private val maxDismissStreak: Flow<Int> = store.data
84-
.mapNotNull { prefs ->
82+
private val maxDismissStreak: Flow<Int?> = store.data
83+
.map { prefs ->
8584
prefs[MAX_DISMISS_STREAK]
8685
}
8786
.distinctUntilChanged()
8887

89-
private val dismissStreakResetDays: Flow<Int> = store.data
90-
.mapNotNull { prefs ->
88+
private val dismissStreakResetDays: Flow<Int?> = store.data
89+
.map { prefs ->
9190
prefs[DISMISS_STREAK_RESET_DAYS]
9291
}
9392
.distinctUntilChanged()
9493

95-
private val coolDownDays: Flow<Long> = store.data
96-
.mapNotNull { prefs ->
94+
private val coolDownDays: Flow<Long?> = store.data
95+
.map { prefs ->
9796
prefs[COOL_DOWN_DAYS]
98-
}
97+
}.distinctUntilChanged()
9998

100-
private val nextShownDate: Flow<String> = store.data
101-
.mapNotNull { prefs ->
99+
private val nextShownDate: Flow<String?> = store.data
100+
.map { prefs ->
102101
prefs[NEXT_SHOWN_DATE]
103102
}
104103
.distinctUntilChanged()

0 commit comments

Comments
 (0)