Add hide videos without duration setting to macOS instance settings

Added the "Experimental: Hide videos without duration" toggle to the
macOS instance settings view to match the iOS/tvOS implementation.
This commit is contained in:
Arkadiusz Fal
2025-11-22 22:54:45 +01:00
parent 2e27dcd2cf
commit 660891f2a5

View File

@@ -12,6 +12,7 @@ struct InstancesSettings: View {
@State private var frontendURL = ""
@State private var proxiesVideos = false
@State private var invidiousCompanion = false
@State private var hideVideosWithoutDuration = false
@Environment(\.colorScheme) private var colorScheme
@ObservedObject private var accounts = AccountsModel.shared
@@ -109,6 +110,18 @@ struct InstancesSettings: View {
.onChange(of: invidiousCompanion) { newValue in
InstancesModel.shared.setInvidiousCompanion(selectedInstance, newValue)
}
hideVideosWithoutDurationToggle
.onAppear {
hideVideosWithoutDuration = selectedInstance.hideVideosWithoutDuration
}
.onChange(of: hideVideosWithoutDuration) { newValue in
InstancesModel.shared.setHideVideosWithoutDuration(selectedInstance, newValue)
}
Text("This can be used to hide shorts")
.font(.caption)
.foregroundColor(.secondary)
}
if selectedInstance != nil, !selectedInstance.app.supportsAccounts {
@@ -201,6 +214,10 @@ struct InstancesSettings: View {
private var invidiousCompanionToggle: some View {
Toggle("Invidious companion", isOn: $invidiousCompanion)
}
private var hideVideosWithoutDurationToggle: some View {
Toggle("Experimental: Hide videos without duration", isOn: $hideVideosWithoutDuration)
}
}
struct InstancesSettingsView_Previews: PreviewProvider {