对齐 Android 立即收款页面 UI,并补齐推送状态与语音开关。
统一收款详情布局、设置金额弹窗和收款记录样式,接入 type 6/1 推送驱动与轮询 fallback,使 iOS 收款反馈与 Android 一致。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -46,7 +46,7 @@ struct PushPayload: Sendable {
|
||||
let actionText = values["action"] ?? ""
|
||||
let merged = [typeText, routeText, uriText, actionText].joined(separator: " ").lowercased()
|
||||
|
||||
if typeText == "1" || merged.contains("payment") || merged.contains("pay") || merged.contains("收款") {
|
||||
if typeText == "1" || typeText == "6" || merged.contains("payment") || merged.contains("pay") || merged.contains("收款") {
|
||||
return .payment
|
||||
}
|
||||
if merged.contains("queue") || merged.contains("排队") || merged.contains("叫号") || uriText == "/scenic-queue" {
|
||||
@ -64,6 +64,34 @@ struct PushPayload: Sendable {
|
||||
return .messageCenter
|
||||
}
|
||||
|
||||
/// 推送 extras 中的 type 字段,供收款页区分扫码/付款事件。
|
||||
nonisolated var paymentEventType: Int? {
|
||||
guard let typeText = values["type"], !typeText.isEmpty else { return nil }
|
||||
return Int(typeText)
|
||||
}
|
||||
|
||||
/// 推送 extras 中的 data 字段,付款成功时通常为 JSON 字符串。
|
||||
nonisolated var paymentEventData: String? {
|
||||
let data = values["data"]?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
||||
return data.isEmpty ? nil : data
|
||||
}
|
||||
|
||||
/// 从付款成功 data JSON 中解析到账金额,供全局语音播报使用。
|
||||
nonisolated var paymentSuccessAmount: String? {
|
||||
guard let dataJSON = paymentEventData,
|
||||
let data = dataJSON.data(using: .utf8),
|
||||
let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any] else {
|
||||
return nil
|
||||
}
|
||||
if let amount = json["order_amount"] as? String, !amount.isEmpty {
|
||||
return amount
|
||||
}
|
||||
if let amount = json["order_amount"] as? NSNumber {
|
||||
return amount.stringValue
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
nonisolated private static func mergeJSON(_ value: Any, into result: inout [String: String]) {
|
||||
if let dict = value as? [String: Any] {
|
||||
for (key, value) in dict {
|
||||
|
||||
Reference in New Issue
Block a user