nwc: turn pending zap orange when we have a NWC success
Orange means payment successful now, not just presence of zap This introduces a paid pending state, which shows up as an orange timer thing in the zaps view. This can be useful if the zap is never sent. We don't want the user to think the payment didn't go through.
This commit is contained in:
@@ -61,17 +61,21 @@ class ZapsDataModel: ObservableObject {
|
||||
self.zaps = zaps
|
||||
}
|
||||
|
||||
func update_state(reqid: String, state: PendingZapState) {
|
||||
func confirm_nwc(reqid: String) {
|
||||
guard let zap = zaps.first(where: { z in z.request.id == reqid }),
|
||||
case .pending(let pzap) = zap,
|
||||
pzap.state != state
|
||||
case .pending(let pzap) = zap
|
||||
else {
|
||||
return
|
||||
}
|
||||
|
||||
pzap.state = state
|
||||
|
||||
self.objectWillChange.send()
|
||||
switch pzap.state {
|
||||
case .external:
|
||||
break
|
||||
case .nwc(let nwc_state):
|
||||
if nwc_state.update_state(state: .confirmed) {
|
||||
self.objectWillChange.send()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var zap_total: Int64 {
|
||||
|
||||
Reference in New Issue
Block a user