Просмотр исходного кода

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

tangchao 1 неделя назад
Родитель
Сommit
a32a5c8461

+ 7 - 1
PDF Office/PDF Master/Class/AIInfo/KMAIRequestServerManager.swift

@@ -438,6 +438,9 @@ class ResultWrapper: NSObject {
                 }
                 var result_bool: Bool = true
                 var message: String = ""
+                if let value = jsonObject!["message"]{
+                    message = value as! String
+                }
                 
                 let result = KMMemberCenterResult(code: code, msg: message, result: result_bool)
                 if code == 200 {
@@ -456,7 +459,7 @@ class ResultWrapper: NSObject {
                         complete(ResultWrapper(success: true, content: ossDownUrl as! String))
                     }
                 } else {
-                    complete(ResultWrapper(success: false, content: ""))
+                    complete(ResultWrapper(success: false, content: message))
                 }
             } else {
                 complete(ResultWrapper(success: false, content: ""))
@@ -916,6 +919,9 @@ class KMAIRequestServer {
                 var result_bool: Bool = true
                 
                 var message: String = ""
+                if let value = jsonObject!["message"]{
+                    message = value as! String
+                }
                 if let string = jsonObject!["data"] {
                     let dataDic = jsonObject!["data"] as? NSDictionary ?? [:]
                     if let dataStr = dataDic["content"] {

+ 6 - 2
PDF Office/PDF Master/Class/Purchase/DMG/Verification/KMVerificationMessageViewController.m

@@ -324,10 +324,14 @@ NSPopoverDelegate>
         type == KMUserScenarioTypePro_type4) {
         if (type == KMUserScenarioTypeLite_type1) { //免费用户
 #if !VERSION_DMG
-            if(IAPProductsManager.defaultManager.fourDevicesAllAccessPackNew12months_lite.isTrialPeriod == YES)  { //是否有试用
+            if(KMMemberInfo.shared.isLogin == NO) {
                 self.button.title = [NSString stringWithFormat:@" %@ ",NSLocalizedString(@"Upgrade", nil)];
             } else {
-                self.button.title = [NSString stringWithFormat:@" %@ ",NSLocalizedString(@"Free Trial", nil)];
+                if(IAPProductsManager.defaultManager.fourDevicesAllAccessPackNew12months_lite.isTrialPeriod == YES)  { //是否有试用
+                    self.button.title = [NSString stringWithFormat:@" %@ ",NSLocalizedString(@"Upgrade", nil)];
+                } else {
+                    self.button.title = [NSString stringWithFormat:@" %@ ",NSLocalizedString(@"Free Trial", nil)];
+                }
             }
 #else
 #endif

+ 11 - 3
PDF Office/PDF Master/MemberCenter/Model/KMMemberInfo.swift

@@ -824,13 +824,15 @@ import Cocoa
                         .map { $0.trimmingCharacters(in: .whitespaces) }
 
                     if  userScenarioType == .pro_type5 {
-                        if(platformsArray.contains("mac")) { //购买了mac
+                        if(platformsArray.contains("mac") && KMMemberInfo.shared.vip_levels == "3") { //购买了mac且高级
                             return true
                         }
                     } else if userScenarioType == .pro_type1 ||
                               userScenarioType == .pro_type2 ||
                               userScenarioType == .pro_type4  {
-                        return true
+                        if(platformsArray.contains("mac") && KMMemberInfo.shared.vip_levels == "3") { //购买了mac
+                            return true
+                        }
                     }
                     return false
                 }
@@ -871,11 +873,17 @@ import Cocoa
 #else
     // AppStore 付费版
         if KMMemberInfo.shared.isLogin {
-            if IAPProductsManager.default().aiAllAccessPack1month_pro.isSubscribed {
+            if KMMemberInfo.shared.aiPoint > 0 {
+                return true
+            }
+            if AIInfoManager.default().aiInfo.totalToken - AIInfoManager.default().aiInfo.usedTimes > 0 {
                 return true
             }
             return false
         } else {
+            if AIInfoManager.default().aiInfo.totalToken - AIInfoManager.default().aiInfo.usedTimes > 0 {
+                return true
+            }
             return false
         }
 #endif

+ 52 - 24
PDF Office/PDF Master/MemberCenter/ViewModel/KMProductModel.swift

@@ -172,7 +172,7 @@ class KMProductModel: ObservableObject {
     func getDMGPrice(productCode: String) -> String {
         guard let productModels = dmgProductDatas?.listingProducts else { return "" }
         for model in productModels {
-            if model.code == "productCode" {
+            if model.code == productCode {
                 return model.price.stringValue
             }
         }
@@ -184,7 +184,7 @@ class KMProductModel: ObservableObject {
     func getDMGCNYPrice(productCode: String) -> String {
         guard let productModels = dmgProductDatas?.listingProducts else { return "" }
         for model in productModels {
-            if model.code == "productCode" {
+            if model.code == productCode {
                 return model.cnyPrice.stringValue
             }
         }
@@ -196,7 +196,7 @@ class KMProductModel: ObservableObject {
     func getDMGDisplayPrice(productCode: String) -> String {
         guard let productModels = dmgProductDatas?.listingProducts else { return "" }
         for model in productModels {
-            if model.code == "productCode" {
+            if model.code == productCode {
                 return model.displayPrice.stringValue
             }
         }
@@ -208,7 +208,7 @@ class KMProductModel: ObservableObject {
     func getDMGDisplayCNYPrice(productCode: String) -> String {
         guard let productModels = dmgProductDatas?.listingProducts else { return "" }
         for model in productModels {
-            if model.code == "productCode" {
+            if model.code == productCode {
                 return model.displayCnyPrice.stringValue
             }
         }
@@ -425,6 +425,28 @@ class KMProductModel: ObservableObject {
      对应商品价格
      */
     func getProductPrice(_ type: KMPurchasedProductType) -> String {
+#if VERSION_FREE
+#if VERSION_DMG
+    // DMG
+            if type == .pdfReaderProStandard_dmg {
+                return getDMGPrice(productCode: "standard-annual-subscription")
+            } else if type == .pdfReaderProAdvanced_dmg {
+                return getDMGPrice(productCode: "advanced-annual-subscription")
+            } else if type == .pdfReaderProPermanent_dmg {
+                return getDMGPrice(productCode: "advanced-permanent")
+            } else if type == .pdfReaderProAIAnnual_dmg {
+                return getDMGPrice(productCode: "ai-subscription-year-trail")
+            } else if type == .pdfReaderProAIMonthly_dmg {
+                return getDMGPrice(productCode: "ai-subscription-month")
+            } else if type == .pdfToOffice_dmg {
+                return getDMGPrice(productCode: "PDF to Office")
+            } else if type == .add2Device_dmg {
+                return getDMGPrice(productCode: "Add 2-Device · Advanced Annual")
+            } else if type == .add3Device_dmg {
+                return getDMGPrice(productCode: "Add 3-Device · Advanced Annual")
+            }
+#else
+    // AppStore 免费版本
         if type == .fourDevicesAllAccessPackNew6months_lite {
             if let product = IAPProductsManager.default().fourDevicesAllAccessPackNew6Months_lite, product.isOffers {
                 return product.offersPrice()
@@ -467,7 +489,11 @@ class KMProductModel: ObservableObject {
             } else {
                 return IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_lite.price()
             }
-        } else if type == .aiAllAccessPack1month_pro {
+        }
+#endif
+#else
+    // AppStore 付费版
+        if type == .aiAllAccessPack1month_pro {
             if let product = IAPProductsManager.default().aiAllAccessPack1month_pro, product.isOffers {
                 return product.offersPrice()
             } else {
@@ -509,23 +535,8 @@ class KMProductModel: ObservableObject {
             } else {
                 return IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro.price()
             }
-        } else if type == .pdfReaderProStandard_dmg {
-            return getDMGPrice(productCode: "PDF Reader Pro Standard - Annual Plan")
-        } else if type == .pdfReaderProAdvanced_dmg {
-            return getDMGPrice(productCode: "PDF Reader Pro Advanced - Annual Plan")
-        } else if type == .pdfReaderProPermanent_dmg {
-            return getDMGPrice(productCode: "PDF Reader Pro Permanent")
-        } else if type == .pdfReaderProAIAnnual_dmg {
-            return getDMGPrice(productCode: "PDF Reader Pro AI - Annual Plan")
-        } else if type == .pdfReaderProAIMonthly_dmg {
-            return getDMGPrice(productCode: "PDF Reader Pro AI - Monthly Plan")
-        } else if type == .pdfToOffice_dmg {
-            return getDMGPrice(productCode: "PDF to Office")
-        } else if type == .add2Device_dmg {
-            return getDMGPrice(productCode: "Add 2-Device · Advanced Annual")
-        } else if type == .add3Device_dmg {
-            return getDMGPrice(productCode: "Add 3-Device · Advanced Annual")
         }
+#endif
         return ""
     }
     
@@ -533,11 +544,11 @@ class KMProductModel: ObservableObject {
         if state == .dmg_Base {
             var code = ""
             if tag == 1 {
-                code = "PDF Reader Pro Standard - Annual Plan"
+                code = "standard-annual-subscription"
             } else if tag == 3 {
-                code = "PDF Reader Pro Permanent"
+                code = "advanced-permanent"
             } else {
-                code = "PDF Reader Pro Advanced - Annual Plan"
+                code = "advanced-annual-subscription"
             }
             #if VERSION_DMG
             let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(code)
@@ -727,6 +738,21 @@ 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" {
+                productCode = "advanced-annual-subscription-standard-upgrade"
+                if IAPProductsManager.default().standardAddDevicesAllAccessPack12months_pro.isSubscribed {
+                    isSubscribed = true
+                }
+            } else if productId == "com.pdfreaderpro.mac.advanced_add_devices_all_access_pack_advanced_annual.001" {
+                productCode = "advanced-annual-subscription-single-upgrade"
+                if IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_pro.isSubscribed {
+                    isSubscribed = true
+                }
+            } else if productId == "com.pdfreaderpro.mac.advanced_add_2_devices_all_access_pack_advanced_annual.001" {
+                productCode = "advanced-annual-subscription-multi-upgrade"
+                if IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro.isSubscribed {
+                    isSubscribed = true
+                }
             }
             if isSubscribed {
                 KMMemberCenterManager.manager.appStoreEquityVerification(applePayProductId: productId, transactionId: transactionId, productCode: productCode) { success, result in
@@ -770,6 +796,7 @@ class KMProductModel: ObservableObject {
      会员购买
      */
     private func membershipPurchase(_ type: KMPurchasedProductType) -> Void {
+#if !VERSION_DMG
         if type == .fourDevicesAllAccessPackNew6months_lite || type == .fourDevicesAllAccessPackNew12months_lite {
             if isPurchaseSwitch {
                 IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite, discount: isCancelAutoRenew)
@@ -801,6 +828,7 @@ class KMProductModel: ObservableObject {
         } else if type == .advancedAdd2DevicesAllAccessPack12months_pro {
             IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro, discount: isCancelAutoRenew)
         }
+#endif
     }
 
     // MARK: Action Method

+ 3 - 2
PDF Office/PDF Master/MemberCenter/ViewModel/KMUserInfoVCModel.swift

@@ -192,8 +192,9 @@ class KMUserInfoVCModel: ObservableObject {
                 }
             }
         } else {
-            if (KMMemberInfo.shared.vip_paymentModel == "1" && KMMemberInfo.shared.vip_status == 1) || (KMMemberInfo.shared.ai_status == 1 && KMMemberInfo.shared.ai_paymentModel == "1") {
-                // 订阅用户提示退订
+            if (KMMemberInfo.shared.vip_payType == 1) ||
+                (KMMemberInfo.shared.ai_payType == 1) {
+                // 在续订中用户提示退订
                 NotificationCenter.default.post(name: NSNotification.Name("CloseMenuNotification"), object: nil)
                 KMMemberPromptWC.shared.showWindow(nil)
                 KMMemberPromptWC.shared.tipType = .unsubscribe

+ 1 - 1
PDF Office/PDF Master/MemberCenter/WindowsController/KMMemberCenterWindowController.swift

@@ -150,7 +150,7 @@ class KMMemberCenterWindowController: NSWindowController {
         
         for i in 0 ..< deviceList_Result.count {
             let device = deviceList_Result[i]
-            let name = String(format: "%@(%@)",device.deviceName ?? "PDF Reader Pro User for ",device.device_model ?? " Device Name")
+            let name = String(format: "%@%@(%@)","PDF Reader Pro for ",device.device_model ?? "PDF Reader Pro User",device.deviceName ?? " Device Name")
             if i == 0 {
                 device1Label.stringValue = name
             } else if i == 1 {

Разница между файлами не показана из-за своего большого размера
+ 15 - 3
PDF Office/PDF Master/MemberCenter/WindowsController/KMProductCompareWC.swift


+ 1 - 1
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="1800" height="1125"/>
+            <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"/>