From 45801f3e6c4adc9013b44901a605ce6c9d963fc1 Mon Sep 17 00:00:00 2001 From: William Casarin Date: Mon, 24 Jul 2023 13:08:55 -0700 Subject: [PATCH] ndb: rename NostrEvent to NostrEventOld This facilitates the switch to NdbNote by allowing us to switch back and forth to fix things. --- damus/Nostr/NostrEvent.swift | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/damus/Nostr/NostrEvent.swift b/damus/Nostr/NostrEvent.swift index 04e99a40..9a4a6af7 100644 --- a/damus/Nostr/NostrEvent.swift +++ b/damus/Nostr/NostrEvent.swift @@ -20,7 +20,10 @@ enum ValidationResult: Decodable { case bad_sig } -class NostrEvent: Codable, Identifiable, CustomStringConvertible, Equatable, Hashable, Comparable { +//typealias NostrEvent = NdbNote +typealias NostrEvent = NostrEventOld + +class NostrEventOld: Codable, Identifiable, CustomStringConvertible, Equatable, Hashable, Comparable { // TODO: memory mapped db events /* private var note_data: UnsafeMutablePointer @@ -67,15 +70,15 @@ class NostrEvent: Codable, Identifiable, CustomStringConvertible, Equatable, Has private var _event_refs: [EventRef]? = nil var decrypted_content: String? = nil private var _blocks: Blocks? = nil - private lazy var inner_event: NostrEvent? = { + private lazy var inner_event: NostrEventOld? = { return event_from_json(dat: self.content) }() - static func == (lhs: NostrEvent, rhs: NostrEvent) -> Bool { + static func == (lhs: NostrEventOld, rhs: NostrEventOld) -> Bool { return lhs.id == rhs.id } - static func < (lhs: NostrEvent, rhs: NostrEvent) -> Bool { + static func < (lhs: NostrEventOld, rhs: NostrEventOld) -> Bool { return lhs.created_at < rhs.created_at } @@ -96,7 +99,7 @@ class NostrEvent: Codable, Identifiable, CustomStringConvertible, Equatable, Has } } -extension NostrEvent { +extension NostrEventOld { var is_textlike: Bool { return kind == 1 || kind == 42 || kind == 30023 } @@ -127,7 +130,7 @@ extension NostrEvent { } - func get_inner_event(cache: EventCache) -> NostrEvent? { + func get_inner_event(cache: EventCache) -> NostrEventOld? { guard self.known_kind == .boost else { return nil }