marinofaggiana 5 anni fa
parent
commit
0d07d37240

+ 3 - 1
iOSClient/CCGlobal.h

@@ -324,7 +324,9 @@
 
 #define k_notificationCenter_uploadFile                 @"uploadFile"
 #define k_notificationCenter_downloadFile               @"downloadFile"
-#define k_notificationCenter_deleteMetadata             @"deleteMetadata"
+#define k_notificationCenter_deleteFile                 @"deleteFile"
+#define k_notificationCenter_renameFile                 @"renameFile"
+#define k_notificationCenter_moveFile                   @"moveFile"
 
 
 // -----------------------------------------------------------------------------------------------------------

+ 6 - 0
iOSClient/Main/CCMain.m

@@ -1557,6 +1557,9 @@
                                 [[NSFileManager defaultManager] moveItemAtPath:atPathIcon toPath:toPathIcon error:nil];
                             }
                             
+                            NSDictionary* userInfo = @{@"metadata": metadata};
+                            [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:k_notificationCenter_renameFile object:nil userInfo:userInfo];
+                            
                             [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:metadata.serverUrl ocId:metadata.ocId action:k_action_MOD];
                             
                         } else if (errorCode != 0) {
@@ -1647,6 +1650,9 @@
                                 [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl ocId:nil action:k_action_NULL];
                         }
                         
+                        NSDictionary* userInfo = @{@"metadata": metadata};
+                        [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:k_notificationCenter_moveFile object:nil userInfo:userInfo];
+                        
                     } else if (errorCode != 0) {
                         
                         [[NCContentPresenter shared] messageNotification:@"_move_" description:message delay:k_dismissAfterSecond type:messageTypeError errorCode:errorCode];

+ 19 - 3
iOSClient/Main/NCDetailViewController.swift

@@ -54,9 +54,11 @@ class NCDetailViewController: UIViewController {
         NotificationCenter.default.addObserver(self, selector: #selector(self.changeTheming), name: NSNotification.Name(rawValue: k_notificationCenter_changeTheming), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(self.changeDisplayMode), name: NSNotification.Name(rawValue: k_notificationCenter_splitViewChangeDisplayMode), object: nil)
         
-        NotificationCenter.default.addObserver(self, selector: #selector(self.deleteMetadata(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_deleteMetadata), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(self.deleteFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_deleteFile), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(self.uploadFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_uploadFile), object: nil)
-
+        NotificationCenter.default.addObserver(self, selector: #selector(self.renameFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_renameFile), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(self.moveFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_moveFile), object: nil)
+        
         changeTheming()
         
         if metadata != nil  {
@@ -132,7 +134,7 @@ class NCDetailViewController: UIViewController {
         }
     }
     
-    @objc func deleteMetadata(_ notification: NSNotification) {
+    @objc func deleteFile(_ notification: NSNotification) {
         if let userInfo = notification.userInfo as NSDictionary? {
             if let metadata = userInfo["metadata"] as? tableMetadata {
                 
@@ -185,6 +187,20 @@ class NCDetailViewController: UIViewController {
         }
     }
     
+    @objc func renameFile(_ notification: NSNotification) {
+        if let userInfo = notification.userInfo as NSDictionary? {
+            if let metadata = userInfo["metadata"] as? tableMetadata {
+            }
+        }
+    }
+    
+    @objc func moveFile(_ notification: NSNotification) {
+        if let userInfo = notification.userInfo as NSDictionary? {
+            if let metadata = userInfo["metadata"] as? tableMetadata {
+            }
+        }
+    }
+    
     //MARK: -
     
     @objc func viewFile(metadata: tableMetadata, selector: String?) {

+ 1 - 1
iOSClient/Main/NCMainCommon.swift

@@ -1010,7 +1010,7 @@ class NCMainCommon: NSObject, PhotoEditorDelegate, NCAudioRecorderViewController
                         
                         // Message
                         let userInfo:[String: tableMetadata] = ["metadata": metadata]
-                        NotificationCenter.default.post(name: Notification.Name.init(rawValue: k_notificationCenter_deleteMetadata), object: nil, userInfo: userInfo)
+                        NotificationCenter.default.post(name: Notification.Name.init(rawValue: k_notificationCenter_deleteFile), object: nil, userInfo: userInfo)
                         
                     } else {