commit b4660bd58ffc8149ec907edc6a4ec4461b068e37 parent d950ad75b8eba277f79d0d05f81126913129b0f6 Author: William Casarin <jb55@jb55.com> Date: Sun, 17 Apr 2022 08:48:25 -0700 oops, add profiles Signed-off-by: William Casarin <jb55@jb55.com> Diffstat:
A | damus/Nostr/Profiles.swift | | | 26 | ++++++++++++++++++++++++++ |
1 file changed, 26 insertions(+), 0 deletions(-)
diff --git a/damus/Nostr/Profiles.swift b/damus/Nostr/Profiles.swift @@ -0,0 +1,26 @@ +// +// Profiles.swift +// damus +// +// Created by William Casarin on 2022-04-17. +// + +import Foundation + + +class Profiles: ObservableObject { + @Published var profiles: [String: TimestampedProfile] = [:] + + func add(id: String, profile: TimestampedProfile) { + profiles[id] = profile + objectWillChange.send() + } + + func lookup(id: String) -> Profile? { + return profiles[id]?.profile + } + + func lookup_with_timestamp(id: String) -> TimestampedProfile? { + return profiles[id] + } +}