summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ios/MullvadVPN/Coordinators/App/ApplicationCoordinator.swift24
1 files changed, 19 insertions, 5 deletions
diff --git a/ios/MullvadVPN/Coordinators/App/ApplicationCoordinator.swift b/ios/MullvadVPN/Coordinators/App/ApplicationCoordinator.swift
index a1df5c3e46..9c8ae157d7 100644
--- a/ios/MullvadVPN/Coordinators/App/ApplicationCoordinator.swift
+++ b/ios/MullvadVPN/Coordinators/App/ApplicationCoordinator.swift
@@ -257,6 +257,8 @@ final class ApplicationCoordinator: Coordinator, Presenting, RootContainerViewCo
// MARK: - Private
+ private var isPresentingRegisteredDeviceBanner = false
+
/**
Continues application flow by evaluating what route to present next.
*/
@@ -705,12 +707,14 @@ final class ApplicationCoordinator: Coordinator, Presenting, RootContainerViewCo
private func deviceStateDidChange(_ deviceState: DeviceState, previousDeviceState: DeviceState) {
splitViewController.preferredDisplayMode = deviceState.splitViewMode
+ updateView(
+ deviceState: deviceState,
+ showDeviceInfo: shouldShowDeviceInfo(deviceState, previousDeviceState: previousDeviceState)
+ )
switch deviceState {
case let .loggedIn(accountData, _):
- let shouldHideDeviceInfo = previousDeviceState == .loggedOut
updateOutOfTimeTimer(accountData: accountData)
- updateView(deviceState: deviceState, showDeviceInfo: !shouldHideDeviceInfo)
// Handle transition to and from expired state.
let accountWasExpired = previousDeviceState.accountData?.isExpired ?? false
@@ -729,11 +733,20 @@ final class ApplicationCoordinator: Coordinator, Presenting, RootContainerViewCo
case .revoked:
cancelOutOfTimeTimer()
router.present(.revoked, animated: true)
- updateView(deviceState: deviceState, showDeviceInfo: false)
-
case .loggedOut:
cancelOutOfTimeTimer()
- updateView(deviceState: deviceState, showDeviceInfo: false)
+ }
+ }
+
+ private func shouldShowDeviceInfo(_ deviceState: DeviceState, previousDeviceState: DeviceState) -> Bool {
+ switch (previousDeviceState, deviceState) {
+ case (.loggedOut, .loggedIn):
+ isPresentingRegisteredDeviceBanner = true
+ return false
+ case (.loggedIn, .loggedIn):
+ return !isPresentingRegisteredDeviceBanner
+ default:
+ return false
}
}
@@ -870,6 +883,7 @@ final class ApplicationCoordinator: Coordinator, Presenting, RootContainerViewCo
case .accountExpirySystemNotification:
router.present(.account)
case .registeredDeviceInAppNotification:
+ isPresentingRegisteredDeviceBanner = false
updateView(deviceState: tunnelManager.deviceState)
default: return
}