Add proxy video setting to macOS

This commit is contained in:
Arkadiusz Fal 2022-08-16 23:23:22 +02:00
parent 3a508b98ab
commit 10fb417d87

View File

@ -13,6 +13,7 @@ struct InstancesSettings: View {
@State private var presentingInstanceRemovalConfirmation = false
@State private var frontendURL = ""
@State private var proxiesVideos = false
@Environment(\.colorScheme) private var colorScheme
@EnvironmentObject<AccountsModel> private var accounts
@ -98,6 +99,16 @@ struct InstancesSettings: View {
.foregroundColor(.secondary)
}
if selectedInstance != nil, selectedInstance.app.allowsDisablingVidoesProxying {
proxiesVideosToggle
.onAppear {
proxiesVideos = selectedInstance.proxiesVideos
}
.onChange(of: proxiesVideos) { newValue in
InstancesModel.setProxiesVideos(selectedInstance, newValue)
}
}
if selectedInstance != nil, !selectedInstance.app.supportsAccounts {
Spacer()
Text("Accounts are not supported for the application of this instance")
@ -177,6 +188,10 @@ struct InstancesSettings: View {
return InstancesModel.accounts(selectedInstanceID)
}
private var proxiesVideosToggle: some View {
Toggle("Proxy videos", isOn: $proxiesVideos)
}
}
struct InstancesSettingsView_Previews: PreviewProvider {