Browse Source

【会员系统】store版本购买成功后状态栏未刷新问题

wangshuai 1 day ago
parent
commit
39105d4174

+ 1 - 1
PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseEmbeddedWindowController.swift

@@ -1484,7 +1484,7 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
                     if(status.uppercased() == "COMPLETED") {
                     if(status.uppercased() == "COMPLETED") {
                         KMUserInfoVCModel().refreshUserInfo { success, msg,dic  in
                         KMUserInfoVCModel().refreshUserInfo { success, msg,dic  in
                             DispatchQueue.main.async {
                             DispatchQueue.main.async {
-                                NotificationCenter.default.post(name: NSNotification.Name.KMIAPSubscriptionLoaded, object: nil)
+                                NotificationCenter.default.post(name: NSNotification.Name.KMMemberInfoChange, object: self)
                             }
                             }
                         }
                         }
                         
                         

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

@@ -143,6 +143,8 @@ NSPopoverDelegate>
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(expandPersonalCenterNotification:) name:@"ExpandPersonalCenter" object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(expandPersonalCenterNotification:) name:@"ExpandPersonalCenter" object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(closeMenu:) name:@"CloseMenuNotification" object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(closeMenu:) name:@"CloseMenuNotification" object:nil];
     
     
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(memberInfoChangeNotification:) name:KMMemberInfoChangeNotification object:nil];
+
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(subscriptionLoadedNotification:) name:KMIAPSubscriptionLoadedNotification object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(subscriptionLoadedNotification:) name:KMIAPSubscriptionLoadedNotification object:nil];
 }
 }
 
 
@@ -801,6 +803,12 @@ NSPopoverDelegate>
         [self reloadData];
         [self reloadData];
     });
     });
 }
 }
+- (void)memberInfoChangeNotification:(NSNotification *)noti {
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [self reloadData];
+    });
+}
+
 
 
 - (void)popOverCloseAction {
 - (void)popOverCloseAction {
     if (self.stopPopOverHide == NO) {
     if (self.stopPopOverHide == NO) {

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

@@ -14,6 +14,7 @@ extern NSString * const KMIAPProductPurchasedNotification;
 extern NSString * const KMIAPProductRestoreFailedNotification;
 extern NSString * const KMIAPProductRestoreFailedNotification;
 extern NSString * const KMIAPProductRestoreFinishedNotification;
 extern NSString * const KMIAPProductRestoreFinishedNotification;
 extern NSString * const KMIAPSubscriptionLoadedNotification;
 extern NSString * const KMIAPSubscriptionLoadedNotification;
+extern NSString * const KMMemberInfoChangeNotification;
 
 
 extern NSString * const KMStandardAnnualSubscriptionCodeKey_DMG; // "productName": "PDF Reader Pro Standard - Annual Plan"
 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 KMAdvancedAnnualSubscriptionCodeKey_DMG; //"productName": "PDF Reader Pro Advanced - Annual Plan"

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

@@ -71,6 +71,7 @@ NSString * const KMIAPProductPurchasedNotification = @"KMIAPProductPurchasedNoti
 NSString * const KMIAPProductRestoreFailedNotification = @"KMIAPProductRestoreFailedNotification";
 NSString * const KMIAPProductRestoreFailedNotification = @"KMIAPProductRestoreFailedNotification";
 NSString * const KMIAPProductRestoreFinishedNotification = @"KMIAPProductRestoreFinishedNotification";
 NSString * const KMIAPProductRestoreFinishedNotification = @"KMIAPProductRestoreFinishedNotification";
 NSString * const KMIAPSubscriptionLoadedNotification = @"KMIAPSubscriptionLoadedNotification";
 NSString * const KMIAPSubscriptionLoadedNotification = @"KMIAPSubscriptionLoadedNotification";
+NSString * const KMMemberInfoChangeNotification = @"KMMemberInfoChangeNotification";
 
 
 @interface IAPProduct ()
 @interface IAPProduct ()
 
 

+ 5 - 1
PDF Office/PDF Master/MemberCenter/WindowsController/KMProductCompareWC.swift

@@ -1209,10 +1209,14 @@ class KMProductCompareWC: NSWindowController {
             guard let self = self else { return }
             guard let self = self else { return }
             if KMMemberInfo.shared.isLogin {
             if KMMemberInfo.shared.isLogin {
                 self.model.appStoreEquityVerification(notification) { success, msg in
                 self.model.appStoreEquityVerification(notification) { success, msg in
-                    DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 1.5) {//购买成功后,会员信息没有及时刷新
+                    DispatchQueue.main.async {
                         if success {
                         if success {
 //                            self.showAlert(message: NSLocalizedString("Binding Interest Success!", comment: ""))
 //                            self.showAlert(message: NSLocalizedString("Binding Interest Success!", comment: ""))
+                            
                             KMUserInfoVCModel().refreshUserInfo { success, msg,dic  in
                             KMUserInfoVCModel().refreshUserInfo { success, msg,dic  in
+                                if(success) {
+                                    NotificationCenter.default.post(name: NSNotification.Name.KMMemberInfoChange, object: self)
+                                }
                             }
                             }
                             self.window?.close()
                             self.window?.close()
                         } else {
                         } else {