mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
allow users to set live location minimum distance update
This commit is contained in:
+21
-2
@@ -7,12 +7,30 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
struct AdvancedSettingsScreenViewState: BindableState {
|
||||
init(timelineMediaVisibility: TimelineMediaVisibility, hideInviteAvatars: Bool, isWaitingTimelineMediaVisibility: Bool = false, isWaitingHideInviteAvatars: Bool = false, bindings: AdvancedSettingsScreenViewStateBindings) {
|
||||
self.timelineMediaVisibility = timelineMediaVisibility
|
||||
self.hideInviteAvatars = hideInviteAvatars
|
||||
self.isWaitingTimelineMediaVisibility = isWaitingTimelineMediaVisibility
|
||||
self.isWaitingHideInviteAvatars = isWaitingHideInviteAvatars
|
||||
self.bindings = bindings
|
||||
|
||||
let linkPlaceholder = "{link}"
|
||||
var footerString = AttributedString(L10n.screenAdvancedSettingsLiveLocationSectionFooter(linkPlaceholder))
|
||||
var linkString = AttributedString(L10n.screenAdvancedSettingsLiveLocationSectionFooterLink)
|
||||
linkString.link = URL(string: UIApplication.openSettingsURLString)
|
||||
linkString.bold()
|
||||
footerString.replace(linkPlaceholder, with: linkString)
|
||||
liveLocationUpdateFooterAttributedString = footerString
|
||||
}
|
||||
|
||||
let liveLocationUpdateFooterAttributedString: AttributedString
|
||||
var timelineMediaVisibility: TimelineMediaVisibility
|
||||
var hideInviteAvatars: Bool
|
||||
var isWaitingTimelineMediaVisibility = false
|
||||
var isWaitingHideInviteAvatars = false
|
||||
var isWaitingTimelineMediaVisibility: Bool
|
||||
var isWaitingHideInviteAvatars: Bool
|
||||
var bindings: AdvancedSettingsScreenViewStateBindings
|
||||
}
|
||||
|
||||
@@ -42,6 +60,7 @@ protocol AdvancedSettingsProtocol: AnyObject {
|
||||
var appAppearance: AppAppearance { get set }
|
||||
var sharePresence: Bool { get set }
|
||||
var optimizeMediaUploads: Bool { get set }
|
||||
var liveLocationMinimumDistanceUpdate: Int { get set }
|
||||
}
|
||||
|
||||
extension AppSettings: AdvancedSettingsProtocol { }
|
||||
|
||||
+25
@@ -37,6 +37,7 @@ struct AdvancedSettingsScreen: View {
|
||||
|
||||
moderationAndSafetySection
|
||||
timelineMediaSection
|
||||
liveLocationSection
|
||||
}
|
||||
.compoundList()
|
||||
.navigationTitle(L10n.commonAdvancedSettings)
|
||||
@@ -84,6 +85,30 @@ struct AdvancedSettingsScreen: View {
|
||||
.compoundListSectionFooter()
|
||||
}
|
||||
}
|
||||
|
||||
private var liveLocationSection: some View {
|
||||
Section {
|
||||
ListRow(kind: .custom {
|
||||
Stepper(L10n.screenAdvancedSettingsLiveLocationUpdateDistance(context.liveLocationMinimumDistanceUpdate),
|
||||
value: $context.liveLocationMinimumDistanceUpdate, in: 1...100)
|
||||
.font(.compound.bodyLG)
|
||||
.foregroundStyle(.compound.textPrimary)
|
||||
.padding(.horizontal, ListRowPadding.horizontal)
|
||||
.padding(.vertical, ListRowPadding.vertical)
|
||||
})
|
||||
} header: {
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
Text(L10n.screenAdvancedSettingsLiveLocationSectionTitle)
|
||||
.compoundListSectionHeader()
|
||||
Text(L10n.screenAdvancedSettingsLiveLocationSectionDescription)
|
||||
.font(.compound.bodyMD)
|
||||
.foregroundStyle(.compound.textSecondary)
|
||||
}
|
||||
} footer: {
|
||||
Text(context.viewState.liveLocationUpdateFooterAttributedString)
|
||||
.compoundListSectionFooter()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private extension AppAppearance {
|
||||
|
||||
Reference in New Issue
Block a user