diff options
| author | David Göransson <david.goransson@mullvad.net> | 2024-10-15 12:49:55 +0200 |
|---|---|---|
| committer | David Göransson <david.goransson@mullvad.net> | 2024-10-18 09:39:03 +0200 |
| commit | 0ec8a73b3eee45ffee2096fa582c94d2b055734a (patch) | |
| tree | 48ac9e1860ef07d7b2cb632806bc1c2ad6d21fcf /android | |
| parent | da32d827b37f276d17a7ad8f9e9ce241ae58a1c2 (diff) | |
| download | mullvadvpn-0ec8a73b3eee45ffee2096fa582c94d2b055734a.tar.xz mullvadvpn-0ec8a73b3eee45ffee2096fa582c94d2b055734a.zip | |
Ensure AccountExpiryInAppNotification has initial emission
Diffstat (limited to 'android')
| -rw-r--r-- | android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/AccountExpiryInAppNotificationUseCase.kt | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/AccountExpiryInAppNotificationUseCase.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/AccountExpiryInAppNotificationUseCase.kt index 83e334a719..9b71297d36 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/AccountExpiryInAppNotificationUseCase.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/AccountExpiryInAppNotificationUseCase.kt @@ -1,8 +1,9 @@ package net.mullvad.mullvadvpn.usecase import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.emptyFlow +import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.flatMapLatest +import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onStart import net.mullvad.mullvadvpn.lib.shared.AccountRepository @@ -25,9 +26,10 @@ class AccountExpiryInAppNotificationUseCase(private val accountRepository: Accou ) .map { expiresInPeriod -> InAppNotification.AccountExpiry(expiresInPeriod) } } else { - emptyFlow<InAppNotification.AccountExpiry?>() + flowOf(null) } } - .onStart { emit(null) } .map(::listOfNotNull) + .onStart { emit(emptyList()) } + .distinctUntilChanged() } |
