Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NT-513] Project page creators header navigation #933

Merged
merged 33 commits into from
Nov 7, 2019

Conversation

Scollaco
Copy link
Contributor

@Scollaco Scollaco commented Nov 6, 2019

📲 What

  • Implements the navigation from the View progress button on the ProjectPamphletContentViewController to the dashboard.

🤔 Why

  • To make easier for creators to navigate to that screen once they open a project created by them
    JIRA ticket

🛠 How

  • Created a protocol delegate to notify the ProjectPamphletContentViewController when the creator taps the View progress button.
  • Had to fix a function on RootTabBarViewController that was trying to cast UINavigationController to a generic type T. This was causing the guard statement to fail making the Dashboard present showing the wrong project.
  • Added tests

👀 See

header_navigation

✅ Acceptance criteria

  • Login as therealnativesquad and search for a project created with this account. (e.g Help me transform this pile of wood)
  • On the Project Page, tap View dashboard. The ProjectPage should dismiss and the Dashboard should be presented with the selected project.

@@ -186,7 +186,8 @@ public final class RootTabBarViewController: UITabBarController {
private func viewControllerAndParam<T, P>(with index: RootViewControllerIndex, param: P) -> (T, P)? {
guard
let vcs = self.viewControllers,
let vc = vcs[clamp(0, vcs.count - 1)(index)] as? T
let nav = vcs[clamp(0, vcs.count - 1)(index)] as? UINavigationController,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The self.viewControllers is actually an array of UINavigationController. Now we first try to cast to UINavigationController and then cast the viewController to whichever type it is.
This was breaking the navigation to the dashboard when trying to navigate to it through deeplink.

Copy link
Contributor

@ifbarrera ifbarrera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm! Just that one suggestion about naming.

@@ -11,9 +11,9 @@ private enum Layout {
}

protocol ProjectPamphletCreatorHeaderCellDelegate: class {
func projectPamphletCreatorHeaderCellDidTapButton(
func projectPamphletCreatorHeaderCell(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rename this to something like projectPamphletCreatorHeaderCellDidTapViewProgress(_ cell: ProjectPamphletCreatorHeaderCell, with project: Project)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion! I will change that.

@Scollaco Scollaco changed the base branch from project-page-creators-header to master November 7, 2019 20:21
@Scollaco Scollaco changed the base branch from master to project-page-creators-header November 7, 2019 20:22
@Scollaco Scollaco changed the base branch from project-page-creators-header to master November 7, 2019 20:45
@ksr-ci-bot
Copy link

ksr-ci-bot commented Nov 7, 2019

SwiftFormat found issues:

File Rules
Kickstarter-iOS/Views/Cells/ProjectPamphletCreatorHeaderCell.swift anyObjectProtocol

Generated by 🚫 Danger

@Scollaco Scollaco merged commit 403259f into master Nov 7, 2019
@Scollaco Scollaco deleted the project-page-creators-header-navigation branch November 7, 2019 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants