瀏覽代碼

Improved offline

Marino Faggiana 8 年之前
父節點
當前提交
0be909f956

+ 1 - 1
iOSClient/AppDelegate.m

@@ -393,7 +393,7 @@
         [directory addObject:record.serverUrl];
     
     if ([directory count] > 0)
-        [[CCOfflineFileFolder sharedOfflineFileFolder] offlineFolderAnimationDirectory:directory callViewController:YES];
+        [[CCOfflineFileFolder sharedOfflineFileFolder] offlineFolderAnimationDirectory:directory setGraphicsFolder:YES];
 
 // ONLY BACKGROUND
     

+ 1 - 1
iOSClient/Main/CCMain.m

@@ -5019,7 +5019,7 @@
             else cell.offlineImageView.image = [UIImage imageNamed:image_offline];
             
             // Animation synchronized gif
-            if ([[CCOfflineFileFolder sharedOfflineFileFolder] offlineFolderAnimationDirectory:[[NSArray alloc] initWithObjects:directoryServerUrl, nil] callViewController:NO]) {
+            if ([[CCOfflineFileFolder sharedOfflineFileFolder] offlineFolderAnimationDirectory:[[NSArray alloc] initWithObjects:directoryServerUrl, nil] setGraphicsFolder:NO]) {
                 
                 NSURL *myURL;
                 

+ 1 - 1
iOSClient/Offline/CCOfflineFileFolder.h

@@ -40,6 +40,6 @@
 
 - (void)verifyChangeMedatas:(NSArray *)allRecordMetadatas serverUrl:(NSString *)serverUrl account:(NSString *)account offline:(BOOL)offline;
 
-- (BOOL)offlineFolderAnimationDirectory:(NSArray *)directory callViewController:(BOOL)callViewController;
+- (BOOL)offlineFolderAnimationDirectory:(NSArray *)directory setGraphicsFolder:(BOOL)setGraphicsFolder;
 
 @end

+ 9 - 5
iOSClient/Offline/CCOfflineFileFolder.m

@@ -114,14 +114,15 @@
 
 // Graphics Animation Offline Folders
 //
-// User return BOOL animation for 1 directory only
 //
 
-- (BOOL)offlineFolderAnimationDirectory:(NSArray *)directory callViewController:(BOOL)callViewController
+- (BOOL)offlineFolderAnimationDirectory:(NSArray *)directory setGraphicsFolder:(BOOL)setGraphicsFolder
 {
     BOOL animation = NO;
+    BOOL isAtLeastOneInAnimation = NO;
     NSMutableOrderedSet *serversUrlInDownload = [[NSMutableOrderedSet alloc] init];
     
+    // Active for download
     NSMutableArray *metadatasNet = [app verifyExistsInQueuesDownloadSelector:selectorDownloadOffline];
     
     for (CCMetadataNet *metadataNet in metadatasNet)
@@ -133,7 +134,10 @@
         
         animation = [serversUrlInDownload containsObject:serverUrl];
         
-        if (callViewController) {
+        if (animation)
+            isAtLeastOneInAnimation = YES;
+        
+        if (setGraphicsFolder) {
             
             NSString *serverUrlOffline = [CCUtility deletingLastPathComponentFromServerUrl:serverUrl];
             CCMain *viewController = [app.listMainVC objectForKey:serverUrlOffline];
@@ -142,7 +146,7 @@
         }
     }
     
-    return animation;
+    return isAtLeastOneInAnimation;
 }
 
 - (void)readFolderFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
@@ -436,7 +440,7 @@
             [app addNetworkingOperationQueue:app.netQueueDownload delegate:app.activeMain metadataNet:metadataNet];
         }
     
-        [[CCOfflineFileFolder sharedOfflineFileFolder] offlineFolderAnimationDirectory:[[NSArray alloc] initWithObjects:serverUrl, nil] callViewController:YES];
+        [[CCOfflineFileFolder sharedOfflineFileFolder] offlineFolderAnimationDirectory:[[NSArray alloc] initWithObjects:serverUrl, nil] setGraphicsFolder:YES];
         
         [app.activeMain reloadDatasource:serverUrl fileID:nil selector:nil];