Browse Source

【综合】激活设备补充场景

tangchao 3 months ago
parent
commit
132802c08a

+ 16 - 0
PDF Office/PDF Master/AppDelegate.swift

@@ -229,6 +229,22 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
                 AccountManager.manager.aiBuyUrl = model.aiBuyUrl
                 
                 NotificationCenter.default.post(name: .loginStatusChanged, object: nil)
+                
+                if let data = model.memberInfo?.email, data.isEmpty == false {
+                    self.activateDevice(email: data)
+                }
+            }
+        }
+    }
+    
+    func activateDevice(email: String) {
+//        if IAPProductsManager.default().isAvailableAllFunction() {
+//            return
+//        }
+        
+        VerificationManager.default().activateDevice(withInfo: ["email" : email]) { status, info, err in
+            VerificationManager.default().verification { status, info, err in
+                
             }
         }
     }

+ 7 - 15
PDF Office/PDF Master/Class/Account/Controller/AccountProfileController.swift

@@ -88,8 +88,6 @@ class AccountProfileController: NSViewController {
         } else {
             self.showBenefit()
         }
-        
-        self.activateDevice()
     }
     
     func showBenefit() {
@@ -140,7 +138,9 @@ class AccountProfileController: NSViewController {
                     self.showBenefit()
                 }
                 
-                self.activateDevice()
+                if let data = model.memberInfo?.email, data.isEmpty == false {
+                    self.activateDevice(email: data)
+                }
             }
         }
     }
@@ -286,23 +286,15 @@ class AccountProfileController: NSViewController {
         self.loadingView_.removeFromSuperview()
     }
     
-    func activateDevice() {
+    func activateDevice(email: String) {
 //        if IAPProductsManager.default().isAvailableAllFunction() {
 //            return
 //        }
         
-        var licence: String?
-        for model in self.model?.rightsInterestsData ?? [] {
-            if let data = model.product_code, data.isEmpty == false {
-                licence = data
-                break
+        VerificationManager.default().activateDevice(withInfo: ["email" : email]) { status, info, err in
+            VerificationManager.default().verification { status, info, err in
+                
             }
         }
-        
-        if let data = licence {
-//            VerificationManager.default().activateDevice(withInfo: ["cdkey" : data]) { status, info, err in
-//                KMPrint("")
-//            }
-        }
     }
 }

+ 6 - 0
PDF Office/PDF Master/Class/Account/Model/AccountRightModel.swift

@@ -90,6 +90,8 @@ class AccountRightModel: NSObject {
     
     var trialData: AccountTrialModel?
     
+    var memberInfo: AccountInfoModel?
+    
     convenience init(dict: [String : Any]) {
         self.init()
         
@@ -101,6 +103,10 @@ class AccountRightModel: NSObject {
             self.trialData = AccountTrialModel(dict: info)
         }
         
+        if let info = dict["memberInfo"] as? [String : Any] {
+            self.memberInfo = AccountInfoModel(dict: info)
+        }
+        
         if let array = dict["rightsInterestsData"] as? [Any] {
             var datas: [AccountRightInfoModel] = []
             for data in array {

+ 0 - 1
PDF Office/PDF Master/Class/Account/Tools/AccountTools.swift

@@ -70,7 +70,6 @@ import Cocoa
         }
     }
 
-    
     private class func _isConnectionAvailable() -> Bool {
         if Reachability.forInternetConnection().currentReachabilityStatus().rawValue == 0 {
             return false

+ 16 - 0
PDF Office/PDF Master/Class/Account/Window/AccountCenterWindowController.swift

@@ -86,6 +86,10 @@ class AccountCenterWindowController: NSWindowController {
                 NotificationCenter.default.post(name: .loginStatusChanged, object: nil)
                 
                 self.gotoCenter(model: model, infoModel: nil)
+                
+                if let data = model.memberInfo?.email, data.isEmpty == false {
+                    self.activateDevice(email: data)
+                }
             }
         } else {
 //            if let token = KMDataManager.ud_string(forKey: kAccountEmailKey), token.isEmpty == false {
@@ -213,6 +217,18 @@ class AccountCenterWindowController: NSWindowController {
         self.contentBox.contentView = self.centerC?.view
     }
     
+    func activateDevice(email: String) {
+//        if IAPProductsManager.default().isAvailableAllFunction() {
+//            return
+//        }
+        
+        VerificationManager.default().activateDevice(withInfo: ["email" : email]) { status, info, err in
+            VerificationManager.default().verification { status, info, err in
+                
+            }
+        }
+    }
+    
 //    func rightDatas() {
 //        let header = ["Token" : "7130d162c7533b5a51daefdd4faf17ea1729747785"]
 //        KMHTTP.OEM_POST(urlString: kURLAPI_oemGetPermissions, parameter: nil, headers: header) { success, dataDict, err in