improve: move Reset Image Cache to Dev Mode

This commit is contained in:
naturecodevoid
2023-06-14 18:54:18 -07:00
parent c3f5d9f218
commit 6f14b6b046
4 changed files with 19 additions and 19 deletions

View File

@@ -159,6 +159,9 @@ struct DevModeMenu: View {
.onTapGesture { isUnstableAlertShowing = true }
#endif
SwiftUI.Button(L10n.DevModeView.General.resetImageCache, action: self.resetImageCache)
.foregroundColor(.red)
SwiftUI.Button(action: {
isDevModeEnabled = false
}, label: { Text(L10n.DevModeView.General.disableDevMode) }).foregroundColor(.red)
@@ -252,6 +255,19 @@ struct DevModeMenu: View {
.navigationTitle(L10n.DevModeView.title)
.enableInjection()
}
func resetImageCache() {
do {
let url = try FileManager.default.url(
for: .cachesDirectory,
in: .userDomainMask,
appropriateFor: nil,
create: true)
try FileManager.default.removeItem(at: url.appendingPathComponent("com.zeu.cache", isDirectory: true))
} catch let error {
fatalError("\(error)")
}
}
}
struct DevModeView_Previews: PreviewProvider {