Files
letro-ios/ElementX/Sources/Screens/Settings/AvancedOptionsScreen/View/AdvancedSettingsScreen.swift
Doug a141adbd1f Enable the Optimised Media Uploads feature. (#3467)
* Enable the Optimised Media Uploads feature.

(Well move the toggle from Developer Options to Advanced Settings)

* Add OptimizeMediaUploads analytics.

* Final strings.

* Upload reduced quality media by default 😢

Move the setting out of the feature flags section in the file.

* Fix unit tests now the default has changed.

* Pull in updated string, fix snapshots.
2024-10-31 14:14:14 +00:00

67 lines
2.4 KiB
Swift

//
// Copyright 2022-2024 New Vector Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only
// Please see LICENSE in the repository root for full details.
//
import Compound
import SwiftUI
struct AdvancedSettingsScreen: View {
@ObservedObject var context: AdvancedSettingsScreenViewModel.Context
var body: some View {
Form {
Section {
ListRow(label: .plain(title: L10n.commonAppearance),
kind: .picker(selection: $context.appAppearance,
items: AppAppearance.allCases.map { (title: $0.name, tag: $0) }))
ListRow(label: .plain(title: L10n.actionViewSource,
description: L10n.screenAdvancedSettingsViewSourceDescription),
kind: .toggle($context.viewSourceEnabled))
ListRow(label: .plain(title: L10n.screenAdvancedSettingsSharePresence,
description: L10n.screenAdvancedSettingsSharePresenceDescription),
kind: .toggle($context.sharePresence))
ListRow(label: .plain(title: L10n.screenAdvancedSettingsMediaCompressionTitle,
description: L10n.screenAdvancedSettingsMediaCompressionDescription),
kind: .toggle($context.optimizeMediaUploads))
.onChange(of: context.optimizeMediaUploads) {
context.send(viewAction: .optimizeMediaUploadsChanged)
}
}
}
.compoundList()
.navigationTitle(L10n.commonAdvancedSettings)
.navigationBarTitleDisplayMode(.inline)
}
}
private extension AppAppearance {
var name: String {
switch self {
case .system:
return L10n.commonSystem
case .light:
return L10n.commonLight
case .dark:
return L10n.commonDark
}
}
}
// MARK: - Previews
struct AdvancedSettingsScreen_Previews: PreviewProvider, TestablePreview {
static let viewModel = AdvancedSettingsScreenViewModel(advancedSettings: ServiceLocator.shared.settings,
analytics: ServiceLocator.shared.analytics)
static var previews: some View {
NavigationStack {
AdvancedSettingsScreen(context: viewModel.context)
}
}
}