Browse Source

Optimisation synchronizationAnimationDirectory

Marino Faggiana 8 years ago
parent
commit
c538ff46eb

+ 1 - 1
Share Ext/InfoNextcloud.plist

@@ -21,7 +21,7 @@
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>
-	<string>00008</string>
+	<string>00009</string>
 	<key>NSAppTransportSecurity</key>
 	<dict>
 		<key>NSAllowsArbitraryLoads</key>

+ 1 - 1
iOSClient/AppDelegate.m

@@ -402,7 +402,7 @@
 // BACKGROND & FOREGROUND
     
     /* Active/Disactive Graphics Animation Synchronization Folders */
-    [[CCSynchronization sharedSynchronization] synchronizationAnimationWithViewController:YES];
+    [[CCSynchronization sharedSynchronization] synchronizationAnimationDirectory:[CCCoreData getSynchronizedDirectoryActiveAccount:app.activeAccount] callViewController:YES];
 
 // ONLY BACKGROUND
     

+ 1 - 1
iOSClient/InfoPlist/InfoNextcloud.plist

@@ -69,7 +69,7 @@
 		</dict>
 	</array>
 	<key>CFBundleVersion</key>
-	<string>00008</string>
+	<string>00009</string>
 	<key>ITSAppUsesNonExemptEncryption</key>
 	<true/>
 	<key>ITSEncryptionExportComplianceCode</key>

+ 12 - 6
iOSClient/Main/CCMain.m

@@ -5017,7 +5017,7 @@
         NSString *synchronizedServerUrl = [CCUtility stringAppendServerUrl:_localServerUrl addServerUrl:metadata.fileNameData];
         if ([CCCoreData isSynchronizedDirectory:synchronizedServerUrl activeAccount:app.activeAccount]) {
             
-            if ([[CCSynchronization sharedSynchronization] synchronizationAnimationWithViewController:NO]) {
+            if ([[CCSynchronization sharedSynchronization] synchronizationAnimationDirectory:[[NSArray alloc] initWithObjects:synchronizedServerUrl, nil] callViewController:NO]) {
                 
                 NSURL *myURL;
                 
@@ -5488,7 +5488,9 @@
         
         CCMetadata *recordMetadata = [_sectionDataSource.allRecordsDataSource objectForKey:fileID];
         
-        if (recordMetadata.directory == NO) continue;
+        if (recordMetadata.directory == NO)
+            continue;
+        
         if ([[CCUtility stringAppendServerUrl:_localServerUrl addServerUrl:recordMetadata.fileNameData] isEqualToString:serverUrl]) {
             
             NSIndexPath *indexPath = [_sectionDataSource.fileIDIndexPath objectForKey:recordMetadata.fileID];
@@ -5506,15 +5508,19 @@
         
         NSURL *myURL;
         
-        if (cryptated) myURL = [[NSBundle mainBundle] URLForResource: @"synchronizedcrypto" withExtension:@"gif"];
-        else myURL = [[NSBundle mainBundle] URLForResource: @"synchronized" withExtension:@"gif"];
+        if (cryptated)
+            myURL = [[NSBundle mainBundle] URLForResource: @"synchronizedcrypto" withExtension:@"gif"];
+        else
+            myURL = [[NSBundle mainBundle] URLForResource: @"synchronized" withExtension:@"gif"];
         
         cell.synchronizedImageView.image = [UIImage animatedImageWithAnimatedGIFURL:myURL];
         
     } else {
         
-        if (cryptated) cell.synchronizedImageView.image = [UIImage imageNamed:image_synchronizedcrypto];
-        else cell.synchronizedImageView.image = [UIImage imageNamed:image_synchronized];
+        if (cryptated)
+            cell.synchronizedImageView.image = [UIImage imageNamed:image_synchronizedcrypto];
+        else
+            cell.synchronizedImageView.image = [UIImage imageNamed:image_synchronized];
     }
 }
 

+ 1 - 1
iOSClient/Synchronization/CCSynchronization.h

@@ -38,6 +38,6 @@
 
 - (void)verifyChangeMedatas:(NSArray *)allRecordMetadatas serverUrl:(NSString *)serverUrl directoryID:(NSString *)directoryID account:(NSString *)account synchronization:(BOOL)synchronization;
 
-- (BOOL)synchronizationAnimationWithViewController:(BOOL)callViewController;
+- (BOOL)synchronizationAnimationDirectory:(NSArray *)directory callViewController:(BOOL)callViewController;
 
 @end

+ 25 - 23
iOSClient/Synchronization/CCSynchronization.m

@@ -334,41 +334,43 @@
                 [app addNetworkingOperationQueue:app.netQueueDownload delegate:app.activeMain metadataNet:metadataNet oneByOne:YES];
         }
     
-        [[CCSynchronization sharedSynchronization] synchronizationAnimationWithViewController:nil];
-         
+        [[CCSynchronization sharedSynchronization] synchronizationAnimationDirectory:[[NSArray alloc] initWithObjects:serverUrl, nil] callViewController:YES];
+        
         [app.activeMain getDataSourceWithReloadTableView:directoryID fileID:nil selector:nil];
         
         [_hud hideHud];
     });
 }
 
-/* Graphics Animation Synchronization Folders */
+// Graphics Animation Synchronization Folders 
 
-- (BOOL)synchronizationAnimationWithViewController:(BOOL)callViewController
+- (BOOL)synchronizationAnimationDirectory:(NSArray *)directory callViewController:(BOOL)callViewController
 {
-    NSMutableOrderedSet *serversUrlInDownload = [[NSMutableOrderedSet alloc] init];
+    if ([directory count] > 0) {
+        
+        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 */
-    NSArray *synchronizedDirectory = [CCCoreData getSynchronizedDirectoryActiveAccount:app.activeAccount];
-    for (TableDirectory *record in synchronizedDirectory) {
-        
-        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;
-    }
+        /* 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;
+        }
+    }
     return NO;
 }