Explorar el Código

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

tangchao hace 2 días
padre
commit
dbe8e8d223
Se han modificado 1 ficheros con 57 adiciones y 31 borrados
  1. 57 31
      PDF Office/PDF Master/MemberCenter/ViewModel/KMProductModel.swift

+ 57 - 31
PDF Office/PDF Master/MemberCenter/ViewModel/KMProductModel.swift

@@ -176,7 +176,11 @@ class KMProductModel: ObservableObject {
                 if model.upgradePriceString?.isEmpty == false {
                     return String(format: "%.2f", Float(model.upgradePriceString ?? "0") ?? 0)
                 } else if model.displayPriceString?.isEmpty == false {
-                    return String(format: "%.2f", Float(model.displayPriceString ?? "0") ?? 0)
+                    if model.displayPriceString == "0.00" {
+                        return String(format: "%.2f", Float(model.priceString ?? "0") ?? 0)
+                    } else {
+                        return String(format: "%.2f", Float(model.displayPriceString ?? "0") ?? 0)
+                    }
                 } else {
                     return String(format: "%.2f", Float(model.priceString ?? "0") ?? 0)
                 }
@@ -194,7 +198,11 @@ class KMProductModel: ObservableObject {
                 if model.cnyUpgradePriceString?.isEmpty == false {
                     return String(format: "%.2f", Float(model.cnyUpgradePriceString ?? "0") ?? 0)
                 } else if model.displayCnyPriceString?.isEmpty == false {
-                    return String(format: "%.2f", Float(model.displayCnyPriceString ?? "0") ?? 0)
+                    if model.displayCnyPriceString == "0.00" {
+                        return String(format: "%.2f", Float(model.cnyPriceString ?? "0") ?? 0)
+                    } else {
+                        return String(format: "%.2f", Float(model.displayCnyPriceString ?? "0") ?? 0)
+                    }
                 } else {
                     return String(format: "%.2f", Float(model.cnyPriceString ?? "0") ?? 0)
                 }
@@ -515,38 +523,52 @@ class KMProductModel: ObservableObject {
                     return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMStandardAnnualSubscriptionCodeKey_DMG))
                 }
             } else if type == .pdfReaderProAdvanced_dmg {
-                if isBlackFive {
-                    if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
-                        return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG))
-                    } else {
-                        return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG))
-                    }
-                } else if KMMemberInfo.shared.canTrail && state == .trial {
-                    if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
-                        return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedAnnualSubscriptionTrailCodeKey_DMG))
+                if state == .dmg_Base {
+                    if isBlackFive {
+                        if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
+                            return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG))
+                        } else {
+                            return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG))
+                        }
                     } else {
-                        return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedAnnualSubscriptionTrailCodeKey_DMG))
+                        if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
+                            return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedAnnualSubscriptionCodeKey_DMG))
+                        } else {
+                            return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedAnnualSubscriptionCodeKey_DMG))
+                        }
                     }
                 } else {
-                    if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
-                        return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedAnnualSubscriptionCodeKey_DMG))
+                    if KMMemberInfo.shared.canTrail && state == .trial {
+                        if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
+                            return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedAnnualSubscriptionTrailCodeKey_DMG))
+                        } else {
+                            return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedAnnualSubscriptionTrailCodeKey_DMG))
+                        }
                     } else {
-                        return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedAnnualSubscriptionCodeKey_DMG))
+                        if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
+                            return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedAnnualSubscriptionCodeKey_DMG))
+                        } else {
+                            return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedAnnualSubscriptionCodeKey_DMG))
+                        }
                     }
                 }
             } else if type == .pdfReaderProPermanent_dmg {
-                if isBlackFive {
-                    if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
-                        return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedPermanentBlackFiveCodeKey_DMG))
+                if state == .dmg_Base {
+                    if isBlackFive {
+                        if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
+                            return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedPermanentBlackFiveCodeKey_DMG))
+                        } else {
+                            return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedPermanentBlackFiveCodeKey_DMG))
+                        }
                     } else {
-                        return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedPermanentBlackFiveCodeKey_DMG))
+                        if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
+                            return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedPermanentCodeKey_DMG))
+                        } else {
+                            return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedPermanentCodeKey_DMG))
+                        }
                     }
                 } else {
-                    if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
-                        return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedPermanentCodeKey_DMG))
-                    } else {
-                        return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedPermanentCodeKey_DMG))
-                    }
+                    
                 }
             } else if type == .pdfReaderProAIAnnual_dmg {
                 if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
@@ -674,8 +696,6 @@ class KMProductModel: ObservableObject {
             } else {
                 if isBlackFive {
                     code = KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG
-                } else if KMMemberInfo.shared.canTrail && state == .trial {
-                    code = KMAdvancedAnnualSubscriptionTrailCodeKey_DMG
                 } else {
                     code = KMAdvancedAnnualSubscriptionCodeKey_DMG
                 }
@@ -757,12 +777,18 @@ class KMProductModel: ObservableObject {
 #if VERSION_DMG
     // DMG
             var code = ""
-            if isBlackFive {
-                code = KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG
-            } else if KMMemberInfo.shared.canTrail && state == .trial {
-                code = KMAdvancedAnnualSubscriptionTrailCodeKey_DMG
+            if state == .dmg_Base {
+                if isBlackFive {
+                    code = KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG
+                } else {
+                    code = KMAdvancedAnnualSubscriptionCodeKey_DMG
+                }
             } else {
-                code = KMAdvancedAnnualSubscriptionCodeKey_DMG
+                if KMMemberInfo.shared.canTrail && state == .trial {
+                    code = KMAdvancedAnnualSubscriptionTrailCodeKey_DMG
+                } else {
+                    code = KMAdvancedAnnualSubscriptionCodeKey_DMG
+                }
             }
             let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(code)
             embeddedWC.showWindow(nil)