Add instant payment collection flow aligned with Android.

Implement收款详情与收款记录 pages with pay-code API, QR generation, amount setting, and record grouping so merchants can collect payments from the home quick action.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-07 09:29:03 +08:00
parent 731de7d7f0
commit d8329d19fd
17 changed files with 1548 additions and 1 deletions

View File

@ -0,0 +1,37 @@
//
// PhotoLibrarySaver.swift
// suixinkan
//
import Photos
import UIKit
/// 使
enum PhotoLibrarySaver {
///
static func saveImage(_ image: UIImage) async -> Bool {
let status = await requestAuthorizationIfNeeded()
guard status == .authorized || status == .limited else {
return false
}
return await withCheckedContinuation { continuation in
PHPhotoLibrary.shared().performChanges({
PHAssetChangeRequest.creationRequestForAsset(from: image)
}, completionHandler: { success, _ in
continuation.resume(returning: success)
})
}
}
private static func requestAuthorizationIfNeeded() async -> PHAuthorizationStatus {
let current = PHPhotoLibrary.authorizationStatus(for: .addOnly)
switch current {
case .notDetermined:
return await PHPhotoLibrary.requestAuthorization(for: .addOnly)
default:
return current
}
}
}