diff --git a/GME Remit/APIs/RestApiManager.swift b/GME Remit/APIs/RestApiManager.swift index 2af586e5..4b582e5c 100644 --- a/GME Remit/APIs/RestApiManager.swift +++ b/GME Remit/APIs/RestApiManager.swift @@ -18,6 +18,7 @@ enum Server { case staging case live case kftcTest + case ngrok } class RestApiMananger { diff --git a/GME Remit/APIs/UrlManager.swift b/GME Remit/APIs/UrlManager.swift index 8b612f2f..9fe63a92 100644 --- a/GME Remit/APIs/UrlManager.swift +++ b/GME Remit/APIs/UrlManager.swift @@ -9,32 +9,36 @@ import Foundation class UrlManager { - static let sharedInstance = UrlManager() + static let sharedInstance = UrlManager() - var version = "v1" - - var baseURL = "" - - let baseSocialURL = "" - - let oldUatServer = "http://gmeuat.gmeremit.com:5012/api/v1/" - let staggingServerUrl = "http://gmeuat.gmeremit.com:5022/api/" - let liveServerUrl = "https://mobileapi.gmeremit.com:8002/api/" - let uatServer = "http://gmeuat.gmeremit.com:5012/api/" + var version = "v1" - init() { - switch server { - case .uat: - self.baseURL = uatServer - case .staging: - self.baseURL = staggingServerUrl - case .live: - self.baseURL = liveServerUrl - case .uat2: - self.baseURL = "http://gmeuat.gmeremit.com:5018/api/" - case .kftcTest: - self.baseURL = "http://gmeuat.gmeremit.com:5008/api/" - } + var baseURL = "" + + let baseSocialURL = "" + + let oldUatServer = "http://gmeuat.gmeremit.com:5012/api/v1/" + let staggingServerUrl = "http://gmeuat.gmeremit.com:5022/api/" + let liveServerUrl = "https://mobileapi.gmeremit.com:8002/api/" + let uatServer = "http://gmeuat.gmeremit.com:5012/api/" + + let justinServer = "https://\((GMEDB.shared.app.string(.ngrokHost) ?? "")).ngrok.io/api/" + + init() { + switch server { + case .uat: + self.baseURL = uatServer + case .staging: + self.baseURL = staggingServerUrl + case .live: + self.baseURL = liveServerUrl + case .uat2: + self.baseURL = "http://gmeuat.gmeremit.com:5018/api/" + case .kftcTest: + self.baseURL = "http://gmeuat.gmeremit.com:5008/api/" + case .ngrok: + self.baseURL = justinServer } - + } + } diff --git a/GME Remit/Modules/LauncherScreen/User Interface/View/LauncherScreenViewController.swift b/GME Remit/Modules/LauncherScreen/User Interface/View/LauncherScreenViewController.swift index 3d6f48b8..0b1ad826 100644 --- a/GME Remit/Modules/LauncherScreen/User Interface/View/LauncherScreenViewController.swift +++ b/GME Remit/Modules/LauncherScreen/User Interface/View/LauncherScreenViewController.swift @@ -37,12 +37,42 @@ class LauncherScreenViewController: UIViewController { override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) + #if DEBUG + switch server { + case .ngrok: + let alert = UIAlertController(title: "ngrok", message: "Set your ngrok code", preferredStyle: .alert) + alert.addTextField { + $0.text = GMEDB.shared.app.string(.ngrokHost) + $0.sendActions(for: .editingChanged) + $0.clearButtonMode = .whileEditing + } + let ok = UIAlertAction(title: "Set", style: .default) { _ in + GMEDB.shared.app.set(alert.textFields?[0].text, .ngrokHost) + + if !self.isShow { + self.setEntryPoint() + self.isShow = true + } + } + + alert.addAction(ok) + + self.present(alert, animated: true, completion: nil) + default: + if !isShow { + setEntryPoint() + isShow = true + } + } + + #else if !isShow { setEntryPoint() isShow = true } + #endif } - + // https://f9df355b.ngrok.io // MARK: IBActions } diff --git a/GME Remit/Utilities/Database/GMEDB.swift b/GME Remit/Utilities/Database/GMEDB.swift index 4921d9f9..f8fd8421 100644 --- a/GME Remit/Utilities/Database/GMEDB.swift +++ b/GME Remit/Utilities/Database/GMEDB.swift @@ -65,6 +65,7 @@ class GMEDB { } enum AppKey: String, KeyProtocol { + case ngrokHost case uuid case firstTimeLanguageIsSet case criticalUpdate