Marino Faggiana 6 роки тому
батько
коміт
3be877bfaf

+ 1 - 1
iOSClient/Activity/CCActivity.m

@@ -151,7 +151,7 @@
         if (errorCode == 0 && [account isEqualToString:appDelegate.activeAccount]) {
             [[NCManageDatabase sharedInstance] addActivityServer:listOfActivity account:account];
         } else if (errorCode == kOCErrorServerUnauthorized) {
-            [appDelegate openLoginView:self loginType:k_login_Modify_Password selector:k_intro_login];
+            [appDelegate openLoginView:self delegate:appDelegate.activeMain loginType:k_login_Modify_Password selector:k_intro_login];
         } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
             [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:message viewController:self delegate:self];
         } else if (errorCode != 0) {

+ 1 - 1
iOSClient/AppDelegate.h

@@ -140,7 +140,7 @@
 @property (nonatomic, strong) NSUserDefaults *ncUserDefaults;
 
 // Login View
-- (void)openLoginView:(id)delegate loginType:(NSInteger)loginType selector:(NSInteger)selector;
+- (void)openLoginView:(UIViewController *)viewController delegate:(id)delegate loginType:(NSInteger)loginType selector:(NSInteger)selector;
 
 // Setting Active Account
 - (void)settingActiveAccount:(NSString *)activeAccount activeUrl:(NSString *)activeUrl activeUser:(NSString *)activeUser activeUserID:(NSString *)activeUserID activePassword:(NSString *)activePassword;

+ 4 - 4
iOSClient/AppDelegate.m

@@ -293,7 +293,7 @@
 #pragma mark ===== Login =====
 #pragma --------------------------------------------------------------------------------------------
 
-- (void)openLoginView:(id)delegate loginType:(NSInteger)loginType selector:(NSInteger)selector
+- (void)openLoginView:(UIViewController *)viewController delegate:(id)delegate loginType:(NSInteger)loginType selector:(NSInteger)selector
 {
     BOOL loginWebFlow = NO;
     
@@ -310,7 +310,7 @@
                 _activeLoginWeb.urlBase = [[NCBrandOptions sharedInstance] loginBaseUrl];
                 
                 dispatch_async(dispatch_get_main_queue(), ^ {
-                    [_activeLoginWeb open:delegate];
+                    [_activeLoginWeb open:viewController];
                 });
             }
             return;
@@ -341,7 +341,7 @@
                 }
 
                 dispatch_async(dispatch_get_main_queue(), ^ {
-                    [_activeLoginWeb open:delegate];
+                    [_activeLoginWeb open:viewController];
                 });
             }
             
@@ -354,7 +354,7 @@
                 _activeLogin.loginType = loginType;
                 
                 dispatch_async(dispatch_get_main_queue(), ^ {
-                    [delegate presentViewController:_activeLogin animated:YES completion:nil];
+                    [viewController presentViewController:_activeLogin animated:YES completion:nil];
                 });
             }
         }

+ 2 - 2
iOSClient/Favorites/CCFavorites.m

@@ -174,7 +174,7 @@
             [[NCManageDatabase sharedInstance] setMetadataFavoriteWithFileID:metadata.fileID favorite:favorite];
             [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:metadata.serverUrl fileID:metadata.fileID action:k_action_MOD];
         } else if (errorCode == kOCErrorServerUnauthorized) {
-            [appDelegate openLoginView:self loginType:k_login_Modify_Password selector:k_intro_login];
+            [appDelegate openLoginView:self delegate:appDelegate.activeMain loginType:k_login_Modify_Password selector:k_intro_login];
         } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
             [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:message viewController:self delegate:self];
         } else if (errorCode != 0) {
@@ -241,7 +241,7 @@
             [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"clearDateReadDataSource" object:nil];
             
         } else if (errorCode == kOCErrorServerUnauthorized) {
-            [appDelegate openLoginView:self loginType:k_login_Modify_Password selector:k_intro_login];
+            [appDelegate openLoginView:self delegate:appDelegate.activeMain loginType:k_login_Modify_Password selector:k_intro_login];
         } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
             [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:message viewController:self delegate:self];
         } else if (errorCode != 0) {

+ 13 - 13
iOSClient/Main/CCMain.m

@@ -1137,7 +1137,7 @@
             }
             
         } else if (errorCode == kOCErrorServerUnauthorized) {
-            [appDelegate openLoginView:self loginType:k_login_Modify_Password selector:k_intro_login];
+            [appDelegate openLoginView:self delegate:self loginType:k_login_Modify_Password selector:k_intro_login];
         } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
             [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:message viewController:self delegate:self];
         } else if (errorCode != 0) {
@@ -1269,7 +1269,7 @@
         if (errorCode == 0 && [account isEqualToString:appDelegate.activeAccount]) {
             [self insertMetadatasWithAccount:account serverUrl:serverUrl metadataFolder:metadataFolder metadatas:metadatas];
         } else if (errorCode == kOCErrorServerUnauthorized) {
-            [appDelegate openLoginView:self loginType:k_login_Modify_Password selector:k_intro_login];
+            [appDelegate openLoginView:self delegate:self loginType:k_login_Modify_Password selector:k_intro_login];
         } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
             [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:message viewController:self delegate:self];
         } else if (errorCode != 0) {
@@ -1332,7 +1332,7 @@
         } else {
             
             if (errorCode == kOCErrorServerUnauthorized) {
-                [appDelegate openLoginView:self loginType:k_login_Modify_Password selector:k_intro_login];
+                [appDelegate openLoginView:self delegate:self loginType:k_login_Modify_Password selector:k_intro_login];
             } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
                 [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:message viewController:self delegate:self];
             } else if (errorCode != 0) {
@@ -1522,7 +1522,7 @@
             } else if (errorCode != 0) {
                 
                 if (errorCode == kOCErrorServerUnauthorized) {
-                    [appDelegate openLoginView:self loginType:k_login_Modify_Password selector:k_intro_login];
+                    [appDelegate openLoginView:self delegate:self loginType:k_login_Modify_Password selector:k_intro_login];
                 } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
                     [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:message viewController:self delegate:self];
                 } else if (errorCode == kOCErrorServerPathNotFound) {
@@ -1609,7 +1609,7 @@
         } else if (errorCode != 0) {
             
             if (errorCode == kOCErrorServerUnauthorized) {
-                [appDelegate openLoginView:self loginType:k_login_Modify_Password selector:k_intro_login];
+                [appDelegate openLoginView:self delegate:self loginType:k_login_Modify_Password selector:k_intro_login];
             } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
                 [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:message viewController:self delegate:self];
             } else if (errorCode == kOCErrorServerPathNotFound) {
@@ -1819,7 +1819,7 @@
             [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl fileID:nil action:k_action_NULL];
             
             if (errorCode == kOCErrorServerUnauthorized) {
-                [appDelegate openLoginView:self loginType:k_login_Modify_Password selector:k_intro_login];
+                [appDelegate openLoginView:self delegate:self loginType:k_login_Modify_Password selector:k_intro_login];
             } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
                 [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:message viewController:self delegate:self];
             } else if (errorCode != 0) {
@@ -1947,7 +1947,7 @@
         } else if (errorCode != 0) {
             
             if (errorCode == kOCErrorServerUnauthorized)
-                [appDelegate openLoginView:self loginType:k_login_Modify_Password selector:k_intro_login];
+                [appDelegate openLoginView:self delegate:self loginType:k_login_Modify_Password selector:k_intro_login];
             else
                 [appDelegate messageNotification:@"_share_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
         }
@@ -1980,7 +1980,7 @@
         } else if (errorCode != 0) {
             
             if (errorCode == kOCErrorServerUnauthorized)
-                [appDelegate openLoginView:self loginType:k_login_Modify_Password selector:k_intro_login];
+                [appDelegate openLoginView:self delegate:self loginType:k_login_Modify_Password selector:k_intro_login];
             else
                 [appDelegate messageNotification:@"_share_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
         }
@@ -2007,7 +2007,7 @@
         } else if (errorCode != 0) {
             
             if (errorCode == kOCErrorServerUnauthorized)
-                [appDelegate openLoginView:self loginType:k_login_Modify_Password selector:k_intro_login];
+                [appDelegate openLoginView:self delegate:self loginType:k_login_Modify_Password selector:k_intro_login];
             else
                 [appDelegate messageNotification:@"_share_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
         }
@@ -2036,7 +2036,7 @@
         } else if (errorCode != 0) {
             
             if (errorCode == kOCErrorServerUnauthorized)
-                [appDelegate openLoginView:self loginType:k_login_Modify_Password selector:k_intro_login];
+                [appDelegate openLoginView:self delegate:self loginType:k_login_Modify_Password selector:k_intro_login];
             else
                 [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
         }
@@ -2061,7 +2061,7 @@
         } else if (errorCode != 0) {
             
             if (errorCode == kOCErrorServerUnauthorized)
-                [appDelegate openLoginView:self loginType:k_login_Modify_Password selector:k_intro_login];
+                [appDelegate openLoginView:self delegate:self loginType:k_login_Modify_Password selector:k_intro_login];
             else
                 [appDelegate messageNotification:@"_share_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
         }
@@ -2199,7 +2199,7 @@
             }
             
         } else if (errorCode == kOCErrorServerUnauthorized) {
-            [appDelegate openLoginView:self loginType:k_login_Modify_Password selector:k_intro_login];
+            [appDelegate openLoginView:self delegate:self loginType:k_login_Modify_Password selector:k_intro_login];
         } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
             [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:message viewController:self delegate:self];
         } else if (errorCode != 0) {
@@ -2376,7 +2376,7 @@
 
 - (void)addNewAccount:(CCMenuItem *)sender
 {
-    [appDelegate openLoginView:self loginType:k_login_Add selector:k_intro_login];
+    [appDelegate openLoginView:self delegate:self loginType:k_login_Add selector:k_intro_login];
 }
 
 #pragma --------------------------------------------------------------------------------------------

+ 1 - 1
iOSClient/Main/CCMore.swift

@@ -429,7 +429,7 @@ class CCMore: UIViewController, UITableViewDelegate, UITableViewDataSource, CCLo
                 let manageAccount = CCManageAccount()
                 manageAccount.delete(self.appDelegate.activeAccount)
                 
-                self.appDelegate.openLoginView(self, loginType: Int(k_login_Add_Forced), selector: Int(k_intro_login))
+                self.appDelegate.openLoginView(self, delegate: self, loginType: Int(k_login_Add_Forced), selector: Int(k_intro_login)) 
             }
             
             let actionNo = UIAlertAction(title: NSLocalizedString("_no_delete_", comment: ""), style: .default) { (action:UIAlertAction) in

+ 4 - 4
iOSClient/Main/CCSplit.m

@@ -133,7 +133,7 @@
         
         [CCUtility setIntro:YES];
         if (appDelegate.activeAccount.length == 0) {
-            [appDelegate openLoginView:self loginType:k_login_Add selector:k_intro_login];
+            [appDelegate openLoginView:self delegate:self loginType:k_login_Add selector:k_intro_login];
         }
     
     } else {
@@ -145,7 +145,7 @@
         
         } else {
             if (appDelegate.activeAccount.length == 0) {
-                [appDelegate openLoginView:self loginType:k_login_Add selector:k_intro_login];
+                [appDelegate openLoginView:self delegate:self loginType:k_login_Add selector:k_intro_login];
             }
         }
     }
@@ -159,7 +159,7 @@
             {
                 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
                     if (appDelegate.activeAccount.length == 0) {
-                        [appDelegate openLoginView:self loginType:k_login_Add selector:k_intro_login];
+                        [appDelegate openLoginView:self delegate:self loginType:k_login_Add selector:k_intro_login];
                     }
                 });
             }
@@ -167,7 +167,7 @@
             
         case k_intro_signup:
             {
-                [appDelegate openLoginView:self loginType:k_login_Add selector:k_intro_signup];
+                [appDelegate openLoginView:self delegate:self loginType:k_login_Add selector:k_intro_signup];
             }
             break;
     }

+ 4 - 4
iOSClient/Settings/CCManageAccount.m

@@ -216,7 +216,7 @@
 {
     [self deselectFormRow:sender];
     
-    [appDelegate openLoginView:self loginType:k_login_Add selector:k_intro_login];
+    [appDelegate openLoginView:self delegate:self loginType:k_login_Add selector:k_intro_login];
 }
 
 #pragma --------------------------------------------------------------------------------------------
@@ -227,7 +227,7 @@
 {    
     [self deselectFormRow:sender];
     
-    [appDelegate openLoginView:self loginType:k_login_Modify_Password selector:k_intro_login];
+    [appDelegate openLoginView:self delegate:self loginType:k_login_Modify_Password selector:k_intro_login];
 }
 
 #pragma --------------------------------------------------------------------------------------------
@@ -272,7 +272,7 @@
         if ([listAccount count] > 0)
             [self ChangeDefaultAccount:listAccount[0]];
         else {
-            [appDelegate openLoginView:self loginType:k_login_Add_Forced selector:k_intro_login];
+            [appDelegate openLoginView:self delegate:self loginType:k_login_Add_Forced selector:k_intro_login];
         }
     }]];
     
@@ -316,7 +316,7 @@
     NSArray *listAccount = [[NCManageDatabase sharedInstance] getAccounts];
     
     if (listAccount.count == 0) {
-        [appDelegate openLoginView:self loginType:k_login_Add_Forced selector:k_intro_login];
+        [appDelegate openLoginView:self delegate:self loginType:k_login_Add_Forced selector:k_intro_login];
         return;
     }
     

+ 1 - 1
iOSClient/Shares/NCShares.m

@@ -169,7 +169,7 @@
             [self reloadDatasource];
             
         } if (errorCode == kOCErrorServerUnauthorized) {
-            [appDelegate openLoginView:self loginType:k_login_Modify_Password selector:k_intro_login];
+            [appDelegate openLoginView:self delegate:appDelegate.activeMain loginType:k_login_Modify_Password selector:k_intro_login];
         } else if (errorCode == NSURLErrorServerCertificateUntrusted) {
             [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:message viewController:self delegate:self];
         } else if (errorCode != 0) {

+ 7 - 1
iOSClient/Trash/NCTrash.swift

@@ -462,7 +462,9 @@ class NCTrash: UIViewController ,UICollectionViewDataSource, UICollectionViewDel
 
             if errorCode == 0 && account == self.appDelegate.activeAccount {
                 NCManageDatabase.sharedInstance.deleteTrash(filePath: self.path, account: self.appDelegate.activeAccount)
-                NCManageDatabase.sharedInstance.addTrashs(item as! [tableTrash])                
+                NCManageDatabase.sharedInstance.addTrashs(item as! [tableTrash])
+            } else if errorCode == kOCErrorServerUnauthorized {
+                self.appDelegate.openLoginView(self, delegate: self.appDelegate.activeMain, loginType: Int(k_login_Modify_Password), selector: Int(k_intro_login))
             } else if errorCode != 0 {
                 self.appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
             } else {
@@ -486,6 +488,8 @@ class NCTrash: UIViewController ,UICollectionViewDataSource, UICollectionViewDel
             if errorCode == 0 && account == self.appDelegate.activeAccount {
                 NCManageDatabase.sharedInstance.deleteTrash(fileID: fileID, account: account!)
                 self.loadDatasource()
+            } else if errorCode == kOCErrorServerUnauthorized {
+                self.appDelegate.openLoginView(self, delegate: self.appDelegate.activeMain, loginType: Int(k_login_Modify_Password), selector: Int(k_intro_login))
             } else if errorCode != 0 {
                 self.appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
             } else {
@@ -499,6 +503,8 @@ class NCTrash: UIViewController ,UICollectionViewDataSource, UICollectionViewDel
         OCNetworking.sharedManager().emptyTrash(withAccount: appDelegate.activeAccount, completion: { (account, message, errorCode) in
             if errorCode == 0 && account == self.appDelegate.activeAccount {
                 NCManageDatabase.sharedInstance.deleteTrash(fileID: nil, account: self.appDelegate.activeAccount)
+            } else if errorCode == kOCErrorServerUnauthorized {
+                self.appDelegate.openLoginView(self, delegate: self.appDelegate.activeMain, loginType: Int(k_login_Modify_Password), selector: Int(k_intro_login))
             } else if errorCode != 0 {
                 self.appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
             } else {