File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -4,10 +4,14 @@ import FirebaseCore
4
4
import FirebaseMessaging
5
5
import AsyncHTTPClient
6
6
7
+ public enum Provider {
8
+ case fcm, apns
9
+ }
10
+
7
11
open class NotificationHandler {
8
12
public static let shared = NotificationHandler()
9
13
10
- public var fcmEnabled = true
14
+ public var provider: Provider = .apns
11
15
12
16
internal var client: Client? = nil
13
17
internal var account: Account? = nil
@@ -72,9 +76,18 @@ open class NotificationHandler {
72
76
}
73
77
74
78
public func handleAPNSToken(_ token: Data) {
75
- if (fcmEnabled) {
79
+ switch (provider) {
80
+ case .fcm:
76
81
FirebaseMessaging.Messaging.messaging().apnsToken = token
77
- } else {
82
+ case .apns:
83
+ Task {
84
+ await self.updateTarget(
85
+ existingCookies: [],
86
+ newCookies: [],
87
+ token: token.map { String(format: "%.2hhx", $0) }.joined()
88
+
89
+ )
90
+ }
78
91
}
79
92
}
80
93
You can’t perform that action at this time.
0 commit comments