mirror of
https://github.com/AU-COVIDSafe/mobile-ios.git
synced 2025-04-19 13:05:21 +00:00
COVIDSafe code from version 1.10
This commit is contained in:
parent
3b1d8fa3f4
commit
9d9164c615
37 changed files with 2681 additions and 328 deletions
|
@ -7,7 +7,44 @@
|
|||
|
||||
import UIKit
|
||||
import SafariServices
|
||||
import KeychainSwift
|
||||
|
||||
class OnboardingStep1ViewController: UIViewController {
|
||||
|
||||
|
||||
let keychain = KeychainSwift()
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
switch UIApplication.shared.isProtectedDataAvailable {
|
||||
case true :
|
||||
checkToken()
|
||||
break
|
||||
case false:
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(setKeychainAvailable(_:)), name: UIApplication.protectedDataDidBecomeAvailableNotification, object: nil)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@objc
|
||||
func setKeychainAvailable(_ notification: Notification) {
|
||||
NotificationCenter.default.removeObserver(self, name: UIApplication.protectedDataDidBecomeAvailableNotification, object: nil)
|
||||
checkToken()
|
||||
}
|
||||
|
||||
func checkToken() {
|
||||
let isLoggedIn: Bool = (keychain.get("JWT_TOKEN") != nil)
|
||||
|
||||
if isLoggedIn {
|
||||
DispatchQueue.main.async {
|
||||
guard let homeVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "HomeVC") as? HomeViewController else {
|
||||
return
|
||||
}
|
||||
homeVC.modalPresentationStyle = .overFullScreen
|
||||
homeVC.modalTransitionStyle = .coverVertical
|
||||
|
||||
self.present(homeVC, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue