Compare commits

..
2 Commits
2 changed files with 9 additions and 8 deletions

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@ struct Gif: StickerProtocol {
let split = urlString.split(separator: ".")
let fileExtension = ".\(split.last ?? "png")"
return EmojiHoarder.container.appendingPathComponent("gifs", conformingTo: .directory).absoluteString+id+fileExtension
return GifHoarder.container.absoluteString+id+fileExtension
}
var remoteImageURL: URL
+8 -7
View File
@@ -16,8 +16,9 @@ struct SearchView: View {
var body: some View {
NavigationStack {
List() {
List {
Text("\(searchResult.count) Result\(searchResult.count.plural)")
.contentTransition(.numericText())
ForEach(searchResult, id: \.self) { name in
StickerRow(hoarder: hoarder, emoji: hoarder.trie.dict[name]!)
}
@@ -25,17 +26,17 @@ struct SearchView: View {
}
.searchable(text: $searchTerm)
.onChange(of: searchTerm) { _ in
if searchTerm.isEmpty { searchResult = [] }
}
.onSubmit(of: .search) {
guard !searchTerm.isEmpty else {
currentSearch?.cancel()
searchResult = []
withAnimation { searchResult = [] }
return
}
if currentSearch != nil { currentSearch?.cancel() }
currentSearch = Task.detached {
if currentSearch != nil {
withAnimation { currentSearch?.cancel() }
}
currentSearch = Task {
let result = await hoarder.trie.search(for: searchTerm)
guard !Task.isCancelled else { return }
await MainActor.run {
withAnimation(.snappy) {
searchResult = result
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.