mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Feed cache
This commit is contained in:
@@ -11,9 +11,9 @@ struct AdvancedSettings: View {
|
||||
|
||||
@State private var countries = [String]()
|
||||
@State private var filesToShare = [MPVClient.logFile]
|
||||
@State private var presentingInstanceForm = false
|
||||
@State private var presentingShareSheet = false
|
||||
@State private var savedFormInstanceID: Instance.ID?
|
||||
|
||||
private var settings = SettingsModel.shared
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
@@ -36,9 +36,6 @@ struct AdvancedSettings: View {
|
||||
.onChange(of: countryOfPublicInstances) { newCountry in
|
||||
InstancesManifest.shared.setPublicAccount(newCountry, asCurrent: AccountsModel.shared.current?.isPublic ?? true)
|
||||
}
|
||||
.sheet(isPresented: $presentingInstanceForm) {
|
||||
InstanceForm(savedInstanceID: $savedFormInstanceID)
|
||||
}
|
||||
#if os(tvOS)
|
||||
.frame(maxWidth: 1000)
|
||||
#endif
|
||||
@@ -87,6 +84,11 @@ struct AdvancedSettings: View {
|
||||
logButton
|
||||
}
|
||||
}
|
||||
|
||||
Section(header: SettingsHeader(text: "Cache")) {
|
||||
clearCacheButton
|
||||
cacheSize
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder var mpvFooter: some View {
|
||||
@@ -128,13 +130,27 @@ struct AdvancedSettings: View {
|
||||
}
|
||||
#endif
|
||||
|
||||
private var addInstanceButton: some View {
|
||||
private var clearCacheButton: some View {
|
||||
Button {
|
||||
presentingInstanceForm = true
|
||||
settings.presentAlert(
|
||||
Alert(
|
||||
title: Text(
|
||||
"Are you sure you want to clear cache?"
|
||||
),
|
||||
primaryButton: .destructive(Text("Clear"), action: CacheModel.shared.clear),
|
||||
secondaryButton: .cancel()
|
||||
)
|
||||
)
|
||||
} label: {
|
||||
Label("Add Location...", systemImage: "plus")
|
||||
Text("Clear all")
|
||||
.foregroundColor(.red)
|
||||
}
|
||||
}
|
||||
|
||||
var cacheSize: some View {
|
||||
Text(String(format: "Total size: %@", CacheModel.shared.totalSizeFormatted))
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
}
|
||||
|
||||
struct AdvancedSettings_Previews: PreviewProvider {
|
||||
|
@@ -164,7 +164,9 @@ struct HistorySettings: View {
|
||||
|
||||
struct HistorySettings_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
HistorySettings()
|
||||
.injectFixtureEnvironmentObjects()
|
||||
VStack(alignment: .leading) {
|
||||
HistorySettings()
|
||||
}
|
||||
.frame(minHeight: 500)
|
||||
}
|
||||
}
|
||||
|
@@ -231,7 +231,7 @@ struct SettingsView: View {
|
||||
case .locations:
|
||||
return 600
|
||||
case .advanced:
|
||||
return 250
|
||||
return 350
|
||||
case .help:
|
||||
return 650
|
||||
}
|
||||
|
Reference in New Issue
Block a user