Prechádzať zdrojové kódy

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

tangchao 6 dní pred
rodič
commit
99e119e40c

+ 43 - 2
PDF Office/PDF Master/Class/AD/KMAdsWebView.swift

@@ -297,8 +297,49 @@ class KMAdsWebView: NSView, WKNavigationDelegate, CAAnimationDelegate {
         }
         
         if type == .ComparisonSheet {
-            KMProductCompareWC.shared.orientation = false
-            KMProductCompareWC.shared.showWindow(nil)
+            if KMMemberInfo.shared.isLogin {
+                if KMMemberInfo.shared.vip_levels == "1" {
+                    KMProductCompareWC.shared.orientation = true
+    #if VERSION_FREE
+    #if VERSION_DMG
+        // DMG
+                    KMProductCompareWC.shared.orientationType = .dmg_Base
+    #else
+        // AppStore 免费版本
+                    KMProductCompareWC.shared.orientationType = .lite_Base
+    #endif
+    #else
+        // AppStore 付费版
+                    KMProductCompareWC.shared.orientationType = .pro_Base
+    #endif
+                    KMProductCompareWC.shared.showWindow(nil)
+                } else {
+                    KMMemberInfo.shared.advancedFunctionUsage()
+                }
+            } else {
+                KMLoginWindowsController.shared.openWindow { success in
+                    if success {
+                        if KMMemberInfo.shared.vip_levels == "1" {
+                            KMProductCompareWC.shared.orientation = true
+            #if VERSION_FREE
+            #if VERSION_DMG
+                // DMG
+                            KMProductCompareWC.shared.orientationType = .dmg_Base
+            #else
+                // AppStore 免费版本
+                            KMProductCompareWC.shared.orientationType = .lite_Base
+            #endif
+            #else
+                // AppStore 付费版
+                            KMProductCompareWC.shared.orientationType = .pro_Base
+            #endif
+                            KMProductCompareWC.shared.showWindow(nil)
+                        } else {
+                            KMMemberInfo.shared.advancedFunctionUsage()
+                        }
+                    }
+                }
+            }
         } else {
             let newURL = NSURL(string: string)
             NSWorkspace.shared.open(newURL! as URL)

+ 43 - 2
PDF Office/PDF Master/Class/KMAdvertisement/View/KMRecommondPopWindow/KMRecommondPopWindow.m

@@ -96,8 +96,49 @@ NSWindowDelegate>
 - (IBAction)buyAction:(NSButton *)sender {
     if (_info.version) {
         if ([_info.jumpType isEqualToString:@"Comparison Sheet"]) {
-            [[KMProductCompareWC shared] setOrientation:NO];
-            [[KMProductCompareWC shared] showWindow:nil];
+            if ([KMMemberInfo shared].isLogin) {
+                if ([[KMMemberInfo shared].vip_levels isEqualToString:@"1"]) {
+                    [[KMProductCompareWC shared] setOrientation:YES];
+    #if VERSION_FREE
+    #if VERSION_DMG
+        // DMG
+                [[KMProductCompareWC shared] setOrientationType:KMCompareTableTypeDmg_Base];
+    #else
+        // AppStore 免费版本
+                [[KMProductCompareWC shared] setOrientationType:KMCompareTableTypeLite_Base];
+    #endif
+    #else
+        // AppStore 付费版
+                [[KMProductCompareWC shared] setOrientationType:KMCompareTableTypePro_Base];
+    #endif
+                    [[KMProductCompareWC shared] showWindow:nil];
+                } else {
+                    [[KMMemberInfo shared] advancedFunctionUsage];
+                }
+            } else {
+                [[KMLoginWindowsController shared] openWindow:^(BOOL success) {
+                    if (success) {
+                        if ([[KMMemberInfo shared].vip_levels isEqualToString:@"1"]) {
+                            [[KMProductCompareWC shared] setOrientation:YES];
+    #if VERSION_FREE
+    #if VERSION_DMG
+        // DMG
+                [[KMProductCompareWC shared] setOrientationType:KMCompareTableTypeDmg_Base];
+    #else
+        // AppStore 免费版本
+                [[KMProductCompareWC shared] setOrientationType:KMCompareTableTypeLite_Base];
+    #endif
+    #else
+        // AppStore 付费版
+                [[KMProductCompareWC shared] setOrientationType:KMCompareTableTypePro_Base];
+    #endif
+                            [[KMProductCompareWC shared] showWindow:nil];
+                        } else {
+                            [[KMMemberInfo shared] advancedFunctionUsage];
+                        }
+                    }
+                }];
+            }
         } else {
             [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[KMAdvertisementModelTransition transitionLanguageWithLangeuage:_info.linkURL]]];
         }

+ 70 - 22
PDF Office/PDF Master/Class/Purchase/DMG/Verification/KMVerificationMessageViewController.m

@@ -528,34 +528,72 @@ NSPopoverDelegate>
         KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeRepeatTrialGuide];
         [vc showWindow:nil];
     } else {
-        [[KMProductCompareWC shared] setOrientation:NO];
-        [[KMProductCompareWC shared] showWindow:nil];
+        [[KMMemberInfo shared] advancedFunctionUsage];
     }
 }
 
 - (IBAction)buttonAction:(id)sender {
     if (KMAdvertisementManager.manager.info.topRightInfoContent != nil) {
         if (KMAdvertisementManager.manager.info.topRightInfoContent.content.firstObject != nil) {
-            [[KMProductCompareWC shared] setOrientation:YES];
-#if VERSION_FREE
-#if VERSION_DMG
-    // DMG
-            [[KMProductCompareWC shared] setOrientationType:KMCompareTableTypeDmg_Base];
-#else
-    // AppStore 免费版本
-            [[KMProductCompareWC shared] setOrientationType:KMCompareTableTypeLite_Base];
-#endif
-#else
-    // AppStore 付费版
-            [[KMProductCompareWC shared] setOrientationType:KMCompareTableTypePro_Base];
-#endif
-            [[KMProductCompareWC shared] showWindow:nil];
+            if ([KMMemberInfo shared].isLogin) {
+                if ([[KMMemberInfo shared].vip_levels isEqualToString:@"1"]) {
+                    [[KMProductCompareWC shared] setOrientation:YES];
+        #if VERSION_FREE
+        #if VERSION_DMG
+            // DMG
+                    [[KMProductCompareWC shared] setOrientationType:KMCompareTableTypeDmg_Base];
+        #else
+            // AppStore 免费版本
+                    [[KMProductCompareWC shared] setOrientationType:KMCompareTableTypeLite_Base];
+        #endif
+        #else
+            // AppStore 付费版
+                    [[KMProductCompareWC shared] setOrientationType:KMCompareTableTypePro_Base];
+        #endif
+                    [[KMProductCompareWC shared] showWindow:nil];
+                } else {
+                    [[KMMemberInfo shared] advancedFunctionUsage];
+                }
+            } else {
+                [[KMLoginWindowsController shared] openWindow:^(BOOL success) {
+                    if (success) {
+                        if ([[KMMemberInfo shared].vip_levels isEqualToString:@"1"]) {
+                            [[KMProductCompareWC shared] setOrientation:YES];
+                #if VERSION_FREE
+                #if VERSION_DMG
+                    // DMG
+                            [[KMProductCompareWC shared] setOrientationType:KMCompareTableTypeDmg_Base];
+                #else
+                    // AppStore 免费版本
+                            [[KMProductCompareWC shared] setOrientationType:KMCompareTableTypeLite_Base];
+                #endif
+                #else
+                    // AppStore 付费版
+                            [[KMProductCompareWC shared] setOrientationType:KMCompareTableTypePro_Base];
+                #endif
+                            [[KMProductCompareWC shared] showWindow:nil];
+                        } else {
+                            [[KMMemberInfo shared] advancedFunctionUsage];
+                        }
+                    }
+                }];
+            }
         } else {
             KMUserScenarioType type = [KMMemberInfo shared].userScenarioType;
             if (type == KMUserScenarioTypeDmg_type4) {
-                [[KMProductCompareWC shared] setOrientation:YES];
-                [[KMProductCompareWC shared] setOrientationType:KMCompareTableTypeTrial];
-                [[KMProductCompareWC shared] showWindow:nil];
+                if ([KMMemberInfo shared].isLogin) {
+                    [[KMProductCompareWC shared] setOrientation:YES];
+                    [[KMProductCompareWC shared] setOrientationType:KMCompareTableTypeTrial];
+                    [[KMProductCompareWC shared] showWindow:nil];
+                } else {
+                    [[KMLoginWindowsController shared] openWindow:^(BOOL success) {
+                        if (success) {
+                            [[KMProductCompareWC shared] setOrientation:YES];
+                            [[KMProductCompareWC shared] setOrientationType:KMCompareTableTypeTrial];
+                            [[KMProductCompareWC shared] showWindow:nil];
+                        }
+                    }];
+                }
             } else {
                 [[KMMemberInfo shared] advancedFunctionUsage];
             }
@@ -563,9 +601,19 @@ NSPopoverDelegate>
     } else {
         KMUserScenarioType type = [KMMemberInfo shared].userScenarioType;
         if (type == KMUserScenarioTypeDmg_type4) {
-            [[KMProductCompareWC shared] setOrientation:YES];
-            [[KMProductCompareWC shared] setOrientationType:KMCompareTableTypeTrial];
-            [[KMProductCompareWC shared] showWindow:nil];
+            if ([KMMemberInfo shared].isLogin) {
+                [[KMProductCompareWC shared] setOrientation:YES];
+                [[KMProductCompareWC shared] setOrientationType:KMCompareTableTypeTrial];
+                [[KMProductCompareWC shared] showWindow:nil];
+            } else {
+                [[KMLoginWindowsController shared] openWindow:^(BOOL success) {
+                    if (success) {
+                        [[KMProductCompareWC shared] setOrientation:YES];
+                        [[KMProductCompareWC shared] setOrientationType:KMCompareTableTypeTrial];
+                        [[KMProductCompareWC shared] showWindow:nil];
+                    }
+                }];
+            }
         } else {
             [[KMMemberInfo shared] advancedFunctionUsage];
         }

+ 1 - 2
PDF Office/PDF Master/Class/Purchase/DMG/Verification/KMVerificationWindowController.m

@@ -303,8 +303,7 @@ static KMVerificationWindowController *_currentWindowController = nil;
 //                NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@?utm_source=app_dmg&utm_medium=dmg_puw_sec_free_trial", Swift_oc_Tool.Store_Link_OC]];
 //                [[NSWorkspace sharedWorkspace] openURL:url];
 //                [blockSelf close];
-                [[KMProductCompareWC shared] setOrientation:NO];
-                [[KMProductCompareWC shared] showWindow:nil];
+                [[KMMemberInfo shared] advancedFunctionUsage];
             } else if (clickIndex == 2) {
                 //输入序列码
                 KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeActivate];

+ 14 - 2
PDF Office/PDF Master/MemberCenter/ViewModel/KMProductModel.swift

@@ -173,7 +173,13 @@ class KMProductModel: ObservableObject {
         guard let productModels = dmgProductDatas?.listingProducts else { return "" }
         for model in productModels {
             if model.code == productCode {
-                return String(format: "%.2f", Float(model.priceString ?? "0") ?? 0)
+                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)
+                } else {
+                    return String(format: "%.2f", Float(model.priceString ?? "0") ?? 0)
+                }
             }
         }
         return ""
@@ -185,7 +191,13 @@ class KMProductModel: ObservableObject {
         guard let productModels = dmgProductDatas?.listingProducts else { return "" }
         for model in productModels {
             if model.code == productCode {
-                return String(format: "%.2f", Float(model.cnyPriceString ?? "0") ?? 0)
+                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)
+                } else {
+                    return String(format: "%.2f", Float(model.cnyPriceString ?? "0") ?? 0)
+                }
             }
         }
         return ""