From 05815e6d35a8f85e11b723886274a3cbe693a221 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Tue, 14 Feb 2023 07:46:45 +0100 Subject: [PATCH] Correctly route notification at app launch --- IceCubesApp/App/IceCubesApp.swift | 1 + IceCubesApp/App/Tabs/NotificationTab.swift | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/IceCubesApp/App/IceCubesApp.swift b/IceCubesApp/App/IceCubesApp.swift index c64a9692..6ae9ee7c 100644 --- a/IceCubesApp/App/IceCubesApp.swift +++ b/IceCubesApp/App/IceCubesApp.swift @@ -239,6 +239,7 @@ class AppDelegate: NSObject, UIApplicationDelegate { didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { try? AVAudioSession.sharedInstance().setCategory(.ambient, options: .mixWithOthers) + PushNotificationsService.shared.setAccounts(accounts: AppAccountsManager.shared.pushAccounts) return true } diff --git a/IceCubesApp/App/Tabs/NotificationTab.swift b/IceCubesApp/App/Tabs/NotificationTab.swift index 1aa2b148..e11f6686 100644 --- a/IceCubesApp/App/Tabs/NotificationTab.swift +++ b/IceCubesApp/App/Tabs/NotificationTab.swift @@ -56,7 +56,7 @@ struct NotificationsTab: View { } .onChange(of: pushNotificationsService.handleNotification) { notification in if let notification, let type = notification.supportedType { - DispatchQueue.main.async { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { switch type { case .follow, .follow_request: routerPath.navigate(to: .accountDetailWithAccount(account: notification.account))