Commit 862b5676 by Demid Merzlyakov

Forecast: city button and notifications button implemented

parent 4e9f7a95
...@@ -23,7 +23,7 @@ class ForecastCoordinator: Coordinator { ...@@ -23,7 +23,7 @@ class ForecastCoordinator: Coordinator {
} }
func start() { func start() {
let forecastViewController = ForecastViewController(viewModel: forecastViewModel) let forecastViewController = ForecastViewController(viewModel: forecastViewModel, coordinator: self)
navigationController.viewControllers = [forecastViewController] navigationController.viewControllers = [forecastViewController]
tabBarController?.add(viewController: navigationController) tabBarController?.add(viewController: navigationController)
self.forecastViewController = forecastViewController self.forecastViewController = forecastViewController
...@@ -33,6 +33,18 @@ class ForecastCoordinator: Coordinator { ...@@ -33,6 +33,18 @@ class ForecastCoordinator: Coordinator {
self.forecastViewController?.switchTo(timePeriod: timePeriod) self.forecastViewController?.switchTo(timePeriod: timePeriod)
} }
public func openNotificationsScreen() {
let notificationsCoordinator = NotificationsCoordinator(parentViewController: navigationController)
notificationsCoordinator.parentCoordinator = self
notificationsCoordinator.start()
}
public func openLocationsSearch() {
let searchCoordinator = LocationSearchCoordinator(parentViewController: navigationController)
searchCoordinator.parentCoordinator = self
searchCoordinator.start()
}
func viewControllerDidEnd(controller: UIViewController) { func viewControllerDidEnd(controller: UIViewController) {
// //
} }
......
...@@ -12,6 +12,7 @@ class ForecastViewController: UIViewController { ...@@ -12,6 +12,7 @@ class ForecastViewController: UIViewController {
private let forecastCellFactory:ForecastCellFactory private let forecastCellFactory:ForecastCellFactory
private let cityButton = NavigationCityButton() private let cityButton = NavigationCityButton()
private let daysControlView = DaysControlView() private let daysControlView = DaysControlView()
private let coordinator: ForecastCoordinator
private let timePeriodControl = ForecastTimePeriodControl(items: ["forecast.timePeriod.daily".localized(), private let timePeriodControl = ForecastTimePeriodControl(items: ["forecast.timePeriod.daily".localized(),
"forecast.timePeriod.hourly".localized()]) "forecast.timePeriod.hourly".localized()])
private let tableView = UITableView() private let tableView = UITableView()
...@@ -22,8 +23,9 @@ class ForecastViewController: UIViewController { ...@@ -22,8 +23,9 @@ class ForecastViewController: UIViewController {
return TimePeriod(rawValue: timePeriodControl.selectedSegmentIndex) ?? .daily return TimePeriod(rawValue: timePeriodControl.selectedSegmentIndex) ?? .daily
} }
init(viewModel: ForecastViewModel) { init(viewModel: ForecastViewModel, coordinator: ForecastCoordinator) {
self.viewModel = viewModel self.viewModel = viewModel
self.coordinator = coordinator
self.forecastCellFactory = ForecastCellFactory(viewModel: viewModel) self.forecastCellFactory = ForecastCellFactory(viewModel: viewModel)
super.init(nibName: nil, bundle: nil) super.init(nibName: nil, bundle: nil)
} }
...@@ -83,11 +85,11 @@ class ForecastViewController: UIViewController { ...@@ -83,11 +85,11 @@ class ForecastViewController: UIViewController {
} }
@objc private func handleCityButton() { @objc private func handleCityButton() {
print("Handle city button") coordinator.openLocationsSearch()
} }
@objc private func handleNotificationButton() { @objc private func handleNotificationButton() {
print("Handle notification button") coordinator.openNotificationsScreen()
} }
} }
......
...@@ -13,7 +13,7 @@ class RadarViewController: UIViewController { ...@@ -13,7 +13,7 @@ class RadarViewController: UIViewController {
//Private //Private
private let kPinnedLayersHeight:CGFloat = 43 private let kPinnedLayersHeight:CGFloat = 43
private let radarViewModel = RadarViewModel() private let radarViewModel = RadarViewModel()
private let coordinator:RadarCoordinator private let coordinator: RadarCoordinator
private let cityButton = NavigationCityButton() private let cityButton = NavigationCityButton()
private var localizationObserver:Any? private var localizationObserver:Any?
private let mapView = MKMapView() private let mapView = MKMapView()
......
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