Browse Source

test with : isReloadDataSourceInProgress

Marino Faggiana 6 years ago
parent
commit
c682e01e2a
1 changed files with 11 additions and 0 deletions
  1. 11 0
      iOSClient/Main/CCMain.m

+ 11 - 0
iOSClient/Main/CCMain.m

@@ -43,6 +43,7 @@
         
         
     BOOL _isRoot;
     BOOL _isRoot;
     BOOL _isViewDidLoad;
     BOOL _isViewDidLoad;
+    BOOL isReloadDataSourceInProgress;
     
     
     NSMutableDictionary *_selectedFileIDsMetadatas;
     NSMutableDictionary *_selectedFileIDsMetadatas;
     NSUInteger _numSelectedFileIDsMetadatas;
     NSUInteger _numSelectedFileIDsMetadatas;
@@ -3741,6 +3742,9 @@
     if (appDelegate.activeAccount.length == 0 || serverUrl.length == 0 || serverUrl == nil)
     if (appDelegate.activeAccount.length == 0 || serverUrl.length == 0 || serverUrl == nil)
         return;
         return;
     
     
+    // ****
+    isReloadDataSourceInProgress = YES;
+    
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
         @synchronized(self) {
         @synchronized(self) {
             
             
@@ -3759,6 +3763,7 @@
                 sectionDataSource = [CCSectionMetadata creataDataSourseSectionMetadata:metadatas listProgressMetadata:nil groupByField:_directoryGroupBy filterFileID:appDelegate.filterFileID filterTypeFileImage:NO filterTypeFileVideo:NO activeAccount:appDelegate.activeAccount];
                 sectionDataSource = [CCSectionMetadata creataDataSourseSectionMetadata:metadatas listProgressMetadata:nil groupByField:_directoryGroupBy filterFileID:appDelegate.filterFileID filterTypeFileImage:NO filterTypeFileVideo:NO activeAccount:appDelegate.activeAccount];
 
 
                 dispatch_async(dispatch_get_main_queue(), ^{
                 dispatch_async(dispatch_get_main_queue(), ^{
+                    isReloadDataSourceInProgress = NO;
                     [self tableViewReloadData];
                     [self tableViewReloadData];
                 });
                 });
                     
                     
@@ -3791,6 +3796,7 @@
                     });
                     });
                 } else {
                 } else {
                     dispatch_async(dispatch_get_main_queue(), ^{
                     dispatch_async(dispatch_get_main_queue(), ^{
+                        isReloadDataSourceInProgress = NO;
                         [self tableViewReloadData];
                         [self tableViewReloadData];
                     });
                     });
                 }
                 }
@@ -3853,6 +3859,7 @@
                         return;
                         return;
                     }
                     }
                 }
                 }
+                isReloadDataSourceInProgress = NO;
                 [self tableViewReloadData];
                 [self tableViewReloadData];
             });
             });
         }
         }
@@ -3916,6 +3923,10 @@
 
 
 - (void)tableViewReloadData
 - (void)tableViewReloadData
 {
 {
+    //
+    if (isReloadDataSourceInProgress)
+        return;
+    
     // store selected cells before relod
     // store selected cells before relod
     NSArray *indexPaths = [self.tableView indexPathsForSelectedRows];
     NSArray *indexPaths = [self.tableView indexPathsForSelectedRows];