Skip to content

Commit 49d0f79

Browse files
author
Achyut Kumar M
committed
not using anymore. will delete the file in next pr
1 parent 9fb311d commit 49d0f79

File tree

3 files changed

+383
-396
lines changed

3 files changed

+383
-396
lines changed

GoInfoGame/GoInfoGame/UI/Login/LoginViewController.swift

Lines changed: 47 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -8,55 +8,50 @@
88
import UIKit
99
import SwiftUI
1010

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+
//}

GoInfoGame/GoInfoGame/UI/Login/OAuth/OAuthManager.swift

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -9,49 +9,49 @@ import Foundation
99
import SafariServices
1010
import UIKit
1111

12-
class OAuthManager: ObservableObject {
13-
14-
// MARK: - Properties
15-
16-
static let shared = OAuthManager()
17-
18-
private var oAuth: OAuthService = OAuth2()
19-
20-
@Published var isAuthorized: Bool = false
21-
22-
// MARK: - Initialization
23-
24-
private init() {}
25-
26-
// MARK: - Public Methods
27-
28-
func checkAuthorizationStatus() {
29-
isAuthorized = oAuth.isAuthorized()
30-
}
31-
32-
func removeAuthorization() {
33-
oAuth.removeAuthorization()
34-
isAuthorized = false
35-
}
36-
37-
func requestAccessFromUser(withVC vc: UIViewController, onComplete callback: @escaping (Result<Void, Error>) -> Void) {
38-
oAuth.requestAccessFromUser(withVC: vc, onComplete: callback)
39-
}
40-
41-
func redirectHandler(url: URL, options: [UIApplication.OpenURLOptionsKey: Any]) {
42-
oAuth.redirectHandler(url: url, options: options)
43-
}
44-
45-
func urlRequest(url: URL) -> URLRequest? {
46-
return oAuth.urlRequest(url: url)
47-
}
48-
49-
func urlRequest(string: String) -> URLRequest? {
50-
return oAuth.urlRequest(string: string)
51-
}
52-
53-
func getUserDetails(callback: @escaping ([String: Any]?) -> Void) {
54-
oAuth.getUserDetails(callback: callback)
55-
}
56-
}
57-
12+
//class OAuthManager: ObservableObject {
13+
//
14+
// // MARK: - Properties
15+
//
16+
// static let shared = OAuthManager()
17+
//
18+
// private var oAuth: OAuthService = OAuth2()
19+
//
20+
// @Published var isAuthorized: Bool = false
21+
//
22+
// // MARK: - Initialization
23+
//
24+
// private init() {}
25+
//
26+
// // MARK: - Public Methods
27+
//
28+
// func checkAuthorizationStatus() {
29+
// isAuthorized = oAuth.isAuthorized()
30+
// }
31+
//
32+
// func removeAuthorization() {
33+
// oAuth.removeAuthorization()
34+
// isAuthorized = false
35+
// }
36+
//
37+
// func requestAccessFromUser(withVC vc: UIViewController, onComplete callback: @escaping (Result<Void, Error>) -> Void) {
38+
// oAuth.requestAccessFromUser(withVC: vc, onComplete: callback)
39+
// }
40+
//
41+
// func redirectHandler(url: URL, options: [UIApplication.OpenURLOptionsKey: Any]) {
42+
// oAuth.redirectHandler(url: url, options: options)
43+
// }
44+
//
45+
// func urlRequest(url: URL) -> URLRequest? {
46+
// return oAuth.urlRequest(url: url)
47+
// }
48+
//
49+
// func urlRequest(string: String) -> URLRequest? {
50+
// return oAuth.urlRequest(string: string)
51+
// }
52+
//
53+
// func getUserDetails(callback: @escaping ([String: Any]?) -> Void) {
54+
// oAuth.getUserDetails(callback: callback)
55+
// }
56+
//}
57+
//

0 commit comments

Comments
 (0)