fix user notifications from old events immediately shown on install and login

Changelog-Fixed: Fix user notifications from old events immediately shown on install and login
Closes: #1106
This commit is contained in:
Bryan Montz
2023-05-08 06:44:58 -05:00
committed by William Casarin
parent 9847f12c95
commit 43017828e2
2 changed files with 15 additions and 1 deletions

View File

@@ -278,6 +278,11 @@ class NostrEvent: Codable, Identifiable, CustomStringConvertible, Equatable, Has
func sign(privkey: String) {
self.sig = sign_event(privkey: privkey, ev: self)
}
var age: TimeInterval {
let event_date = Date(timeIntervalSince1970: TimeInterval(created_at))
return Date.now.timeIntervalSince(event_date)
}
}
func sign_event(privkey: String, ev: NostrEvent) -> String {