feat: 自动刷新订单交付确认状态
This commit is contained in:
@@ -7,11 +7,13 @@ enum DroneDockDeliveryEntry {
|
||||
static func makeMethodSheet(order: DroneDockHomeOrder, context: DroneDockHomeContext,
|
||||
taskID: Int? = nil,
|
||||
controllerFactory: @escaping (DroneDockHomeOrder, DroneDockHomeContext, Int?) -> UIViewController,
|
||||
onDidDismiss: ((Bool) -> Void)? = nil,
|
||||
onDidCloseCloud: @escaping () -> Void = {}) -> UINavigationController {
|
||||
let methods = DroneDockDeliveryMethodViewController(customerTitle: order.touristTitle)
|
||||
let navigation = DroneDockDeliverySheetNavigationController(rootViewController: methods)
|
||||
navigation.modalPresentationStyle = .pageSheet
|
||||
navigation.onDidCloseCloud = onDidCloseCloud
|
||||
navigation.onDidDismiss = onDidDismiss
|
||||
methods.onClose = { [weak navigation] in navigation?.dismiss(animated: true) }
|
||||
methods.onNearbyTransfer = { [weak navigation, weak methods] in
|
||||
guard let navigation, let methods, navigation.topViewController === methods else { return }
|
||||
@@ -63,6 +65,8 @@ private final class DroneDockDeliverySheetNavigationController: UINavigationCont
|
||||
var didOpenCloud = false
|
||||
/// 不因仅查看交付方式而刷新订单。
|
||||
var onDidCloseCloud: (() -> Void)?
|
||||
/// 关闭方式弹窗后通知来源页,并传回是否曾打开云端交付。
|
||||
var onDidDismiss: ((Bool) -> Void)?
|
||||
private var didNotifyClose = false
|
||||
|
||||
override func viewDidLoad() {
|
||||
@@ -82,5 +86,6 @@ private final class DroneDockDeliverySheetNavigationController: UINavigationCont
|
||||
guard !didNotifyClose else { return }
|
||||
didNotifyClose = true
|
||||
if didOpenCloud { onDidCloseCloud?() }
|
||||
onDidDismiss?(didOpenCloud)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user