feat: update app workflows and permissions
This commit is contained in:
@ -20,6 +20,7 @@ final class WildPhotographerReportSubmitViewController: BaseViewController {
|
||||
private let submitButton = UIButton(type: .system)
|
||||
private var pickerTarget: WildReportPickerTarget = .image
|
||||
private weak var activeInputView: UIView?
|
||||
private var isShowingSubmitLoading = false
|
||||
|
||||
init(
|
||||
homeViewModel: WildPhotographerReportHomeViewModel,
|
||||
@ -109,7 +110,11 @@ final class WildPhotographerReportSubmitViewController: BaseViewController {
|
||||
|
||||
override func bindActions() {
|
||||
viewModel.onStateChange = { [weak self] in
|
||||
Task { @MainActor in self?.rebuildContent() }
|
||||
Task { @MainActor in
|
||||
guard let self else { return }
|
||||
self.updateSubmitLoading()
|
||||
self.rebuildContent()
|
||||
}
|
||||
}
|
||||
viewModel.onShowMessage = { [weak self] message in
|
||||
Task { @MainActor in self?.showToast(message) }
|
||||
@ -152,7 +157,7 @@ final class WildPhotographerReportSubmitViewController: BaseViewController {
|
||||
contentStack.addArrangedSubview(paymentCard)
|
||||
contentStack.setCustomSpacing(16, after: paymentCard)
|
||||
contentStack.addArrangedSubview(submitButton)
|
||||
submitButton.setTitle(viewModel.isSubmitting ? viewModel.submitProgressText : "提交举报", for: .normal)
|
||||
submitButton.setTitle("提交举报", for: .normal)
|
||||
submitButton.isEnabled = !viewModel.isSubmitting
|
||||
submitButton.alpha = viewModel.isSubmitting ? 0.78 : 1
|
||||
submitButton.snp.remakeConstraints { make in
|
||||
@ -561,6 +566,18 @@ final class WildPhotographerReportSubmitViewController: BaseViewController {
|
||||
@objc private func contactChanged() { viewModel.updateContact(contactField.text ?? "") }
|
||||
@objc private func dismissKeyboard() { view.endEditing(true) }
|
||||
|
||||
@MainActor
|
||||
private func updateSubmitLoading() {
|
||||
if viewModel.isSubmitting {
|
||||
guard !isShowingSubmitLoading else { return }
|
||||
isShowingSubmitLoading = true
|
||||
showLoading()
|
||||
} else if isShowingSubmitLoading {
|
||||
isShowingSubmitLoading = false
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
private func registerKeyboardNotifications() {
|
||||
NotificationCenter.default.addObserver(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user