Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

iOS console : hide login button when not in error

William Balcaena24d5da6e9ee
diff --git a/console/iOS/console/TokenManager.swift b/console/iOS/console/TokenManager.swift
index 6f366ab00..c3dba5c80 100644
--- a/console/iOS/console/TokenManager.swift
+++ b/console/iOS/console/TokenManager.swift
@@ -124,8 +124,11 @@ class TokenManager:NSObject, WKScriptMessageHandler, WKUIDelegate, WKNavigationD
}
if (offlineToken != nil && refreshToken != nil && idToken != nil && !didLogOut) {
self.hasToken = true
+ if let vc = viewController.presentingViewController as? ViewController {
+ vc.isInError = false
+ }
UIApplication.shared.isNetworkActivityIndicatorVisible = false
- self.viewController.dismiss(animated: true, completion: {
+ self.viewController.dismiss(animated: false, completion: {
let notificationName = Notification.Name(NotificationsNames.isAuthenticated)
NotificationCenter.default.post(name: notificationName, object: nil)
})
diff --git a/console/iOS/console/ViewController.swift b/console/iOS/console/ViewController.swift
index b83c56dd6..5a167a604 100644
--- a/console/iOS/console/ViewController.swift
+++ b/console/iOS/console/ViewController.swift
@@ -51,10 +51,11 @@ class ViewController: UIViewController {
func showLoginPage() {
if (TokenManager.sharedInstance.hasToken && !TokenManager.sharedInstance.didLogOut) {
isInError = false
+ if (self.presentedViewController == nil) {
self.present(orViewController, animated: true, completion: nil)
+ }
} else {
TokenManager.sharedInstance.authenticate()
- isInError = true
}
}