This commit is contained in:
SEAN 2025-11-26 18:42:25 +09:00
parent 1badbcc371
commit 5c8bb517cb
2 changed files with 10 additions and 40 deletions

View File

@ -19,8 +19,8 @@ let package = Package(
// 4. ( ) // 4. ( )
.binaryTarget( .binaryTarget(
name: "tcmpush_core", name: "tcmpush_core",
url: "https://git.ipstein.myds.me/api/packages/seonkyu.kim/generic/tcmpush/1.0.0/tcmpush.xcframework.zip", url: "https://git.ipstein.myds.me/api/packages/seonkyu.kim/generic/tcmpush/1.0.1/tcmpush.xcframework.zip",
checksum: "097aa3e33ce234fa7146757a8236361f17090bb669a2463b13d311229de2d43d" checksum: "d977cbcd3e7c80accfd3188c76b6557fe253ac6f1a92ce33c1f74867a11028d8"
), ),
// 5. ( ) // 5. ( )

View File

@ -6,54 +6,24 @@
// //
import UIKit import UIKit
import FirebaseCore
import FirebaseMessaging
public class TCMPush: NSObject { public class TCMPush: NSObject {
public static let shared: TCMPush = { public static let shared = TCMPush()
let inistance = TCMPush()
return inistance
}()
private override init() {} private override init() {}
public var isDebugMode: Bool = false public static var isDebugMode: Bool = false
public func printLog<T>(_ object: T,_ function: String = #function, _ line: Int = #line){
if isDebugMode {
Swift.print("""
_____ _____ _____ _____ _____ _____ _____ _____ _____ _____
| NAME = [\(function)] || LINE = [\(line)]
|>>> PRINT = \(object)
""")
}
}
public func configure() { public func configure() {
if FirebaseApp.app() == nil { FCMManager.shared.configure()
FirebaseApp.configure()
printLog("[TCMPush] FirebaseApp configured")
}
} }
public func setAPNSToken(_ deviceId: Data){ public func setAPNSToken(_ deviceToken: Data) {
Messaging.messaging().apnsToken = deviceId FCMManager.shared.setAPNSToken(deviceToken)
printLog("[TCMPush] set APNS Token: \(deviceId)")
} }
// completion .
public func getFCMToken(completion: @escaping (String?, Error?) -> Void) { public func getFCMToken(completion: @escaping (String?, Error?) -> Void) {
Messaging.messaging().token { [weak self] token, error in FCMManager.shared.getFCMToken(completion: completion)
guard let self = self else { return }
if let error = error {
self.printLog("[TCMPush] 토큰 가져오기 실패: \(error.localizedDescription)")
completion(nil, error)
} else if let token = token {
self.printLog("[TCMPush] 토큰 획득 성공: \(token)")
completion(token, nil)
} }
}
}
} }