-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: server - FCM refactor: app - compose feat: app - FCM
- Loading branch information
1 parent
ddc1e5d
commit 07ede58
Showing
135 changed files
with
6,024 additions
and
3,189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,45 @@ | ||
import SwiftUI | ||
import FirebaseCore | ||
|
||
import Firebase | ||
import UserNotifications | ||
|
||
class AppDelegate: NSObject, UIApplicationDelegate { | ||
func application(_ application: UIApplication, | ||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { | ||
FirebaseApp.configure() | ||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { | ||
FirebaseApp.configure() | ||
|
||
initRemoteNotifications(application: application) | ||
initFirebaseMessaging() | ||
|
||
return true | ||
} | ||
|
||
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { | ||
Messaging.messaging().apnsToken = deviceToken | ||
} | ||
|
||
|
||
func initRemoteNotifications(application: UIApplication) { | ||
UNUserNotificationCenter.current().delegate = self | ||
|
||
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound] | ||
UNUserNotificationCenter.current().requestAuthorization( | ||
options: authOptions, | ||
completionHandler: { _, _ in } | ||
) | ||
|
||
application.registerForRemoteNotifications() | ||
} | ||
|
||
func initFirebaseMessaging() { | ||
Messaging.messaging().delegate = self | ||
} | ||
} | ||
|
||
extension AppDelegate: UNUserNotificationCenterDelegate { | ||
|
||
} | ||
|
||
return true | ||
} | ||
extension AppDelegate: MessagingDelegate { | ||
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) { | ||
print("Firebase registration token: \(String(describing: fcmToken))") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>aps-environment</key> | ||
<string>development</string> | ||
</dict> | ||
</plist> |
Oops, something went wrong.