Add nip05 search
Changelog-Added: Added ability to lookup users by nip05 identifiers
This commit is contained in:
@@ -12,6 +12,7 @@ enum Search {
|
||||
case hashtag(String)
|
||||
case profile(String)
|
||||
case note(String)
|
||||
case nip05(String)
|
||||
case hex(String)
|
||||
}
|
||||
|
||||
@@ -41,6 +42,10 @@ struct SearchResultsView: View {
|
||||
NavigationLink(destination: dst) {
|
||||
Text("Search hashtag: #\(ht)", comment: "Navigation link to search hashtag.")
|
||||
}
|
||||
|
||||
case .nip05(let addr):
|
||||
SearchingEventView(state: damus_state, evid: addr, search_type: .nip05)
|
||||
|
||||
case .profile(let prof):
|
||||
let decoded = try? bech32_decode(prof)
|
||||
let hex = hex_encode(decoded!.data)
|
||||
@@ -95,6 +100,12 @@ func search_for_string(profiles: Profiles, _ new: String) -> Search? {
|
||||
return nil
|
||||
}
|
||||
|
||||
let splitted = new.split(separator: "@")
|
||||
|
||||
if splitted.count == 2 {
|
||||
return .nip05(new)
|
||||
}
|
||||
|
||||
if new.first! == "#" {
|
||||
let ht = String(new.dropFirst().filter{$0 != " "})
|
||||
return .hashtag(ht)
|
||||
|
||||
Reference in New Issue
Block a user