|
8 | 8 | import UIKit |
9 | 9 | import SwiftUI |
10 | 10 |
|
11 | | -class LoginViewController: UIViewController { |
12 | | - |
13 | | - override func viewDidLoad() { |
14 | | - super.viewDidLoad() |
15 | | - |
16 | | - // Do any additional setup after loading the view. |
17 | | - } |
18 | | - |
19 | | - @IBAction func loginMethod(_ sender: Any?) { |
20 | | - |
21 | | - if OAuthManager.shared.isAuthorized() { |
22 | | - // User is already authorized, fetch user details or perform other actions |
23 | | - OAuthManager.shared.getUserDetails { userDetails in |
24 | | - // Handle user details or perform other actions |
25 | | - } |
26 | | - } else { |
27 | | - // User is not authorized, request access from the user |
28 | | - OAuthManager.shared.requestAccessFromUser(withVC: self) { [weak self] result in |
29 | | - self?.handleAuthorizationResult(result) |
30 | | - } |
31 | | - } |
32 | | - |
33 | | - |
34 | | - } |
35 | | - |
36 | | - // Handle the result of the authorization request |
37 | | - private func handleAuthorizationResult(_ result: Result<Void, Error>) { |
38 | | - switch result { |
39 | | - case .success: |
40 | | - // Authorization successful, fetch user details or perform other actions |
41 | | - OAuthManager.shared.getUserDetails { userDetails in |
42 | | - // Handle user details or perform other actions |
43 | | - } |
44 | | - case .failure(let error): |
45 | | - // Authorization failed, handle the error |
46 | | - print("Authorization failed with error: \(error.localizedDescription)") |
47 | | - } |
48 | | - } |
49 | | - |
50 | | - @IBAction func skipButtonTapped(_ sender: Any) { |
51 | | - @AppStorage("isOnboarding") var isOnboarding: Bool = true |
52 | | - let contentView = isOnboarding ? AnyView( OnboardingView()) : AnyView(MapView()) |
53 | | - let childView = UIHostingController(rootView: contentView) |
54 | | - self.navigationController?.pushViewController(childView, animated: false) |
55 | | - } |
56 | | - |
57 | | - @IBAction func viewQuestsTapped(_ sender: Any) { |
58 | | - let childView = UIHostingController(rootView: QuestsListUIView()) |
59 | | - self.navigationController?.pushViewController(childView, animated: false) |
60 | | - |
61 | | - } |
62 | | -} |
| 11 | +//class LoginViewController: UIViewController { |
| 12 | +// |
| 13 | +// override func viewDidLoad() { |
| 14 | +// super.viewDidLoad() |
| 15 | +// |
| 16 | +// // Do any additional setup after loading the view. |
| 17 | +// } |
| 18 | +// |
| 19 | +// @IBAction func loginMethod(_ sender: Any?) { |
| 20 | +// |
| 21 | +// |
| 22 | +// // User is not authorized, request access from the user |
| 23 | +// OAuthManager.shared.requestAccessFromUser(withVC: self) { [weak self] result in |
| 24 | +// self?.handleAuthorizationResult(result) |
| 25 | +// } |
| 26 | +// |
| 27 | +// |
| 28 | +// |
| 29 | +// } |
| 30 | +// |
| 31 | +// // Handle the result of the authorization request |
| 32 | +// private func handleAuthorizationResult(_ result: Result<Void, Error>) { |
| 33 | +// switch result { |
| 34 | +// case .success: |
| 35 | +// // Authorization successful, fetch user details or perform other actions |
| 36 | +// OAuthManager.shared.getUserDetails { userDetails in |
| 37 | +// // Handle user details or perform other actions |
| 38 | +// } |
| 39 | +// case .failure(let error): |
| 40 | +// // Authorization failed, handle the error |
| 41 | +// print("Authorization failed with error: \(error.localizedDescription)") |
| 42 | +// } |
| 43 | +// } |
| 44 | +// |
| 45 | +// @IBAction func skipButtonTapped(_ sender: Any) { |
| 46 | +// @AppStorage("isOnboarding") var isOnboarding: Bool = true |
| 47 | +// let contentView = isOnboarding ? AnyView( OnboardingView()) : AnyView(MapView()) |
| 48 | +// let childView = UIHostingController(rootView: contentView) |
| 49 | +// self.navigationController?.pushViewController(childView, animated: false) |
| 50 | +// } |
| 51 | +// |
| 52 | +// @IBAction func viewQuestsTapped(_ sender: Any) { |
| 53 | +// let childView = UIHostingController(rootView: QuestsListUIView()) |
| 54 | +// self.navigationController?.pushViewController(childView, animated: false) |
| 55 | +// |
| 56 | +// } |
| 57 | +//} |
0 commit comments