Browse Source

fix blink

marinofaggiana 5 years ago
parent
commit
133211f2e9
2 changed files with 25 additions and 27 deletions
  1. 1 1
      iOSClient/Brand/NCBrand.swift
  2. 24 26
      iOSClient/Main/CCMain.m

+ 1 - 1
iOSClient/Brand/NCBrand.swift

@@ -94,7 +94,7 @@ class NCBrandColor: NSObject {
     @objc public var userAgent:                         String = "Nextcloud-iOS"                                    // Don't touch me !!
     
     // Module
-    @objc public let useMLVision:                       Bool = false
+    @objc public let useMLVision:                       Bool = true
     
     // Options
     @objc public let use_login_web_personalized:        Bool = false                                                // Don't touch me !!

+ 24 - 26
iOSClient/Main/CCMain.m

@@ -3613,6 +3613,30 @@
          NSLog(@"[LOG] [OPTIMIZATION] Rebuild Data Source File : %@ - %@", _serverUrl, _dateReadDataSource);
     }
     
+    // BLINK
+    if (self.blinkFileNamePath != nil) {
+        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
+            for (NSString *key in sectionDataSource.allRecordsDataSource) {
+                tableMetadata *metadata = [sectionDataSource.allRecordsDataSource objectForKey:key];
+                NSString *metadataFileNamePath = [NSString stringWithFormat:@"%@/%@", metadata.serverUrl, metadata.fileName];
+                if ([metadataFileNamePath isEqualToString:self.blinkFileNamePath]) {
+                    for (NSString *key in sectionDataSource.fileIDIndexPath) {
+                        if ([key isEqualToString:metadata.fileID]) {
+                            NSIndexPath *indexPath = [sectionDataSource.fileIDIndexPath objectForKey:key];
+                            [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:NO];
+                            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
+                                CCCellMain *cell = [self.tableView cellForRowAtIndexPath:indexPath];
+                                if (cell) {
+                                    self.blinkFileNamePath = nil;
+                                    [[NCUtility sharedInstance] blinkWithCell:cell];
+                                }
+                            });
+                        }
+                    }
+                }
+            }
+        });
+    }
 }
 
 - (CCSectionDataSourceMetadata *)queryDatasourceWithReloadData:(BOOL)withReloadData serverUrl:(NSString *)serverUrl
@@ -3712,33 +3736,7 @@
     if (self.tableView.editing)
         [self setTitle];
     
-    //
     [self.tableView reloadEmptyDataSet];
-    
-    // blinkFileNamePath
-    if (self.blinkFileNamePath != nil) {
-        for (NSString *key in sectionDataSource.allRecordsDataSource) {
-            tableMetadata *metadata = [sectionDataSource.allRecordsDataSource objectForKey:key];
-            NSString *metadataFileNamePath = [NSString stringWithFormat:@"%@/%@", metadata.serverUrl, metadata.fileName];
-            if ([metadataFileNamePath isEqualToString:self.blinkFileNamePath]) {
-                for (NSString *key in sectionDataSource.fileIDIndexPath) {
-                    if ([key isEqualToString:metadata.fileID]) {
-                        NSIndexPath *indexPath = [sectionDataSource.fileIDIndexPath objectForKey:key];
-                        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
-                            [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:NO];
-                            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
-                                CCCellMain *cell = [self.tableView cellForRowAtIndexPath:indexPath];
-                                if (cell && [self.tableView.visibleCells containsObject:cell]) {
-                                    self.blinkFileNamePath = nil;
-                                    [[NCUtility sharedInstance] blinkWithCell:cell];
-                                }
-                            });
-                        });
-                    }
-                }
-            }
-        }
-    }
 }
 
 - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath