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

+ 2 - 1
Nextcloud.xcodeproj/project.pbxproj

@@ -2670,6 +2670,7 @@
 				);
 				SDKROOT = iphoneos;
 				SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) NC";
+				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
 				SWIFT_SWIFT3_OBJC_INFERENCE = Off;
 			};
 			name = Debug;
@@ -2729,7 +2730,7 @@
 				SDKROOT = iphoneos;
 				SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG NC";
 				SWIFT_COMPILATION_MODE = wholemodule;
-				SWIFT_OPTIMIZATION_LEVEL = "-O";
+				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
 				SWIFT_SWIFT3_OBJC_INFERENCE = Off;
 				VALIDATE_PRODUCT = YES;
 			};

+ 4 - 2
iOSClient/AppDelegate.swift

@@ -124,7 +124,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
         }
         
         // init home
-        NotificationCenter.default.addObserver(self, selector: #selector(initializeMain(notification:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitializeMain), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(initializeMain), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterInitializeMain), object: nil)
         NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitializeMain)
         
         // Auto upload
@@ -272,7 +272,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
     
     // MARK: -
 
-    @objc func initializeMain(notification: NSNotification) {
+    @objc func initializeMain() {
         
         if account == "" { return}
 
@@ -467,6 +467,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
             if activeLoginWeb?.view.window == nil {
                 activeLoginWeb = UIStoryboard(name: "CCLogin", bundle: nil).instantiateViewController(withIdentifier: "NCLoginWeb") as? NCLoginWeb
                 activeLoginWeb?.urlBase = NCBrandOptions.shared.loginBaseUrl
+                activeLoginWeb?.account = account
                 showLoginViewController(activeLoginWeb, contextViewController: viewController)
             }
             
@@ -475,6 +476,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
             if activeLoginWeb?.view.window == nil {
                 activeLoginWeb = UIStoryboard(name: "CCLogin", bundle: nil).instantiateViewController(withIdentifier: "NCLoginWeb") as? NCLoginWeb
                 activeLoginWeb?.urlBase = urlBase
+                activeLoginWeb?.account = account
                 showLoginViewController(activeLoginWeb, contextViewController: viewController)
             }
             

+ 8 - 4
iOSClient/Login/NCLoginWeb.swift

@@ -33,6 +33,7 @@ class NCLoginWeb: UIViewController {
     let appDelegate = UIApplication.shared.delegate as! AppDelegate
 
     @objc var urlBase = ""
+    @objc var account = ""
     
     @objc var loginFlowV2Available = false
     @objc var loginFlowV2Token = ""
@@ -142,6 +143,8 @@ class NCLoginWeb: UIViewController {
         
         for account in accounts {
             
+            let title = account.user + " " + URL(string: account.urlBase)?.host ?? ""
+            
             var fileNamePath = CCUtility.getDirectoryUserData() + "/" + CCUtility.getStringUser(account.user, urlBase: account.urlBase) + "_" + account.user
             fileNamePath = fileNamePath + ".png"
             if var userImage = UIImage(contentsOfFile: fileNamePath) {
@@ -158,16 +161,17 @@ class NCLoginWeb: UIViewController {
             
             actions.append(
                 NCMenuAction(
-                    title: account.account,
+                    title: title,
                     icon: avatar,
-                    onTitle: account.account,
+                    onTitle: title,
                     onIcon: avatar,
                     selected: account.active == true,
                     on: account.active == true,
                     action: { menuAction in
-                        self.dismiss(animated: true) {
+                        if self.accont != account.account {
                             self.appDelegate.settingAccount(account.account, urlBase: account.urlBase, user: account.user, userId: account.userId, password: CCUtility.getPassword(account.account))
-                            NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitializeMain)
+                            self.appDelegate.initializeMain()
+                            self.dismiss(animated: true) { }
                         }
                     }
                 )