Settings: Add an option to clean media cache

This commit is contained in:
Thomas Ricouard 2023-02-23 18:43:09 +01:00
parent 8e99c195e0
commit cdbfd5db00
19 changed files with 74 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import Models
import Network
import SwiftUI
import Timeline
import Nuke
struct SettingsTabs: View {
@Environment(\.dismiss) private var dismiss
@ -22,6 +23,7 @@ struct SettingsTabs: View {
@State private var addAccountSheetPresented = false
@State private var isEditingAccount = false
@State private var cachedRemoved = false
@Binding var popToRootTab: Tab
@ -32,6 +34,7 @@ struct SettingsTabs: View {
accountsSection
generalSection
otherSections
cacheSection
}
.scrollContentBackground(.hidden)
.background(theme.secondaryBackgroundColor)
@ -272,4 +275,21 @@ struct SettingsTabs: View {
.scrollContentBackground(.hidden)
.background(theme.secondaryBackgroundColor)
}
private var cacheSection: some View {
Section("settings.section.cache") {
if cachedRemoved {
Text("action.done")
.transition(.move(edge: .leading))
} else {
Button("settings.cache-media.clear", role: .destructive) {
ImagePipeline.shared.cache.removeAll()
withAnimation {
cachedRemoved = true
}
}
}
}
.listRowBackground(theme.primaryBackgroundColor)
}
}

View File

@ -195,6 +195,9 @@
"settings.display.section.font" = "Шрыфт";
"settings.section.cache" = "Cache";
"settings.cache-media.clear" = "Clear Media Cache";
// MARK: Tabs
"tab.explore" = "Аглядзець";
"tab.federated" = "Аб'яднаны";

View File

@ -189,6 +189,9 @@
"settings.display.section.font" = "Font";
"settings.section.cache" = "Cache";
"settings.cache-media.clear" = "Clear Media Cache";
// MARK: Tabs
"tab.explore" = "Exploreu";
"tab.federated" = "Federat";

View File

@ -187,6 +187,9 @@
"settings.display.section.font" = "Schriftart";
"settings.section.cache" = "Cache";
"settings.cache-media.clear" = "Clear Media Cache";
"enum.expand-media.show" = "Alle zeigen";
"enum.expand-media.hide" = "Alle ausblenden";
"enum.expand-media.hide-sensitive" = "Sensible ausblenden";

View File

@ -193,6 +193,9 @@
"settings.display.section.font" = "Font";
"settings.section.cache" = "Cache";
"settings.cache-media.clear" = "Clear Media Cache";
// MARK: Tabs
"tab.explore" = "Explore";
"tab.federated" = "Federated";

View File

@ -191,6 +191,9 @@
"settings.display.section.font" = "Font";
"settings.section.cache" = "Cache";
"settings.cache-media.clear" = "Clear Media Cache";
// MARK: Tabs
"tab.explore" = "Explore";
"tab.federated" = "Federated";

View File

@ -187,6 +187,9 @@
"settings.display.section.font" = "Fuente";
"settings.section.cache" = "Cache";
"settings.cache-media.clear" = "Clear Media Cache";
"enum.expand-media.show" = "Siempre";
"enum.expand-media.hide" = "Nunca";
"enum.expand-media.hide-sensitive" = "Ocultar contenido sensible";

View File

@ -187,6 +187,9 @@
"settings.display.section.font" = "Letra-tipoa";
"settings.section.cache" = "Cache";
"settings.cache-media.clear" = "Clear Media Cache";
"enum.expand-media.show" = "Erakutsi guztia";
"enum.expand-media.hide" = "Ezkutatu guztia";
"enum.expand-media.hide-sensitive" = "Ezkutatu hunkigarria";

View File

@ -190,6 +190,9 @@
"settings.display.section.font" = "Police";
"settings.section.cache" = "Cache";
"settings.cache-media.clear" = "Clear Media Cache";
// MARK: Tabs
"tab.explore" = "Explorer";
"tab.federated" = "Fédéré";

View File

@ -190,6 +190,9 @@
"settings.display.section.font" = "Font";
"settings.section.cache" = "Cache";
"settings.cache-media.clear" = "Clear Media Cache";
// MARK: Tabs
"tab.explore" = "Esplora";
"tab.federated" = "Federazione";

View File

@ -190,6 +190,9 @@
"settings.display.section.font" = "フォント";
"settings.section.cache" = "Cache";
"settings.cache-media.clear" = "Clear Media Cache";
// MARK: Tabs
"tab.explore" = "探索";
"tab.federated" = "連合";

View File

@ -190,6 +190,9 @@
"settings.display.section.font" = "글꼴";
"settings.section.cache" = "Cache";
"settings.cache-media.clear" = "Clear Media Cache";
// MARK: Tabs
"tab.explore" = "둘러보기";
"tab.federated" = "연합";

View File

@ -190,6 +190,9 @@
"settings.display.section.font" = "Font";
"settings.section.cache" = "Cache";
"settings.cache-media.clear" = "Clear Media Cache";
// MARK: Tabs
"tab.explore" = "Utforsk";
"tab.federated" = "Federert";

View File

@ -187,6 +187,9 @@
"settings.display.section.font" = "Lettertype";
"settings.section.cache" = "Cache";
"settings.cache-media.clear" = "Clear Media Cache";
// MARK: Tabs
"tab.explore" = "Ontdekken";
"tab.federated" = "Gefedereerd";

View File

@ -190,6 +190,9 @@
"settings.display.section.font" = "Czcionka";
"settings.section.cache" = "Cache";
"settings.cache-media.clear" = "Clear Media Cache";
// MARK: Tabs
"tab.explore" = "Odkrywaj";
"tab.federated" = "Globalny";

View File

@ -190,6 +190,9 @@
"settings.display.section.font" = "Fonte";
"settings.section.cache" = "Cache";
"settings.cache-media.clear" = "Clear Media Cache";
// MARK: Tabs
"tab.explore" = "Explorar";
"tab.federated" = "Linha global";

View File

@ -190,6 +190,9 @@
"settings.display.section.font" = "Font";
"settings.section.cache" = "Cache";
"settings.cache-media.clear" = "Clear Media Cache";
// MARK: Tabs
"tab.explore" = "Keşfet";
"tab.federated" = "Birleştirilmiş";

View File

@ -191,6 +191,9 @@
"settings.display.section.font" = "Шрифти";
"settings.section.cache" = "Cache";
"settings.cache-media.clear" = "Clear Media Cache";
// MARK: Tabs
"tab.explore" = "Огляд";
"tab.federated" = "Глобальна";

View File

@ -188,6 +188,9 @@
"settings.display.section.font" = "字体";
"settings.section.cache" = "Cache";
"settings.cache-media.clear" = "Clear Media Cache";
// MARK: Tabs
"tab.explore" = "探索";
"tab.federated" = "跨站";