Commit 08bed76c by Demid Merzlyakov

IOS-186: added support for deeplinking.

parent c3e394ce
...@@ -21,6 +21,7 @@ class DeeplinksRouter: DeepLinksRouterProtocol { ...@@ -21,6 +21,7 @@ class DeeplinksRouter: DeepLinksRouterProtocol {
case forecast = "forecast" case forecast = "forecast"
case hourly = "hourly" case hourly = "hourly"
case daily = "daily" case daily = "daily"
case minutely = "minutely"
case precipitation = "precipitation" case precipitation = "precipitation"
case radar = "radar" case radar = "radar"
case sunMoon = "sun-moon" case sunMoon = "sun-moon"
...@@ -121,6 +122,8 @@ class DeeplinksRouter: DeepLinksRouterProtocol { ...@@ -121,6 +122,8 @@ class DeeplinksRouter: DeepLinksRouterProtocol {
openHourlyForecast() openHourlyForecast()
case .daily: case .daily:
openDailyForecast() openDailyForecast()
case .minutely:
openMinutelyForecast()
case .precipitation: case .precipitation:
openPrecipitation() openPrecipitation()
case .radar: case .radar:
...@@ -152,14 +155,21 @@ class DeeplinksRouter: DeepLinksRouterProtocol { ...@@ -152,14 +155,21 @@ class DeeplinksRouter: DeepLinksRouterProtocol {
func openDailyForecast() { func openDailyForecast() {
onMain { onMain {
self.log.info("open Forecast") self.log.info("open Forecast (daily)")
self.appCoordinator.openForecast(timePeriod: .daily) self.appCoordinator.openForecast(timePeriod: .daily)
} }
} }
func openMinutelyForecast() {
onMain {
self.log.info("open Forecast (minutely)")
self.appCoordinator.openForecast(timePeriod: .minutely)
}
}
func openHourlyForecast() { func openHourlyForecast() {
onMain { onMain {
self.log.info("open Forecast") self.log.info("open Forecast (hourly)")
self.appCoordinator.openForecast(timePeriod: .hourly) self.appCoordinator.openForecast(timePeriod: .hourly)
} }
} }
......
...@@ -7,9 +7,11 @@ ...@@ -7,9 +7,11 @@
import UIKit import UIKit
import OneWeatherCore import OneWeatherCore
import OneWeatherAnalytics
class ForecastCoordinator: Coordinator { class ForecastCoordinator: Coordinator {
//Private //Private
private let log = Logger(componentName: "ForecastCoordinator")
private let forecastViewModel = ForecastViewModel(locationManager: LocationManager.shared) private let forecastViewModel = ForecastViewModel(locationManager: LocationManager.shared)
private let navigationController = ColoredNavigationController(nibName: nil, bundle: nil) private let navigationController = ColoredNavigationController(nibName: nil, bundle: nil)
private var tabBarController:UITabBarController? private var tabBarController:UITabBarController?
...@@ -31,6 +33,13 @@ class ForecastCoordinator: Coordinator { ...@@ -31,6 +33,13 @@ class ForecastCoordinator: Coordinator {
} }
public func open(timePeriod: TimePeriod) { public func open(timePeriod: TimePeriod) {
var timePeriod = timePeriod
if timePeriod == .minutely {
if !FeatureAvailabilityManager.shared.isAvailable(feature: .minutelyForecast) {
timePeriod = .daily
log.warning("Open daily instead of minutely (minutely forecast is not available).")
}
}
self.forecastViewController?.switchTo(timePeriod: timePeriod) self.forecastViewController?.switchTo(timePeriod: timePeriod)
} }
......
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