Skip to content

Commit d4e1de0

Browse files
committed
Added attributions on the map
1 parent 86e79ed commit d4e1de0

1 file changed

Lines changed: 27 additions & 10 deletions

File tree

GoInfoGame/GoInfoGame/UI/Map/MapView.swift

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ struct MapView: View {
5757
@State private var shadowOverlay = ShadowOverlay()
5858

5959
@State private var showUndoSidebar = false
60+
@State private var shatilliteSelected: String? = nil
6061

6162

6263
var body: some View {
@@ -143,22 +144,38 @@ struct MapView: View {
143144
VStack {
144145
Spacer()
145146
HStack {
146-
UndoButton(
147-
onPreview: { id, type in
148-
149-
147+
VStack(alignment: .leading) {
148+
UndoButton(
149+
onPreview: { id, type in
150150
// if let element = DatabaseConnector.shared.getElement(withId: id, type: type) {
151151
// let annotation = DisplayUnitAnnotation(element: element)
152152
// mapViewRef?.addAnnotation(annotation)
153153
// mapViewRef?.setCenter(annotation.coordinate, animated: true)
154154
// }
155-
},
156-
onRemovePreview: {
157-
},
158-
onRevert: { id in
159-
MapUndoManager.shared.undo(for: id)
155+
},
156+
onRemovePreview: {
157+
},
158+
onRevert: { id in
159+
MapUndoManager.shared.undo(for: id)
160+
}
161+
)
162+
if case .wmts(let server) = viewModel.selectedOption,
163+
server.attribution.attributionRequired,
164+
let url = URL(string: server.attribution.url),
165+
UIApplication.shared.canOpenURL(url) {
166+
Button(action: {
167+
UIApplication.shared.open(url)
168+
}) {
169+
Text(server.attribution.text)
170+
.background(.white.opacity(0.6))
171+
.foregroundColor(.black)
172+
.padding()
173+
.font(.system(size: 8, weight: .light))
174+
.cornerRadius(8)
175+
}
160176
}
161-
)
177+
178+
}
162179
.padding(.bottom, 24)
163180
.padding(.leading, 16)
164181
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottomLeading)

0 commit comments

Comments
 (0)