Commit 3e506463 by Demid Merzlyakov

Search is closed properly.

parent b1d774af
......@@ -202,7 +202,7 @@ extension LocationViewController: LocationsViewModelDelegate {
self.showAlert(withTitle: title, message: message)
}
func viewModelDidSelectCity(model: LocationsViewModel, city: Location) {
func viewModelDidSelectCity(model: LocationsViewModel) {
close()
}
}
......@@ -353,8 +353,6 @@ extension LocationViewController: UITableViewDelegate {
// analytics(log: .ANALYTICS_FTUE_SEARCH_POPULAR)
// }
}
self.close()
//TODO: should be done from ViewModel?
}
}
......
......@@ -12,7 +12,7 @@ public protocol LocationsViewModelDelegate:class {
func viewModelDidChange(model:LocationsViewModel)
func viewModelDisplayModeDidChange(model: LocationsViewModel)
func viewModelError(model:LocationsViewModel, title:String?, message:String?)
func viewModelDidSelectCity(model:LocationsViewModel, city: Location)
func viewModelDidSelectCity(model:LocationsViewModel)
}
public enum LocationsViewModelDisplayMode {
......@@ -192,8 +192,7 @@ public class LocationsViewModel {
return
}
locationManager.addIfNeeded(partialLocation: city, selectLocation: true)
// TODO: close View Controller here, otherwise we can't choose already selected city.
// Currently it's done in the didSelectRow method in the VC.
self.delegate?.viewModelDidSelectCity(model: self)
}
func delete(city: PartialLocation) {
......@@ -232,9 +231,6 @@ extension LocationsViewModel: LocationManagerDelegate {
public func locationManager(_ locationManager: LocationManager, changedSelectedLocation newLocation: Location?) {
DispatchQueue.main.async {
self.delegate?.viewModelDidChange(model: self)
if let location = newLocation {
self.delegate?.viewModelDidSelectCity(model: self, city: location)
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment