Correctly route notification at app launch

This commit is contained in:
Thomas Ricouard 2023-02-14 07:46:45 +01:00
parent 1f14311c2c
commit 05815e6d35
2 changed files with 2 additions and 1 deletions

View file

@ -239,6 +239,7 @@ class AppDelegate: NSObject, UIApplicationDelegate {
didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool
{ {
try? AVAudioSession.sharedInstance().setCategory(.ambient, options: .mixWithOthers) try? AVAudioSession.sharedInstance().setCategory(.ambient, options: .mixWithOthers)
PushNotificationsService.shared.setAccounts(accounts: AppAccountsManager.shared.pushAccounts)
return true return true
} }

View file

@ -56,7 +56,7 @@ struct NotificationsTab: View {
} }
.onChange(of: pushNotificationsService.handleNotification) { notification in .onChange(of: pushNotificationsService.handleNotification) { notification in
if let notification, let type = notification.supportedType { if let notification, let type = notification.supportedType {
DispatchQueue.main.async { DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
switch type { switch type {
case .follow, .follow_request: case .follow, .follow_request:
routerPath.navigate(to: .accountDetailWithAccount(account: notification.account)) routerPath.navigate(to: .accountDetailWithAccount(account: notification.account))