Ver Fonte

【综合】DMG试用流程入口调整

niehaoyu há 6 meses atrás
pai
commit
9d3ea8e864

+ 2 - 0
PDF Office/PDF Master/Class/Purchase/Appstore/KMPurchaseCompareWindowController.h

@@ -14,6 +14,8 @@
 
 + (NSWindowController *)DMGPurchaseInstance;
 
++ (NSWindowController *)firstTrialInstance;
+
 - (IBAction)startModal:(id)sender;
 - (IBAction)endModal:(id)sender;
 

+ 22 - 18
PDF Office/PDF Master/Class/Purchase/Appstore/KMPurchaseCompareWindowController.m

@@ -182,6 +182,9 @@ static NSString *const KMPurchaseCompareCellIdentifier       = @"KMPurchaseCompa
 
 #pragma mark - KMPurchaseCompareWindowController
 
+static KMPurchaseCompareDMGWindowController *dmgSingleton = nil;
+static KMPurchaseFirstTrialWindowController *firstTrialSingleton = nil;
+
 @interface KMPurchaseCompareWindowController ()<NSTableViewDelegate, NSTableViewDataSource>
 
 @property (nonatomic,assign) NSModalSession modalSession;
@@ -297,19 +300,15 @@ static NSString *const KMPurchaseCompareCellIdentifier       = @"KMPurchaseCompa
 + (NSWindowController *)sharedInstance {
 #if VERSION_DMG
     if (ActivityStatusNone == [VerificationManager manager].status) {
-        static KMPurchaseFirstTrialWindowController *singleton = nil;
-        static dispatch_once_t pred;
-        dispatch_once(&pred, ^{
-            singleton = [KMPurchaseCompareWindowController firstTrialWCCheck];
-        });
-        return singleton;
+        if (!firstTrialSingleton) {
+            firstTrialSingleton = [KMPurchaseCompareWindowController firstTrialWCCheck];
+        }
+        return firstTrialSingleton;
     } else {
-        static KMPurchaseCompareDMGWindowController *singleton = nil;
-        static dispatch_once_t pred;
-        dispatch_once(&pred, ^{
-            singleton = [[KMPurchaseCompareDMGWindowController alloc] init];
-        });
-        return singleton;
+        if (!dmgSingleton) {
+            dmgSingleton = [[KMPurchaseCompareDMGWindowController alloc] init];
+        }
+        return dmgSingleton;
     }
 #else
     static KMPurchaseCompareWindowController *singleton = nil;
@@ -321,13 +320,18 @@ static NSString *const KMPurchaseCompareCellIdentifier       = @"KMPurchaseCompa
 #endif
 }
 
++ (NSWindowController *)firstTrialInstance {
+    if (!firstTrialSingleton) {
+        firstTrialSingleton = [KMPurchaseCompareWindowController firstTrialWCCheck];
+    }
+    return firstTrialSingleton;
+}
+
 + (NSWindowController *)DMGPurchaseInstance {
-    static KMPurchaseCompareDMGWindowController *singleton = nil;
-    static dispatch_once_t pred;
-    dispatch_once(&pred, ^{
-        singleton = [[KMPurchaseCompareDMGWindowController alloc] init];
-    });
-    return singleton;
+    if (!dmgSingleton) {
+        dmgSingleton = [[KMPurchaseCompareDMGWindowController alloc] init];
+    }
+    return dmgSingleton;
 }
 
 #pragma mark - FirstTrial WC

+ 1 - 5
PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseCompareDMGWindowController.m

@@ -620,11 +620,7 @@ static NSString *const KMPurchaseCompareDMGCellIdentifier       = @"KMPurchaseCo
             [self close];
         } else {
             [self close];
-            KMVerificationWindowController *vc = [KMVerificationWindowController verificationWithType:KMVerificationTypeTrial];
-            vc.callback = ^{
-                [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
-            };
-            [vc showWindow:nil];
+            [KMPurchaseCompareWindowController.firstTrialInstance showWindow:nil];
         }
 //    } else {
 //        [self close];