Преглед изворни кода

【会员系统】- 领取AI补充load转圈

dinglingui пре 3 месеци
родитељ
комит
f3315db34f

+ 1 - 1
PDF Office/PDF Master/AppDelegate.swift

@@ -768,7 +768,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
 #if VERSION_FREE
         KMPrint("restoreSubscriptions ...")
         KMProductCompareWC.shared.orientation = false
-        KMProductCompareWC.shared.showWindowRestore(nil)
+        KMProductCompareWC.shared.showWindowRestore(sender)
 #else
         var vc: KMToolCompareWindowController? = nil
         vc = KMToolCompareWindowController.toolCompare(toolType: .Convert, selectNum: 0)

+ 21 - 0
PDF Office/PDF Master/MemberCenter/WindowsController/KMFreeGetAIWC.swift

@@ -60,6 +60,20 @@ class KMFreeGetAIWC: NSWindowController {
         termsServiceLabel.isEditable = false
         termsServiceLabel.isSelectable = true
         termsServiceLabel.allowsEditingTextAttributes = true
+        
+        NotificationCenter.default.addObserver(
+            self,
+            selector: #selector(IAPSubscriptionLoadedNotification(_:)),
+            name: NSNotification.Name(rawValue: "KMIAPSubscriptionLoadedNotification"),
+            object: nil
+        )
+        
+        NotificationCenter.default.addObserver(
+            self,
+            selector: #selector(IAPSubscriptionLoadedNotification(_:)),
+            name: NSNotification.Name(rawValue: "KMIAPProductFailedNotification"),
+            object: nil
+        )
 
         let privacyPolicy = NSLocalizedString("Privacy Policy", tableName: "MemberCenterLocalizable", comment: "")
         let termsService = NSLocalizedString("Terms of Service", tableName: "MemberCenterLocalizable", comment: "")
@@ -92,11 +106,14 @@ class KMFreeGetAIWC: NSWindowController {
 #if VERSION_DMG
     // DMG
 #else
+            self.window?.showWaitingView()
+
     // AppStore 免费版本
             IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().aiAllAccessPack12month_lite, discount: IAPProductsManager.default().isCancelAutoRenew())
 #endif
 #else
     // AppStore 付费版
+            self.window?.showWaitingView()
             IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().aiAllAccessPack12month_pro, discount: IAPProductsManager.default().isCancelAutoRenew())
 #endif
 
@@ -130,4 +147,8 @@ class KMFreeGetAIWC: NSWindowController {
     @IBAction func laterButtonAction(_ sender: NSButton) {
         window?.close()
     }
+    
+    @objc func IAPSubscriptionLoadedNotification(_ notification: Notification) {
+        self.removeWaitingView((self.window?.contentView)!)
+    }
 }