diff options
| author | Mojgan <Mojgan.jelodar@codic.se> | 2023-05-23 12:01:09 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2023-05-24 12:21:02 +0200 |
| commit | a05b13416b28d6c27deac7c6b94d16fe16740ce2 (patch) | |
| tree | 7ef84737ed66a581286ed2204c7d8121e32c149d | |
| parent | 350bc6e4ced9257c40142ae5137f967d458d8e8b (diff) | |
| download | mullvadvpn-a05b13416b28d6c27deac7c6b94d16fe16740ce2.tar.xz mullvadvpn-a05b13416b28d6c27deac7c6b94d16fe16740ce2.zip | |
Show device info in just case user is logged in and dismissed the registered in app notification banner
| -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 } |
