Browse Source

Merge branch 'develop_PDFReaderPro_V4.7.0' of git.kdan.cc:Mac_PDF/PDF_Office into develop_PDFReaderPro_V4.7.0

tangchao 3 months ago
parent
commit
84c3d057ca

+ 16 - 0
PDF Office/PDF Master/Class/Purchase/IAPProductsManager.m

@@ -1422,14 +1422,26 @@ NSString * const KMIAPSubscriptionLoadedNotification = @"KMIAPSubscriptionLoaded
         self.allAccessPackPermanent_lite.isSubscribed = YES;
         [[NSUserDefaults standardUserDefaults] setObject:self.allAccessPackPermanent_lite.isSubscribed ? @"YES":@"NO" forKey:@"allAccessPackPermanent_lite.isSubscribed"];
         [[NSUserDefaults standardUserDefaults] synchronize];
+        [self loadReceipt:^(NSError *error) {
+            [[NSNotificationCenter defaultCenter] postNotificationName:KMIAPSubscriptionLoadedNotification
+                                                                object:transaction];
+        }];
     } else if ([productIdentifier isEqualToString:self.PDFToOfficeProduct.productIdentifier]) {
         self.PDFToOfficeProduct.isSubscribed = YES;
         [[NSUserDefaults standardUserDefaults] setObject:self.PDFToOfficeProduct.isSubscribed ? @"YES":@"NO" forKey:@"PDFToOfficeProduct.isSubscribed"];
         [[NSUserDefaults standardUserDefaults] synchronize];
+        [self loadReceipt:^(NSError *error) {
+            [[NSNotificationCenter defaultCenter] postNotificationName:KMIAPSubscriptionLoadedNotification
+                                                                object:transaction];
+        }];
     } else if ([productIdentifier isEqualToString:self.pdfToOfficePackPermanent_pro.productIdentifier]) {
         self.pdfToOfficePackPermanent_pro.isSubscribed = YES;
         [[NSUserDefaults standardUserDefaults] setObject:self.pdfToOfficePackPermanent_pro.isSubscribed ? @"YES":@"NO" forKey:@"pdfToOfficePackPermanent_pro.isSubscribed"];
         [[NSUserDefaults standardUserDefaults] synchronize];
+        [self loadReceipt:^(NSError *error) {
+            [[NSNotificationCenter defaultCenter] postNotificationName:KMIAPSubscriptionLoadedNotification
+                                                                object:transaction];
+        }];
     } else if ([productIdentifier isEqualToString:self.liteAIProduct.productIdentifier]) {
         [self loadReceipt:^(NSError *error) {
                     
@@ -1516,6 +1528,10 @@ NSString * const KMIAPSubscriptionLoadedNotification = @"KMIAPSubscriptionLoaded
         self.allAccessProduct.isSubscribed = YES;
         [[NSUserDefaults standardUserDefaults] setObject:self.allAccessProduct.isSubscribed ? @"YES":@"NO" forKey:@"allAccessProduct.isSubscribed"];
         [[NSUserDefaults standardUserDefaults] synchronize];
+        [self loadReceipt:^(NSError *error) {
+            [[NSNotificationCenter defaultCenter] postNotificationName:KMIAPSubscriptionLoadedNotification
+                                                                object:transaction];
+        }];
     }
     if (!self.isPurchasing) {
         return;

+ 8 - 7
PDF Office/PDF Master/MemberCenter/ViewModel/KMProductModel.swift

@@ -722,16 +722,17 @@ class KMProductModel: ObservableObject {
             }
             if isSubscribed {
                 KMMemberCenterManager.manager.appStoreEquityVerification(applePayProductId: productId, transactionId: transactionId, productCode: productCode) { success, result in
-                    if success {
-                        complete(true, result)
-                    } else {
-                        complete(false, result)
+                    DispatchQueue.main.async {
+                        if success {
+                            complete(true, result)
+                        } else {
+                            complete(false, result)
+                        }
                     }
-                    
                 }
             }
         } else {
-            print("Transaction ID not found in notification.")
+            print(NSLocalizedString("Order does not exist.", tableName: "MemberCenterLocalizable", comment: ""))
         }
 #endif
 #else
@@ -791,7 +792,7 @@ class KMProductModel: ObservableObject {
                 }
             }
         } else {
-            print("Transaction ID not found in notification.")
+            print(NSLocalizedString("Order does not exist.", tableName: "MemberCenterLocalizable", comment: ""))
         }
 #endif
     }

+ 37 - 14
PDF Office/PDF Master/MemberCenter/WindowsController/KMProductCompareWC.swift

@@ -88,9 +88,9 @@ class KMProductCompareWC: NSWindowController {
     @IBOutlet @objc weak var permanentInfoLabel: NSTextField!
     @IBOutlet @objc weak var permanentPurchaseLabel: NSTextField!
     @IBOutlet @objc weak var permanentPurchaseSubLabel: NSTextField!
-    @IBOutlet @objc weak var permanentPurchaseButton: KMButton!
+    @IBOutlet @objc weak var permanentPurchaseButton: NSButton!
     @IBOutlet @objc weak var permanentPurchaseLbl: NSTextField!
-    @IBOutlet @objc weak var permanentPurchaseLblBtn: KMButton!
+    @IBOutlet @objc weak var permanentPurchaseLblBtn: NSButton!
     @IBOutlet @objc weak var permanentPurchaseSubLabel2: NSTextField!
     @IBOutlet @objc weak var discountPermanent4: NSImageView!
 
@@ -676,15 +676,15 @@ class KMProductCompareWC: NSWindowController {
             saleBox.isHidden = true
         }
         
-        if KMMemberInfo.shared.isMemberAllFunction == true {
-            value1PurchaseButton.isEnabled = false
-            permanentPurchaseButton.isEnabled = false
-            permanentPurchaseLbl.textColor = NSColor(red: 85/255.0, green: 40/255.0, blue: 255/255.0, alpha: 0.5)
-        } else {
-            value1PurchaseButton.isEnabled = true
-            permanentPurchaseButton.isEnabled = true
-            permanentPurchaseLbl.textColor = NSColor(red: 85/255.0, green: 40/255.0, blue: 255/255.0, alpha: 1.0)
-        }
+//        if KMMemberInfo.shared.isMemberAllFunction == true {
+//            value1PurchaseButton.isEnabled = false
+//            permanentPurchaseButton.isEnabled = false
+//            permanentPurchaseLbl.textColor = NSColor(red: 85/255.0, green: 40/255.0, blue: 255/255.0, alpha: 0.5)
+//        } else {
+//            value1PurchaseButton.isEnabled = true
+//            permanentPurchaseButton.isEnabled = true
+//            permanentPurchaseLbl.textColor = NSColor(red: 85/255.0, green: 40/255.0, blue: 255/255.0, alpha: 1.0)
+//        }
         
         permanentPurchaseLbl.font = NSFont.UbuntuBoldFontWithSize(16)
         value1PurchaseOriPriceLbl.font = NSFont.SFProTextRegularFont(12)
@@ -978,6 +978,24 @@ class KMProductCompareWC: NSWindowController {
         }
     }
     
+    private func showAlert(message: String) {
+        let alert = NSAlert()
+        alert.alertStyle = .critical
+        alert.messageText = message
+        alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
+        alert.runModal()
+    }
+
+    private func handleVerificationFailure(msg: KMMemberProductResult?) {
+        var message = msg?.msg ?? ""
+        if msg?.code == 344 {
+            message = NSLocalizedString("The current ticket has created an order.", tableName: "MemberCenterLocalizable", comment: "")
+        }
+        if !message.isEmpty {
+            showAlert(message: message)
+        }
+    }
+    
     // MARK: Button Actions
     
     @IBAction func buttonItemClicked_Subscribe(_ sender: Any) {
@@ -1149,10 +1167,15 @@ class KMProductCompareWC: NSWindowController {
             guard let self = self else { return }
             if KMMemberInfo.shared.isLogin {
                 self.model.appStoreEquityVerification(notification) { success, msg in
-                    KMUserInfoVCModel().refreshUserInfo { success, msg,dic  in
-                    }
                     DispatchQueue.main.async {
-                        self.window?.close()
+                        if success {
+//                            self.showAlert(message: NSLocalizedString("Binding Interest Success!", comment: ""))
+                            KMUserInfoVCModel().refreshUserInfo { success, msg,dic  in
+                            }
+                            self.window?.close()
+                        } else {
+                            self.handleVerificationFailure(msg: msg)
+                        }
                     }
                 }
             }

+ 11 - 11
PDF Office/PDF Master/MemberCenter/WindowsController/KMProductCompareWC.xib

@@ -102,7 +102,7 @@
         <window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="documentWindow" titlebarAppearsTransparent="YES" id="7jy-UC-R98">
             <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" fullSizeContentView="YES"/>
             <rect key="contentRect" x="77" y="40" width="970" height="660"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
             <view key="contentView" wantsLayer="YES" misplaced="YES" id="BHT-Ss-56B">
                 <rect key="frame" x="0.0" y="0.0" width="970" height="660"/>
                 <autoresizingMask key="autoresizingMask"/>
@@ -180,10 +180,10 @@
                                     <rect key="frame" x="28" y="61" width="320" height="43"/>
                                     <clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="Euu-kC-XYf">
                                         <rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
-                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                        <autoresizingMask key="autoresizingMask"/>
                                         <subviews>
                                             <textView editable="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" spellingCorrection="YES" smartInsertDelete="YES" id="GaB-cW-JRI">
-                                                <rect key="frame" x="0.0" y="13" width="320" height="263"/>
+                                                <rect key="frame" x="0.0" y="13.456024169921875" width="320" height="263"/>
                                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                 <color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
                                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -448,7 +448,7 @@ https://www.pdfreaderpro.com/privacy-policy</mutableString>
                         <rect key="frame" x="0.0" y="-50" width="970" height="518"/>
                         <clipView key="contentView" drawsBackground="NO" id="mXx-Ex-E5u">
                             <rect key="frame" x="0.0" y="0.0" width="970" height="518"/>
-                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                            <autoresizingMask key="autoresizingMask"/>
                             <subviews>
                                 <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" tableStyle="plain" selectionHighlightStyle="none" columnSelection="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="49" rowSizeStyle="automatic" viewBased="YES" id="UQf-R2-MfQ">
                                     <rect key="frame" x="0.0" y="0.0" width="970" height="518"/>
@@ -1358,7 +1358,7 @@ https://www.pdfreaderpro.com/privacy-policy</mutableString>
                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                     </textFieldCell>
                 </textField>
-                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ep1-iy-QCy" customClass="KMCustomButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ep1-iy-QCy">
                     <rect key="frame" x="90" y="16" width="120" height="40"/>
                     <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="Aue-MU-4OW">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -1461,7 +1461,7 @@ https://www.pdfreaderpro.com/privacy-policy</mutableString>
             <rect key="frame" x="0.0" y="0.0" width="299" height="202"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
-                <button tag="1" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3Ik-8P-4RK" customClass="KMButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                <button tag="1" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3Ik-8P-4RK">
                     <rect key="frame" x="90" y="16" width="120" height="40"/>
                     <buttonCell key="cell" type="bevel" bezelStyle="rounded" imagePosition="overlaps" alignment="center" imageScaling="axesIndependently" inset="2" id="qe5-qU-Z1A">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -1483,7 +1483,7 @@ https://www.pdfreaderpro.com/privacy-policy</mutableString>
                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                     </textFieldCell>
                 </textField>
-                <button tag="1" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ZEN-97-7fT" customClass="KMButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                <button tag="1" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ZEN-97-7fT">
                     <rect key="frame" x="90" y="16" width="120" height="40"/>
                     <buttonCell key="cell" type="bevel" bezelStyle="rounded" imagePosition="overlaps" alignment="center" imageScaling="axesIndependently" inset="2" id="0Tg-Jy-lFf">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -1588,7 +1588,7 @@ https://www.pdfreaderpro.com/privacy-policy</mutableString>
                     <rect key="frame" x="0.0" y="-10" width="299" height="212"/>
                     <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="axesIndependently" image="ComparativeBackground" id="tbr-y9-h9V"/>
                 </imageView>
-                <button tag="2" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="SFA-A0-TRs" customClass="KMButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                <button tag="2" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="SFA-A0-TRs">
                     <rect key="frame" x="90" y="16" width="120" height="40"/>
                     <buttonCell key="cell" type="bevel" bezelStyle="rounded" imagePosition="overlaps" alignment="center" imageScaling="axesIndependently" inset="2" id="fjI-CT-M5Z">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -1610,7 +1610,7 @@ https://www.pdfreaderpro.com/privacy-policy</mutableString>
                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                     </textFieldCell>
                 </textField>
-                <button tag="2" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="JRG-Tt-bke" customClass="KMButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                <button tag="2" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="JRG-Tt-bke">
                     <rect key="frame" x="90" y="16" width="120" height="40"/>
                     <buttonCell key="cell" type="bevel" bezelStyle="rounded" imagePosition="overlaps" alignment="center" imageScaling="axesIndependently" inset="2" id="BxF-VB-cFe">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -1715,7 +1715,7 @@ https://www.pdfreaderpro.com/privacy-policy</mutableString>
             <rect key="frame" x="0.0" y="0.0" width="299" height="202"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
-                <button tag="3" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zmz-yq-8SZ" customClass="KMButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                <button tag="3" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zmz-yq-8SZ">
                     <rect key="frame" x="90" y="16" width="120" height="40"/>
                     <buttonCell key="cell" type="bevel" bezelStyle="rounded" imagePosition="overlaps" alignment="center" imageScaling="axesIndependently" inset="2" id="9jy-F5-8Ox">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -1737,7 +1737,7 @@ https://www.pdfreaderpro.com/privacy-policy</mutableString>
                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                     </textFieldCell>
                 </textField>
-                <button tag="3" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="5cy-wO-SqL" customClass="KMButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                <button tag="3" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="5cy-wO-SqL">
                     <rect key="frame" x="90" y="16" width="120" height="40"/>
                     <buttonCell key="cell" type="bevel" bezelStyle="rounded" imagePosition="overlaps" alignment="center" imageScaling="axesIndependently" inset="2" id="PEx-dX-RcI">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>