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