notifications: add support for tagged mentions

These are text notes that have you tagged but do not have inline
mentions or are replies.

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-09-05 16:52:10 -07:00
committed by Daniel D’Aquino
parent d9bbca1005
commit 1dbf7101b9
4 changed files with 43 additions and 15 deletions

View File

@@ -48,10 +48,24 @@ struct LossyLocalNotification {
}
}
enum NotificationTarget {
case note(NostrEvent)
case note_id(NoteId)
var id: NoteId {
switch self {
case .note(let note):
return note.id
case .note_id(let id):
return id
}
}
}
struct LocalNotification {
let type: LocalNotificationType
let event: NostrEvent
let target: NostrEvent
let target: NotificationTarget
let content: String
func to_lossy() -> LossyLocalNotification {
@@ -64,6 +78,7 @@ enum LocalNotificationType: String {
case like
case mention
case reply
case tagged
case repost
case zap
case profile_zap