marinofaggiana 6 years ago
parent
commit
5d2ada8bcd
1 changed files with 7 additions and 1 deletions
  1. 7 1
      iOSClient/AppDelegate.m

+ 7 - 1
iOSClient/AppDelegate.m

@@ -1104,6 +1104,12 @@
 
 - (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
 {
+    // Test Maintenance
+    if (self.activeAccount.length == 0 || self.maintenanceMode) {
+        completionHandler(UIBackgroundFetchResultNoData);
+        return;
+    }
+    
     NSLog(@"[LOG] Start perform Fetch With Completion Handler");
     
     // Verify new photo
@@ -1112,7 +1118,7 @@
     // after 20 sec
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 20 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
         
-        NSArray *records = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND session != ''", self.activeAccount] sorted:nil ascending:NO];
+        NSArray *records = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"session != ''"] sorted:nil ascending:NO];
         
         if ([records count] > 0) {
             completionHandler(UIBackgroundFetchResultNewData);