From 85c75c3aae52e5d148324f52c6568cb78ed38212 Mon Sep 17 00:00:00 2001 From: baegteun Date: Sun, 22 Sep 2024 18:41:43 +0900 Subject: [PATCH] =?UTF-8?q?:recycle:=20::=20[#1299]=20=EB=B9=88=ED=86=A0?= =?UTF-8?q?=ED=81=B0=20=EB=AF=B8=EC=A0=84=EC=86=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseDomain/Sources/BasePlugin/BasePlugin.swift | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Projects/Domains/BaseDomain/Sources/BasePlugin/BasePlugin.swift b/Projects/Domains/BaseDomain/Sources/BasePlugin/BasePlugin.swift index a6da000cd..dc97392be 100644 --- a/Projects/Domains/BaseDomain/Sources/BasePlugin/BasePlugin.swift +++ b/Projects/Domains/BaseDomain/Sources/BasePlugin/BasePlugin.swift @@ -46,7 +46,8 @@ public struct BasePlugin: PluginType { } for type in baseInfoTypes { - newJson[type.apiKey] = typeToValue(with: type) + guard let value = typeToValue(with: type) else { continue } + newJson[type.apiKey] = value } guard let newBodyData = try? JSONSerialization.data(withJSONObject: newJson, options: []) else { @@ -60,7 +61,7 @@ public struct BasePlugin: PluginType { } private extension BasePlugin { - func typeToValue(with type: BaseInfoType) -> String { + func typeToValue(with type: BaseInfoType) -> String? { switch type { case .os: return "ios" @@ -75,18 +76,17 @@ private extension BasePlugin { func fetchDeviceID() -> String { let deviceIDFromKeychain: String = keychain.load(type: .deviceID) - let uuidString: String = UIDevice.current.identifierForVendor?.uuidString ?? "" + let uuidString: String? = UIDevice.current.identifierForVendor?.uuidString - if deviceIDFromKeychain.isEmpty { + if deviceIDFromKeychain.isEmpty, let uuidString { keychain.save(type: .deviceID, value: uuidString) return uuidString - } else { return deviceIDFromKeychain } } - func fetchPushToken() -> String { - return Messaging.messaging().fcmToken ?? "" + func fetchPushToken() -> String? { + return Messaging.messaging().fcmToken } }