Add a "clear cache" function

This commit is contained in:
2026-04-11 11:30:42 +02:00
parent 12224db55e
commit ae706bc8bc
3 changed files with 136 additions and 1 deletions
+18 -1
View File
@@ -392,7 +392,8 @@ struct SettingsView: View {
@Environment(\.localeManager) private var localeManager
@Environment(MAStoreManager.self) private var storeManager
@State private var showThankYou = false
@State private var showClearCacheConfirm = false
var body: some View {
NavigationStack {
Form {
@@ -476,12 +477,19 @@ struct SettingsView: View {
// Actions Section
Section {
Button(role: .destructive) {
showClearCacheConfirm = true
} label: {
Label("Clear Cache", systemImage: "trash")
}
Button(role: .destructive) {
service.disconnect()
service.authManager.logout()
} label: {
Label("Disconnect", systemImage: "arrow.right.square")
}
} footer: {
Text("Clearing the cache removes all locally stored artwork and library data. The next launch or reload may take longer.")
}
// Support Development Section
@@ -536,6 +544,15 @@ struct SettingsView: View {
.task {
await storeManager.loadProducts()
}
.alert("Clear Cache?", isPresented: $showClearCacheConfirm) {
Button("Clear", role: .destructive) {
ImageCache.shared.clearAll()
service.libraryManager.clearAll()
}
Button("Cancel", role: .cancel) { }
} message: {
Text("This will delete all locally cached artwork and library data. The next launch or reload may take longer while everything is fetched again.")
}
.alert("Thank You!", isPresented: $showThankYou) {
Button("You're welcome!", role: .cancel) { }
} message: {