Pending Zaps

A fairly large change that replaces Zaps in the codebase with "Zapping"
which is a tagged union consisting of a resolved Zap and a Pending Zap.
These are both counted as Zaps everywhere in Damus, except pending zaps
can be cancelled (most of the time).
This commit is contained in:
William Casarin
2023-05-13 21:33:34 -07:00
parent 1518a0a16c
commit 03691d0369
24 changed files with 738 additions and 179 deletions
+6 -3
View File
@@ -9,17 +9,20 @@ import SwiftUI
struct ZapsView: View {
let state: DamusState
@StateObject var model: ZapsModel
var model: ZapsModel
@ObservedObject var zaps: ZapsDataModel
init(state: DamusState, target: ZapTarget) {
self.state = state
self._model = StateObject(wrappedValue: ZapsModel(state: state, target: target))
self.model = ZapsModel(state: state, target: target)
self._zaps = ObservedObject(wrappedValue: state.events.get_cache_data(target.id).zaps_model)
}
var body: some View {
ScrollView {
LazyVStack {
ForEach(model.zaps, id: \.event.id) { zap in
ForEach(zaps.zaps, id: \.request.id) { zap in
ZapEvent(damus: state, zap: zap)
.padding([.horizontal])
}