insert sort, profile updates revamp
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -28,6 +28,10 @@ struct NostrFilter: Codable {
|
||||
case authors
|
||||
}
|
||||
|
||||
public static func copy(from: NostrFilter) -> NostrFilter {
|
||||
return NostrFilter(ids: from.ids, kinds: from.kinds, referenced_ids: from.referenced_ids, pubkeys: from.pubkeys, since: from.since, until: from.until, authors: from.authors, hashtag: from.hashtag)
|
||||
}
|
||||
|
||||
public static func filter_hashtag(_ htags: [String]) -> NostrFilter {
|
||||
return NostrFilter(ids: nil, kinds: nil, referenced_ids: nil, pubkeys: nil, since: nil, until: nil, authors: nil, hashtag: htags)
|
||||
}
|
||||
|
||||
@@ -92,8 +92,8 @@ func decode_nostr_uri(_ s: String) -> NostrLink? {
|
||||
return
|
||||
}
|
||||
|
||||
if parts.count >= 3 && parts[1] == "hashtag" {
|
||||
return .filter(NostrFilter.filter_hashtag([parts[2]]))
|
||||
if parts.count >= 2 && parts[0] == "hashtag" {
|
||||
return .filter(NostrFilter.filter_hashtag([parts[1]]))
|
||||
}
|
||||
|
||||
return tag_to_refid(parts).map { .ref($0) }
|
||||
|
||||
@@ -10,12 +10,11 @@ import UIKit
|
||||
import Combine
|
||||
|
||||
|
||||
class Profiles: ObservableObject {
|
||||
@Published var profiles: [String: TimestampedProfile] = [:]
|
||||
class Profiles {
|
||||
var profiles: [String: TimestampedProfile] = [:]
|
||||
|
||||
func add(id: String, profile: TimestampedProfile) {
|
||||
profiles[id] = profile
|
||||
objectWillChange.send()
|
||||
}
|
||||
|
||||
func lookup(id: String) -> Profile? {
|
||||
|
||||
Reference in New Issue
Block a user