wip
This commit is contained in:
parent
dfa048e918
commit
170c0daa5b
|
@ -66,4 +66,5 @@
|
||||||
"Attachment.Tab.location" = "Location";
|
"Attachment.Tab.location" = "Location";
|
||||||
"Attachment.Tab.contacts" = "Contacts";
|
"Attachment.Tab.contacts" = "Contacts";
|
||||||
"Attachment.Send.media" = "Send media";
|
"Attachment.Send.media" = "Send media";
|
||||||
|
"Attachment.Send.location" = "Send location";
|
||||||
|
|
||||||
|
|
|
@ -5,47 +5,44 @@ import SwiftUI
|
||||||
|
|
||||||
struct AttachmentLocationPickerView: View {
|
struct AttachmentLocationPickerView: View {
|
||||||
@State var region = MKCoordinateRegion()
|
@State var region = MKCoordinateRegion()
|
||||||
@State var userInteracting = false
|
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ZStack {
|
VStack(spacing: 0) {
|
||||||
if userInteracting {
|
// Map
|
||||||
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 {
|
|
||||||
Map(
|
Map(
|
||||||
coordinateRegion: $region,
|
coordinateRegion: $region,
|
||||||
interactionModes: .all,
|
interactionModes: .all,
|
||||||
showsUserLocation: false,
|
showsUserLocation: false,
|
||||||
userTrackingMode: .constant(.follow)
|
userTrackingMode: .constant(.follow)
|
||||||
)
|
)
|
||||||
.gesture(DragGesture().onChanged { _ in
|
.overlay {
|
||||||
userInteracting = true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
Image(systemName: "mappin")
|
Image(systemName: "mappin")
|
||||||
.font(.system(size: 30))
|
.font(.system(size: 30))
|
||||||
.foregroundColor(.Material.Elements.active)
|
.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