Переглянути джерело

HMLG Scan Order 1.39
optimize apn function

Ray Zhang 2 роки тому
батько
коміт
7012ad8881

+ 2 - 2
RedAnt ERP Mobile/HMLG Scan Order.xcodeproj/project.pbxproj

@@ -2523,7 +2523,7 @@
 				CODE_SIGN_ENTITLEMENTS = "HMLG Scan Order/HMLG Scan Order.entitlements";
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				CURRENT_PROJECT_VERSION = 54350;
+				CURRENT_PROJECT_VERSION = 54371;
 				DEVELOPMENT_TEAM = HXWLAA5YN5;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -2573,7 +2573,7 @@
 				CODE_SIGN_ENTITLEMENTS = "HMLG Scan Order/HMLG Scan Order.entitlements";
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				CURRENT_PROJECT_VERSION = 54350;
+				CURRENT_PROJECT_VERSION = 54371;
 				DEVELOPMENT_TEAM = HXWLAA5YN5;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",

+ 1 - 1
RedAnt ERP Mobile/HMLG Scan Order/AppDelegate.h

@@ -11,7 +11,7 @@
 #import <UserNotifications/UserNotifications.h>
 
 @interface AppDelegate : AppDelegateBase<UNUserNotificationCenterDelegate>
-
+@property bool occupied;
 
 @end
 //#import "iSalesDB.h"

+ 18 - 1
RedAnt ERP Mobile/HMLG Scan Order/AppDelegate.m

@@ -62,7 +62,13 @@
 
 - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
     
+    if(self.occupied)
+    {
+        completionHandler(UIBackgroundFetchResultNoData);
+        return; // 不处理后台时的推送,避免重复推送
+    }
     
+    self.occupied = true;
     if(application.applicationState == UIApplicationStateInactive)
     {
         completionHandler(UIBackgroundFetchResultNoData);
@@ -107,6 +113,14 @@
     
     
     
+    
+    // 取消所有推送
+    [application setApplicationIconBadgeNumber:0];
+
+//    UNUserNotificationCenter * center = [UNUserNotificationCenter currentNotificationCenter];
+//    [center removeAllPendingNotificationRequests];
+    // 弹出提示框
+    
     UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Local Data Update Required" message:nil preferredStyle:UIAlertControllerStyleAlert];
     //block代码块取代了delegate
 
@@ -119,7 +133,7 @@
 
 
 
-      
+        self.occupied = false;
 
 
     }];
@@ -129,6 +143,8 @@
         [RADataProvider updateTemplate:vc];
         
         [RADataProvider updateStock:vc];
+        
+        self.occupied = false;
 
         
     }];
@@ -138,6 +154,7 @@
         [alertControl addAction:alertthree];
 
     UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Update Later" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
+        self.occupied = false;
     }];
     [alertControl addAction:alertcancel];