Commit a797f93a by Demid Merzlyakov

Fix tap on Alert on the Today screen.

parent a55b9c74
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
import UIKit import UIKit
private enum TodayCellType:Int { public enum TodayCellType:Int {
case alert = 0 case alert = 0
case forecast case forecast
case ad case ad
...@@ -96,8 +96,13 @@ class TodayCellFactory: CellFactoryProtocol { ...@@ -96,8 +96,13 @@ class TodayCellFactory: CellFactoryProtocol {
return adView return adView
} }
public func cellFromTableView(tableView:UITableView, indexPath:IndexPath) -> UITableViewCell { public func cellType(at indexPath: IndexPath) -> TodayCellType {
let cellType = todaySection.rows[indexPath.row] let cellType = todaySection.rows[indexPath.row]
return cellType
}
public func cellFromTableView(tableView:UITableView, indexPath:IndexPath) -> UITableViewCell {
let cellType = self.cellType(at: indexPath)
guard let loc = self.todayViewModel.location else { guard let loc = self.todayViewModel.location else {
return UITableViewCell() return UITableViewCell()
} }
......
...@@ -130,7 +130,10 @@ extension TodayViewController: UITableViewDataSource { ...@@ -130,7 +130,10 @@ extension TodayViewController: UITableViewDataSource {
//MARK:- UITableView Delegate //MARK:- UITableView Delegate
extension TodayViewController: UITableViewDelegate { extension TodayViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
print("TodayViewController: didSelectRow") let cellType = viewModel.todayCellFactory.cellType(at: indexPath)
if cellType == .alert {
coordinator.openNotificationsScreen()
}
} }
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
......
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