Commit 5d73acf9 by Demid Merzlyakov

Audomatically focus on Search Bar if there are no locations.

parent e340a1da
......@@ -59,6 +59,9 @@ class LocationViewController:UIViewController {
if openedFromOnboarding {
analytics(log: .ANALYTICS_FTUE_SEARCH_SEEN)
}
if locationsViewModel.shouldFocusOnSearchBar {
self.searchBar.becomeFirstResponder()
}
}
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
......
......@@ -51,6 +51,10 @@ public class LocationsViewModel {
return fullLocation == locationManager.selectedLocation
}
public var shouldFocusOnSearchBar: Bool {
return !locationManager.hasLocations
}
public init() {
locationManager.add(delegate: self)
}
......
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