12345678910111213141516171819202122232425262728293031323334 |
- //
- // AccountTools.swift
- // PDF Reader Pro
- //
- // Created by User-Tangchao on 2024/11/5.
- //
- import Cocoa
- class AccountTools: NSObject {
- @available(macOS 10.15.0, iOS 13.0, *)
- public class func canUseAdvance() async -> Bool {
- return await withCheckedContinuation({ continuation in
- self.canUseAdvance { success, err in
- continuation.resume(returning: success)
- }
- })
- }
-
- public class func canUseAdvance(callback: @escaping ((Bool, String?)->Void)) {
- guard let token = KMDataManager.ud_string(forKey: kAccountTokenKey), token.isEmpty == false else {
- return callback(false, nil)
- }
- let header = ["Token" : token]
-
- let uuid = GetHardwareUUID()
- let params = ["device_code" : uuid]
- // 绑定设备
- KMHTTP.OEM_POST(urlString: kURLAPI_oemBind, parameter: params, headers: header) { success, dataModel, err in
- callback(success, "")
- }
- }
- }
|