diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2021-09-30 11:16:49 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2021-09-30 11:16:49 +0200 |
| commit | 286c4bd7254c476a17b90a404e01f24930a2b5f6 (patch) | |
| tree | ca43b77c4423b4293a42406763fcc589c3f5833c | |
| parent | af5798694ac47c045ff69d7994c39514927cbfe1 (diff) | |
| download | mullvadvpn-286c4bd7254c476a17b90a404e01f24930a2b5f6.tar.xz mullvadvpn-286c4bd7254c476a17b90a404e01f24930a2b5f6.zip | |
Fix bug where notification manager delegate was unset after re-login
| -rw-r--r-- | ios/MullvadVPN/AppDelegate.swift | 2 | ||||
| -rw-r--r-- | ios/MullvadVPN/NotificationManager.swift | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/ios/MullvadVPN/AppDelegate.swift b/ios/MullvadVPN/AppDelegate.swift index 250333111c..fb8d7d0c63 100644 --- a/ios/MullvadVPN/AppDelegate.swift +++ b/ios/MullvadVPN/AppDelegate.swift @@ -153,7 +153,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate { fatalError() } - notificationManager.delegate = connectController?.notificationController notificationManager.notificationProviders = [ AccountExpiryNotificationProvider() ] @@ -245,6 +244,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { private func makeConnectViewController() -> ConnectViewController { let connectController = ConnectViewController() connectController.delegate = self + notificationManager.delegate = connectController.notificationController return connectController } diff --git a/ios/MullvadVPN/NotificationManager.swift b/ios/MullvadVPN/NotificationManager.swift index cf5f2c1450..0204396c57 100644 --- a/ios/MullvadVPN/NotificationManager.swift +++ b/ios/MullvadVPN/NotificationManager.swift @@ -83,6 +83,13 @@ class NotificationManager: NotificationProviderDelegate { willSet { assert(Thread.isMainThread) } + + didSet { + // Pump in-app notifications when changing delegate. + if !inAppNotificationDescriptors.isEmpty { + delegate?.notificationManagerDidUpdateInAppNotifications(self, notifications: inAppNotificationDescriptors) + } + } } func updateNotifications() { |
