|
@@ -32,7 +32,7 @@ import NCCommunication
|
|
|
let appDelegate = UIApplication.shared.delegate as! AppDelegate
|
|
|
var checkRemoteUserInProgress = false
|
|
|
|
|
|
- @objc func checkRemoteUser(account: String, errorCode: Int) {
|
|
|
+ @objc func checkRemoteUser(account: String, errorCode: Int, errorDescription: String) {
|
|
|
|
|
|
if self.checkRemoteUserInProgress {
|
|
|
return
|
|
@@ -45,28 +45,35 @@ import NCCommunication
|
|
|
|
|
|
if serverVersionMajor >= NCGlobal.shared.nextcloudVersion17 {
|
|
|
|
|
|
- let token = CCUtility.getPassword(account)!
|
|
|
- if token == "" { return }
|
|
|
-
|
|
|
- NCCommunication.shared.getRemoteWipeStatus(serverUrl: tableAccount.urlBase, token: token) { (account, wipe, errorCode, errorDescriptiuon) in
|
|
|
+ if errorCode == 401 {
|
|
|
+
|
|
|
+ let token = CCUtility.getPassword(account)!
|
|
|
+ if token == "" { return }
|
|
|
|
|
|
- if wipe {
|
|
|
+ NCCommunication.shared.getRemoteWipeStatus(serverUrl: tableAccount.urlBase, token: token) { (account, wipe, errorCode, errorDescriptiuon) in
|
|
|
|
|
|
- self.appDelegate.deleteAccount(account, wipe: true)
|
|
|
- NCContentPresenter.shared.messageNotification(tableAccount.user, description: "_wipe_account_", delay: NCGlobal.shared.dismissAfterSecondLong, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError)
|
|
|
- NCCommunication.shared.setRemoteWipeCompletition(serverUrl: tableAccount.urlBase, token: token) { (account, errorCode, errorDescription) in
|
|
|
- print("wipe")
|
|
|
+ if wipe {
|
|
|
+
|
|
|
+ self.appDelegate.deleteAccount(account, wipe: true)
|
|
|
+ NCContentPresenter.shared.messageNotification(tableAccount.user, description: "_wipe_account_", delay: NCGlobal.shared.dismissAfterSecondLong, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError)
|
|
|
+ NCCommunication.shared.setRemoteWipeCompletition(serverUrl: tableAccount.urlBase, token: token) { (account, errorCode, errorDescription) in print("wipe") }
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ if UIApplication.shared.applicationState == .active && NCCommunication.shared.isNetworkReachable() {
|
|
|
+ let description = String.localizedStringWithFormat(NSLocalizedString("_error_check_remote_user_", comment: ""), tableAccount.user, tableAccount.urlBase)
|
|
|
+ NCContentPresenter.shared.messageNotification("_error_", description: description, delay: NCGlobal.shared.dismissAfterSecondLong, type: NCContentPresenter.messageType.error, errorCode: errorCode)
|
|
|
+ CCUtility.setPassword(account, password: nil)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- } else {
|
|
|
-
|
|
|
- if UIApplication.shared.applicationState == .active && NCCommunication.shared.isNetworkReachable() {
|
|
|
- let description = String.localizedStringWithFormat(NSLocalizedString("_error_check_remote_user_", comment: ""), tableAccount.user, tableAccount.urlBase)
|
|
|
- NCContentPresenter.shared.messageNotification("_error_", description: description, delay: NCGlobal.shared.dismissAfterSecondLong, type: NCContentPresenter.messageType.error, errorCode: errorCode)
|
|
|
- CCUtility.setPassword(account, password: nil)
|
|
|
- }
|
|
|
+ self.checkRemoteUserInProgress = false
|
|
|
}
|
|
|
|
|
|
+ } else {
|
|
|
+
|
|
|
+ NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecondLong, type: NCContentPresenter.messageType.error, errorCode: errorCode)
|
|
|
+
|
|
|
self.checkRemoteUserInProgress = false
|
|
|
}
|
|
|
|
|
@@ -74,7 +81,7 @@ import NCCommunication
|
|
|
|
|
|
if UIApplication.shared.applicationState == .active && NCCommunication.shared.isNetworkReachable() {
|
|
|
let description = String.localizedStringWithFormat(NSLocalizedString("_error_check_remote_user_", comment: ""), tableAccount.user, tableAccount.urlBase)
|
|
|
- NCContentPresenter.shared.messageNotification("_error_", description: description, delay: NCGlobal.shared.dismissAfterSecondLong, type: NCContentPresenter.messageType.error, errorCode: 403)
|
|
|
+ NCContentPresenter.shared.messageNotification("_error_", description: description, delay: NCGlobal.shared.dismissAfterSecondLong, type: NCContentPresenter.messageType.error, errorCode: errorCode)
|
|
|
CCUtility.setPassword(account, password: nil)
|
|
|
}
|
|
|
|