diff --git a/Club_portal/Club Portal/Club Portal.xcodeproj/xcuserdata/umertahir.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Club_portal/Club Portal/Club Portal.xcodeproj/xcuserdata/umertahir.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 4f062a3..68b0d8c 100644 --- a/Club_portal/Club Portal/Club Portal.xcodeproj/xcuserdata/umertahir.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/Club_portal/Club Portal/Club Portal.xcodeproj/xcuserdata/umertahir.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -270,5 +270,209 @@ landmarkType = "7"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Club_portal/Club Portal/Club Portal/UI/Main/Club_PortalApp.swift b/Club_portal/Club Portal/Club Portal/UI/Main/Club_PortalApp.swift index 23762c4..6d2d38f 100644 --- a/Club_portal/Club Portal/Club Portal/UI/Main/Club_PortalApp.swift +++ b/Club_portal/Club Portal/Club Portal/UI/Main/Club_PortalApp.swift @@ -14,7 +14,7 @@ struct Club_PortalApp: App { @UIApplicationDelegateAdaptor(AppDelegate.self) var delegate // Initialize notification service - @StateObject var notificationService = NotificationService() + @ObservedObject var notificationService = NotificationService.shared var body: some Scene { WindowGroup { WelcomeView() @@ -53,10 +53,16 @@ class AppDelegate: NSObject, UIApplicationDelegate { // Handle remote notification registration func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { + print("Successfully registered for remote notifications with token: \(deviceToken.map { String(format: "%02.2hhx", $0) }.joined())") Messaging.messaging().apnsToken = deviceToken NotificationService.shared.updateFCMToken() } + func application(_ application: UIApplication, + didFailToRegisterForRemoteNotificationsWithError error: Error) { + print("Failed to register for remote notifications: \(error.localizedDescription)") + } + // Handle notification tap when app is in background or terminated func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any],