Просмотр исходного кода

Add protocol loginDisappear on CCLogin

Marino Faggiana 7 лет назад
Родитель
Сommit
0e662349d9

+ 4 - 2
Nextcloud.xcodeproj/project.pbxproj

@@ -726,7 +726,6 @@
 		F700229E1EC4C9100080073F /* OCConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCConstants.h; sourceTree = "<group>"; };
 		F700229F1EC4C9100080073F /* UtilsFramework.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UtilsFramework.h; sourceTree = "<group>"; };
 		F70022A01EC4C9100080073F /* UtilsFramework.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UtilsFramework.m; sourceTree = "<group>"; };
-		F70211F41BAC56E9003FC03E /* CCCellMain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCCellMain.h; sourceTree = "<group>"; };
 		F70211F51BAC56E9003FC03E /* CCCellMain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCCellMain.m; sourceTree = "<group>"; };
 		F70211F61BAC56E9003FC03E /* CCCellMain.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CCCellMain.xib; sourceTree = "<group>"; };
 		F70211F71BAC56E9003FC03E /* CCCellMainTransfer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCCellMainTransfer.h; sourceTree = "<group>"; };
@@ -1507,6 +1506,8 @@
 		F7FCFFDE1D707B83000E6E29 /* CCPeekPop.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCPeekPop.m; sourceTree = "<group>"; };
 		F7FE125C1BAC03FB0041924B /* CCBKPasscode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBKPasscode.h; sourceTree = "<group>"; };
 		F7FE125D1BAC03FB0041924B /* CCBKPasscode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCBKPasscode.m; sourceTree = "<group>"; };
+		F7FFEACD1F82BB1C005E5C17 /* CCCellMain.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CCCellMain.h; path = Main/CCCellMain.h; sourceTree = "<group>"; };
+		F7FFEACE1F82BB23005E5C17 /* CCCellMain.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CCCellMain.h; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -1679,9 +1680,9 @@
 		F70211F31BAC56E9003FC03E /* Main */ = {
 			isa = PBXGroup;
 			children = (
+				F7FFEACE1F82BB23005E5C17 /* CCCellMain.h */,
 				F70211F51BAC56E9003FC03E /* CCCellMain.m */,
 				F70211F61BAC56E9003FC03E /* CCCellMain.xib */,
-				F70211F41BAC56E9003FC03E /* CCCellMain.h */,
 				F70211F71BAC56E9003FC03E /* CCCellMainTransfer.h */,
 				F70211F81BAC56E9003FC03E /* CCCellMainTransfer.m */,
 				F70211F91BAC56E9003FC03E /* CCCellMainTransfer.xib */,
@@ -2897,6 +2898,7 @@
 				F70022561EC4C9100080073F /* OCCommunicationLib */,
 				F7A582D71A24DAB500E903D7 /* AppDelegate.h */,
 				F7A582D61A24DAB500E903D7 /* AppDelegate.m */,
+				F7FFEACD1F82BB1C005E5C17 /* CCCellMain.h */,
 				F7C8C1901B482CEA0048180E /* CCGlobal.h */,
 				F7C8C1911B482CEA0048180E /* CCGlobal.m */,
 				F73CB5771ED46807005F2A5A /* NCBridgeSwift.h */,

+ 1 - 1
iOSClient/AppDelegate.m

@@ -364,7 +364,7 @@
         
         } else {
         
-            if (!_activeLogin.view.window) {
+            if (_activeLogin == nil) {
 
                 _activeLogin = [[UIStoryboard storyboardWithName:@"CCLogin" bundle:nil] instantiateViewControllerWithIdentifier:@"CCLoginNextcloud"];
                 _activeLogin.delegate = delegate;

+ 1 - 0
iOSClient/Login/CCLogin.h

@@ -30,6 +30,7 @@
 @protocol CCLoginDelegate <NSObject>
 
 - (void) loginSuccess:(NSInteger)loginType;
+- (void) loginDisappear;
 
 @end
 

+ 9 - 0
iOSClient/Login/CCLogin.m

@@ -129,6 +129,15 @@
     [super viewDidAppear:animated];
 }
 
+//
+- (void)viewDidDisappear:(BOOL)animated
+{
+    [super viewDidDisappear:animated];
+    
+    if ([self.delegate respondsToSelector:@selector(loginDisappear)])
+        [self.delegate loginDisappear];
+}
+
 - (BOOL)textFieldShouldReturn:(UITextField *)textField
 {
     [textField resignFirstResponder];

+ 6 - 1
iOSClient/Main/CCMain.m

@@ -934,7 +934,7 @@
 }
 
 #pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Change Password =====
+#pragma mark === Delegate Login ===
 #pragma --------------------------------------------------------------------------------------------
 
 - (void)loginSuccess:(NSInteger)loginType
@@ -942,6 +942,11 @@
     [self readFolder:_serverUrl];
 }
 
+- (void)loginDisappear
+{
+    app.activeLogin = nil;
+}
+
 #pragma mark -
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ===== Peek & Pop  =====

+ 5 - 1
iOSClient/Main/CCMore.swift

@@ -381,13 +381,17 @@ class CCMore: UIViewController, UITableViewDelegate, UITableViewDataSource, CCLo
         
         self.navigationController?.pushViewController(controller, animated: true)
     }
-
+    
     func loginSuccess(_ loginType: NSInteger) {
         
         NotificationCenter.default.post(name: NSNotification.Name(rawValue: "initializeMain"), object: nil)
         
         appDelegate.selectedTabBarController(Int(k_tabBarApplicationIndexFile))
     }
+    
+    func loginDisappear() {
+        
+    }
 }
 
 extension CCMore: SwiftModalWebVCDelegate, SwiftWebVCDelegate{

+ 11 - 1
iOSClient/Main/CCSplit.m

@@ -126,7 +126,7 @@
 }
 
 #pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== newAccount =====
+#pragma mark === Delegate Login ===
 #pragma --------------------------------------------------------------------------------------------
 
 - (void)loginSuccess:(NSInteger)loginType
@@ -134,6 +134,16 @@
     [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"initializeMain" object:nil];
 }
 
+- (void)loginDisappear
+{
+    app.activeLogin = nil;
+}
+
+#pragma --------------------------------------------------------------------------------------------
+#pragma mark ===== newAccount =====
+#pragma --------------------------------------------------------------------------------------------
+
+
 - (void)newAccount
 {
     if (app.activeAccount.length == 0) {

+ 5 - 0
iOSClient/Settings/CCManageAccount.m

@@ -191,6 +191,11 @@
         [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"initializeMain" object:nil];
 }
 
+- (void)loginDisappear
+{
+    app.activeLogin = nil;
+}
+
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark === Add Account ===
 #pragma --------------------------------------------------------------------------------------------