Add scenic selection and cooperation order flows aligned with Android.
Upgrade scenic picker with search, location sorting, permission apply/status, and blocking home dialog; add cooperation order module and order source picker improvements with unit tests. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -89,6 +89,11 @@ final class HomeViewController: BaseViewController {
|
||||
)
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
navigationController?.setNavigationBarHidden(true, animated: animated)
|
||||
}
|
||||
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
if !hasInitialized {
|
||||
@ -361,18 +366,17 @@ final class HomeViewController: BaseViewController {
|
||||
|
||||
private func presentScenicDialog() {
|
||||
let alert = UIAlertController(
|
||||
title: "请选择景区",
|
||||
message: "使用首页功能前需要先选择当前景区",
|
||||
title: "提示",
|
||||
message: "您还没有选定入驻景区,请先入驻",
|
||||
preferredStyle: .alert
|
||||
)
|
||||
alert.addAction(UIAlertAction(title: "稍后", style: .cancel) { [weak self] _ in
|
||||
self?.viewModel.hideScenicDialog()
|
||||
self?.activeDialog = nil
|
||||
alert.isModalInPresentation = true
|
||||
alert.addAction(UIAlertAction(title: "关闭app", style: .default) { _ in
|
||||
UIApplication.shared.perform(#selector(NSXPCConnection.suspend))
|
||||
})
|
||||
alert.addAction(UIAlertAction(title: "去选择", style: .default) { [weak self] _ in
|
||||
self?.viewModel.hideScenicDialog()
|
||||
alert.addAction(UIAlertAction(title: "去入驻", style: .default) { [weak self] _ in
|
||||
self?.activeDialog = nil
|
||||
self?.presentScenicSelection()
|
||||
self?.pushScenicSelection()
|
||||
})
|
||||
present(alert, animated: true)
|
||||
}
|
||||
@ -440,24 +444,24 @@ final class HomeViewController: BaseViewController {
|
||||
}
|
||||
|
||||
private func presentScenicSelection() {
|
||||
let scenicList = AppStore.shared.roleScenicList()
|
||||
guard !scenicList.isEmpty else {
|
||||
showToast("暂无可选景区")
|
||||
return
|
||||
}
|
||||
let controller = ScenicSelectionViewController(scenicList: scenicList)
|
||||
controller.onSelected = { [weak self] in
|
||||
pushScenicSelection()
|
||||
}
|
||||
|
||||
private func pushScenicSelection() {
|
||||
navigationController?.setNavigationBarHidden(false, animated: true)
|
||||
let controller = ScenicSelectionViewController()
|
||||
controller.onSelectionComplete = { [weak self] in
|
||||
guard let self else { return }
|
||||
Task {
|
||||
await self.viewModel.reloadIfNeeded(api: self.homeAPI)
|
||||
self.viewModel.refreshLocalDisplayState()
|
||||
self.viewModel.rebuildCommonMenus()
|
||||
await self.viewModel.loadStoreListIfNeeded(api: self.homeAPI)
|
||||
self.applyViewModel()
|
||||
await self.evaluateDialogsWithDelay()
|
||||
await self.viewModel.evaluateDialogs(api: self.homeAPI)
|
||||
await MainActor.run { self.presentDialogsIfNeeded() }
|
||||
}
|
||||
}
|
||||
let nav = UINavigationController(rootViewController: controller)
|
||||
nav.modalPresentationStyle = .pageSheet
|
||||
present(nav, animated: true)
|
||||
navigationController?.pushViewController(controller, animated: true)
|
||||
}
|
||||
|
||||
private func startCountdownTimer() {
|
||||
|
||||
Reference in New Issue
Block a user