Browse Source

Modify synchronizationAnimationDirectory

Marino Faggiana 8 years ago
parent
commit
ecc5bbd56a
2 changed files with 25 additions and 21 deletions
  1. 7 1
      iOSClient/AppDelegate.m
  2. 18 20
      iOSClient/Synchronization/CCSynchronization.m

+ 7 - 1
iOSClient/AppDelegate.m

@@ -402,7 +402,13 @@
 // BACKGROND & FOREGROUND
     
     /* Active/Disactive Graphics Animation Synchronization Folders */
-    [[CCSynchronization sharedSynchronization] synchronizationAnimationDirectory:[CCCoreData getSynchronizedDirectoryActiveAccount:app.activeAccount] callViewController:YES];
+    NSArray *records = [CCCoreData getSynchronizedDirectoryActiveAccount:app.activeAccount];
+    NSMutableArray *directory = [[NSMutableArray alloc] init];
+    for (TableDirectory *record in records)
+        [directory addObject:record.serverUrl];
+    
+    if ([directory count] > 0)
+        [[CCSynchronization sharedSynchronization] synchronizationAnimationDirectory:directory callViewController:YES];
 
 // ONLY BACKGROUND
     

+ 18 - 20
iOSClient/Synchronization/CCSynchronization.m

@@ -346,31 +346,29 @@
 
 - (BOOL)synchronizationAnimationDirectory:(NSArray *)directory callViewController:(BOOL)callViewController
 {
-    if ([directory count] > 0) {
-        
-        NSMutableOrderedSet *serversUrlInDownload = [[NSMutableOrderedSet alloc] init];
+    NSMutableOrderedSet *serversUrlInDownload = [[NSMutableOrderedSet alloc] init];
     
-        NSMutableArray *metadatasNet = [app verifyExistsInQueuesDownloadSelector:selectorDownloadSynchronized];
+    NSMutableArray *metadatasNet = [app verifyExistsInQueuesDownloadSelector:selectorDownloadSynchronized];
     
-        for (CCMetadataNet *metadataNet in metadatasNet)
-            [serversUrlInDownload addObject:metadataNet.serverUrl];
+    for (CCMetadataNet *metadataNet in metadatasNet)
+        [serversUrlInDownload addObject:metadataNet.serverUrl];
     
-        /* Animation ON/OFF */
+    /* Animation ON/OFF */
     
-        for (TableDirectory *record in directory) {
-        
-            NSString *serverUrl = record.serverUrl;
-            BOOL animation = [serversUrlInDownload containsObject:serverUrl];
-        
-            if (callViewController) {
-                NSString *serverUrlSynchronized = [CCUtility deletingLastPathComponentFromServerUrl:serverUrl];
-                CCMain *viewController = [app.listMainVC objectForKey:serverUrlSynchronized];
-                if (viewController)
-                    [viewController synchronizedFolderGraphicsServerUrl:serverUrl animation:animation];
-            } else
-                return animation;
-        }
+    for (NSString *serverUrl in directory) {
+        
+        BOOL animation = [serversUrlInDownload containsObject:serverUrl];
+        
+        if (callViewController) {
+            
+            NSString *serverUrlSynchronized = [CCUtility deletingLastPathComponentFromServerUrl:serverUrl];
+            CCMain *viewController = [app.listMainVC objectForKey:serverUrlSynchronized];
+            if (viewController)
+                [viewController synchronizedFolderGraphicsServerUrl:serverUrl animation:animation];
+        } else
+            return animation;
     }
+    
     return NO;
 }