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

Add FXIOS-10164 [Homepage] Navigation for Pocket Section #22597

Merged
merged 4 commits into from
Oct 29, 2024

Conversation

cyndichin
Copy link
Contributor

@cyndichin cyndichin commented Oct 16, 2024

📜 Tickets

Jira ticket
Github issue

💡 Description

Background Context
Discuss this PR during the team meeting and agree that this is the path we want to proceed in terms of navigation that is shared across the application. This PR originally came from a question asked in another PR. Some of the logic in that PR gets removed here.

Summary

  • Add navigation to pocket section (tapping on cells; learn more link)
  • Refactor navigation for customize homepage
  • Created new action called NavigationBrowserAction and new NavigationDestination type that is used to determine how to handle where to navigate
  • Instead of HomepageState knowing about where to navigate BrowserViewControllerState is responsible for this because the navigation is not unique to homepage
  • Added state tests, BVC is lacking tests currently so didn't test handleNavigation, the effort seems more worth to test this when we revisit cleaning up BVC.

📝 Checklist

You have to check all boxes before merging

  • Filled in the above information (tickets numbers and description of your work)
  • Updated the PR name to follow our PR naming guidelines
  • Wrote unit tests and/or ensured the tests suite is passing
  • When working on UI, I checked and implemented accessibility (minimum Dynamic Text and VoiceOver)
  • If needed, I updated documentation / comments for complex code and public methods
  • If needed, added a backport comment (example @Mergifyio backport release/v120)

Video

Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-10-16.at.14.10.08.mp4

@cyndichin
Copy link
Contributor Author

@OrlaM @adudenamedruby @thatswinnie in case you want to peek before the teams meeting

Base automatically changed from cc/FXIOS-10164-add-pocket-footer-and-header-UI to main October 17, 2024 14:05
Copy link
Contributor

mergify bot commented Oct 17, 2024

This pull request has conflicts when rebasing. Could you fix it @cyndichin? 🙏

@cyndichin cyndichin force-pushed the cc/FXIOS-10164-navigation-for-pocket-section branch 3 times, most recently from 62f639e to 9d1109b Compare October 17, 2024 18:21
@@ -132,7 +131,6 @@ class BrowserCoordinator: BaseCoordinator,

func showHomepage() {
let homepageController = self.homepageViewController ?? HomepageViewController(windowUUID: windowUUID)
homepageController.parentCoordinator = self
Copy link
Contributor Author

Choose a reason for hiding this comment

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

no need for a coordinator for homepage since the navigation is done on browser view level and there are no navigation currently that is specific to homepage only.

@@ -7,6 +7,7 @@ import Storage
import WebKit

import struct MozillaAppServices.CreditCard
import enum MozillaAppServices.VisitType
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not a fan of declaring these types from another service, I prefer to have a wrapper object. However, to minimize changing will keep the method for VisitType the same

Comment on lines +101 to +105
/// Navigates from home page to a new link
func navigateFromHomePanel(to url: URL, visitType: VisitType, isGoogleTopSite: Bool)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is specific to homepage today because I am calling the homePanel method in the browser coordinator. It would be great to have a single navigateToLink method instead, but leaving this as of now until we revisit some logic that we are doing in BVC. Let me know if any issues!

import Foundation
import Redux

/// Actions that are related to navigation from the user perspective
Copy link
Contributor Author

Choose a reason for hiding this comment

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

user perspective for now, we can update this comment if we see that there are API actions taken that uses this

Comment on lines +2036 to +2069
case _ where state.navigationDestination != nil:
guard let destination = state.navigationDestination else { return }
handleNavigation(to: destination)
Copy link
Contributor Author

@cyndichin cyndichin Oct 17, 2024

Choose a reason for hiding this comment

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

I prefer if statements, but left this for now to follow suite our other cases.

@cyndichin cyndichin force-pushed the cc/FXIOS-10164-navigation-for-pocket-section branch from 7fbd8e9 to 61d3ea1 Compare October 17, 2024 18:39
@cyndichin
Copy link
Contributor Author

@DanielDervishi @tusharC95 for visibility

@cyndichin cyndichin marked this pull request as ready for review October 17, 2024 18:41
@cyndichin cyndichin requested a review from a team as a code owner October 17, 2024 18:41
@mobiletest-ci-bot
Copy link

mobiletest-ci-bot commented Oct 17, 2024

Messages
📖 Project coverage: 32.63%
📖 Edited 16 files
📖 Created 2 files

Client.app: Coverage: 30.63

File Coverage
HomepageState.swift 87.04%
BrowserViewController.swift 4.89% ⚠️
BrowserCoordinator.swift 71.19%
HomepageDiffableDataSource.swift 96.0%
BrowserNavigationHandler.swift 75.0%
BrowserViewControllerState.swift 49.3% ⚠️
PocketState.swift 84.62%
NavigationBrowserAction.swift 100.0%
PocketStoryState.swift 13.79% ⚠️
HomepageViewController.swift 40.12% ⚠️
BrowserNavigationType.swift 100.0%
HomepageAction.swift 100.0%

Generated by 🚫 Danger Swift against c1eef36

@cyndichin cyndichin force-pushed the cc/FXIOS-10164-navigation-for-pocket-section branch from 61d3ea1 to c1eef36 Compare October 29, 2024 18:26
@cyndichin cyndichin merged commit 5c5a952 into main Oct 29, 2024
12 of 14 checks passed
@cyndichin cyndichin deleted the cc/FXIOS-10164-navigation-for-pocket-section branch October 29, 2024 20:39
rockstareast1

This comment was marked as spam.

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.

5 participants