marinofaggiana 4 years ago
parent
commit
a02c1b6357

+ 2 - 2
Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

@@ -15,8 +15,8 @@
         "repositoryURL": "https://github.com/realm/realm-core",
         "state": {
           "branch": null,
-          "revision": "e051fc73c56830bf3ab0b8a82f7a613968cec6c6",
-          "version": "6.0.26"
+          "revision": "4e5326b20e6d4aae6af581402372a42971fa732b",
+          "version": "6.1.1"
         }
       }
     ]

+ 46 - 0
iOSClient/AppDelegate.m

@@ -80,6 +80,9 @@
         [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"Start session with level %lu %@", (unsigned long)logLevel, versionNextcloudiOS]];
     }
     
+    //
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(initializeMain:) name:k_notificationCenter_initializeMain object:nil];
+    
     // Set account, if no exists clear all
     tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountActive];
     if (tableAccount == nil) {
@@ -273,6 +276,49 @@
     [[NCCommunicationCommon shared] writeLog:@"bye bye"];
 }
 
+// NotificationCenter
+- (void)initializeMain:(NSNotification *)notification
+{
+    if (self.account.length == 0) return;
+    
+    // Clear error certificate
+    [CCUtility setCertificateError:self.account error:NO];
+    
+    // Setting Theming
+    [self settingThemingColorBrand];
+    
+    // If AVPlayer in play -> Stop
+    if (self.player != nil && self.player.rate != 0) {
+        [self.player pause];
+    }
+    
+    // close detail
+    [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:k_notificationCenter_menuDetailClose object:nil];
+    
+    // Not Photos Video in library ? then align and Init Auto Upload
+    NSArray *recordsPhotoLibrary = [[NCManageDatabase sharedInstance] getPhotoLibraryWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", self.account]];
+    if ([recordsPhotoLibrary count] == 0) {
+        [[NCAutoUpload sharedInstance] alignPhotoLibrary];
+    }
+    
+    // Start Auto Upload
+    [[NCAutoUpload sharedInstance] initStateAutoUpload];
+    
+    // Start services
+    [[NCCommunicationCommon shared] writeLog:@"Request Service Server Nextcloud"];
+    [[NCService shared] startRequestServicesServer];
+    
+    // Registeration push notification
+    [self pushNotification];
+    
+    // Registeration domain File Provider
+    if (k_fileProvider_domain) {
+        [FileProviderDomain.sharedInstance registerDomain];
+    } else {
+        [FileProviderDomain.sharedInstance removeAllDomain];
+    }
+}
+
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ===== Login / checkErrorNetworking =====
 #pragma --------------------------------------------------------------------------------------------

+ 0 - 33
iOSClient/Main/CCMain.m

@@ -391,29 +391,6 @@
         // Remove search mode
         [self cancelSearchBar];
         
-        // Clear error certificate
-        [CCUtility setCertificateError:appDelegate.account error:NO];
-        
-        // Setting Theming
-        [appDelegate settingThemingColorBrand];
-        
-        // Detail
-        // If AVPlayer in play -> Stop
-        if (appDelegate.player != nil && appDelegate.player.rate != 0) {
-            [appDelegate.player pause];
-        }
-        [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:k_notificationCenter_menuDetailClose object:nil];
-                        
-        // Not Photos Video in library ? then align and Init Auto Upload
-        NSArray *recordsPhotoLibrary = [[NCManageDatabase sharedInstance] getPhotoLibraryWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", appDelegate.account]];
-        if ([recordsPhotoLibrary count] == 0) {
-            [[NCAutoUpload sharedInstance] alignPhotoLibrary];
-        }
-        [[NCAutoUpload sharedInstance] initStateAutoUpload];
-        
-        [[NCCommunicationCommon shared] writeLog:@"Request Service Server Nextcloud"];
-        [[NCService shared] startRequestServicesServer];
-                
         // Read this folder
         [self readFileReloadFolder];
                 
@@ -422,16 +399,6 @@
         // reload datasource
         [self reloadDatasource:_serverUrl ocId:nil];
     }
-    
-    // Registeration push notification
-    [appDelegate pushNotification];
-    
-    // Registeration domain File Provider
-    if (k_fileProvider_domain) {
-        [FileProviderDomain.sharedInstance registerDomain];
-    } else {
-        [FileProviderDomain.sharedInstance removeAllDomain];
-    }
 }
 
 #pragma --------------------------------------------------------------------------------------------

+ 7 - 0
iOSClient/Main/Collection/NCCollectionViewCommon.swift

@@ -207,9 +207,16 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
     // MARK: - NotificationCenter
 
     @objc func initializeMain() {
+        
+        if searchController?.isActive ?? false {
+            searchController?.isActive = false
+        }
+        
         self.navigationController?.popToRootViewController(animated: false)
         appDelegate.listFavoriteVC.removeAllObjects()
         appDelegate.listOfflineVC.removeAllObjects()
+        
+        reloadDataSource()
     }
     
     @objc func changeTheming() {