Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions AirCasting/CreateSessionViews/ChooseCustomLocationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ struct ChooseCustomLocationView: View {
@Binding var creatingSessionFlowContinues: Bool
@StateObject private var locationTracker = BindableLocationTracker()
var sessionName: String
@State private var locationChangedProgramatically: Bool = false
@Injected private var AppLocationTracker: LocationTracker

@EnvironmentObject private var sessionContext: CreateSessionContext
Expand All @@ -38,6 +39,8 @@ struct ChooseCustomLocationView: View {
.background(confirmCreatingSessionLink)
.sheet(isPresented: $isLocationPopupPresented, onDismiss: {
guard let newLocation = location else { return }

locationChangedProgramatically = true
locationTracker.ovverridenLocation = newLocation
}, content: {
PlacePicker(service: ChooseLocationPickerService(address: $locationName,
Expand All @@ -58,8 +61,11 @@ struct ChooseCustomLocationView: View {
locationTracker: locationTracker,
stickHardToTheUser: true)
.indicateMapLocationChange { newLocation in
location = .init(latitude: newLocation.coordinate.latitude,
longitude: newLocation.coordinate.longitude)
if !locationChangedProgramatically {
locationChangedProgramatically = false
location = .init(latitude: newLocation.coordinate.latitude,
longitude: newLocation.coordinate.longitude)
}
}
.onMyLocationButtonTapped {
locationTracker.ovverridenLocation = nil
Expand Down
Loading