Skip to content

Commit eed9048

Browse files
committed
Fixed fresh start bug where Add First Favorite didn't appear correctly
1 parent dc16fe4 commit eed9048

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

TCAT/Controllers/HomeViewController.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,15 @@ extension HomeViewController: UITableViewDataSource {
338338

339339
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
340340
var cell: UITableViewCell!
341-
342-
if sections[indexPath.section].type == .seeAllStops {
341+
342+
if sections[indexPath.section].type == .favorites &&
343+
sections[indexPath.section].items.first?.name == Constants.General.firstFavorite
344+
{
345+
cell = tableView.dequeueReusableCell(withIdentifier: Constants.Cells.placeIdentifier) as? PlaceTableViewCell
346+
cell.textLabel?.text = Constants.General.firstFavorite
347+
cell.detailTextLabel?.text = Constants.General.tapHere
348+
(cell as? PlaceTableViewCell)?.iconColor = Colors.tcatBlue
349+
} else if sections[indexPath.section].type == .seeAllStops {
343350
cell = tableView.dequeueReusableCell(withIdentifier: Constants.Cells.seeAllStopsIdentifier)
344351
cell.textLabel?.text = Constants.General.seeAllStops
345352
cell.imageView?.image = #imageLiteral(resourceName: "list")

TCAT/Supporting Files/Constants.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ struct Constants {
195195
/// General phrases used throughout the app
196196
struct General {
197197
static let firstFavorite = "Add Your First Favorite!"
198+
static let tapHere = "Tap Here"
198199
static let searchPlaceholder = "Where to?"
199200
static let favoritesPlaceholder = "Search any destination"
200201
static let fromSearchBarPlaceholder = "Choose starting point..."

0 commit comments

Comments
 (0)