@@ -21,7 +21,6 @@ struct ConfirmCreatingSessionView: View {
2121 @EnvironmentObject var selectedSection : SelectedSection
2222 @EnvironmentObject private var sessionContext : CreateSessionContext
2323 @Injected private var locationTracker : LocationTracker
24- private var constantTracker : ConstantTracker ?
2524 @Injected private var downloadMeasurementsService : DownloadMeasurementsService
2625 @EnvironmentObject private var tabSelection : TabBarSelector
2726 @Binding var creatingSessionFlowContinues : Bool
@@ -35,10 +34,6 @@ struct ConfirmCreatingSessionView: View {
3534 _creatingSessionFlowContinues = . init( projectedValue: creatingSessionFlowContinues)
3635 self . sessionName = sessionName
3736 self . initialLocation = initialLocation
38-
39- if let initialLocation = initialLocation {
40- self . constantTracker = ConstantTracker ( location: initialLocation)
41- }
4237 }
4338
4439 var body : some View {
@@ -128,7 +123,7 @@ struct ConfirmCreatingSessionView: View {
128123 type: . normal,
129124 trackingStyle: . none,
130125 userIndicatorStyle: . none,
131- locationTracker: constantTracker! ,
126+ locationTracker: ConstantTracker ( location : initialLocation! ) ,
132127 markers: [ ] )
133128 . disabled ( true )
134129 // It needs to be disabled to prevent user interaction (swiping map) because it is only conformation screen
@@ -183,27 +178,13 @@ extension ConfirmCreatingSessionView {
183178 sessionContext. saveCurrentLocation ( lat: krakowLat, log: krakowLong)
184179 return
185180 #endif
186-
187- if ( sessionContext. sessionType == . fixed && sessionContext. isIndoor!) || sessionContext. locationless {
188- sessionContext. saveCurrentLocation ( lat: 200 , log: 200 )
189- } else if ( sessionContext. sessionType == . fixed && !sessionContext. isIndoor!) {
190-
191- guard let lat = ( constantTracker? . location. coordinate. latitude) ,
192- let lon = ( constantTracker? . location. coordinate. longitude)
193- else {
194- Log . error ( " No location found! " )
195- return
181+ if sessionContext. sessionType == . fixed || sessionContext. locationless {
182+ if sessionContext. isIndoor! || sessionContext. locationless {
183+ sessionContext. saveCurrentLocation ( lat: 200 , log: 200 )
196184 }
197-
198- sessionContext. saveCurrentLocation ( lat: lat, log: lon)
199-
200185 } else {
201186 guard let lat = ( locationTracker. location. value? . coordinate. latitude) ,
202- let lon = ( locationTracker. location. value? . coordinate. longitude)
203- else {
204- Log . error ( " No location found! " )
205- return
206- }
187+ let lon = ( locationTracker. location. value? . coordinate. longitude) else { return }
207188 sessionContext. saveCurrentLocation ( lat: lat, log: lon)
208189 }
209190 }
@@ -218,8 +199,8 @@ extension ConfirmCreatingSessionView {
218199 } else if sessionContext. sessionType == . mobile {
219200 return MobilePeripheralSessionCreator ( )
220201 } else {
221- Log . info ( " Can't set the session creator storage " )
222202 return nil
203+ Log . info ( " Can't set the session creator storage " )
223204 }
224205 }
225206
0 commit comments