Open Live Locations map on tapping on the banner (#5477)

* Implemented opening the LLS on our own user when tapping on the banner

* added a test for moving the map as soon as the first update arrives.

* updated preview tests
This commit is contained in:
Mauro
2026-04-24 13:19:07 +02:00
committed by GitHub
parent 5d1132c75b
commit ef26796d98
12 changed files with 104 additions and 27 deletions
@@ -9,19 +9,22 @@ import Compound
import SwiftUI
struct LiveLocationSharingBannerView: View {
var onTap: () -> Void
var onStop: () -> Void
var body: some View {
HStack(spacing: 9) {
CompoundIcon(\.locationPinSolid, size: .medium, relativeTo: .compound.bodyMDSemibold)
.foregroundColor(Color.compound.iconSuccessPrimary)
.accessibilityHidden(true)
Text(L10n.screenRoomLiveLocationBanner)
.font(.compound.bodyMDSemibold)
.foregroundColor(.compound.textPrimary)
Spacer()
Button(L10n.actionStop, role: .destructive, action: onStop)
.buttonStyle(.compound(.primary, size: .small))
Button { onTap() } label: {
HStack(spacing: 9) {
CompoundIcon(\.locationPinSolid, size: .medium, relativeTo: .compound.bodyMDSemibold)
.foregroundColor(Color.compound.iconSuccessPrimary)
.accessibilityHidden(true)
Text(L10n.screenRoomLiveLocationBanner)
.font(.compound.bodyMDSemibold)
.foregroundColor(.compound.textPrimary)
Spacer()
Button(L10n.actionStop, role: .destructive, action: onStop)
.buttonStyle(.compound(.primary, size: .small))
}
}
.padding(.vertical, 16)
.padding(.horizontal, 15)
@@ -33,7 +36,7 @@ struct LiveLocationSharingBannerView: View {
struct LiveLocationSharingBannerView_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
LiveLocationSharingBannerView { }
LiveLocationSharingBannerView { } onStop: { }
.previewLayout(.sizeThatFits)
}
}
@@ -88,6 +88,8 @@ struct RoomScreen: View {
private var liveLocationBanner: some View {
LiveLocationSharingBannerView {
context.send(viewAction: .tappedOpenLiveLocation)
} onStop: {
context.send(viewAction: .tappedStopLiveLocation)
}
}