marinofaggiana 4 жил өмнө
parent
commit
a2d949ea5f

+ 0 - 6
iOSClient/AppDelegate.h

@@ -122,9 +122,6 @@
 // Shares
 @property (nonatomic, strong) NSArray *shares;
 
-// Maintenance Mode
-@property BOOL maintenanceMode;
-
 // UserDefaults
 @property (nonatomic, strong) NSUserDefaults *ncUserDefaults;
 
@@ -154,8 +151,5 @@
 - (void)settingThemingColorBrand;
 - (void)changeTheming:(UIViewController *)viewController tableView:(UITableView *)tableView collectionView:(UICollectionView *)collectionView form:(BOOL)form;
 
-// Maintenance Mode
-- (void)maintenanceMode:(BOOL)mode;
-
 @end
 

+ 14 - 37
iOSClient/AppDelegate.m

@@ -155,7 +155,9 @@
         if (self.account.length == 0) {
             [self openLoginView:nil selector:k_intro_login openLoginWeb:false];
         }
+        
     } else {
+        
         if ([CCUtility getIntro] == NO) {
             UIViewController *introViewController = [[UIStoryboard storyboardWithName:@"NCIntro" bundle:[NSBundle mainBundle]] instantiateInitialViewController];
             
@@ -186,9 +188,7 @@
 //
 - (void)applicationWillResignActive:(UIApplication *)application
 {
-    // Test Maintenance
-    if (self.account.length == 0 || self.maintenanceMode)
-        return;
+    if (self.account.length == 0) { return; }
     
     // Dismiss FileViewInFolder
     if (self.activeFileViewInFolder != nil ) {
@@ -205,7 +205,7 @@
 //
 - (void)applicationWillEnterForeground:(UIApplication *)application
 {
-    if (self.account.length == 0 || self.maintenanceMode) { return; }
+    if (self.account.length == 0) { return; }
     
     [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:k_notificationCenter_applicationWillEnterForeground object:nil];
     
@@ -237,7 +237,7 @@
 //
 - (void)applicationDidBecomeActive:(UIApplication *)application
 {
-    if (self.account.length == 0 || self.maintenanceMode) { return; }
+    if (self.account.length == 0) { return; }
         
     // Brand
     #if defined(HC)
@@ -261,7 +261,7 @@
 //
 - (void)applicationDidEnterBackground:(UIApplication *)application
 {
-    if (self.account.length == 0 || self.maintenanceMode) { return; }
+    if (self.account.length == 0) { return; }
 
     [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:k_notificationCenter_applicationDidEnterBackground object:nil];
     
@@ -326,8 +326,7 @@
 - (void)checkErrorNetworking
 {
     // test
-    if (self.account.length == 0 || self.maintenanceMode)
-        return;
+    if (self.account.length == 0) { return; }
     
     // check unauthorized server (401)
     if ([CCUtility getPassword:self.account].length == 0) {
@@ -526,9 +525,7 @@
 
 - (void)pushNotification
 {
-    // test
-    if (self.account.length == 0 || self.maintenanceMode || self.pushKitToken.length == 0)
-        return;
+    if (self.account.length == 0 || self.pushKitToken.length == 0) { return; }
     
     for (tableAccount *result in [[NCManageDatabase sharedInstance] getAllAccount]) {
         
@@ -547,9 +544,7 @@
 
 - (void)subscribingNextcloudServerPushNotification:(NSString *)account urlBase:(NSString *)urlBase user:(NSString *)user
 {
-    // test
-    if (self.account.length == 0 || self.maintenanceMode || self.pushKitToken.length == 0)
-        return;
+    if (self.account.length == 0 || self.pushKitToken.length == 0) { return; }
     
     [[NCPushNotificationEncryption sharedInstance] generatePushNotificationsKeyPair:account];
 
@@ -578,9 +573,7 @@
 
 - (void)unsubscribingNextcloudServerPushNotification:(NSString *)account urlBase:(NSString *)urlBase user:(NSString *)user withSubscribing:(BOOL)subscribing
 {
-    // test
-    if (self.account.length == 0 || self.maintenanceMode)
-        return;
+    if (self.account.length == 0) { return; }
     
     NSString *deviceIdentifier = [CCUtility getPushNotificationDeviceIdentifier:account];
     NSString *signature = [CCUtility getPushNotificationDeviceIdentifierSignature:account];
@@ -782,7 +775,7 @@
 
 - (void)updateApplicationIconBadgeNumber
 {
-    if (self.account.length == 0 || self.maintenanceMode) return;
+    if (self.account.length == 0) { return; }
             
     NSInteger counterDownload = [[NCOperationQueue shared] downloadCount];
     NSInteger counterUpload = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"status == %d OR status == %d OR status == %d", k_metadataStatusWaitUpload, k_metadataStatusInUpload, k_metadataStatusUploading]].count;
@@ -903,10 +896,6 @@
 
 - (void)handleTouchTabbarCenter:(id)sender
 {
-    // Test Maintenance
-    if (self.maintenanceMode)
-        return;
-    
     tableDirectory *tableDirectory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@", self.account, self.activeServerUrl]];
     
     if ([tableDirectory.permissions containsString:@"CK"]) {
@@ -922,8 +911,7 @@
 
 - (void)settingThemingColorBrand
 {
-    if (self.account.length == 0 || self.maintenanceMode)
-        return;
+    if (self.account.length == 0) { return; }
     
     if ([NCBrandOptions sharedInstance].use_themingColor) {
         
@@ -1015,8 +1003,7 @@
 
 - (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
 {
-    // Test Maintenance
-    if (self.account.length == 0 || self.maintenanceMode) {
+    if (self.account.length == 0) {
         completionHandler(UIBackgroundFetchResultNoData);
         return;
     }
@@ -1061,8 +1048,7 @@
 // Method called from iOS system to send a file from other app.
 - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options
 {
-    if (self.account.length == 0 || self.maintenanceMode)
-        return YES;
+    if (self.account.length == 0) { return YES; }
     
     NSString *scheme = url.scheme;
     NSString *fileName;
@@ -1267,13 +1253,4 @@
     }
 }
 
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Maintenance Mode =====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)maintenanceMode:(BOOL)mode
-{
-    self.maintenanceMode = mode;
-}
-
 @end

+ 1 - 3
iOSClient/AutoUpload/NCAutoUpload.m

@@ -332,9 +332,7 @@
 
 - (void)uploadAssetsNewAndFull:(NSString *)selector
 {
-    if (!appDelegate.account || appDelegate.maintenanceMode) {
-         return;
-    }
+    if (!appDelegate.account) { return; }
     
     tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountActive];
     if (tableAccount == nil) {

+ 6 - 3
iOSClient/Main/Colleaction Common/NCCollectionViewCommon.swift

@@ -229,7 +229,8 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
     // MARK: - NotificationCenter
 
     @objc func initializeMain() {
-        if appDelegate.account.count == 0 { return }
+        
+        if appDelegate.account == nil || appDelegate.account.count == 0 { return }
         
         if searchController?.isActive ?? false {
             searchController?.isActive = false
@@ -902,7 +903,8 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
     // MARK: - DataSource + NC Endpoint
     
     @objc func reloadDataSource() {
-        if appDelegate.account.count == 0 { return }
+        
+        if appDelegate.account == nil || appDelegate.account.count == 0 { return }
         
         // Get richWorkspace Text
         let directory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.account, serverUrl))
@@ -923,7 +925,8 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         reloadDataSourceNetwork(forced: true)
     }
     @objc func networkSearch() {
-        if appDelegate.account.count == 0 { return }
+        
+        if appDelegate.account == nil || appDelegate.account.count == 0 { return }
         
         if literalSearch?.count ?? 0 > 1 {
         

+ 1 - 1
iOSClient/Media/NCMedia.swift

@@ -633,7 +633,7 @@ extension NCMedia {
     
     @objc func reloadDataSourceWithCompletion(_ completion: @escaping (_ metadatas: [tableMetadata]) -> Void) {
         
-        if (appDelegate.account == nil || appDelegate.account.count == 0 || appDelegate.maintenanceMode == true) { return }
+        if appDelegate.account == nil || appDelegate.account.count == 0 { return }
         
         if account != appDelegate.account {
             self.metadatas = []

+ 2 - 4
iOSClient/Networking/NCNetworkingAutoUpload.swift

@@ -46,15 +46,13 @@ class NCNetworkingAutoUpload: NSObject {
 
     @objc private func process() {
 
+        if appDelegate.account == nil || appDelegate.account.count == 0 { return }
+        
         var counterUpload: Int = 0
         var sizeUpload = 0
         var maxConcurrentOperationUpload = 5
         let sessionSelectors = [selectorUploadFile, selectorUploadAutoUpload, selectorUploadAutoUploadAll]
         
-        if appDelegate.account == nil || appDelegate.account.count == 0 || appDelegate.maintenanceMode {
-            return
-        }
-        
         let metadatasUpload = NCManageDatabase.sharedInstance.getMetadatas(predicate: NSPredicate(format: "status == %d OR status == %d", k_metadataStatusInUpload, k_metadataStatusUploading))
         counterUpload = metadatasUpload.count
         for metadata in metadatasUpload {

+ 3 - 9
iOSClient/Networking/NCService.swift

@@ -37,9 +37,7 @@ class NCService: NSObject {
     
     @objc public func startRequestServicesServer() {
    
-        if (appDelegate.account == nil || appDelegate.account.count == 0 || appDelegate.maintenanceMode == true) {
-            return
-        }
+        if appDelegate.account == nil || appDelegate.account.count == 0 { return }
         
         self.requestUserProfile()
         self.requestServerStatus()
@@ -49,9 +47,7 @@ class NCService: NSObject {
     
     private func requestUserProfile() {
         
-        if (appDelegate.account == nil || appDelegate.account.count == 0 || appDelegate.maintenanceMode == true) {
-            return
-        }
+        if appDelegate.account == nil || appDelegate.account.count == 0 { return }
         
         NCCommunication.shared.getUserProfile() { (account, userProfile, errorCode, errorDescription) in
                
@@ -142,9 +138,7 @@ class NCService: NSObject {
     
     private func requestServerCapabilities() {
         
-        if (appDelegate.account == nil || appDelegate.account.count == 0 || appDelegate.maintenanceMode == true) {
-            return
-        }
+        if appDelegate.account == nil || appDelegate.account.count == 0 { return }
         
         NCCommunication.shared.getCapabilities() { (account, data, errorCode, errorDescription) in
             

+ 0 - 4
iOSClient/Settings/CCAdvanced.m

@@ -314,8 +314,6 @@
 
 - (void)clearCache
 {
-    [appDelegate maintenanceMode:YES];
-    
     [[NCNetworking shared] cancelAllTransferWithAccount:appDelegate.account completion:^{ }];
     [[NCOperationQueue shared] cancelAllQueue];
 
@@ -335,8 +333,6 @@
 
     [[NCAutoUpload sharedInstance] alignPhotoLibrary];
 
-    [appDelegate maintenanceMode:NO];
-
     // Inizialized home
     [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:k_notificationCenter_initializeMain object:nil userInfo:nil];