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. ( )
.binaryTarget(
name: "tcmpush_core",
url: "https://git.ipstein.myds.me/api/packages/seonkyu.kim/generic/tcmpush/1.0.0/tcmpush.xcframework.zip",
checksum: "097aa3e33ce234fa7146757a8236361f17090bb669a2463b13d311229de2d43d"
url: "https://git.ipstein.myds.me/api/packages/seonkyu.kim/generic/tcmpush/1.0.1/tcmpush.xcframework.zip",
checksum: "d977cbcd3e7c80accfd3188c76b6557fe253ac6f1a92ce33c1f74867a11028d8"
),
// 5. ( )

View File

@ -6,54 +6,24 @@
//
import UIKit
import FirebaseCore
import FirebaseMessaging
public class TCMPush: NSObject {
public static let shared: TCMPush = {
let inistance = TCMPush()
return inistance
}()
public static let shared = TCMPush()
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() {
if FirebaseApp.app() == nil {
FirebaseApp.configure()
printLog("[TCMPush] FirebaseApp configured")
}
FCMManager.shared.configure()
}
public func setAPNSToken(_ deviceId: Data){
Messaging.messaging().apnsToken = deviceId
printLog("[TCMPush] set APNS Token: \(deviceId)")
public func setAPNSToken(_ deviceToken: Data) {
FCMManager.shared.setAPNSToken(deviceToken)
}
// completion .
public func getFCMToken(completion: @escaping (String?, Error?) -> Void) {
Messaging.messaging().token { [weak self] token, error in
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)
}
}
}
FCMManager.shared.getFCMToken(completion: completion)
}
}