Don't Badge DMs if Sent By You

Closes: #176
Changelog-Fixed: Don't badge DMs if sent by you
This commit is contained in:
Joel Klabo
2022-12-28 21:33:39 -08:00
committed by William Casarin
parent 4781795187
commit 79ea4da2d2

View File

@@ -338,12 +338,14 @@ class HomeModel: ObservableObject {
return m[kind]
}
func handle_last_event(ev: NostrEvent, timeline: Timeline) {
func handle_last_event(ev: NostrEvent, timeline: Timeline, shouldNotify: Bool = true) {
let last_ev = get_last_event(timeline)
if last_ev == nil || last_ev!.created_at < ev.created_at {
save_last_event(ev, timeline: timeline)
new_events = NewEventsBits(prev: new_events, setting: timeline)
if shouldNotify {
new_events = NewEventsBits(prev: new_events, setting: timeline)
}
}
}
@@ -415,7 +417,7 @@ class HomeModel: ObservableObject {
}
if inserted {
handle_last_event(ev: ev, timeline: .dms)
handle_last_event(ev: ev, timeline: .dms, shouldNotify: !ours)
dms.dms = dms.dms.sorted { a, b in
if a.1.events.count > 0 && b.1.events.count > 0 {