Fixed repost turning green too early and not reposting sometimes
Changelog-Fixed: Fixed repost turning green too early and not reposting sometimes
This commit is contained in:
@@ -83,6 +83,7 @@ struct ContentView: View {
|
|||||||
@State var filter_state : FilterState = .posts_and_replies
|
@State var filter_state : FilterState = .posts_and_replies
|
||||||
@State private var isSideBarOpened = false
|
@State private var isSideBarOpened = false
|
||||||
@StateObject var home: HomeModel = HomeModel()
|
@StateObject var home: HomeModel = HomeModel()
|
||||||
|
@State var shouldShowBoostAlert = false
|
||||||
|
|
||||||
// connect retry timer
|
// connect retry timer
|
||||||
let timer = Timer.publish(every: 4, on: .main, in: .common).autoconnect()
|
let timer = Timer.publish(every: 4, on: .main, in: .common).autoconnect()
|
||||||
@@ -353,7 +354,10 @@ struct ContentView: View {
|
|||||||
|
|
||||||
}
|
}
|
||||||
.onReceive(handle_notify(.boost)) { notif in
|
.onReceive(handle_notify(.boost)) { notif in
|
||||||
current_boost = (notif.object as? NostrEvent)
|
if let ev = (notif.object as? NostrEvent) {
|
||||||
|
current_boost = ev
|
||||||
|
shouldShowBoostAlert = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.onReceive(handle_notify(.reply)) { notif in
|
.onReceive(handle_notify(.reply)) { notif in
|
||||||
let ev = notif.object as! NostrEvent
|
let ev = notif.object as! NostrEvent
|
||||||
@@ -583,7 +587,7 @@ struct ContentView: View {
|
|||||||
Text("Could not find user to mute...", comment: "Alert message to indicate that the muted user could not be found.")
|
Text("Could not find user to mute...", comment: "Alert message to indicate that the muted user could not be found.")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.alert(NSLocalizedString("Repost", comment: "Title of alert for confirming to repost a post."), isPresented: $current_boost.mappedToBool()) {
|
.alert(NSLocalizedString("Repost", comment: "Title of alert for confirming to repost a post."), isPresented: $shouldShowBoostAlert) {
|
||||||
Button(NSLocalizedString("Cancel", comment: "Button to cancel out of reposting a post.")) {
|
Button(NSLocalizedString("Cancel", comment: "Button to cancel out of reposting a post.")) {
|
||||||
current_boost = nil
|
current_boost = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,7 +143,9 @@ struct EventActionBar: View {
|
|||||||
|
|
||||||
let boost = make_boost_event(pubkey: damus_state.keypair.pubkey, privkey: privkey, boosted: self.event)
|
let boost = make_boost_event(pubkey: damus_state.keypair.pubkey, privkey: privkey, boosted: self.event)
|
||||||
|
|
||||||
self.bar.our_boost = boost
|
// As we will still have to wait for the confirmation from alert for repost, we do not turn it green yet.
|
||||||
|
// However, turning green handled from EventActionBar spontaneously once reposted
|
||||||
|
// self.bar.our_boost = boost
|
||||||
|
|
||||||
notify(.boost, boost)
|
notify(.boost, boost)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user