added a delete all images button

some other stuff
This commit is contained in:
neon443 committed 2025-10-31 16:23:05 +00:00
1 parent bf3ac0eb3b
commit a1a15c9cb8
4 files changed
+16 -11

No files matched your search

+2 -2
View File
@@ -694,7 +694,7 @@
SWIFT_APPROACHABLE_CONCURRENCY = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 6.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@@ -726,7 +726,7 @@
SWIFT_APPROACHABLE_CONCURRENCY = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 6.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
+1
View File
@@ -81,6 +81,7 @@ struct Emoji: Codable, Identifiable, Hashable {
try? FileManager.default.removeItem(at: localImageURL)
}
@MainActor
mutating func refresh() {
withAnimation { self.uiID = UUID() }
}
+6
View File
@@ -36,6 +36,12 @@ struct ContentView: View {
hoarder.filterEmojis(byCategory: .notDownloaded, searchTerm: searchTerm)
}
Button("delete all images") {
Task.detached {
await hoarder.deleteAllStickers()
}
}
Text("\(hoarder.filteredEmojis.count) Emoji")
ForEach($hoarder.filteredEmojis, id: \.self) { $emoji in
+7 -9
View File
@@ -47,9 +47,12 @@ struct StickerSlackTests {
@Test func deleteAllEmojis() async throws {
await withDiscardingTaskGroup { group in
for emoji in hoarder.emojis {
for i in hoarder.emojis.indices {
group.addTask {
emoji.deleteImage()
hoarder.emojis[i].deleteImage()
await MainActor.run {
hoarder.emojis[i].refresh()
}
}
}
}
@@ -143,12 +146,7 @@ struct PerformanceTests {
}
@Test func deleteAllImages() async throws {
await withDiscardingTaskGroup { group in
for emoji in hoarder.emojis {
group.addTask {
emoji.deleteImage()
}
}
}
try! await fakeDownloadAllStickers()
await hoarder.deleteAllStickers()
}
}
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.