mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-03-11 05:19:13 +00:00
added a delete all images button
some other stuff
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
@@ -81,6 +81,7 @@ struct Emoji: Codable, Identifiable, Hashable {
|
||||
try? FileManager.default.removeItem(at: localImageURL)
|
||||
}
|
||||
|
||||
@MainActor
|
||||
mutating func refresh() {
|
||||
withAnimation { self.uiID = UUID() }
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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