Marino Faggiana 6 жил өмнө
parent
commit
2c002e0135

+ 0 - 4
iOSClient/Main/CCDetail.m

@@ -47,7 +47,6 @@
     NSInteger indexNowVisible;
     NSString *fileIDNowVisible;
     
-    NSMutableOrderedSet *dataSourceDirectoryID;
     NSString *fileNameExtension;
 }
 @end
@@ -70,7 +69,6 @@
         self.metadataDetail = [[tableMetadata alloc] init];
         self.photos = [[NSMutableArray alloc] init];
         self.photoDataSource = [NSMutableArray new];
-        dataSourceDirectoryID = [[NSMutableOrderedSet alloc] init];
         indexNowVisible = -1;
         fileIDNowVisible = nil;
 
@@ -301,7 +299,6 @@
     fileIDNowVisible = nil;
     
     [self.photos removeAllObjects];
-    [dataSourceDirectoryID removeAllObjects];
     
     // if not images, exit
     if ([self.photoDataSource count] == 0)
@@ -317,7 +314,6 @@
         [self.photos addObject:[MWPhoto photoWithImage:nil]];
         
         // add directory
-        [dataSourceDirectoryID addObject:metadata.directoryID];
         index++;
     }
     

+ 10 - 8
iOSClient/Synchronize/CCSynchronize.m

@@ -338,18 +338,18 @@
 // MULTI THREAD
 - (void)SynchronizeMetadatas:(NSArray *)metadatas withDownload:(BOOL)withDownload
 {
-    NSString *oldDirectoryID, *serverUrl;
+    NSString *oldServerUrl;
     NSMutableArray *metadataToAdd = [NSMutableArray new];
+    NSMutableArray *serverUrlToReload = [NSMutableArray new];
+
 
     for (tableMetadata *metadata in metadatas) {
         
         // Clear date for dorce refresh view
-        if (![oldDirectoryID isEqualToString:metadata.directoryID]) {
-            serverUrl = metadata.serverUrl;
-            if (!serverUrl)
-                continue;
-            oldDirectoryID = metadata.directoryID;
-            [[NCManageDatabase sharedInstance] clearDateReadWithServerUrl:serverUrl account:metadata.account];
+        if (![oldServerUrl isEqualToString:metadata.serverUrl]) {
+            oldServerUrl = metadata.serverUrl;
+            [serverUrlToReload addObject:metadata.serverUrl];
+            [[NCManageDatabase sharedInstance] clearDateReadWithServerUrl:metadata.serverUrl account:metadata.account];
         }
         
         metadata.session = k_download_session;
@@ -363,7 +363,9 @@
     (void)[[NCManageDatabase sharedInstance] addMetadatas:metadataToAdd];
     [appDelegate performSelectorOnMainThread:@selector(loadAutoDownloadUpload) withObject:nil waitUntilDone:YES];
     
-    [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:serverUrl fileID:nil action:k_action_NULL];
+    for (NSString *serverUrl in serverUrlToReload) {
+        [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:serverUrl fileID:nil action:k_action_NULL];
+    }
 }
 
 @end