1.0.3
This commit is contained in:
parent
1badbcc371
commit
5c8bb517cb
|
|
@ -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. 래퍼 타겟 (최종 모듈 이름)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user