55 lines
1.4 KiB
Swift
55 lines
1.4 KiB
Swift
//
|
|
// FeatureIntroVC.swift
|
|
// QuickLocation
|
|
//
|
|
|
|
import UIKit
|
|
import CoreLocation
|
|
import SwiftyUserDefaults
|
|
|
|
final class FeatureIntroVC: BaseViewController {
|
|
|
|
override var isNavigationBarHidden: Bool { true }
|
|
|
|
private var rootView: FeatureIntroView!
|
|
|
|
override func loadView() {
|
|
rootView = FeatureIntroView(frame: UIScreen.main.bounds)
|
|
view = rootView
|
|
}
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
rootView.onTapItem = { [weak self] action in
|
|
self?.handle(action)
|
|
}
|
|
}
|
|
|
|
private func handle(_ action: FeatureIntroAction) {
|
|
switch action {
|
|
case .signIn:
|
|
let vc = SignInVC(lastLocation: savedLastLocation)
|
|
vc.isNeedLogin = true
|
|
AppRouter.push(vc)
|
|
case .createBubble:
|
|
AppRouter.push(Route.createBubble)
|
|
case .lockDistract:
|
|
AppRouter.push(Route.lockDistract)
|
|
case .searchLocation:
|
|
AppRouter.push(Route.searchLocation)
|
|
case .sos:
|
|
let vc = SOSViewController()
|
|
vc.isNeedLogin = true
|
|
AppRouter.push(vc)
|
|
case .placeholder:
|
|
DLToast.show(text: "敬请期待")
|
|
}
|
|
}
|
|
|
|
private var savedLastLocation: CLLocation? {
|
|
guard let lat = Defaults[\.currentLatitude],
|
|
let lon = Defaults[\.currentLongitude] else { return nil }
|
|
return CLLocation(latitude: lat, longitude: lon)
|
|
}
|
|
}
|