animations in emojirow

animated deleting/downloading emojis
stopped it glitching when downloading/deleting an emoji
removed refresh() and uiID cos its not necessary sob
moved downloadImage() to stickerprotocol extension
bundled an image so test emoji loading is faster
This commit is contained in:
neon443 committed 2026-03-08 22:38:14 +00:00
1 parent 7d83ae2101
commit ccaaa8e519
10 files changed
+77 -65

No files matched your search

+11 -9
View File
@@ -37,7 +37,7 @@ class EmojiHoarder: ObservableObject {
self.showWelcome = !UserDefaults.standard.bool(forKey: "showWelcome")
let localDB = loadLocalDB()
withAnimation { self.emojis = localDB }
withAnimation(.snappy) { self.emojis = localDB }
loadTrie()
if !skipIndex { buildTrie() }
@@ -204,7 +204,7 @@ class EmojiHoarder: ObservableObject {
private func loadRemoteDB() async {
async let fetched = self.fetchRemoteDB()
if let fetched = await fetched {
withAnimation { self.emojis = fetched }
withAnimation(.snappy) { self.emojis = fetched }
}
}
@@ -232,7 +232,7 @@ class EmojiHoarder: ObservableObject {
return
}
await MainActor.run {
withAnimation { self.emojis = fetched }
withAnimation(.snappy) { self.emojis = fetched }
buildTrie()
}
}
@@ -241,11 +241,12 @@ class EmojiHoarder: ObservableObject {
try? await emoji.downloadImage()
await MainActor.run {
if !skipStoreIndex {
self.downloadedEmojis.insert(emoji.name)
self.downloadedEmojisArr.append(emoji.name)
withAnimation(.snappy) {
self.downloadedEmojis.insert(emoji.name)
self.downloadedEmojisArr.append(emoji.name)
}
self.storeDownloadedIndexes()
}
self.trie.dict[emoji.name]?.refresh()
if !skipStoreIndex { Haptic.success.trigger() }
}
}
@@ -254,11 +255,12 @@ class EmojiHoarder: ObservableObject {
func delete(emoji: Emoji, skipStoreIndex: Bool = false) {
emoji.deleteImage()
if !skipStoreIndex {
downloadedEmojis.remove(emoji.name)
downloadedEmojisArr.removeAll(where: { $0 == emoji.name })
withAnimation(.snappy) {
downloadedEmojis.remove(emoji.name)
downloadedEmojisArr.removeAll(where: { $0 == emoji.name })
}
storeDownloadedIndexes()
}
self.trie.dict[emoji.name]?.refresh()
if !skipStoreIndex { Haptic.heavy.trigger() }
}
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.