Implement orders tab aligned with Android, including scan verify flows.

Add role-based order/deposit lists, AVFoundation QR scanning, verify dialogs, and ViewModel tests so photographers, scenic admins, and store admins match Android behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-06 16:59:53 +08:00
parent 6492f80ef0
commit 31d2b6094b
27 changed files with 4226 additions and 17 deletions

View File

@ -0,0 +1,55 @@
//
// OrderLocationProvider.swift
// suixinkan
//
import CoreLocation
///
final class OrderLocationProvider: NSObject, CLLocationManagerDelegate {
private let manager = CLLocationManager()
private var continuation: ((Result<CLLocationCoordinate2D, Error>) -> Void)?
override init() {
super.init()
manager.delegate = self
manager.desiredAccuracy = kCLLocationAccuracyBest
}
func requestCoordinate() async throws -> CLLocationCoordinate2D {
let status = manager.authorizationStatus
if status == .notDetermined {
manager.requestWhenInUseAuthorization()
}
guard status == .authorizedWhenInUse || status == .authorizedAlways || manager.authorizationStatus == .authorizedWhenInUse else {
throw OrderLocationError.permissionDenied
}
return try await withCheckedThrowingContinuation { continuation in
self.continuation = { result in
continuation.resume(with: result)
}
manager.requestLocation()
}
}
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
guard let location = locations.last else { return }
continuation?(.success(location.coordinate))
continuation = nil
}
func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
continuation?(.failure(error))
continuation = nil
}
}
enum OrderLocationError: LocalizedError {
case permissionDenied
var errorDescription: String? {
switch self {
case .permissionDenied: "缺少定位权限,功能无法进行"
}
}
}