summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2021-09-30 11:16:49 +0200
committerAndrej Mihajlov <and@mullvad.net>2021-09-30 11:16:49 +0200
commit286c4bd7254c476a17b90a404e01f24930a2b5f6 (patch)
treeca43b77c4423b4293a42406763fcc589c3f5833c
parentaf5798694ac47c045ff69d7994c39514927cbfe1 (diff)
downloadmullvadvpn-286c4bd7254c476a17b90a404e01f24930a2b5f6.tar.xz
mullvadvpn-286c4bd7254c476a17b90a404e01f24930a2b5f6.zip
Fix bug where notification manager delegate was unset after re-login
-rw-r--r--ios/MullvadVPN/AppDelegate.swift2
-rw-r--r--ios/MullvadVPN/NotificationManager.swift7
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() {