Live Location Sharing Banner (#5370)

* Live Location Sharing Banner

# Conflicts:
#	ElementX.xcodeproj/project.pbxproj

* updated the top banner modifier and the top banner views

# Conflicts:
#	ElementX/Resources/Localizations/en-US.lproj/Localizable.strings
#	ElementX/Resources/Localizations/en.lproj/Localizable.strings

* improved the stopping function from the timeline item

* stop live location sharing before starting a new one.

* added some tests for LiveLocationManager

* pr suggestions
This commit is contained in:
Mauro
2026-04-10 14:50:42 +02:00
committed by GitHub
parent 148b292ca6
commit 922fcafcd5
47 changed files with 413 additions and 83 deletions
@@ -35,17 +35,27 @@ struct RoomScreen: View {
}
.background(Color.compound.bgCanvasDefault.ignoresSafeArea())
.topBanners([
TopBannerItem(pinnedItemsBanner, isVisible: context.viewState.shouldShowPinnedEventsBanner && !isVoiceOverEnabled),
// This can overlay on top of the pinnedItemsBanner
TopBannerItem(knockRequestsBanner, isVisible: context.viewState.shouldSeeKnockRequests)
TopBannerLayer(verticalBanners: [
TopBannerItem(pinnedItemsBanner, isVisible: context.viewState.shouldShowPinnedEventsBanner && !isVoiceOverEnabled),
TopBannerItem(liveLocationBanner, isVisible: context.viewState.isSharingLiveLocation && !isVoiceOverEnabled)
]),
// This can overlay on top of the stacked banners
TopBannerLayer(knockRequestsBanner, isVisible: context.viewState.shouldSeeKnockRequests)
], footer: dateBadge)
.safeAreaInset(edge: .top) {
// When VoiceOver is enabled, the table view isn't reversed and the scroll gestures
// don't trigger meaning the banner never hides itself and so the .overlay layout
// above permanently obscures the top of the timeline. So whenever VoiceOver is
// enabled we use a safe area inset to vertically stack it above the timeline.
if context.viewState.shouldShowPinnedEventsBanner, isVoiceOverEnabled {
pinnedItemsBanner
if context.viewState.shouldShowPinnedEventsBanner || context.viewState.isSharingLiveLocation, isVoiceOverEnabled {
VStack(spacing: 0) {
if context.viewState.shouldShowPinnedEventsBanner {
pinnedItemsBanner
}
if context.viewState.isSharingLiveLocation {
liveLocationBanner
}
}
}
}
.safeAreaInset(edge: .bottom, spacing: 0) {
@@ -76,6 +86,12 @@ struct RoomScreen: View {
.sentryTrace("\(Self.self)")
}
private var liveLocationBanner: some View {
LiveLocationSharingBannerView {
context.send(viewAction: .tappedStopLiveLocation)
}
}
private var pinnedItemsBanner: some View {
PinnedItemsBannerView(state: context.viewState.pinnedEventsBannerState,
onMainButtonTap: { context.send(viewAction: .tappedPinnedEventsBanner) },