Преглед на файлове

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

tangchao преди 3 дни
родител
ревизия
7413441be0

+ 6 - 6
PDF Office/PDF Master/Class/GuideInfo/KMFunctionGuideWindowController.swift

@@ -99,9 +99,9 @@ class KMFunctionGuideWindowController: NSWindowController {
                         if KMMemberInfo.shared.isPermitAI {
                             self?.closeAction()
                         } else {
-                            let singleTon = KMPurchaseCompareDMGWindowController.init()
-                            singleTon.showWindow(nil)
-                            singleTon.window?.center()
+                            KMProductCompareWC.shared.orientation = false
+                            KMProductCompareWC.shared.showWindow(nil)
+                            KMProductCompareWC.shared.window?.center()
                         }
                     } else if controller.currentNameKEY == controller.MeasureInfoKey {
 //                        var url = URL(string: Store_Link)!
@@ -109,9 +109,9 @@ class KMFunctionGuideWindowController: NSWindowController {
                         if VerificationManager.default().status == ActivityStatusVerification {
                             self?.closeAction()
                         } else {
-                            let singleTon = KMPurchaseCompareDMGWindowController.init()
-                            singleTon.showWindow(nil)
-                            singleTon.window?.center()
+                            KMProductCompareWC.shared.orientation = false
+                            KMProductCompareWC.shared.showWindow(nil)
+                            KMProductCompareWC.shared.window?.center()
                         }
                     } else {
                         KMPrint("请配置Key...")

+ 7 - 5
PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController.swift

@@ -1007,11 +1007,13 @@ extension KMHomeViewController {
             return
         }
         didTrialExpiredLoad = true
-        let singleTon = KMPurchaseCompareDMGWindowController.init()
-        singleTon.showWindow(nil)
-        if singleTon.className == KMPurchaseCompareDMGWindowController.className() {
-            singleTon.updateTitle(NSLocalizedString("Trial Expired, Upgrade to Pro Version", comment: ""), andColor: NSColor(red: 1, green: 59/255, blue: 47/255, alpha: 1))
-        }
+//        let singleTon = KMPurchaseCompareDMGWindowController.init()
+//        singleTon.showWindow(nil)
+//        if singleTon.className == KMPurchaseCompareDMGWindowController.className() {
+//            singleTon.updateTitle(NSLocalizedString("Trial Expired, Upgrade to Pro Version", comment: ""), andColor: NSColor(red: 1, green: 59/255, blue: 47/255, alpha: 1))
+//        }
+        KMProductCompareWC.shared.orientation = false
+        KMProductCompareWC.shared.showWindow(nil)
     }
     
     func checkRepeatTrialAlertController() -> Void {

+ 0 - 1
PDF Office/PDF Master/Class/Purchase/Appstore/KMPurchaseCompareWindowController.m

@@ -9,7 +9,6 @@
 #import "KMPurchaseCompareWindowController.h"
 #import <PDF_Reader_Pro-Swift.h>
 
-#import "KMPurchaseCompareDMGWindowController.h"
 //#import "WaitingView.h"
 //#import "NSButton+TitleColor.h"
 //#import "HyperLinkButton.h"

+ 3 - 0
PDF Office/PDF Master/Class/Purchase/DMG/DMGEmbeddedOldWC.swift

@@ -245,6 +245,9 @@ class DMGEmbeddedOldWC: NSWindowController {
         priceRefresh()
         
         confirmPayment(isConfirm: false)
+        if productID == "com.brother.pdfreaderpro.mac.product_2" {
+            confirmPayment(isConfirm: true)
+        }
         self.window?.delegate = self;
     }
     

+ 3 - 3
PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseFirstTrialWindowController.swift

@@ -418,9 +418,9 @@ import Cocoa
 //        callBack(self,sender,self.emailTextField.stringValue,self.nameTextField.stringValue)
 //        FMTrackEventManager.defaultManager.trackOnceEvent(event: "PUW", withProperties: ["PUW_Btn":"Btn_PUW_BuyNow"])
 #if VERSION_DMG
-        let singleTon = KMPurchaseCompareDMGWindowController.init()
-        singleTon.showWindow(nil)
-        singleTon.window?.center()
+        KMProductCompareWC.shared.orientation = false
+        KMProductCompareWC.shared.showWindow(nil)
+        KMProductCompareWC.shared.window?.center()
 #endif
     }
     

+ 17 - 28
PDF Office/PDF Master/Class/Purchase/DMG/Verification/KMVerificationMessageViewController.m

@@ -262,16 +262,16 @@ NSPopoverDelegate>
     
     if (type == KMUserScenarioTypeDmg_type2 ||
         type == KMUserScenarioTypeDmg_type19 ||
+        type == KMUserScenarioTypeDmg_type20 ||
+        type == KMUserScenarioTypeDmg_type21 ||
         type == KMUserScenarioTypeDmg_type22 ||
-        type == KMUserScenarioTypeDmg_type33 ||
         type == KMUserScenarioTypeDmg_type30 ||
-        type == KMUserScenarioTypeDmg_type20 ||
         type == KMUserScenarioTypeDmg_type31 ||
-        type == KMUserScenarioTypeDmg_type21 ||
-        type == KMUserScenarioTypeDmg_type32) {
+        type == KMUserScenarioTypeDmg_type32 ||
+        type == KMUserScenarioTypeDmg_type33) {
         [self.officeButton setTitleColor:[NSColor whiteColor]];
-        self.officeButton.hidden = YES;
-        self.officeImg.hidden = YES;
+        self.officeButton.hidden = NO;
+        self.officeImg.hidden = NO;
         self.officeButton.frame = CGRectMake(totalWidth, kbottomGap, officeWidth, self.view.frame.size.height -2 *kbottomGap);
         CGRect officeRect = self.officeButton.frame;
         self.officeImg.frame = officeRect;
@@ -545,7 +545,9 @@ NSPopoverDelegate>
 }
 
 - (IBAction)officeButtonAction:(id)sender {
-    
+    DMGEmbeddedOldWC *embeddedWC = [DMGEmbeddedOldWC currentFirstTrialWC:@"com.brother.pdfreaderpro.mac.product_2"];
+    [embeddedWC showWindow:nil];
+    [embeddedWC.window center];
 }
 
 - (NSAttributedString *)numberConvertColor:(NSColor*)color String:(NSString *)string {
@@ -621,27 +623,14 @@ NSPopoverDelegate>
 }
 
 - (IBAction)personalCenterAction:(NSButton *)sender {
-    [KMUserInfoViewController refreshTokenUserInfoWithCallback:^(BOOL success,KMMemberCenterResult*resDic) {
-        if(success) {
-            if([KMMemberInfo shared].isLogin == YES) {
-                // 用户头像点击事件
-                self.userMenu = [[NSMenu alloc] init];
-                KMUserInfoViewController *userInfo = [[KMUserInfoViewController alloc] init];
-                NSMenuItem *item = [self.userMenu addItemWithTitle:@"" action:nil target:@""];
-                item.target = self;
-                item.representedObject = userInfo;
-                item.view = userInfo.view;
-                [self.userMenu popUpMenuPositioningItem:nil atLocation:NSMakePoint(-130, 30) inView:sender];
-            }
-        } else {
-            NSInteger code = resDic.code;
-            if(code == 304) {
-                [[KMLoginWindowsController shared] showWindow:nil];
-            }
-        }
-    }];
-  
-
+    // 用户头像点击事件
+    self.userMenu = [[NSMenu alloc] init];
+    KMUserInfoViewController *userInfo = [[KMUserInfoViewController alloc] init];
+    NSMenuItem *item = [self.userMenu addItemWithTitle:@"" action:nil target:@""];
+    item.target = self;
+    item.representedObject = userInfo;
+    item.view = userInfo.view;
+    [self.userMenu popUpMenuPositioningItem:nil atLocation:NSMakePoint(-130, 30) inView:sender];
 }
 
 - (IBAction)signUpAction:(NSButton *)sender {

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

@@ -302,8 +302,8 @@ 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];
-                KMPurchaseCompareDMGWindowController *singleTon = [[KMPurchaseCompareDMGWindowController alloc] init];
-                [singleTon showWindow:nil];
+                [[KMProductCompareWC shared] setOrientation:NO];
+                [[KMProductCompareWC shared] showWindow:nil];
             } else if (clickIndex == 2) {
                 //输入序列码
                 KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeActivate];
@@ -759,8 +759,8 @@ static KMVerificationWindowController *_currentWindowController = nil;
 #if VERSION_DMG
 //    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@?utm_source=MacAppDmg&utm_campaign=StoreLink&utm_medium=PdfStore", Swift_oc_Tool.Store_Link_OC]];
 //    [[NSWorkspace sharedWorkspace] openURL:url];
-    KMPurchaseCompareDMGWindowController *singleTon = [[KMPurchaseCompareDMGWindowController alloc] init];
-    [singleTon showWindow:nil];
+    [[KMProductCompareWC shared] setOrientation:NO];
+    [[KMProductCompareWC shared] showWindow:nil];
 #endif
     
 }

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

@@ -17,6 +17,7 @@ extern NSString * const KMIAPSubscriptionLoadedNotification;
 
 extern NSString * const KMStandardAnnualSubscriptionCodeKey_DMG; // "productName": "PDF Reader Pro Standard - Annual Plan"
 extern NSString * const KMAdvancedAnnualSubscriptionCodeKey_DMG; //"productName": "PDF Reader Pro Advanced - Annual Plan"
+extern NSString * const KMAdvancedAnnualSubscriptionTrailCodeKey_DMG; //"productName": "PDF Reader Pro Advanced - Annual Plan"
 extern NSString * const KMAdvancedPermanentCodeKey_DMG; // "productName": "PDF Reader Pro Permanent"
 
 extern NSString * const KMAISubscriptionYearTrailCodeKey_DMG;               // 0元试用AI 年订阅 产品Code

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

@@ -50,6 +50,7 @@ NSString * const KMAdvancedAdd2DevicesAllAccessPack12Months_Pro = @"com.pdfreade
 
 NSString * const KMStandardAnnualSubscriptionCodeKey_DMG                    = @"standard-annual-subscription"; // "productName": "PDF Reader Pro Standard - Annual Plan"
 NSString * const KMAdvancedAnnualSubscriptionCodeKey_DMG                    = @"advanced-annual-subscription"; //"productName": "PDF Reader Pro Advanced - Annual Plan"
+NSString * const KMAdvancedAnnualSubscriptionTrailCodeKey_DMG               = @"advanced-annual-subscription-trail"; //"productName": "PDF Reader Pro Advanced - Annual Plan"
 NSString * const KMAdvancedPermanentCodeKey_DMG                             = @"advanced-permanent"; // "productName": "PDF Reader Pro Permanent"
 
 NSString * const KMAISubscriptionYearTrailCodeKey_DMG                       = @"ai-subscription-year-trail"; // 0元试用AI 年订阅 产品Code

+ 3 - 3
PDF Office/PDF Master/MemberCenter/KMMemberCenterConfig.swift

@@ -11,12 +11,12 @@ class KMMemberCenterConfig: NSObject {
     func activityBaseURL() -> String {
         #if DEBUG
         if kTestMode == 1{
-            return "http://139.196.160.101:8081"
-        } else {
             return "https://test-pdf-pro.kdan.cn"
+        } else {
+            return "https://pdfmaster.pdfreaderpro.com"
         }
         #else
-        return "https://test-pdf-pro.kdan.cn"
+        return "https://pdfmaster.pdfreaderpro.com"
         #endif
     }
 }

+ 36 - 2
PDF Office/PDF Master/MemberCenter/ViewController/KMUserInfoViewController.swift

@@ -162,6 +162,25 @@ class KMUserInfoViewController: NSViewController {
             })
         }
         NotificationCenter.default.addObserver(self, selector: #selector(changeEffectiveAppearance), name: NSNotification.Name(rawValue: "kEffectiveAppearance"), object: nil)
+        
+        addWaitingView(to: self.view)
+        KMUserInfoViewController.refreshTokenUserInfo {[weak self] success, resDic in
+            DispatchQueue.main.async {
+                self?.removeWaitingView(from: self?.view ?? NSView())
+                if(success) {
+                    if KMMemberInfo.shared.isLogin {
+                    }
+                } else {
+                    NotificationCenter.default.post(name: NSNotification.Name("CloseMenuNotification"), object: nil)
+                    let code = resDic?.code
+                    if code == 304 {
+                        KMLoginWindowsController.shared.showWindow(nil)
+                    }
+                }
+            }
+        }
+        
+
     }
     
     @objc func changeEffectiveAppearance() {
@@ -478,6 +497,23 @@ class KMUserInfoViewController: NSViewController {
         }
     }
     
+    func addWaitingView(to view: NSView) {
+        removeWaitingView(from: view)
+        let waitingView = WaitingView(frame: view.bounds)
+        waitingView.autoresizingMask = [.width, .height]
+        view.addSubview(waitingView)
+        waitingView.startAnimation()
+    }
+
+    func removeWaitingView(from view: NSView) {
+        for subview in view.subviews {
+            if subview is WaitingView {
+                subview.removeFromSuperview()
+                break
+            }
+        }
+    }
+    
     private func initializeUI() -> Void {
         refreshEquity()
         
@@ -1138,8 +1174,6 @@ class KMUserInfoViewController: NSViewController {
                         endDateLabel.isHidden = false
                         endDateLabel.textColor = NSColor(named: "FA1E5D")
                     }
-                    spliLineImageView.isHidden = false
-                    endDateLabel.isHidden = false
                     buyNow2Box.isHidden = true
                     buyNow1BoxLeftConst.constant = (CGRectGetWidth(view.bounds) - CGRectGetWidth(buyNow1Box.frame))/2
                 } else { // 免费

+ 8 - 0
PDF Office/PDF Master/MemberCenter/ViewModel/KMProductModel.swift

@@ -441,6 +441,12 @@ class KMProductModel: ObservableObject {
                     } else {
                         return String(format: "CNY ¥%@", getDMGCNYPrice(productCode: KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG))
                     }
+                } else if KMMemberInfo.shared.canTrail {
+                    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 {
                     if NSLocalizedString("USD", tableName: "MemberCenterLocalizable", comment: "") == "USD" {
                         return String(format: "USD $%@", getDMGPrice(productCode: KMAdvancedAnnualSubscriptionCodeKey_DMG))
@@ -588,6 +594,8 @@ class KMProductModel: ObservableObject {
             } else {
                 if isBlackFive {
                     code = KMAdvancedAnnualSubscriptionBlackFiveCodeKey_DMG
+                } else if KMMemberInfo.shared.canTrail {
+                    code = KMAdvancedAnnualSubscriptionTrailCodeKey_DMG
                 } else {
                     code = KMAdvancedAnnualSubscriptionCodeKey_DMG
                 }

+ 8 - 0
PDF Office/PDF Master/MemberCenter/WindowsController/KMProductCompareWC.swift

@@ -311,6 +311,11 @@ class KMProductCompareWC: NSWindowController {
 
     @objc override func showWindow(_ sender: Any?) {
         super.showWindow(sender)
+#if VERSION_DMG
+        model.getDMGProductDatas { success, result in
+            
+        }
+#endif
         if orientation {
             model.state = orientationType
         } else {
@@ -366,6 +371,9 @@ class KMProductCompareWC: NSWindowController {
 #if VERSION_FREE
 #if VERSION_DMG
     // DMG
+        if KMMemberInfo.shared.canTrail {
+            advancedPlanPurchaseLbl.stringValue = NSLocalizedString("Free Trial", comment: "")
+        }
         if model.state == .dmg_Base {
             standardPlanPurchaseLabel.stringValue = model.getProductPrice(.pdfReaderProStandard_dmg)
             advancedPlanPurchaseLabel.stringValue = model.getProductPrice(.pdfReaderProAdvanced_dmg)

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

@@ -4274,6 +4274,7 @@
 
 "2 devices" = "2 devices";
 "4 devices" = "4 devices";
+"1 device" = "1 device";
 
 "Password cannot exceed 30 characters." = "Password cannot exceed 30 characters.";
 "Auto-renewal | 50 credits/month | Cancel anytime" = "Auto-renewal | 50 credits/month | Cancel anytime";

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

@@ -4176,6 +4176,7 @@
 
 "2 devices" = "2台设备";
 "4 devices" = "4台设备";
+"1 device" = "1台设备";
 
 "Password cannot exceed 30 characters." = "密码不能超过30个字符。";
 "Auto-renewal | 50 credits/month | Cancel anytime" = "自动续订|每月50点数|可随时取消";

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

@@ -4307,6 +4307,7 @@
 
 "2 devices" = "2台設備";
 "4 devices" = "4台設備";
+"1 device" = "1台設備";
 
 "Password cannot exceed 30 characters." = "密碼不能超過30個字元。";
 "Auto-renewal | 50 credits/month | Cancel anytime" = "自動續訂|每月50點|可隨時取消";