diff options
Diffstat (limited to 'android/app')
| -rw-r--r-- | android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/ConnectFragment.kt | 8 | ||||
| -rw-r--r-- | android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/NotificationBanner.kt | 3 |
2 files changed, 7 insertions, 4 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/ConnectFragment.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/ConnectFragment.kt index 5dc832eaa1..5139129526 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/ConnectFragment.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/ConnectFragment.kt @@ -14,8 +14,8 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.callbackFlow -import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.combine +import kotlinx.coroutines.flow.debounce import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.flowOf @@ -188,6 +188,8 @@ class ConnectFragment : BaseFragment(), NavigationBarPainter { Pair(uiState, realState) } } + // Fix to avoid wrong notification shown due to very frequent tunnel state updates. + .debounce(TUNNEL_STATE_UPDATE_DEBOUNCE_DURATION_MILLIS) .collect { (uiState, realState) -> tunnelStateNotification.updateTunnelState(uiState) updateTunnelState(uiState, realState) @@ -254,4 +256,8 @@ class ConnectFragment : BaseFragment(), NavigationBarPainter { return ((this as? TunnelState.Error)?.errorState?.cause as? ErrorStateCause.AuthFailed) ?.isCausedByExpiredAccount() ?: false } + + companion object { + const val TUNNEL_STATE_UPDATE_DEBOUNCE_DURATION_MILLIS: Long = 200 + } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/NotificationBanner.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/NotificationBanner.kt index c4432da8f7..502d7d2302 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/NotificationBanner.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/NotificationBanner.kt @@ -50,9 +50,6 @@ class NotificationBanner : FrameLayout { private val animation = ObjectAnimator.ofFloat(this, "translationY", 0.0f).apply { addListener(animationListener) setDuration(350) - - // Ensure there's time for the layout to finish before making the banner visible - setStartDelay(20) } private val container = |
