Commit 9e53819f by Demid Merzlyakov

IOS-184: choose minutely precipitation on Forecast when navigating.

parent e46e8e35
......@@ -43,7 +43,7 @@ class PrecipitationCell: UITableViewCell {
fatalError("init(coder:) has not been implemented")
}
public func configure(with dayily:[DailyWeather], location: Location) {
public func configure(with dayily:[DailyWeather], location: Location, timePeriod: TimePeriod) {
minutelyForecastView.configure(with: location, forecastType: .precipitation)
......@@ -96,10 +96,14 @@ class PrecipitationCell: UITableViewCell {
precipButton.configure(with: dayily[index])
}
if timePeriod == .minutely {
periodSegmentedControl.selectedSegmentIndex = 1
}
self.handleSegmentDidChange()
}
public func configure(with hourly:[HourlyWeather], location: Location) {
public func configure(with hourly:[HourlyWeather], location: Location, timePeriod: TimePeriod) {
self.headingLabel.font = AppFont.SFPro.bold(size: 18)
self.headingLabel.text = "precipitation.title".localized().capitalized
self.headingLabel.textColor = ThemeManager.currentTheme.primaryTextColor
......@@ -155,6 +159,10 @@ class PrecipitationCell: UITableViewCell {
precipButton.configure(with: hourly[index])
}
if timePeriod == .minutely {
periodSegmentedControl.selectedSegmentIndex = 1
}
handleSegmentDidChange()
}
......
......@@ -171,7 +171,7 @@ class ForecastCellFactory: CellFactory {
if let hourly = forecastViewModel.location?.hourly {
if cellsToUpdate.contains(.precipitation) {
if let location = forecastViewModel.location {
cell.configure(with: hourly, location: location)
cell.configure(with: hourly, location: location, timePeriod: self.timePeriod)
}
cellsToUpdate.remove(.precipitation)
}
......
......@@ -163,7 +163,7 @@ class TodayCellFactory: CellFactory {
cell.delegate = self
if cellsToUpdate.contains(.precipitation) {
if let location = todayViewModel.location {
cell.configure(with: loc.daily, location: location)
cell.configure(with: loc.daily, location: location, timePeriod: .hourly)
}
cellsToUpdate.remove(.precipitation)
}
......
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