Refactor AppServices into grouped bundles and document DI conventions.
Centralize dependency wiring with Session/Context/Network/UI/Runtime bundles, unify leaf ViewControllers on appServices, and add a test initializer with AppServicesTests. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -10,7 +10,6 @@ import UIKit
|
||||
|
||||
/// 收款页。
|
||||
final class PaymentCollectionViewController: UIViewController {
|
||||
private let services = AppServices.shared
|
||||
private let viewModel = PaymentCollectionViewModel()
|
||||
private let qrImageView = UIImageView()
|
||||
private let statusLabel = UILabel()
|
||||
@ -25,7 +24,7 @@ final class PaymentCollectionViewController: UIViewController {
|
||||
view.backgroundColor = UIColor(hex: 0xF5F7FA)
|
||||
setupUI()
|
||||
viewModel.onChange = { [weak self] in self?.render() }
|
||||
Task { await viewModel.loadPayCode(api: services.paymentAPI, scenicId: services.currentScenicId) }
|
||||
Task { await viewModel.loadPayCode(api: appServices.paymentAPI, scenicId: appServices.currentScenicId) }
|
||||
}
|
||||
|
||||
/// 初始化UI相关 UI 或状态。
|
||||
@ -76,8 +75,8 @@ final class PaymentCollectionViewController: UIViewController {
|
||||
@objc private func togglePolling() {
|
||||
Task {
|
||||
await viewModel.pollUntilPaymentDetected(
|
||||
api: services.paymentAPI,
|
||||
scenicId: services.currentScenicId
|
||||
api: appServices.paymentAPI,
|
||||
scenicId: appServices.currentScenicId
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user