mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
updated the UI for the live locations distance to match designs.
This commit is contained in:
@@ -283,9 +283,9 @@
|
|||||||
<key>NSStringFormatValueTypeKey</key>
|
<key>NSStringFormatValueTypeKey</key>
|
||||||
<string>d</string>
|
<string>d</string>
|
||||||
<key>one</key>
|
<key>one</key>
|
||||||
<string>%1$d meter</string>
|
<string>Every %1$d meter</string>
|
||||||
<key>other</key>
|
<key>other</key>
|
||||||
<string>%1$d meters</string>
|
<string>Every %1$d meters</string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>NSStringLocalizedFormatKey</key>
|
<key>NSStringLocalizedFormatKey</key>
|
||||||
<string>%#@COUNT@</string>
|
<string>%#@COUNT@</string>
|
||||||
|
|||||||
+1
@@ -61,6 +61,7 @@ protocol AdvancedSettingsProtocol: AnyObject {
|
|||||||
var sharePresence: Bool { get set }
|
var sharePresence: Bool { get set }
|
||||||
var optimizeMediaUploads: Bool { get set }
|
var optimizeMediaUploads: Bool { get set }
|
||||||
var liveLocationMinimumDistanceUpdate: Int { get set }
|
var liveLocationMinimumDistanceUpdate: Int { get set }
|
||||||
|
var liveLocationSharingEnabled: Bool { get set }
|
||||||
}
|
}
|
||||||
|
|
||||||
extension AppSettings: AdvancedSettingsProtocol { }
|
extension AppSettings: AdvancedSettingsProtocol { }
|
||||||
|
|||||||
+52
-11
@@ -10,6 +10,13 @@ import Compound
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct AdvancedSettingsScreen: View {
|
struct AdvancedSettingsScreen: View {
|
||||||
|
static let measurementFormatter = {
|
||||||
|
let formatter = MeasurementFormatter()
|
||||||
|
formatter.unitOptions = .providedUnit
|
||||||
|
formatter.unitStyle = .short
|
||||||
|
return formatter
|
||||||
|
}()
|
||||||
|
|
||||||
@Bindable var context: AdvancedSettingsScreenViewModel.Context
|
@Bindable var context: AdvancedSettingsScreenViewModel.Context
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
@@ -37,7 +44,9 @@ struct AdvancedSettingsScreen: View {
|
|||||||
|
|
||||||
moderationAndSafetySection
|
moderationAndSafetySection
|
||||||
timelineMediaSection
|
timelineMediaSection
|
||||||
liveLocationSection
|
if context.liveLocationSharingEnabled {
|
||||||
|
liveLocationSection
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.compoundList()
|
.compoundList()
|
||||||
.navigationTitle(L10n.commonAdvancedSettings)
|
.navigationTitle(L10n.commonAdvancedSettings)
|
||||||
@@ -86,15 +95,41 @@ struct AdvancedSettingsScreen: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
private var liveLocationSection: some View {
|
private var liveLocationSection: some View {
|
||||||
|
let binding = Binding(get: {
|
||||||
|
Double(context.liveLocationMinimumDistanceUpdate)
|
||||||
|
}, set: { newValue in
|
||||||
|
context.liveLocationMinimumDistanceUpdate = Int(newValue)
|
||||||
|
})
|
||||||
|
|
||||||
Section {
|
Section {
|
||||||
ListRow(kind: .custom {
|
ListRow(kind: .custom {
|
||||||
Stepper(L10n.screenAdvancedSettingsLiveLocationUpdateDistance(context.liveLocationMinimumDistanceUpdate),
|
VStack(alignment: .leading, spacing: 0) {
|
||||||
value: $context.liveLocationMinimumDistanceUpdate, in: 1...100)
|
Text(L10n.screenAdvancedSettingsLiveLocationUpdateDistance(context.liveLocationMinimumDistanceUpdate))
|
||||||
.font(.compound.bodyLG)
|
.font(.compound.bodyLG)
|
||||||
.foregroundStyle(.compound.textPrimary)
|
.foregroundStyle(.compound.textPrimary)
|
||||||
.padding(.horizontal, ListRowPadding.horizontal)
|
// The internal hidden label of the slider will read voice over
|
||||||
.padding(.vertical, ListRowPadding.vertical)
|
.accessibilityHidden(true)
|
||||||
|
Slider(value: binding, in: 1...100) {
|
||||||
|
Text(L10n.screenAdvancedSettingsLiveLocationUpdateDistance(context.liveLocationMinimumDistanceUpdate))
|
||||||
|
} minimumValueLabel: {
|
||||||
|
Text(Self.measurementFormatter.string(from: .init(value: 1,
|
||||||
|
unit: UnitLength.meters)))
|
||||||
|
.font(.compound.bodyLG)
|
||||||
|
.foregroundStyle(.compound.textSecondary)
|
||||||
|
.padding(.trailing, 15)
|
||||||
|
} maximumValueLabel: {
|
||||||
|
Text(Self.measurementFormatter.string(from: .init(value: 100,
|
||||||
|
unit: UnitLength.meters)))
|
||||||
|
.font(.compound.bodyLG)
|
||||||
|
.foregroundStyle(.compound.textSecondary)
|
||||||
|
.padding(.leading, 15)
|
||||||
|
}
|
||||||
|
.tint(.compound.iconAccentPrimary)
|
||||||
|
}
|
||||||
|
.padding(.horizontal, ListRowPadding.horizontal)
|
||||||
|
.padding(.vertical, ListRowPadding.vertical)
|
||||||
})
|
})
|
||||||
} header: {
|
} header: {
|
||||||
VStack(alignment: .leading, spacing: 4) {
|
VStack(alignment: .leading, spacing: 4) {
|
||||||
@@ -127,10 +162,16 @@ private extension AppAppearance {
|
|||||||
// MARK: - Previews
|
// MARK: - Previews
|
||||||
|
|
||||||
struct AdvancedSettingsScreen_Previews: PreviewProvider, TestablePreview {
|
struct AdvancedSettingsScreen_Previews: PreviewProvider, TestablePreview {
|
||||||
static let viewModel = AdvancedSettingsScreenViewModel(advancedSettings: ServiceLocator.shared.settings,
|
static let viewModel = {
|
||||||
analytics: ServiceLocator.shared.analytics,
|
AppSettings.resetAllSettings()
|
||||||
clientProxy: ClientProxyMock(.init()),
|
let appSettings = AppSettings()
|
||||||
userIndicatorController: UserIndicatorControllerMock())
|
appSettings.liveLocationSharingEnabled = true
|
||||||
|
return AdvancedSettingsScreenViewModel(advancedSettings: appSettings,
|
||||||
|
analytics: ServiceLocator.shared.analytics,
|
||||||
|
clientProxy: ClientProxyMock(.init()),
|
||||||
|
userIndicatorController: UserIndicatorControllerMock())
|
||||||
|
}()
|
||||||
|
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
ElementNavigationStack {
|
ElementNavigationStack {
|
||||||
AdvancedSettingsScreen(context: viewModel.context)
|
AdvancedSettingsScreen(context: viewModel.context)
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ class LiveLocationManager: NSObject, LiveLocationManagerProtocol, CLLocationMana
|
|||||||
|
|
||||||
appSettings.$liveLocationMinimumDistanceUpdate
|
appSettings.$liveLocationMinimumDistanceUpdate
|
||||||
.removeDuplicates()
|
.removeDuplicates()
|
||||||
.debounce(for: .seconds(3), scheduler: DispatchQueue.main)
|
.debounce(for: .seconds(1), scheduler: DispatchQueue.main)
|
||||||
.sink { [weak self] minimumDistance in
|
.sink { [weak self] minimumDistance in
|
||||||
self?.setupMinimumDistance(minimumDistance)
|
self?.setupMinimumDistance(minimumDistance)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:c30282bd1093590cb60fda722552305473fd3cacad999bed81044c2eccc9d57c
|
oid sha256:7cf54519ba66ea01ee0fbb2cac517ad99bdb0018409d6a70e66c5d6f383ecf8f
|
||||||
size 171794
|
size 192815
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:3d02782eb9595efd43c2fff296316cae7b350ef8bb9d14aefabefcbef29f0da7
|
oid sha256:5f9ebe7f8b2081eaa353a8c6cc491d9667e9d58785d792d05dceb1c6b499285c
|
||||||
size 211907
|
size 241765
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:497c7f492ee43082bb72ec58ff20353e72d33be936b66ff9478eda5b653332a0
|
oid sha256:0727ef553dcdd695436b11d8f167d035636678dddeaf55326b23ed88060b0ec3
|
||||||
size 125423
|
size 136037
|
||||||
|
|||||||
Reference in New Issue
Block a user