Skip to content

Commit 4927aac

Browse files
committed
[fix] fcm 토큰 수정
1 parent b7a5c09 commit 4927aac

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

Projects/App/Sources/AppDelegate/AppDelegate.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ extension AppDelegate: UIApplicationDelegate {
4242
Messaging.messaging().token { token, error in
4343
if let error {
4444
self.store.send(.didRegisterForRemoteNotifications(.failure(error)))
45-
} else if let _ = token {
46-
self.store.send(.didRegisterForRemoteNotifications(.success(deviceToken)))
45+
} else if let token {
46+
self.store.send(.didRegisterForRemoteNotifications(.success(token)))
4747
}
4848
}
4949
}

Projects/App/Sources/AppDelegate/AppDelegateFeature.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public struct AppDelegateFeature {
2828

2929
public enum Action {
3030
case didFinishLaunching
31-
case didRegisterForRemoteNotifications(Result<Data, Error>)
31+
case didRegisterForRemoteNotifications(Result<String, Error>)
3232
case userNotifications(UserNotificationClient.DelegateEvent)
3333
case root(RootFeature.Action)
3434
}
@@ -70,9 +70,8 @@ public struct AppDelegateFeature {
7070
}
7171
case .didRegisterForRemoteNotifications(.failure):
7272
return .none
73-
case let .didRegisterForRemoteNotifications(.success(tokenData)):
74-
let token = tokenData.map { String(format: "%02.2hhx", $0) }.joined()
75-
return .run { _ in await userDefaults.setString(token, .fcmToken) }
73+
case let .didRegisterForRemoteNotifications(.success(token)):
74+
return .run { _ in await userDefaults.setString(token, .fcmToken) }
7675
catch: { _, _ in }
7776
case let .userNotifications(.willPresentNotification(_, completionHandler)):
7877
return .run { _ in completionHandler(.banner) }

0 commit comments

Comments
 (0)