mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Cache settings
This commit is contained in:
@@ -6,8 +6,8 @@ struct AdvancedSettings: View {
|
||||
@Default(.mpvCacheSecs) private var mpvCacheSecs
|
||||
@Default(.mpvCachePauseWait) private var mpvCachePauseWait
|
||||
@Default(.mpvEnableLogging) private var mpvEnableLogging
|
||||
@Default(.countryOfPublicInstances) private var countryOfPublicInstances
|
||||
@Default(.instances) private var instances
|
||||
@Default(.showCacheStatus) private var showCacheStatus
|
||||
@Default(.feedCacheSize) private var feedCacheSize
|
||||
|
||||
@State private var countries = [String]()
|
||||
@State private var filesToShare = [MPVClient.logFile]
|
||||
@@ -33,9 +33,6 @@ struct AdvancedSettings: View {
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
.onChange(of: countryOfPublicInstances) { newCountry in
|
||||
InstancesManifest.shared.setPublicAccount(newCountry, asCurrent: AccountsModel.shared.current?.isPublic ?? true)
|
||||
}
|
||||
#if os(tvOS)
|
||||
.frame(maxWidth: 1000)
|
||||
#endif
|
||||
@@ -85,9 +82,10 @@ struct AdvancedSettings: View {
|
||||
}
|
||||
}
|
||||
|
||||
Section(header: SettingsHeader(text: "Cache")) {
|
||||
Section(header: SettingsHeader(text: "Cache"), footer: cacheSize) {
|
||||
showCacheStatusToggle
|
||||
feedCacheSizeTextField
|
||||
clearCacheButton
|
||||
cacheSize
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,6 +128,22 @@ struct AdvancedSettings: View {
|
||||
}
|
||||
#endif
|
||||
|
||||
private var feedCacheSizeTextField: some View {
|
||||
HStack {
|
||||
Text("Maximum feed items")
|
||||
.frame(minWidth: 200, alignment: .leading)
|
||||
TextField("Limit", text: $feedCacheSize)
|
||||
#if !os(macOS)
|
||||
.keyboardType(.numberPad)
|
||||
#endif
|
||||
}
|
||||
.multilineTextAlignment(.trailing)
|
||||
}
|
||||
|
||||
private var showCacheStatusToggle: some View {
|
||||
Toggle("Show cache status", isOn: $showCacheStatus)
|
||||
}
|
||||
|
||||
private var clearCacheButton: some View {
|
||||
Button {
|
||||
settings.presentAlert(
|
||||
|
Reference in New Issue
Block a user