From 6c91ddf547afd26a15c0920eb20d9670ff1aa948 Mon Sep 17 00:00:00 2001 From: Michael Leong Date: Tue, 13 Aug 2024 08:25:53 -0700 Subject: [PATCH] Adds Team rookie year and Event week number to respective views (#967) * info * remove new line --- .../Event/EventInfoViewController.swift | 2 +- .../Teams/Team/TeamInfoViewController.swift | 20 +++++++++++++++++-- .../ViewElements/Info/InfoCellViewModel.swift | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/the-blue-alliance-ios/ViewControllers/Events/Event/EventInfoViewController.swift b/the-blue-alliance-ios/ViewControllers/Events/Event/EventInfoViewController.swift index 5e491076f..157ffed58 100755 --- a/the-blue-alliance-ios/ViewControllers/Events/Event/EventInfoViewController.swift +++ b/the-blue-alliance-ios/ViewControllers/Events/Event/EventInfoViewController.swift @@ -113,7 +113,7 @@ class EventInfoViewController: TBATableViewController, Observable { return cell case .twitter: let cell = self.tableView(tableView, detailCellForRowAtIndexPath: indexPath) - cell.textLabel?.text = "View #\(self.event.key) on Twitter" + cell.textLabel?.text = "View \(self.event.key) on Twitter" return cell case .youtube: let cell = self.tableView(tableView, detailCellForRowAtIndexPath: indexPath) diff --git a/the-blue-alliance-ios/ViewControllers/Teams/Team/TeamInfoViewController.swift b/the-blue-alliance-ios/ViewControllers/Teams/Team/TeamInfoViewController.swift index bb1b43e1a..42484da3c 100755 --- a/the-blue-alliance-ios/ViewControllers/Teams/Team/TeamInfoViewController.swift +++ b/the-blue-alliance-ios/ViewControllers/Teams/Team/TeamInfoViewController.swift @@ -10,6 +10,7 @@ private enum TeamInfoSection: Int { private enum TeamInfoItem { case location + case rookieYear case sponsors case website case twitter @@ -75,6 +76,8 @@ class TeamInfoViewController: TBATableViewController, Observable { switch item { case .location: return self.tableView(tableView, locationCellForRowAt: indexPath) + case .rookieYear: + return self.tableView(tableView, rookieYearCellForRowAt: indexPath) case .sponsors: return self.tableView(tableView, sponsorCellForRowAt: indexPath) case .website: @@ -83,7 +86,7 @@ class TeamInfoViewController: TBATableViewController, Observable { return cell case .twitter: let cell = self.tableView(tableView, linkCellForRowAt: indexPath) - cell.textLabel?.text = "View #\(self.team.key) on Twitter" + cell.textLabel?.text = "View \(self.team.key) on Twitter" return cell case .youtube: let cell = self.tableView(tableView, linkCellForRowAt: indexPath) @@ -108,7 +111,8 @@ class TeamInfoViewController: TBATableViewController, Observable { infoItems.append(.location) } if team.name != nil { - infoItems.append(.sponsors) + infoItems.append(.rookieYear) + infoItems.append(.sponsors) } if !infoItems.isEmpty { @@ -146,6 +150,18 @@ class TeamInfoViewController: TBATableViewController, Observable { return cell } + + private func tableView(_ tableView: UITableView, rookieYearCellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(indexPath: indexPath) as ReverseSubtitleTableViewCell + + cell.titleLabel?.text = "Rookie Year" + cell.subtitleLabel?.text = String(team.rookieYear!) + + cell.accessoryType = .none + cell.selectionStyle = .none + + return cell + } private func tableView(_ tableView: UITableView, sponsorCellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(indexPath: indexPath) as BasicTableViewCell diff --git a/the-blue-alliance-ios/ViewElements/Info/InfoCellViewModel.swift b/the-blue-alliance-ios/ViewElements/Info/InfoCellViewModel.swift index 79d45f5ba..da03fa935 100644 --- a/the-blue-alliance-ios/ViewElements/Info/InfoCellViewModel.swift +++ b/the-blue-alliance-ios/ViewElements/Info/InfoCellViewModel.swift @@ -9,7 +9,7 @@ struct InfoCellViewModel { init(event: Event) { nameString = event.name ?? event.key - subtitleStrings = [event.locationString, event.dateString].compactMap({ $0 }) + subtitleStrings = [event.locationString, event.dateString, event.weekString].compactMap({ $0 }) } init(team: Team) {