diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2023-05-24 12:23:38 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2023-05-24 12:23:38 +0200 |
| commit | 0cd73c2ce02d8a57ea2580951cd9a628e540f591 (patch) | |
| tree | 7ef84737ed66a581286ed2204c7d8121e32c149d | |
| parent | 350bc6e4ced9257c40142ae5137f967d458d8e8b (diff) | |
| parent | a05b13416b28d6c27deac7c6b94d16fe16740ce2 (diff) | |
| download | mullvadvpn-0cd73c2ce02d8a57ea2580951cd9a628e540f591.tar.xz mullvadvpn-0cd73c2ce02d8a57ea2580951cd9a628e540f591.zip | |
Merge branch 'device-info-should-only-be-displayed-ios-169'
| -rw-r--r-- | ios/MullvadVPN/Coordinators/App/ApplicationCoordinator.swift | 24 |
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 } |
