Pārlūkot izejas kodu

【综合】比较表页面调整

tangchao 3 mēneši atpakaļ
vecāks
revīzija
02de8c8d0c

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

@@ -49,6 +49,8 @@ NSPopoverDelegate>
 
 @property (nonatomic, retain) NSMenu *userMenu;
 
+// 远程按钮 最大宽度限制 100
+@property (nonatomic, assign) CGFloat remoteButtonMaxWidth;
 
 @end
 
@@ -58,6 +60,8 @@ NSPopoverDelegate>
 
 - (instancetype)init {
     if (self = [super initWithNibName:@"KMVerificationMessageViewController" bundle:nil]) {
+        self.remoteButtonMaxWidth = 100;
+        
 #if VERSION_DMG
         [[NSNotificationCenter defaultCenter] addObserver:self
                                                  selector:@selector(deviceActivateStatusChangeNotification:)
@@ -515,6 +519,7 @@ NSPopoverDelegate>
         if (KMAdvertisementManager.manager.info.topRightInfoContent != nil) {
             if (KMAdvertisementManager.manager.info.topRightInfoContent.content.firstObject != nil) {
                 buttonWidth += 10;
+                buttonWidth = MIN(buttonWidth, self.remoteButtonMaxWidth);
             }
         }
         self.button.frame = CGRectMake(totalWidth, kbottomGap, buttonWidth, self.view.frame.size.height -2 *kbottomGap);

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

@@ -55,6 +55,10 @@ extern NSString * const KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG; //"pro
 - (NSString *)offersPrice;
 - (NSString *)offersAveragePrice;
 
+// 推介优惠价格
+- (NSString *)introPrice;
+- (NSString *)introAveragePrice;
+
 // 是否取消订阅
 - (BOOL)isCancelAutoRenew;
 

+ 61 - 33
PDF Office/PDF Master/Class/Purchase/IAPProductsManager.m

@@ -113,39 +113,22 @@ NSString * const KMMemberInfoChangeNotification = @"KMMemberInfoChangeNotificati
 - (NSString *)price {
     NSString *price = nil;
 #if !VERSION_DMG
-#if VERSION_FREE
-    NSString *productIdentifier = self.product.productIdentifier;
-    if ([productIdentifier isEqualToString:KM4DevicesAllAccessPack12Months_Free] || [productIdentifier isEqualToString:KM4DevicesAllAccessPackNew6Months_Free]) {
-        SKProductDiscount *introductoryPrice = self.product.introductoryPrice;
-        // 是否有 优惠价格
-        if (introductoryPrice != nil) {
-            SKProductDiscountPaymentMode paymentMode = [introductoryPrice paymentMode];
-            if (paymentMode == SKProductDiscountPaymentModePayUpFront || paymentMode == SKProductDiscountPaymentModePayAsYouGo) {
-                NSNumberFormatter *numberFormatter = [[[NSNumberFormatter alloc] init] autorelease];
-                [numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
-                [numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
-                [numberFormatter setLocale:self.product.priceLocale];
-                return [numberFormatter stringFromNumber:introductoryPrice.price];
-            }
-        }
-    }
-#else
-    NSString *productIdentifier = self.product.productIdentifier;
-    if ([productIdentifier isEqualToString:KMStandardAddDevicesAllAccessPack_12Months_Pro]) {
-        SKProductDiscount *introductoryPrice = self.product.introductoryPrice;
-        // 是否有 优惠价格
-        if (introductoryPrice != nil) {
-            SKProductDiscountPaymentMode paymentMode = [introductoryPrice paymentMode];
-            if (paymentMode == SKProductDiscountPaymentModePayUpFront || paymentMode == SKProductDiscountPaymentModePayAsYouGo) {
-                NSNumberFormatter *numberFormatter = [[[NSNumberFormatter alloc] init] autorelease];
-                [numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
-                [numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
-                [numberFormatter setLocale:self.product.priceLocale];
-                return [numberFormatter stringFromNumber:introductoryPrice.price];
-            }
-        }
-    }
-#endif
+//    NSString *productIdentifier = self.product.productIdentifier;
+//    if ([productIdentifier isEqualToString:KM4DevicesAllAccessPack12Months_Free]) {
+//        SKProductDiscount *introductoryPrice = self.product.introductoryPrice;
+//        // 是否有 优惠价格
+//        if (introductoryPrice != nil) {
+//            SKProductDiscountPaymentMode paymentMode = [introductoryPrice paymentMode];
+//            // || paymentMode == SKProductDiscountPaymentModePayAsYouGo
+//            if (paymentMode == SKProductDiscountPaymentModePayUpFront) {
+//                NSNumberFormatter *numberFormatter = [[[NSNumberFormatter alloc] init] autorelease];
+//                [numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
+//                [numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
+//                [numberFormatter setLocale:self.product.priceLocale];
+//                return [numberFormatter stringFromNumber:introductoryPrice.price];
+//            }
+//        }
+//    }
     if (self.product.price) {
         price = [self formattedPrice:NO];
     } else {
@@ -276,6 +259,51 @@ NSString * const KMMemberInfoChangeNotification = @"KMMemberInfoChangeNotificati
     return [self.offersPriceNumber doubleValue]/[self.priceNumber doubleValue];
 }
 
+- (NSString *)introPrice {
+    NSString *price = nil;
+#if !VERSION_DMG
+    SKProductDiscount *introductoryPrice = self.product.introductoryPrice;
+    // 是否有 优惠价格
+    if (introductoryPrice.price) {
+        price = [self discountFormattedPrice:false price:introductoryPrice.price];
+    } else {
+        price = [NSString stringWithFormat:@"USD $%0.2f", [self.offersPriceNumber doubleValue]];
+#ifndef VERSION_DMG
+        // 获取产品价格信息
+        [[IAPProductsManager defaultManager] loadAllProducts];
+#endif
+    }
+#endif
+    price = price ? : @"";
+    return price;
+}
+
+- (NSString *)introAveragePrice {
+    NSString *price = nil;
+#if !VERSION_DMG
+    SKProductDiscount *introductoryPrice = self.product.introductoryPrice;
+    // 是否有 优惠价格
+    if (introductoryPrice.price) {
+        price = [self discountFormattedPrice:true price:introductoryPrice.price];
+    } else {
+        if (self.offersAveragePrice) {
+            CGFloat mouths = self.mouthNumber;
+            if (mouths <= 0) {
+                mouths = 1.0;
+            }
+            price = [NSString stringWithFormat:@"USD $%0.2f", [self.offersPriceNumber doubleValue]/mouths];
+        }
+#ifndef VERSION_DMG
+        // 获取产品价格信息
+        [[IAPProductsManager defaultManager] loadAllProducts];
+#endif
+    }
+#endif
+
+    price = price ? : @"";
+    return price;
+}
+
 - (BOOL)isCancelAutoRenew {
     if (self.autoRenewStatus == nil) {
         // 没有订阅

+ 48 - 15
PDF Office/PDF Master/MemberCenter/WindowsController/KMProductCompareWC.swift

@@ -915,13 +915,16 @@ class KMProductCompareWC: NSWindowController {
         standardPlanPurchaseLblBtn.isEnabled = standardPlanPurchaseButton.isEnabled
         advancedPlanPurchaseLblBtn.isEnabled = advancedPlanPurchaseButton.isEnabled
 
-        let averageMonthPrice: String?
-        let monthPrice: String?
-        let averageMonthPriceDiscount: String?
-        let monthPriceDiscount: String?
-        var allPrice: String?
+        var averageMonthPrice: String? = nil
+        var monthPrice: String? = nil
+        var averageMonthPriceDiscount: String? = nil
+        var monthPriceDiscount: String? = nil
+        var allPrice: String? = nil
         let isOffers_newlyMonth = fourDevicesAllAccessPackNew6Months_lite?.isOffers ?? false
         let isOffers_year = fourDevicesAllAccessPackNew12months_lite?.isOffers ?? false
+        
+        var introPrice: String? = nil
+        var introAveragePrice: String? = nil
 
         if isOffers_newlyMonth {
             specialView1.isHidden = false
@@ -929,11 +932,15 @@ class KMProductCompareWC: NSWindowController {
             monthPrice = fourDevicesAllAccessPackNew6Months_lite?.offersPrice()
             averageMonthPriceDiscount = fourDevicesAllAccessPackNew6Months_lite?.discountAveragePrice()
             monthPriceDiscount = fourDevicesAllAccessPackNew6Months_lite?.discountPrice()
+            introPrice = fourDevicesAllAccessPackNew6Months_lite?.introPrice()
+            introAveragePrice = fourDevicesAllAccessPackNew6Months_lite?.introAveragePrice()
         } else if isOffers_year {
             averageMonthPrice = fourDevicesAllAccessPackNew12months_lite?.offersAveragePrice()
             monthPrice = fourDevicesAllAccessPackNew12months_lite?.offersPrice()
             averageMonthPriceDiscount = fourDevicesAllAccessPackNew12months_lite?.discountAveragePrice()
             monthPriceDiscount = fourDevicesAllAccessPackNew12months_lite?.discountPrice()
+            introPrice = fourDevicesAllAccessPackNew12months_lite?.introPrice()
+            introAveragePrice = fourDevicesAllAccessPackNew12months_lite?.introAveragePrice()
         } else {
             specialView1.isHidden = true
             if !model.isPurchaseSwitch {
@@ -941,11 +948,15 @@ class KMProductCompareWC: NSWindowController {
                 monthPrice = fourDevicesAllAccessPackNew6Months_lite?.price()
                 averageMonthPriceDiscount = fourDevicesAllAccessPackNew6Months_lite?.discountAveragePrice()
                 monthPriceDiscount = fourDevicesAllAccessPackNew6Months_lite?.discountPrice()
+                introPrice = fourDevicesAllAccessPackNew6Months_lite?.introPrice()
+                introAveragePrice = fourDevicesAllAccessPackNew6Months_lite?.introAveragePrice()
             } else {
                 averageMonthPrice = fourDevicesAllAccessPackNew12months_lite?.averagePrice()
                 monthPrice = fourDevicesAllAccessPackNew12months_lite?.price()
                 averageMonthPriceDiscount = fourDevicesAllAccessPackNew12months_lite?.discountAveragePrice()
                 monthPriceDiscount = fourDevicesAllAccessPackNew12months_lite?.discountPrice()
+                introPrice = fourDevicesAllAccessPackNew12months_lite?.introPrice()
+                introAveragePrice = fourDevicesAllAccessPackNew12months_lite?.introAveragePrice()
             }
         }
         
@@ -992,9 +1003,16 @@ class KMProductCompareWC: NSWindowController {
                     value1PurchaseOriPriceLbl.isHidden = false
                     billedTopConst.constant = 16
                 } else {
-                    value1PurchaseLabel.stringValue = String(format: "%@/%@", monthPrice ?? "", NSLocalizedString("12 months", comment: ""))
-                    value1PurchaseOriPriceLbl.isHidden = true
-                    billedTopConst.constant = 0
+                    if let data = introPrice, data.isEmpty == false {
+                        value1PurchaseLabel.stringValue = String(format: "%@/%@", data, NSLocalizedString("12 months", comment: ""))
+                        value1PurchaseOriPriceLbl.stringValue = String(format: "%@/%@", monthPrice ?? "", NSLocalizedString("12 months", comment: ""))
+                        value1PurchaseOriPriceLbl.isHidden = false
+                        billedTopConst.constant = 16
+                    } else {
+                        value1PurchaseLabel.stringValue = String(format: "%@/%@", monthPrice ?? "", NSLocalizedString("12 months", comment: ""))
+                        value1PurchaseOriPriceLbl.isHidden = true
+                        billedTopConst.constant = 0
+                    }
                 }
             } else {
                 if model.isShowSale {
@@ -1003,18 +1021,25 @@ class KMProductCompareWC: NSWindowController {
                     value1PurchaseOriPriceLbl.isHidden = false
                     billedTopConst.constant = 16
                 } else {
-                    value1PurchaseLabel.stringValue = String(format: "%@/%@", monthPrice ?? "", NSLocalizedString("6mon", comment: ""))
-                    value1PurchaseOriPriceLbl.isHidden = true
-                    billedTopConst.constant = 0
+                    if let data = introPrice, data.isEmpty == false {
+                        value1PurchaseLabel.stringValue = String(format: "%@/%@", data, NSLocalizedString("6mon", comment: ""))
+                        value1PurchaseOriPriceLbl.stringValue = String(format: "%@/%@", monthPrice ?? "", NSLocalizedString("6mon", comment: ""))
+                        value1PurchaseOriPriceLbl.isHidden = false
+                        billedTopConst.constant = 16
+                    } else {
+                        value1PurchaseLabel.stringValue = String(format: "%@/%@", monthPrice ?? "", NSLocalizedString("6mon", comment: ""))
+                        value1PurchaseOriPriceLbl.isHidden = true
+                        billedTopConst.constant = 0
+                    }
                 }
             }
         }
         value1PurchaseLabel.textColor = NSColor(red: 1.0, green: 231.0/255.0, blue: 106.0/255.0, alpha: 1.0)
-        value1PurchaseOriPriceLbl.textColor = NSColor(white: 1.0, alpha: 0.7)
+        value1PurchaseOriPriceLbl.textColor = NSColor(hex: "#FFE76A")
         
         value1PurchaseOriPriceLbl.attributedStringValue = NSAttributedString(string: value1PurchaseOriPriceLbl.stringValue, attributes: [
             .font : NSFont.SFProTextRegularFont(12),
-            .foregroundColor: NSColor(white: 1, alpha: 0.7),
+            .foregroundColor: NSColor(hex: "#FFE76A"),
             .strikethroughStyle: NSUnderlineStyle.single.rawValue
         ])
         var tTips: String
@@ -1058,13 +1083,21 @@ class KMProductCompareWC: NSWindowController {
                 if model.isShowSale {
                     tTips = String(format: NSLocalizedString("%@ for the first year's subscription", comment: ""), monthPriceDiscount ?? "")
                 } else {
-                    tTips = String(format: NSLocalizedString("Billed every 12 months at %@", comment: ""), monthPrice ?? "")
+                    if let data = introPrice, data.isEmpty == false {
+                        tTips = String(format: NSLocalizedString("Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)", comment: ""), monthPrice ?? "")
+                    } else {
+                        tTips = String(format: NSLocalizedString("Billed every 12 months at %@", comment: ""), monthPrice ?? "")
+                    }
                 }
             } else {
                 if model.isShowSale {
                     tTips = String(format: NSLocalizedString("%@ for the first 6-month subscription", comment: ""), monthPriceDiscount ?? "")
                 } else {
-                    tTips = String(format: NSLocalizedString("Billed every 6 months at %@", comment: ""), monthPrice ?? "")
+                    if let data = introPrice, data.isEmpty == false {
+                        tTips = String(format: NSLocalizedString("Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)", comment: ""), monthPrice ?? "")
+                    } else {
+                        tTips = String(format: NSLocalizedString("Billed every 6 months at %@", comment: ""), monthPrice ?? "")
+                    }
                 }
             }
 #endif

+ 3 - 0
PDF Office/PDF Master/Strings/ar.lproj/Localizable.strings

@@ -4748,3 +4748,6 @@
 
 "Purchase without Login" = "الشراء بدون تسجيل الدخول";
 
+"Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)" = "Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)";
+"Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)" = "Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)";
+

+ 3 - 0
PDF Office/PDF Master/Strings/de.lproj/Localizable.strings

@@ -3113,3 +3113,6 @@
 "Membership Benefits" = "Membership Benefits";
 
 "Purchase without Login" = "Kaufen ohne Login";
+
+"Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)" = "Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)";
+"Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)" = "Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)";

+ 3 - 0
PDF Office/PDF Master/Strings/en.lproj/Localizable.strings

@@ -4285,3 +4285,6 @@
 "Membership Benefits" = "Membership Benefits";
 
 "Purchase without Login" = "Purchase without Login";
+
+"Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)" = "Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)";
+"Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)" = "Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)";

+ 3 - 0
PDF Office/PDF Master/Strings/es.lproj/Localizable.strings

@@ -3193,3 +3193,6 @@
 "Membership Benefits" = "Membership Benefits";
 
 "Purchase without Login" = "Comprar sin iniciar sesión";
+
+"Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)" = "Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)";
+"Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)" = "Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)";

+ 3 - 0
PDF Office/PDF Master/Strings/fr.lproj/Localizable.strings

@@ -3079,3 +3079,6 @@
 "Membership Benefits" = "Membership Benefits";
 
 "Purchase without Login" = "Acheter sans connexion";
+
+"Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)" = "Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)";
+"Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)" = "Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)";

+ 3 - 0
PDF Office/PDF Master/Strings/it.lproj/Localizable.strings

@@ -2989,3 +2989,6 @@
 "Membership Benefits" = "Membership Benefits";
 
 "Purchase without Login" = "Acquista senza effettuare il login";
+
+"Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)" = "Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)";
+"Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)" = "Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)";

+ 3 - 0
PDF Office/PDF Master/Strings/ja.lproj/Localizable.strings

@@ -3269,3 +3269,6 @@
 "Membership Benefits" = "Membership Benefits";
 
 "Purchase without Login" = "ログインせずに購入する";
+
+"Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)" = "Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)";
+"Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)" = "Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)";

+ 3 - 0
PDF Office/PDF Master/Strings/nl.lproj/Localizable.strings

@@ -3151,3 +3151,6 @@
 "Membership Benefits" = "Membership Benefits";
 
 "Purchase without Login" = "Koop zonder login";
+
+"Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)" = "Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)";
+"Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)" = "Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)";

+ 3 - 0
PDF Office/PDF Master/Strings/pl.lproj/Localizable.strings

@@ -3205,3 +3205,6 @@
 "Membership Benefits" = "Membership Benefits";
 
 "Purchase without Login" = "Zakup bez logowania";
+
+"Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)" = "Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)";
+"Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)" = "Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)";

+ 3 - 0
PDF Office/PDF Master/Strings/pt.lproj/Localizable.strings

@@ -4668,3 +4668,6 @@
 "Membership Benefits" = "Membership Benefits";
 
 "Purchase without Login" = "Compre sem Login";
+
+"Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)" = "Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)";
+"Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)" = "Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)";

+ 3 - 0
PDF Office/PDF Master/Strings/ru.lproj/Localizable.strings

@@ -3139,3 +3139,6 @@
 "Membership Benefits" = "Membership Benefits";
 
 "Purchase without Login" = "Покупка без входа в систему";
+
+"Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)" = "Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)";
+"Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)" = "Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)";

+ 3 - 0
PDF Office/PDF Master/Strings/zh-Hans.lproj/Localizable.strings

@@ -4186,3 +4186,6 @@
 "Membership Benefits" = "会员权益";
 
 "Purchase without Login" = "购买";
+
+"Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)" = "过期后按每半年%@ 自动续费 可随时取消(含税)";
+"Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)" = "过期后按每年%@自动续费 可随时取消(含税)";

+ 3 - 0
PDF Office/PDF Master/Strings/zh-Hant.lproj/Localizable.strings

@@ -4319,3 +4319,6 @@
 "Membership Benefits" = "會員權益";
 
 "Purchase without Login" = "購買";
+
+"Auto-renew at %@/6-month after expiration Cancel anytime (Tax Incl.)" = "過期後按每半年%@自動續費 可隨時取消(含稅)";
+"Auto-renew at %@/year after expiration Cancel anytime (Tax Incl.)" = "過期後按每年%@自動續費 可隨時取消(含稅)";