Explorar el Código

normalized

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana hace 2 años
padre
commit
14343e617d

+ 1 - 0
iOSClient/Networking/NCNetworkingCheckRemoteUser.swift

@@ -64,6 +64,7 @@ class NCNetworkingCheckRemoteUser {
                         let error = NKError(errorCode: error.errorCode, errorDescription: description)
                         NCContentPresenter.shared.showError(error: error, priority: .max)
                         CCUtility.setPassword(account, password: nil)
+                        NKCommon.shared.writeLog("Password removed.")
                         appDelegate.deletePasswordSession = true
                     }
                 }

+ 12 - 3
iOSClient/Networking/NCService.swift

@@ -110,9 +110,18 @@ class NCService: NSObject {
 
         NextcloudKit.shared.getUserProfile(options: options) { account, userProfile, data, error in
             guard error == .success, account == self.appDelegate.account else {
-                NCBrandColor.shared.settingThemingColor(account: account)
-                if error.errorCode == NCGlobal.shared.errorNCUnauthorized || error.errorCode == NCGlobal.shared.errorUnauthorized || error.errorCode == NCGlobal.shared.errorForbidden {
-                    NCNetworkingCheckRemoteUser().checkRemoteUser(account: account, error: error)
+                
+                // Ops the server has Unauthorized
+                NKCommon.shared.writeLog("The server has response with Unauthorized \(error.errorCode)")
+
+                DispatchQueue.main.async {
+                    if  (UIApplication.shared.applicationState == .active) &&
+                        (NCNetworking.shared.networkReachability != NKCommon.typeReachability.notReachable) &&
+                        (error.errorCode == NCGlobal.shared.errorNCUnauthorized || error.errorCode == NCGlobal.shared.errorUnauthorized || error.errorCode == NCGlobal.shared.errorForbidden) {
+                        
+                        NCBrandColor.shared.settingThemingColor(account: account)
+                        NCNetworkingCheckRemoteUser().checkRemoteUser(account: account, error: error)
+                    }
                 }
                 return
             }