Marino Faggiana преди 6 години
родител
ревизия
df685cd89a
променени са 4 файла, в които са добавени 16 реда и са изтрити 10 реда
  1. 1 1
      iOSClient/AutoUpload/NCAutoUpload.m
  2. 2 3
      iOSClient/CCGlobal.h
  3. 1 1
      iOSClient/Create/CCCreateCloud.swift
  4. 12 5
      iOSClient/Main/CCMain.m

+ 1 - 1
iOSClient/AutoUpload/NCAutoUpload.m

@@ -449,7 +449,7 @@
     });
     
     // reload
-    [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:nil fileID:nil action:k_action_ADD];
+    [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:nil fileID:nil action:k_action_NULL];
 }
 
 - (void)addQueueUploadAndPhotoLibrary:(tableMetadata *)metadata asset:(PHAsset *)asset

+ 2 - 3
iOSClient/CCGlobal.h

@@ -302,9 +302,8 @@
 
 // Cell Reload Data Source
 #define k_action_NULL                                   0
-#define k_action_ADD                                    1
-#define k_action_MOD                                    2
-#define k_action_DEL                                    3
+#define k_action_MOD                                    1
+#define k_action_DEL                                    2
 
 // -----------------------------------------------------------------------------------------------------------
 // -----------------------------------------------------------------------------------------------------------

+ 1 - 1
iOSClient/Create/CCCreateCloud.swift

@@ -631,7 +631,7 @@ class CreateFormUploadFile: XLFormViewController, CCMoveDelegate {
                 _ = NCManageDatabase.sharedInstance.addMetadata(metadataForUpload)
                 self.appDelegate.perform(#selector(self.appDelegate.loadAutoDownloadUpload), on: Thread.main, with: nil, waitUntilDone: true)
                 
-                NCMainCommon.sharedInstance.reloadDatasource(ServerUrl: self.serverUrl, fileID: fileID, action: Int32(k_action_ADD))
+                NCMainCommon.sharedInstance.reloadDatasource(ServerUrl: self.serverUrl, fileID: nil, action: Int32(k_action_NULL))
                 
             } else {
                 

+ 12 - 5
iOSClient/Main/CCMain.m

@@ -738,7 +738,7 @@
                             (void)[[NCManageDatabase sharedInstance] addMetadata:metadataForUpload];
                             [appDelegate performSelectorOnMainThread:@selector(loadAutoDownloadUpload) withObject:nil waitUntilDone:YES];
                             
-                            [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl fileID:fileID action:k_action_ADD];
+                            [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl fileID:nil action:k_action_NULL];
                         }];
                         
                         [alertController addAction:cancelAction];
@@ -756,7 +756,7 @@
                         (void)[[NCManageDatabase sharedInstance] addMetadata:metadataForUpload];
                         [appDelegate performSelectorOnMainThread:@selector(loadAutoDownloadUpload) withObject:nil waitUntilDone:YES];
 
-                        [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl fileID:fileID action:k_action_ADD];
+                        [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl fileID:nil action:k_action_NULL];
                     }
                     
                 } else {
@@ -1017,7 +1017,7 @@
         
         [_hud hideHud];
         
-        [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl fileID:nil action:k_action_ADD];
+        [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl fileID:nil action:k_action_NULL];
     });
     
     [self tableViewSelect:NO];
@@ -1257,7 +1257,7 @@
         }
     }
     
-    [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl fileID:nil action:k_action_ADD];
+    [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl fileID:nil action:k_action_NULL];
 }
 
 #pragma --------------------------------------------------------------------------------------------
@@ -3142,7 +3142,7 @@
                 // Add Medtadata for upload
                 (void)[[NCManageDatabase sharedInstance] addMetadata:metadataForUpload];
                 
-                [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl fileID:fileID action:k_action_ADD];
+                [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl fileID:nil action:k_action_NULL];
             }
         }
     }
@@ -3846,6 +3846,13 @@
             }
             
             dispatch_async(dispatch_get_main_queue(), ^{
+                if (fileID) {
+                    NSIndexPath *indexPath = [sectionDataSource.fileIDIndexPath objectForKey:fileID];
+                    if (indexPath && [self indexPathIsValid:indexPath] && action == k_action_MOD) {
+                        [self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationTop];
+                        return;
+                    }
+                }
                 [self tableViewReloadData];
             });
         }