Browse Source

applied ngrok

pull/1/head
InKwon James Kim 5 years ago
parent
commit
9880d142c2
  1. 1
      GME Remit/APIs/RestApiManager.swift
  2. 4
      GME Remit/APIs/UrlManager.swift
  3. 30
      GME Remit/Modules/LauncherScreen/User Interface/View/LauncherScreenViewController.swift
  4. 1
      GME Remit/Utilities/Database/GMEDB.swift

1
GME Remit/APIs/RestApiManager.swift

@ -18,6 +18,7 @@ enum Server {
case staging
case live
case kftcTest
case ngrok
}
class RestApiMananger {

4
GME Remit/APIs/UrlManager.swift

@ -22,6 +22,8 @@ class UrlManager {
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:
@ -34,6 +36,8 @@ class UrlManager {
self.baseURL = "http://gmeuat.gmeremit.com:5018/api/"
case .kftcTest:
self.baseURL = "http://gmeuat.gmeremit.com:5008/api/"
case .ngrok:
self.baseURL = justinServer
}
}

30
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
}

1
GME Remit/Utilities/Database/GMEDB.swift

@ -65,6 +65,7 @@ class GMEDB {
}
enum AppKey: String, KeyProtocol {
case ngrokHost
case uuid
case firstTimeLanguageIsSet
case criticalUpdate

Loading…
Cancel
Save