Commit b70e29c6 by Demid Merzlyakov

IOS-184: navigate to forecast/minutely.

parent c65cc864
...@@ -10,7 +10,7 @@ import OneWeatherCore ...@@ -10,7 +10,7 @@ import OneWeatherCore
import OneWeatherAnalytics import OneWeatherAnalytics
protocol PrecipitationCellDelegate: AnyObject { protocol PrecipitationCellDelegate: AnyObject {
func precipitationCtaClicked() func precipitationCtaClicked(choosingTimePeriod: TimePeriod)
} }
class PrecipitationCell: UITableViewCell { class PrecipitationCell: UITableViewCell {
...@@ -160,7 +160,8 @@ class PrecipitationCell: UITableViewCell { ...@@ -160,7 +160,8 @@ class PrecipitationCell: UITableViewCell {
//Private //Private
@objc private func handleArrowButton() { @objc private func handleArrowButton() {
self.delegate?.precipitationCtaClicked() let timePeriod: TimePeriod = periodSegmentedControl.selectedSegmentIndex == 0 ? .daily : .minutely
self.delegate?.precipitationCtaClicked(choosingTimePeriod: timePeriod)
} }
@objc private func handlePrecipButton(button:PrecipButton) { @objc private func handlePrecipButton(button:PrecipButton) {
......
...@@ -215,11 +215,11 @@ class ForecastCellFactory: CellFactory { ...@@ -215,11 +215,11 @@ class ForecastCellFactory: CellFactory {
} }
public func setNeedsUpdate() { public func setNeedsUpdate() {
self.cellsToUpdate = [.forecastDaily, .forecastHourly, .forecastDailyInfo, .precipitation, .wind] self.cellsToUpdate = [.forecastDaily, .forecastHourly, .forecastDailyInfo, .precipitation, .wind, .minutely, .precipitationAdviced]
} }
public func selectedWeatherDidChange() { public func selectedWeatherDidChange() {
self.cellsToUpdate = [.forecastDailyInfo, .precipitation, .wind] self.cellsToUpdate = [.forecastDailyInfo, .precipitation, .wind, .minutely, .precipitationAdviced]
} }
public func willDisplay(cell:UITableViewCell) { public func willDisplay(cell:UITableViewCell) {
......
...@@ -102,6 +102,10 @@ class ForecastViewController: UIViewController { ...@@ -102,6 +102,10 @@ class ForecastViewController: UIViewController {
self.timePeriodControl.set(items: ["forecast.timePeriod.daily".localized(), self.timePeriodControl.set(items: ["forecast.timePeriod.daily".localized(),
"forecast.timePeriod.hourly".localized()]) "forecast.timePeriod.hourly".localized()])
} }
let indexToSelect = forecastCellFactory.timePeriod.rawValue
if indexToSelect >= 0 && indexToSelect < timePeriodControl.numberOfSegments {
timePeriodControl.selectedSegmentIndex = indexToSelect
}
} }
public func switchTo(timePeriod: TimePeriod) { public func switchTo(timePeriod: TimePeriod) {
......
...@@ -287,9 +287,9 @@ extension TodayCellFactory: AdViewDelegate { ...@@ -287,9 +287,9 @@ extension TodayCellFactory: AdViewDelegate {
} }
extension TodayCellFactory: PrecipitationCellDelegate { extension TodayCellFactory: PrecipitationCellDelegate {
func precipitationCtaClicked() { func precipitationCtaClicked(choosingTimePeriod timePeriod: TimePeriod) {
onMain { onMain {
self.todayViewModel.openForecast(timePeriod: .minutely) self.todayViewModel.openForecast(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