Send pin-drop location (#1179)

* add location sharing action in room, and open location sharing screen

* add pin location sharing

* fix asset, add tests for location viewModel, add send location request

* fix map zoom level, fix assets for location

* add feature flag for location sharing

* hide attribution button
This commit is contained in:
Flescio
2023-06-28 11:39:38 +02:00
committed by GitHub
parent e25ca2e120
commit 102e6a64fa
29 changed files with 548 additions and 42 deletions
@@ -66,7 +66,7 @@ struct TimelineReplyView: View {
ReplyView(sender: sender,
plainBody: L10n.commonSharedLocation,
formattedBody: nil,
icon: .init(kind: .icon(Asset.Images.locationPin.name), cornerRadii: iconCornerRadii))
icon: .init(kind: .icon(Asset.Images.locationMarker.name), cornerRadii: iconCornerRadii))
}
default:
LoadingReplyView()
@@ -37,21 +37,30 @@ struct RoomAttachmentPicker: View {
context.showAttachmentPopover = false
context.send(viewAction: .displayMediaPicker)
} label: {
PickerLabel(title: L10n.screenRoomAttachmentSourceGallery, systemImageName: "photo.fill")
PickerLabel(title: L10n.screenRoomAttachmentSourceGallery, icon: Image(systemName: "photo.fill"))
}
Button {
context.showAttachmentPopover = false
context.send(viewAction: .displayDocumentPicker)
} label: {
PickerLabel(title: L10n.screenRoomAttachmentSourceFiles, systemImageName: "paperclip")
PickerLabel(title: L10n.screenRoomAttachmentSourceFiles, icon: Image(systemName: "paperclip"))
}
Button {
context.showAttachmentPopover = false
context.send(viewAction: .displayCameraPicker)
} label: {
PickerLabel(title: L10n.screenRoomAttachmentSourceCamera, systemImageName: "camera.fill")
PickerLabel(title: L10n.screenRoomAttachmentSourceCamera, icon: Image(systemName: "camera.fill"))
}
if ServiceLocator.shared.settings.shareLocationEnabled {
Button {
context.showAttachmentPopover = false
context.send(viewAction: .displayLocationPicker)
} label: {
PickerLabel(title: L10n.screenRoomAttachmentSourceLocation, icon: Image(asset: Asset.Images.locationPin))
}
}
}
.padding(.top, isPresented ? 20 : 0)
@@ -73,14 +82,23 @@ struct RoomAttachmentPicker: View {
private struct PickerLabel: View {
let title: String
let systemImageName: String
let icon: Image
init(title: String, icon: Image) {
self.title = title
self.icon = icon
}
var body: some View {
Label(title, systemImage: systemImageName)
.labelStyle(FixedIconSizeLabelStyle())
.multilineTextAlignment(.leading)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(16)
Label {
Text(title)
} icon: {
icon
}
.labelStyle(FixedIconSizeLabelStyle())
.multilineTextAlignment(.leading)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(16)
}
}
}
@@ -25,7 +25,7 @@ struct LocationRoomTimelineView: View {
if let geoURI = timelineItem.content.geoURI {
let mapSize: CGSize = .init(width: 292, height: 188)
MapLibreStaticMapView(geoURI: geoURI, size: mapSize) {
LocationPinView()
LocationMarkerView()
}
.frame(width: mapSize.width, height: mapSize.height)
} else {