@@ -10,11 +10,11 @@ import MapKit
1010import Combine
1111
1212struct MapView : View {
13- let selectedWorkspace : Workspace ?
13+ let selectedWorkspace : Workspace
1414 @State var trackingMode : MapUserTrackingMode = MapUserTrackingMode . follow
1515 @Environment ( \. presentationMode) private var presentationMode
1616 @AppStorage ( " isMapFromOnboarding " ) var isMapFromOnboarding : Bool = false
17- @StateObject private var viewModel = MapViewModel ( )
17+ @StateObject var viewModel : MapViewModel
1818 @State private var isPresented = false
1919
2020 @State private var shouldShowPolyline = true
@@ -247,7 +247,7 @@ struct MapView: View {
247247 . font ( FontFamily . Lato. regular. swiftUIFont ( size: 12 ) )
248248 . foregroundStyle ( Asset . Colors. _83879BTextFiledTitle. swiftUIColor)
249249
250- Text ( selectedWorkspace? . title ?? " " )
250+ Text ( selectedWorkspace. title)
251251 . font ( FontFamily . Lato. bold. swiftUIFont ( size: 14 ) )
252252 . foregroundStyle ( Asset . Colors. huskyPurple. swiftUIColor)
253253 }
@@ -260,47 +260,48 @@ struct MapView: View {
260260 }
261261
262262 ToolbarItem ( placement: . navigationBarTrailing) {
263- QuestSyncButton ( badgeCount: viewModel. syncFailedElementsCount, isSyncing: isSyncing, action: {
264- debugPrint ( " Sync taped " )
265- guard viewModel. syncFailedElementsCount > 0 else {
266- alertIcon = " info.bubble "
267- alertMessage = " No elements to sync "
268- showAlert = true
269- return
263+ HStack ( spacing: 5.0 ) {
264+ QuestSyncButton ( badgeCount: viewModel. syncFailedElementsCount, isSyncing: isSyncing, action: {
265+ debugPrint ( " Sync taped " )
266+ guard viewModel. syncFailedElementsCount > 0 else {
267+ alertIcon = " info.bubble "
268+ alertMessage = " No elements to sync "
269+ showAlert = true
270+ return
271+ }
272+ isSyncing = true
273+ DatasyncManager . shared. syncDataToOSM ( exclude_gig_tags: false ) { _ in
274+ isSyncing = false
275+ viewModel. checkSyncStatus ( )
276+ }
277+ } )
278+
279+ Button ( action: {
280+ debugPrint ( " satellite icon tapped " )
281+ viewModel. updateOptions ( for: mapViewRef? . region. center ?? CLLocationCoordinate2D ( latitude: 0.0 , longitude: 0.0 ) )
282+ viewModel. showSatellitePicker = true
283+ } ) {
284+ Image ( systemName: " square.2.layers.3d.bottom.filled " )
285+ . resizable ( )
286+ . padding ( 8 )
287+ . foregroundStyle ( Asset . Colors. huskyPurple. swiftUIColor)
288+ . background ( Asset . Colors. e7E3EELightPurpuleBg. swiftUIColor)
289+ . frame ( width: 34 , height: 34 )
290+ . clipShape ( Circle ( ) )
270291 }
271- isSyncing = true
272- DatasyncManager . shared. syncDataToOSM ( exclude_gig_tags: false ) { _ in
273- isSyncing = false
274- viewModel. checkSyncStatus ( )
292+
293+ Button ( action: {
294+ print ( " Settings icon tapped " )
295+ showUserSettingsSheet = true
296+ } ) {
297+ Image ( systemName: " gear " )
298+ . resizable ( )
299+ . padding ( 8 )
300+ . foregroundStyle ( Asset . Colors. huskyPurple. swiftUIColor)
301+ . background ( Asset . Colors. e7E3EELightPurpuleBg. swiftUIColor)
302+ . frame ( width: 34 , height: 34 )
303+ . clipShape ( Circle ( ) )
275304 }
276- } )
277- }
278-
279- ToolbarItem ( placement: . navigationBarTrailing) {
280- Button ( action: {
281- debugPrint ( " satellite icon tapped " )
282- viewModel. updateOptions ( for: mapViewRef? . region. center ?? CLLocationCoordinate2D ( latitude: 0.0 , longitude: 0.0 ) )
283- viewModel. showSatellitePicker = true
284- } ) {
285- Image ( systemName: " square.2.layers.3d.bottom.filled " )
286- . padding ( 8 )
287- . foregroundStyle ( Asset . Colors. huskyPurple. swiftUIColor)
288- . background ( Asset . Colors. e7E3EELightPurpuleBg. swiftUIColor)
289- . frame ( width: 34 , height: 34 )
290- . clipShape ( Circle ( ) )
291- }
292- }
293- ToolbarItem ( placement: . navigationBarTrailing) {
294- Button ( action: {
295- print ( " Settings icon tapped " )
296- showUserSettingsSheet = true
297- } ) {
298- Image ( systemName: " gear " )
299- . padding ( 8 )
300- . foregroundStyle ( Asset . Colors. huskyPurple. swiftUIColor)
301- . background ( Asset . Colors. e7E3EELightPurpuleBg. swiftUIColor)
302- . frame ( width: 34 , height: 34 )
303- . clipShape ( Circle ( ) )
304305 }
305306 }
306307 }
@@ -342,7 +343,7 @@ struct MapView: View {
342343 . presentationDragIndicator ( . visible)
343344 }
344345 . sheet ( isPresented: $showUserSettingsSheet) {
345- UserSettingsView ( selectedWorkspace: selectedWorkspace? . title ?? " " , options: OptionModel . options, onNavigate: { navigate in
346+ UserSettingsView ( selectedWorkspace: selectedWorkspace. title, options: OptionModel . options, onNavigate: { navigate in
346347 showUserSettingsSheet = false
347348 DispatchQueue . main. asyncAfter ( deadline: . now( ) + 0.3 ) {
348349 // navigateToProfileSettings = true
@@ -506,7 +507,7 @@ struct MapView: View {
506507 } )
507508 . onAppear ( ) {
508509 HiddenQuestManager . shared. loadHiddenQuests ( )
509- print ( " selected workspace " , selectedWorkspace? . title ?? " " )
510+ print ( " selected workspace " , selectedWorkspace. title)
510511 QuestsRepository . shared. loadLongQuests ( from: " longQuestJson " )
511512// self.baseUrl = "https://osm.workspaces-stage.sidewalks.washington.edu"
512513// let original = DatabaseConnector.shared.getNode(id: 43)
0 commit comments