Commit 5d73acf9 by Demid Merzlyakov

Audomatically focus on Search Bar if there are no locations.

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