insert sort, profile updates revamp

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2022-05-09 10:33:03 -07:00
parent 0ab1494b1e
commit 6ac4214be7
26 changed files with 250 additions and 95 deletions

View File

@@ -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)
}

View File

@@ -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) }

View File

@@ -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? {