mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-25 11:02:48 +02:00
6071: Add timeout selector when start live sharing
This commit is contained in:
@@ -20,11 +20,21 @@ import CoreLocation
|
||||
@available(iOS 14.0, *)
|
||||
struct LocationSharingView: View {
|
||||
|
||||
// MARK: - Constants
|
||||
|
||||
private enum Constants {
|
||||
// Timer are in milliseconde because timestamp are in millisecond in Matrix SDK
|
||||
static let liveLocationSharingShortTimeout: TimeInterval = 900000 // 15 minutes
|
||||
static let liveLocationSharingMediumTimeout: TimeInterval = 3600000 // 1 hour
|
||||
static let liveLocationSharingLongTimeout: TimeInterval = 28800000 // 8 hours
|
||||
}
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
||||
@Environment(\.theme) private var theme: ThemeSwiftUI
|
||||
@State private var showingTimerSelector = false
|
||||
|
||||
// MARK: Public
|
||||
|
||||
@@ -112,7 +122,7 @@ struct LocationSharingView: View {
|
||||
// Hide for now until live location sharing is finished
|
||||
if context.viewState.isLiveLocationSharingEnabled {
|
||||
LocationSharingOptionButton(text: VectorL10n.locationSharingLiveShareTitle) {
|
||||
context.send(viewAction: .shareLiveLocation)
|
||||
showingTimerSelector = true
|
||||
} buttonIcon: {
|
||||
Image(uiImage: Asset.Images.locationLiveIcon.image)
|
||||
.resizable()
|
||||
@@ -129,6 +139,24 @@ struct LocationSharingView: View {
|
||||
.disabled(!context.viewState.shareButtonEnabled)
|
||||
}
|
||||
}
|
||||
.actionSheet(isPresented: $showingTimerSelector) {
|
||||
ActionSheet(title: Text(VectorL10n.locationSharingLiveTimerSelectorTitle),
|
||||
buttons: [
|
||||
.default(Text(VectorL10n.locationSharingLiveTimerSelectorShort)) {
|
||||
context.send(viewAction: .shareLiveLocation(timeout: Constants.liveLocationSharingShortTimeout))
|
||||
|
||||
},
|
||||
.default(Text(VectorL10n.locationSharingLiveTimerSelectorMedium)) {
|
||||
context.send(viewAction: .shareLiveLocation(timeout: Constants.liveLocationSharingMediumTimeout))
|
||||
|
||||
},
|
||||
.default(Text(VectorL10n.locationSharingLiveTimerSelectorLong)) {
|
||||
context.send(viewAction: .shareLiveLocation(timeout: Constants.liveLocationSharingLongTimeout))
|
||||
|
||||
},
|
||||
.cancel()
|
||||
])
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user