marinofaggiana 3 年之前
父節點
當前提交
c078bbb74a

+ 4 - 4
iOSClient/Activity/NCActivity.swift

@@ -71,20 +71,20 @@ class NCActivity: UIViewController, NCEmptyDataSetDelegate {
     override func viewDidAppear(_ animated: Bool) {
         super.viewDidAppear(animated)
         
-        NotificationCenter.default.addObserver(self, selector: #selector(initializeMain), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitializeMain), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(initialize), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitialize), object: nil)
         
-        initializeMain()
+        initialize()
     }
     
     override func viewDidDisappear(_ animated: Bool) {
         super.viewDidDisappear(animated)
         
-        NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitializeMain), object: nil)
+        NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitialize), object: nil)
     }
     
     // MARK: - NotificationCenter
 
-    @objc func initializeMain() {
+    @objc func initialize() {
         loadDataSource()
         loadActivity(idActivity: 0)
     }

+ 8 - 8
iOSClient/AppDelegate.swift

@@ -116,9 +116,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
             }
         }
         
-        // init home
-        NotificationCenter.default.addObserver(self, selector: #selector(initializeMain), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitializeMain), object: nil)
-        NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitializeMain)
+        // initialize
+        NotificationCenter.default.addObserver(self, selector: #selector(initialize), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitialize), object: nil)
+        NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize)
         
         // Process upload
         networkingProcessUpload = NCNetworkingProcessUpload.init()
@@ -204,7 +204,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
         if activeAccount.account != account {
             settingAccount(activeAccount.account, urlBase: activeAccount.urlBase, user: activeAccount.user, userId: activeAccount.userId, password: CCUtility.getPassword(activeAccount.account))
             
-            NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitializeMain)
+            NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize)
         }
         
         NCCommunicationCommon.shared.writeLog("Application will enter in foreground")
@@ -274,7 +274,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
     
     // MARK: -
 
-    @objc func initializeMain() {
+    @objc func initialize() {
         
         if account == "" { return }
 
@@ -598,7 +598,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
                 if let newAccount = accounts?.first {
                     if let account = NCManageDatabase.shared.setAccountActive(newAccount) {
                         settingAccount(account.account, urlBase: account.urlBase, user: account.user, userId: account.userId, password: CCUtility.getPassword(account.account))
-                        NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitializeMain)
+                        NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize)
                     }
                 }
             } else {
@@ -617,7 +617,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
             
             settingAccount(activeAccount.account, urlBase: activeAccount.urlBase, user: activeAccount.user, userId: activeAccount.userId, password: CCUtility.getPassword(activeAccount.account))
             
-            NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitializeMain)
+            NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize)
         }
     }
     
@@ -778,7 +778,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
                                 NCManageDatabase.shared.setAccountActive(account.account)
                                 settingAccount(account.account, urlBase: account.urlBase, user: account.user, userId: account.userId, password: CCUtility.getPassword(account.account))
                                 matchedAccount = account
-                                NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitializeMain)
+                                NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize)
                                 break
                             }
                         }

+ 2 - 2
iOSClient/Files/NCFiles.swift

@@ -53,14 +53,14 @@ class NCFiles: NCCollectionViewCommon  {
     
     // MARK: - NotificationCenter
     
-    override func initializeMain() {
+    override func initialize() {
         
         if isRoot {
             serverUrl = NCUtilityFileSystem.shared.getHomeServer(urlBase: appDelegate.urlBase, account: appDelegate.account)
             reloadDataSourceNetwork(forced: true)
         }
         
-        super.initializeMain()
+        super.initialize()
     }
     
     // MARK: - DataSource + NC Endpoint

+ 1 - 1
iOSClient/Login/NCAppConfigView.swift

@@ -94,7 +94,7 @@ class NCAppConfigView: UIViewController {
                     }
                     
                     self.appDelegate.settingAccount(account, urlBase: serverUrl, user: username, userId: tableAccount.userId, password: token!)
-                    NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitializeMain)
+                    NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize)
                     
                     self.dismiss(animated: true) {}
                 } else {

+ 3 - 3
iOSClient/Login/NCLogin.swift

@@ -400,7 +400,7 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate {
             
             if CCUtility.getIntro() {
                 
-                NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitializeMain)
+                NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize)
                 self.dismiss(animated: true)
                 
             } else {
@@ -411,13 +411,13 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate {
                     
                     let viewController = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController()
                     viewController?.modalPresentationStyle = .fullScreen
-                    NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitializeMain)
+                    NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize)
                     self.appDelegate.window?.rootViewController = viewController
                     self.appDelegate.window?.makeKey()
                     
                 } else {
                     
-                    NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitializeMain)
+                    NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize)
                     self.dismiss(animated: true)
                 }
             }

+ 3 - 3
iOSClient/Login/NCLoginWeb.swift

@@ -274,7 +274,7 @@ extension NCLoginWeb: WKNavigationDelegate {
             
         if (CCUtility.getIntro()) {
             
-            NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitializeMain)
+            NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize)
             self.dismiss(animated: true)
                 
         } else {
@@ -283,7 +283,7 @@ extension NCLoginWeb: WKNavigationDelegate {
             if (self.presentingViewController == nil) {
                 if let viewController = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController() {
                     viewController.modalPresentationStyle = .fullScreen
-                    NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitializeMain)
+                    NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize)
                     viewController.view.alpha = 0
                     appDelegate.window?.rootViewController = viewController
                     appDelegate.window?.makeKeyAndVisible()
@@ -292,7 +292,7 @@ extension NCLoginWeb: WKNavigationDelegate {
                     }
                 }
             } else {
-                NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitializeMain)
+                NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize)
                 self.dismiss(animated: true)
             }
         }

+ 3 - 3
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -127,7 +127,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         
         // Notification
         
-        NotificationCenter.default.addObserver(self, selector: #selector(initializeMain), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitializeMain), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(initialize), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitialize), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterChangeTheming), object: nil)
 
         changeTheming()
@@ -241,7 +241,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
     
     // MARK: - NotificationCenter
 
-    @objc func initializeMain() {
+    @objc func initialize() {
         
         if appDelegate.account == "" { return }
         
@@ -744,7 +744,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
             
             appDelegate.settingAccount(activeAccount.account, urlBase: activeAccount.urlBase, user: activeAccount.user, userId: activeAccount.userId, password: CCUtility.getPassword(activeAccount.account))
             
-            NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitializeMain)
+            NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize)
         }
     }
     

+ 2 - 2
iOSClient/Media/NCMedia.swift

@@ -95,7 +95,7 @@ class NCMedia: UIViewController, NCEmptyDataSetDelegate, NCSelectDelegate {
         emptyDataSet = NCEmptyDataSet.init(view: collectionView, offset: 0, delegate: self)
       
         // Notification
-        NotificationCenter.default.addObserver(self, selector: #selector(initializeMain), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitializeMain), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(initialize), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitialize), object: nil)
             
         mediaCommandView = Bundle.main.loadNibNamed("NCMediaCommandView", owner: self, options: nil)?.first as? NCMediaCommandView
         self.view.addSubview(mediaCommandView!)
@@ -160,7 +160,7 @@ class NCMedia: UIViewController, NCEmptyDataSetDelegate, NCSelectDelegate {
     
     //MARK: - Notification
     
-    @objc func initializeMain() {
+    @objc func initialize() {
         
         self.reloadDataSourceWithCompletion { (_) in
             self.timerSearchNewMedia?.invalidate()

+ 1 - 1
iOSClient/Menu/NCLoginWeb+Menu.swift

@@ -56,7 +56,7 @@ extension NCLoginWeb {
                             NCManageDatabase.shared.setAccountActive(account.account)
                             self.dismiss(animated: true) {
                                 self.appDelegate.settingAccount(account.account, urlBase: account.urlBase, user: account.user, userId: account.userId, password: CCUtility.getPassword(account.account))
-                                self.appDelegate.initializeMain()
+                                self.appDelegate.initialize()
                             }
                         }
                     }

+ 2 - 2
iOSClient/More/NCMore.swift

@@ -63,7 +63,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
         labelQuotaExternalSite.addGestureRecognizer(tapQuota)
 
         // Notification
-        NotificationCenter.default.addObserver(self, selector: #selector(initializeMain), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitializeMain), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(initialize), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitialize), object: nil)
     }
 
     override func viewWillAppear(_ animated: Bool) {
@@ -75,7 +75,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
     
     // MARK: - NotificationCenter
 
-    @objc func initializeMain() {
+    @objc func initialize() {
         loadItems()
     }
     

+ 1 - 1
iOSClient/NCGlobal.swift

@@ -289,7 +289,7 @@ class NCGlobal: NSObject {
     let notificationCenterApplicationWillEnterForeground        = "applicationWillEnterForeground"
     let notificationCenterApplicationDidBecomeActive            = "applicationDidBecomeActive"
 
-    @objc let notificationCenterInitializeMain                  = "initializeMain"
+    @objc let notificationCenterInitialize                      = "initialize"
     @objc let notificationCenterChangeTheming                   = "changeTheming"
     let notificationCenterRichdocumentGrabFocus                 = "richdocumentGrabFocus"
     let notificationCenterReloadDataNCShare                     = "reloadDataNCShare"

+ 3 - 3
iOSClient/Notification/NCNotification.swift

@@ -62,7 +62,7 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty
     override func viewDidAppear(_ animated: Bool) {
         super.viewDidAppear(animated)
         
-        NotificationCenter.default.addObserver(self, selector: #selector(initializeMain), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitializeMain), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(initialize), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitialize), object: nil)
         
         getNetwokingNotification()
     }
@@ -70,7 +70,7 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty
     override func viewDidDisappear(_ animated: Bool) {
         super.viewDidDisappear(animated)
         
-        NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitializeMain), object: nil)
+        NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitialize), object: nil)
     }
     
     @objc func viewClose() {
@@ -79,7 +79,7 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty
     
     // MARK: - NotificationCenter
 
-    @objc func initializeMain() {
+    @objc func initialize() {
         getNetwokingNotification()
     }
     

+ 1 - 1
iOSClient/Settings/CCAdvanced.m

@@ -376,7 +376,7 @@
     [[NCAutoUpload shared] alignPhotoLibraryWithViewController:self];
 
     // Inizialized home
-    [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:NCGlobal.shared.notificationCenterInitializeMain object:nil userInfo:nil];
+    [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:NCGlobal.shared.notificationCenterInitialize object:nil userInfo:nil];
     
     // Clear Media
     [appDelegate.activeMedia reloadDataSource];

+ 2 - 2
iOSClient/Settings/CCManageAccount.m

@@ -354,7 +354,7 @@
     
     self.tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground;
     
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(initializeMain) name:NCGlobal.shared.notificationCenterInitializeMain object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(initialize) name:NCGlobal.shared.notificationCenterInitialize object:nil];
     
     [self initializeForm];
 }
@@ -368,7 +368,7 @@
 
 #pragma mark - NotificationCenter
 
-- (void)initializeMain
+- (void)initialize
 {
     [self initializeForm];
 }

+ 2 - 2
iOSClient/Settings/CCManageAutoUpload.m

@@ -208,7 +208,7 @@
     
     self.tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground;
     
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(initializeMain) name:NCGlobal.shared.notificationCenterInitializeMain object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(initialize) name:NCGlobal.shared.notificationCenterInitialize object:nil];
     
     [self initializeForm];
     [self reloadForm];
@@ -235,7 +235,7 @@
     }];
 }
 
-- (void)initializeMain
+- (void)initialize
 {
     [[self navigationController] popViewControllerAnimated:YES];
 }

+ 2 - 2
iOSClient/Settings/NCManageEndToEndEncryption.m

@@ -184,7 +184,7 @@
     self.endToEndInitialize.delegate = self;
     
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidEnterBackground) name:NCGlobal.shared.notificationCenterApplicationDidEnterBackground object:nil];
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(initializeMain) name:NCGlobal.shared.notificationCenterInitializeMain object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(initialize) name:NCGlobal.shared.notificationCenterInitialize object:nil];
 
     [self initializeForm];
 }
@@ -205,7 +205,7 @@
     }
 }
 
-- (void)initializeMain
+- (void)initialize
 {
     [[self navigationController] popViewControllerAnimated:YES];
 }

+ 2 - 2
iOSClient/Settings/NCSettings.m

@@ -182,7 +182,7 @@
     appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
     
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidEnterBackground) name:NCGlobal.shared.notificationCenterApplicationDidEnterBackground object:nil];
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(initializeMain) name:NCGlobal.shared.notificationCenterInitializeMain object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(initialize) name:NCGlobal.shared.notificationCenterInitialize object:nil];
 
     [self initializeForm];
     [self reloadForm];
@@ -197,7 +197,7 @@
 
 #pragma mark - NotificationCenter
 
-- (void)initializeMain
+- (void)initialize
 {
     [self initializeForm];
     [self reloadForm];