fix memory leak when emojipack some emojis that dont exist

added a refersh button
This commit is contained in:
Nihaal Sharma committed 2026-04-24 10:22:31 +01:00
1 parent dfc85bb0b9
commit ee740e86cc
3 files changed
+40 -24

No files matched your search

@@ -21,6 +21,8 @@ struct EmojiPackDetailView: View {
@State var showShare: Bool = false
@State var showNotFoundAlert: Bool = false
var allDownloaded: Bool {
let date = Date.now
let result = Set(pack.items).isSubset(of: hoarder.downloadedStickers)
@@ -102,13 +104,38 @@ struct EmojiPackDetailView: View {
LazyVGrid(columns: layout, spacing: spacing) {
ForEach(pack.items, id: \.self) { name in
TimelineView(.animation) { tl in
let emoji = hoarder.trie.dict[name] ?? .test
VStack {
StickerPreview(sticker: emoji)
Text(emoji.UIName)
.multilineTextAlignment(.center)
.font(.caption)
Spacer()
Group {
VStack {
if let emoji = hoarder.trie.dict[name] {
StickerPreview(sticker: emoji)
Text(emoji.UIName)
.multilineTextAlignment(.center)
.font(.caption)
} else {
Image(systemName: "questionmark.circle.dashed")
.resizable().scaledToFit()
.foregroundStyle(.gray.opacity(0.5))
.overlay(alignment: .topTrailing) {
Button {
showNotFoundAlert.toggle()
} label: {
Image(systemName: "info")
.font(.title3.bold())
}
}
Text(name)
.multilineTextAlignment(.center)
.font(.caption)
}
Spacer()
}
.alert("This emoji was not found", isPresented: $showNotFoundAlert) {
Button("OK") {
showNotFoundAlert.toggle()
}
} message: {
Text("Try reopening the app with an Internet connection to refresh the emoji database.")
}
}
.overlay(alignment: .topLeading) {
if edit {
+4
View File
@@ -112,6 +112,10 @@ struct SettingsView: View {
}
Section("Debug") {
Button("Refresh", systemImage: "arrow.clockwise", role: .destructive) {
hoarder.startLoading(localOnly: false, skipIndex: false)
}
NavigationLink {
TrieTestingView(hoarder: hoarder)
} label: {
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.