Explorar el Código

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

niehaoyu hace 1 semana
padre
commit
95d324c6ad

+ 37 - 2
PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseEmbeddedWindowController.swift

@@ -285,6 +285,38 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
         return false
     }
     
+    func isSubscribeCode()-> Bool {//是否是订阅
+        if(product_code == "standard-annual-subscription" ||
+           product_code == "advanced-annual-subscription-blackFive" ||
+           product_code == "advanced-annual-subscription-trail" ||
+           product_code == "advanced-annual-subscription" ||
+           product_code == "ai-subscription-year-trail" ||
+           product_code == "ai-subscription-month") {
+            return true
+        }
+        return false
+    }
+    
+    func isOneTimePurchaseCode()-> Bool { //是否是一次次购买
+        if(product_code == "advanced-permanent-blackFive" ||
+           product_code == "advanced-permanent") {
+            return true
+        }
+        return false
+    }
+           
+    func isBlackFiveCode()-> Bool { //是否是黑五
+        if(product_code == "advanced-permanent-blackFive" ||
+           product_code == "advanced-annual-subscription-blackFive") {
+            return true
+        }
+        return false
+    }
+
+    func isHaveAvailableCoupon()-> Bool { //是否有优惠卷
+        return false
+    }
+    
     func updateKMDMGProductType(_ productinfo: KMListingProductsModel) -> Void {
         switch productinfo.code {
         case "advanced-annual-subscription-trail":
@@ -353,6 +385,7 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
         addbox.fillColor =  NSColor(named: "0E1114 1") ?? .white
         removebox.fillColor =  NSColor(named: "0E1114 1") ?? .white
 
+
         textbox.fillColor = NSColor(named: "0E1114 2") ?? .white
         yourOrderLabel.stringValue = NSLocalizedString("Your Order", comment: "")
         yourOrderLabel.textColor = NSColor(named: "KMPurchaseTitleColor")
@@ -1101,6 +1134,9 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
                 wechatPayButton.isHidden = false
             }
             amountTextField1.stringValue = String(pdfCount)
+
+            let viewHidden = pdfCount <= 1
+            firmLabel.isHidden = viewHidden
         }
         
         // 价格刷新
@@ -1966,8 +2002,8 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
                 self.scanLabel.stringValue = NSLocalizedString("Scan QR Code with Alipay", comment: "")
                 self.payTypeImageView.image = NSImage(named: "EmbeddedPayment28")
             }
-
             let img = self.convertBase64StringToNSImage(base64String: urlPath)
+
             self.qrCodeImageView.image = img
             
         }
@@ -2065,7 +2101,6 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
                     let requestDic: NSDictionary = dic["result"] as? NSDictionary ?? [:]
                     let status:String = requestDic["status"]  as? String ?? ""
                     if(status.uppercased() == "COMPLETED") {
-                        KMPurchaseSuccessWindowController.shared.showWindow(nil)
                         NotificationCenter.default.post(name: NSNotification.Name(rawValue: "KMIAPSubscriptionLoadedNotification"), object: nil)
                         self.stopPolling()
                         

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 166 - 563
PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseEmbeddedWindowController.xib


+ 12 - 5
PDF Office/PDF Master/Class/Purchase/DMG/Verification/KMVerificationMessageViewController.m

@@ -692,13 +692,18 @@ NSPopoverDelegate>
 }
 
 - (void)loginSuccessNotification:(NSNotification *)noti {
-    _userButton.image = [NSImage imageNamed:@"UserProfilePicture"];
-    [self reloadData];
+    dispatch_async(dispatch_get_main_queue(), ^{
+        self.userButton.image = [NSImage imageNamed:@"UserProfilePicture"];
+        [self reloadData];
+    });
 }
 
 - (void)logoutSuccessNotification:(NSNotification *)noti {
-    _userButton.image = [NSImage imageNamed:@"UserProfilePicture1"];
-    [self reloadData];
+    
+    dispatch_async(dispatch_get_main_queue(), ^{
+        self.userButton.image = [NSImage imageNamed:@"UserProfilePicture1"];
+        [self reloadData];
+    });
 }
 
 - (void)expandPersonalCenterNotification:(NSNotification *)noti {
@@ -715,7 +720,9 @@ NSPopoverDelegate>
 }
 
 - (void)subscriptionLoadedNotification:(NSNotification *)noti {
-    [self reloadData];
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [self reloadData];
+    });
 }
 
 - (void)popOverCloseAction {

+ 10 - 0
PDF Office/PDF Master/Class/Purchase/IAPProductsManager.h

@@ -15,6 +15,16 @@ extern NSString * const KMIAPProductRestoreFailedNotification;
 extern NSString * const KMIAPProductRestoreFinishedNotification;
 extern NSString * const KMIAPSubscriptionLoadedNotification;
 
+extern NSString * const KMStandardAnnualSubscriptionCodeKey; // "productName": "PDF Reader Pro Standard - Annual Plan"
+extern NSString * const KMAdvancedAnnualSubscriptionCodeKey; //"productName": "PDF Reader Pro Advanced - Annual Plan"
+extern NSString * const KMAdvancedPermanentCodeKey; // "productName": "PDF Reader Pro Permanent"
+
+extern NSString * const KMAISubscriptionYearTrailCodeKey;               // 0元试用AI 年订阅 产品Code
+extern NSString * const KMAISubscriptionMonthCodeKey;                   // 0元试用AI 月订阅 产品Code
+
+extern NSString * const KMAdvancedPermanentBlackFiveCodeKey; // "productName": "PDF Reader Pro Permanent"
+extern NSString * const KMAdvancedAnnualSubscriptionBlackFiveCodeKey; //"productName": "PDF Reader Pro Advanced - Annual Plan"
+
 @class SKProduct;
 
 @interface IAPProduct : NSObject

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

@@ -48,6 +48,16 @@ NSString * const KMStandardAddDevicesAllAccessPack_12Months_Pro = @"com.pdfreade
 NSString * const KMAdvancedAddDevicesAllAccessPack12Months_Pro = @"com.pdfreaderpro.mac.advanced_add_devices_all_access_pack_advanced_annual.001"; // 产品名称:advanced_add_devices_all_access_pack_12months(多设备包订阅)
 NSString * const KMAdvancedAdd2DevicesAllAccessPack12Months_Pro = @"com.pdfreaderpro.mac.advanced_add_2_devices_all_access_pack_advanced_annual.001"; // 产品名称:advanced_add_2_devices_all_access_pack_12months(多设备包订阅)
 
+NSString * const KMStandardAnnualSubscriptionCodeKey                    = @"standard-annual-subscription"; // "productName": "PDF Reader Pro Standard - Annual Plan"
+NSString * const KMAdvancedAnnualSubscriptionCodeKey                    = @"advanced-annual-subscription"; //"productName": "PDF Reader Pro Advanced - Annual Plan"
+NSString * const KMAdvancedPermanentCodeKey                             = @"advanced-permanent"; // "productName": "PDF Reader Pro Permanent"
+
+NSString * const KMAISubscriptionYearTrailCodeKey                       = @"ai-subscription-year-trail"; // 0元试用AI 年订阅 产品Code
+NSString * const KMAISubscriptionMonthCodeKey                           = @"ai-subscription-month"; // 0元试用AI 月订阅 产品Code
+
+NSString * const KMAdvancedPermanentBlackFiveCodeKey                    = @"advanced-permanent-blackFive"; // "productName": "PDF Reader Pro Permanent"
+NSString * const KMAdvancedAnnualSubscriptionBlackFiveCodeKey           = @"advanced-annual-subscription-blackFive"; //"productName": "PDF Reader Pro Advanced - Annual Plan"
+
 //NSString * const KMNewMonthLicenseProductIdentifier = @"com.pdftechnologies.pdfreader.mac.yearly.002.Test";
 NSString * const KMAllLicenseProductIdentifier = @"com.pdfreaderpro.mac_free.member.all_access_pack_permanent_license.001";
 NSString * const KMPDFToOfficeLicenseProductIdentifier = @"com.pdfreaderpro.mac.member.pdf_to_office_pack_permanent_license.001";
@@ -365,11 +375,13 @@ NSString * const KMIAPSubscriptionLoadedNotification = @"KMIAPSubscriptionLoaded
         self.DMGPDFReaderProPermanent.isOffers = isOffers;
 
         self.DMGPDFReaderProAI_Annual = [[[IAPProduct alloc] init] autorelease];
+        self.DMGPDFReaderProAI_Annual.productIdentifier = KMAISubscriptionYearTrailCodeKey;
         self.DMGPDFReaderProAI_Annual.priceNumber = @(125.99);
         self.DMGPDFReaderProAI_Annual.offersPriceNumber = @(125.99);
         self.DMGPDFReaderProAI_Annual.isOffers = isOffers;
 
         self.DMGPDFReaderProAI_Monthly = [[[IAPProduct alloc] init] autorelease];
+        self.DMGPDFReaderProAI_Monthly.productIdentifier = KMAISubscriptionMonthCodeKey;
         self.DMGPDFReaderProAI_Monthly.priceNumber = @(14.99);
         self.DMGPDFReaderProAI_Monthly.offersPriceNumber = @(14.99);
         self.DMGPDFReaderProAI_Monthly.isOffers = isOffers;

+ 1 - 1
PDF Office/PDF Master/MemberCenter/Assets/zh-Hans.lproj/MemberCenterLocalizable.strings

@@ -177,5 +177,5 @@
 "If you have purchased multiple PDF Reader Pro Permanent in volume, check them in Account Center -> Transfer Benefits. %@" = "如您购买了多个永久版会员,可在用户中心-赠送会员中查看,%@";
 "Check Benefit" = "立即查看";
 
-"If you need to manage seats in PDF Reader Pro, please purchase the %@." = "如需团队席位管理功能,请前往购买。";
+"If you need to manage seats in PDF Reader Pro, please purchase the %@." = "如需团队席位管理功能,请前往购买。%@";
 "enterprise version" = "企业版";

+ 1 - 1
PDF Office/PDF Master/MemberCenter/Assets/zh-Hant.lproj/MemberCenterLocalizable.strings

@@ -178,5 +178,5 @@
 "If you have purchased multiple PDF Reader Pro Permanent in volume, check them in Account Center -> Transfer Benefits. %@" = "若您購買了多位永久版會員,可在用戶中心-積分會員中查看,%@";
 "Check Benefit" = "立即查看";
 
-"If you need to manage seats in PDF Reader Pro, please purchase the %@." = "如需團隊席位管理功能,請前往購買。";
+"If you need to manage seats in PDF Reader Pro, please purchase the %@." = "如需團隊席位管理功能,請前往購買。%@";
 "enterprise version" = "企業版";

+ 1 - 1
PDF Office/PDF Master/MemberCenter/ViewModel/KMProductModel.swift

@@ -752,7 +752,7 @@ class KMProductModel: ObservableObject {
                 if IAPProductsManager.default().fourDevicesAllAccessPack12months_pro.isSubscribed {
                     isSubscribed = true
                 }
-            } else if productId == "com.pdfreaderpro.mac.advanced_add_devices_all_access_pack_advanced_annual.001" {
+            } else if productId == "com.pdfreaderpro.mac.standard_add_devices_all_access_pack_advanced_annual.001" {
                 productCode = "advanced-annual-subscription-standard-upgrade"
                 if IAPProductsManager.default().standardAddDevicesAllAccessPack12months_pro.isSubscribed {
                     isSubscribed = true

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

@@ -103,11 +103,17 @@ class KMFreeGetAIWC: NSWindowController {
             guard let self = self else { return }
             
         }
+        
         aitoolsBox.downCallback = { [weak self](downEntered: Bool, mouseBox: KMBox, event) -> Void in
             guard let self = self else { return }
 #if VERSION_FREE
 #if VERSION_DMG
     // DMG
+#if VERSION_DMG
+            let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(KMAISubscriptionYearTrailCodeKey)
+            embeddedWC.showWindow(nil)
+            embeddedWC.window?.center()
+#endif
 #else
             self.window?.showWaitingView()
 

+ 19 - 9
PDF Office/PDF Master/MemberCenter/WindowsController/KMProductCompareWC.swift

@@ -66,9 +66,9 @@ class KMProductCompareWC: NSWindowController {
     @IBOutlet @objc weak var standardPlanInfoLabel: NSTextField!
     @IBOutlet @objc weak var standardPlanPurchaseLabel: NSTextField!
     @IBOutlet @objc weak var standardPlanPurchaseSubLabel: NSTextField!
-    @IBOutlet @objc weak var standardPlanPurchaseButton: KMButton!
+    @IBOutlet @objc weak var standardPlanPurchaseButton: NSButton!
     @IBOutlet @objc weak var standardPlanPurchaseLbl: NSTextField!
-    @IBOutlet @objc weak var standardPlanPurchaseLblBtn: KMButton!
+    @IBOutlet @objc weak var standardPlanPurchaseLblBtn: NSButton!
     @IBOutlet @objc weak var standardPlanPurchaseSubLabel2: NSTextField!
     
     // 高级版年订阅
@@ -76,9 +76,9 @@ class KMProductCompareWC: NSWindowController {
     @IBOutlet @objc weak var advancedPlanInfoLabel: NSTextField!
     @IBOutlet @objc weak var advancedPlanPurchaseLabel: NSTextField!
     @IBOutlet @objc weak var advancedPlanPurchaseSubLabel: NSTextField!
-    @IBOutlet @objc weak var advancedPlanPurchaseButton: KMButton!
+    @IBOutlet @objc weak var advancedPlanPurchaseButton: NSButton!
     @IBOutlet @objc weak var advancedPlanPurchaseLbl: NSTextField!
-    @IBOutlet @objc weak var advancedPlanPurchaseLblBtn: KMButton!
+    @IBOutlet @objc weak var advancedPlanPurchaseLblBtn: NSButton!
     @IBOutlet @objc weak var advancedPlanPurchaseSubLabel2: NSTextField!
     @IBOutlet weak var backgroundImage3: NSImageView!
     @IBOutlet @objc weak var discountPermanent2: NSImageView!
@@ -751,7 +751,9 @@ class KMProductCompareWC: NSWindowController {
 
         value1PurchaseBtnLbl.textColor = value1PurchaseBtnLblBtn.isEnabled ? NSColor.white : NSColor.white.withAlphaComponent(0.5)
         permanentPurchaseLblBtn.isEnabled = permanentPurchaseButton.isEnabled
-        
+        standardPlanPurchaseLblBtn.isEnabled = standardPlanPurchaseButton.isEnabled
+        advancedPlanPurchaseLblBtn.isEnabled = advancedPlanPurchaseButton.isEnabled
+
         let averageMonthPrice: String?
         let monthPrice: String?
         let averageMonthPriceDiscount: String?
@@ -1085,11 +1087,14 @@ class KMProductCompareWC: NSWindowController {
     }
     
     @IBAction func appstorePurchaseAction(_ sender: NSButton) {
+#if !VERSION_DMG
         addWaitingView(to: window?.contentView ?? NSView())
+#endif
         model.appstorePurchaseAction(sender.tag) { [weak self] success, msg in
             guard let self = self else { return }
 
         }
+        
     }
     
     // MARK: - InAppPurchaseManager Notification
@@ -1138,11 +1143,16 @@ class KMProductCompareWC: NSWindowController {
     @objc func IAPSubscriptionLoadedNotification(_ notification: Notification) {
         removeWaitingView(from: window?.contentView ?? NSView())
         reloadData()
-        if KMMemberInfo.shared.isLogin {
-            model.appStoreEquityVerification(notification) { success, msg in
-                KMUserInfoVCModel().refreshUserInfo { success, msg,dic  in
+        DispatchQueue.global().async { [weak self] in
+            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()
+                    }
                 }
-                self.window?.close()
             }
         }
     }