marinofaggiana 5 years ago
parent
commit
1e0690da0c

+ 1 - 0
iOSClient/CCGlobal.h

@@ -331,6 +331,7 @@
 #define k_notificationCenter_changeUserProfile          @"changeUserProfile"
 #define k_notificationCenter_richdocumentGrabFocus      @"richdocumentGrabFocus"
 #define k_notificationCenter_reloadDataNCShare          @"reloadDataNCShare"
+#define k_notificationCenter_reloadDataNotification     @"reloadDataNotification"
 
 #define k_notificationCenter_uploadFile                 @"uploadFile"
 #define k_notificationCenter_downloadFile               @"downloadFile"

+ 4 - 4
iOSClient/Media/NCMedia.swift

@@ -97,10 +97,10 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
         }
         
         // Notification
-        NotificationCenter.default.addObserver(self, selector: #selector(self.deleteFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_deleteFile), object: nil)
-        NotificationCenter.default.addObserver(self, selector: #selector(self.changeTheming), name: NSNotification.Name(rawValue: k_notificationCenter_changeTheming), object: nil)
-        NotificationCenter.default.addObserver(self, selector: #selector(self.moveFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_moveFile), 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(deleteFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_deleteFile), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: k_notificationCenter_changeTheming), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(moveFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_moveFile), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(renameFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_renameFile), object: nil)
         
         // changeTheming
         changeTheming()

+ 2 - 2
iOSClient/Networking/NCService.swift

@@ -231,7 +231,7 @@ class NCService: NSObject {
                                     
                                     if (new != old) {
                                         self.appDelegate.listOfNotifications = NSMutableArray.init(array: sortedListOfNotifications)
-                                        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "notificationReloadData"), object: nil)
+                                        NotificationCenter.default.post(name: NSNotification.Name(rawValue: k_notificationCenter_reloadDataNotification), object: nil)
                                     }
                                     
                                     // Update Main NavigationBar
@@ -254,7 +254,7 @@ class NCService: NSObject {
                     
                     // Remove all Notification
                     self.appDelegate.listOfNotifications.removeAllObjects()
-                    NotificationCenter.default.post(name: NSNotification.Name(rawValue: "notificationReloadData"), object: nil)
+                    NotificationCenter.default.post(name: NSNotification.Name(rawValue: k_notificationCenter_reloadDataNotification), object: nil)
                     // Update Main NavigationBar
                     if (self.appDelegate.activeMain != nil && self.appDelegate.activeMain.isSelectedMode == false) {
                         self.appDelegate.activeMain.setUINavigationBarDefault()

+ 3 - 3
iOSClient/Notification/CCNotification.swift

@@ -41,10 +41,10 @@ class CCNotification: UITableViewController, CCNotificationCelllDelegate {
         self.tableView.allowsSelection = false
         
         // Register to receive notification reload data
-        NotificationCenter.default.addObserver(self, selector: #selector(self.reloadDatasource), name: Notification.Name(rawValue: "notificationReloadData"), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(reloadDatasource), name: Notification.Name(rawValue: k_notificationCenter_reloadDataNotification), object: nil)
 
         // Theming view
-        NotificationCenter.default.addObserver(self, selector: #selector(self.changeTheming), name: NSNotification.Name(rawValue: k_notificationCenter_changeTheming), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: k_notificationCenter_changeTheming), object: nil)
         changeTheming()
         
         reloadDatasource()
@@ -57,7 +57,7 @@ class CCNotification: UITableViewController, CCNotificationCelllDelegate {
     @objc func viewClose() {
         
         // Stop listening notification reload data
-        NotificationCenter.default.removeObserver(self, name: Notification.Name("notificationReloadData"), object: nil);
+        NotificationCenter.default.removeObserver(self, name: Notification.Name(k_notificationCenter_reloadDataNotification), object: nil);
         
         self.dismiss(animated: true, completion: nil)
     }