wip
This commit is contained in:
parent
dfa048e918
commit
170c0daa5b
|
@ -66,4 +66,5 @@
|
|||
"Attachment.Tab.location" = "Location";
|
||||
"Attachment.Tab.contacts" = "Contacts";
|
||||
"Attachment.Send.media" = "Send media";
|
||||
"Attachment.Send.location" = "Send location";
|
||||
|
||||
|
|
|
@ -5,47 +5,44 @@ import SwiftUI
|
|||
|
||||
struct AttachmentLocationPickerView: View {
|
||||
@State var region = MKCoordinateRegion()
|
||||
@State var userInteracting = false
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
if userInteracting {
|
||||
Map(
|
||||
coordinateRegion: $region,
|
||||
interactionModes: .all,
|
||||
showsUserLocation: false,
|
||||
userTrackingMode: .constant(.none)
|
||||
)
|
||||
.overlay {
|
||||
VStack {
|
||||
Spacer()
|
||||
HStack {
|
||||
Spacer()
|
||||
Image(systemName: "location.north.circle.fill")
|
||||
.resizable()
|
||||
.frame(width: 30, height: 30)
|
||||
.foregroundColor(.Material.Elements.active)
|
||||
.padding()
|
||||
.tappablePadding(.symmetric(10)) {
|
||||
userInteracting = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
VStack(spacing: 0) {
|
||||
// Map
|
||||
Map(
|
||||
coordinateRegion: $region,
|
||||
interactionModes: .all,
|
||||
showsUserLocation: false,
|
||||
userTrackingMode: .constant(.follow)
|
||||
)
|
||||
.gesture(DragGesture().onChanged { _ in
|
||||
userInteracting = true
|
||||
})
|
||||
}
|
||||
.overlay {
|
||||
Image(systemName: "mappin")
|
||||
.font(.system(size: 30))
|
||||
.foregroundColor(.Material.Elements.active)
|
||||
}
|
||||
|
||||
// Send panel
|
||||
Rectangle()
|
||||
.foregroundColor(.Material.Shape.black)
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(height: 50)
|
||||
.overlay {
|
||||
HStack {
|
||||
Text(L10n.Attachment.Send.location)
|
||||
.foregroundColor(.Material.Text.white)
|
||||
.font(.body1)
|
||||
Image(systemName: "arrow.up.circle")
|
||||
.foregroundColor(.Material.Text.white)
|
||||
.font(.body1)
|
||||
.padding(.leading, 8)
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
.clipped()
|
||||
.onTapGesture {
|
||||
// TODO: Send location
|
||||
print("Send location")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
11
ConversationsClassic/View/UIToolkit/View+If.swift
Normal file
11
ConversationsClassic/View/UIToolkit/View+If.swift
Normal file
|
@ -0,0 +1,11 @@
|
|||
import SwiftUI
|
||||
|
||||
public extension View {
|
||||
@ViewBuilder func `if`<Content: View>(_ condition: @autoclosure () -> Bool, transform: (Self) -> Content) -> some View {
|
||||
if condition() {
|
||||
transform(self)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue