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

Bug 1845409 - File RFC 0010 proposing handling navigation through middleware #4126

Merged

Conversation

MatthewTighe
Copy link
Contributor

@MatthewTighe MatthewTighe commented Oct 18, 2023

This patch includes an RFC for a new architectural goal of handling navigation through middleware moving forward. Currently, there are two commits.

  1. Old proposal for observing navigation state and reacting accordingly.
  2. New proposal for handling navigation through middleware.

The first proposal seemed suboptimal after offline conversations with the team, so I've reworked it accordingly. It's included here for context.

Tentative deadline is Feb 2nd.

GitHub Automation

https://bugzilla.mozilla.org/show_bug.cgi?id=1845409

@github-actions github-actions bot added the 🕵️‍♀️ needs review PRs that need to be reviewed label Oct 18, 2023
@MatthewTighe MatthewTighe force-pushed the rfc-0010-state-based-navigation branch from f31d616 to 1c8de2d Compare October 18, 2023 00:06
jonalmeida
jonalmeida previously approved these changes Oct 19, 2023
Copy link
Collaborator

@jonalmeida jonalmeida left a comment

Choose a reason for hiding this comment

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

This seems fair to me!

I reviewed the code in Focus to see how it connects the AppStore to an activity that has a lifetime, and I think that flow makes sense for Fenix too for only navigations that that are coming from HomeActivity.

I'm curious to see a prototype of this though and if it plays well with the navgraph library.

@gabrielluong gabrielluong added approved PR that has been approved and removed 🕵️‍♀️ needs review PRs that need to be reviewed labels Oct 24, 2023
MozillaNoah
MozillaNoah previously approved these changes Oct 26, 2023
Copy link
Contributor

@MozillaNoah MozillaNoah left a comment

Choose a reason for hiding this comment

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

This all makes sense to me. What would be the next steps? Do you have v0.1 or v1 of what this effort looks like?

@MatthewTighe
Copy link
Contributor Author

I would like to get a small prototype together in the next few days focused on tackling the bug this is filed against. I'll announce more broadly when I get something together

@MatthewTighe MatthewTighe mentioned this pull request Nov 1, 2023
@MatthewTighe
Copy link
Contributor Author

I worked up a basic prototype that can be found at #4323

@MatthewTighe MatthewTighe changed the title Bug 1845409 - File RFC 0010 proposing adding nav State to AppState Bug 1845409 - File RFC 0010 proposing handling navigation through middleware Jan 19, 2024
@MatthewTighe
Copy link
Contributor Author

I've updated the proposal based on offline conversations with the team in our weekly sync meeting. I've left the original proposal as a separate commit for now for context.

@MatthewTighe MatthewTighe marked this pull request as draft January 19, 2024 19:23
@github-actions github-actions bot added work in progress Not ready to land yet. Work in progress (WIP). and removed approved PR that has been approved labels Jan 19, 2024
@MozillaNoah
Copy link
Contributor

MozillaNoah commented Jan 19, 2024

@MatthewTighe, should this be moved out of draft?

Did the Debug Drawer navigation help inform some of this direction?

Also, will the prototype PR be updated at all?

@MatthewTighe
Copy link
Contributor Author

@MatthewTighe, should this be moved out of draft?

Yeah, I will move this out of draft shortly. Was getting a draft pass from @boek offline.

Did the Debug Drawer navigation help inform some of this direction?

The Debug Drawer, Review Checker, and History fragment refactor all helped inform this, yes.

Also, will the prototype PR be updated at all?

Yes, I can update the prototype PR

@MatthewTighe
Copy link
Contributor Author

@MozillaNoah Instead of dealing with a messy diff to update the previous prototype, I've drafted a new one

@MatthewTighe MatthewTighe added 🕵️‍♀️ needs review PRs that need to be reviewed and removed work in progress Not ready to land yet. Work in progress (WIP). labels Jan 22, 2024
@MatthewTighe MatthewTighe marked this pull request as ready for review January 22, 2024 20:04
@github-actions github-actions bot added approved PR that has been approved and removed 🕵️‍♀️ needs review PRs that need to be reviewed labels Jan 22, 2024
@MatthewTighe MatthewTighe dismissed stale reviews from jonalmeida and MozillaNoah January 22, 2024 22:24

Approval on first proposal

@MatthewTighe MatthewTighe added 🕵️‍♀️ needs review PRs that need to be reviewed and removed approved PR that has been approved labels Jan 22, 2024
Copy link
Contributor

@MozillaNoah MozillaNoah left a comment

Choose a reason for hiding this comment

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

Nice job with the updates!

Comment on lines 46 to 50
next(action)
when (action) {
is HomeButtonClicked -> getNavController().navigate(R.id.home_fragment)
is HistoryGroupClicked -> getNavController().navigate(R.id.history_metadata_fragment)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: indent missing? I think the original example have the same issue. Maybe the override fun invoke( part have too much indent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, apparently Android Studio used actual unexpanded tab characters any time I copied a line with a tab in it. Haven't run into a tabs v spaces problem in a longggggg time 😆

@MatthewTighe MatthewTighe force-pushed the rfc-0010-state-based-navigation branch from e7f3daa to 5ccfb67 Compare January 24, 2024 23:45
@github-actions github-actions bot added approved PR that has been approved and removed 🕵️‍♀️ needs review PRs that need to be reviewed labels Jan 24, 2024
@MatthewTighe MatthewTighe force-pushed the rfc-0010-state-based-navigation branch from 5ccfb67 to 16e91ee Compare January 24, 2024 23:49

## Summary

Following the acceptance of [0009 - Remove Interactors and Controllers](0009-remove-interactors-and-controllers), Fenix should have a method of navigation that is tied to the `lib-state` model to provide a method of handling navigation side-effects that is consistent with architectural goals.
Copy link
Contributor

@t-p-white t-p-white Jan 31, 2024

Choose a reason for hiding this comment

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

that is consistent with architectural goals.

nit: Is there documentation that you can link here to outline the architectural goals?

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 call, updated!

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice 👌

}
```

### 3. The special case of `openToBrowserAndLoad`
Copy link
Contributor

Choose a reason for hiding this comment

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

👌

@t-p-white
Copy link
Contributor

t-p-white commented Jan 31, 2024

Looks good, no objections from me 🙂 having a consistent method for handling the various aspects of navigation would certainly be beneficial. Appreciate the demo provided too. My only immediate concern is around the defined use cases and how clear the boundaries of responsibility are e.g handling telemetry and other various side effects, but I don't think it's reasonable for you to anticipate all use cases upfront

@MatthewTighe MatthewTighe force-pushed the rfc-0010-state-based-navigation branch from 16e91ee to b985a89 Compare January 31, 2024 18:42
@MatthewTighe MatthewTighe added the 🛬 needs landing PRs that are ready to land label Feb 27, 2024
@mergify mergify bot merged commit 12e13e2 into mozilla-mobile:main Feb 27, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved PR that has been approved 🛬 needs landing PRs that are ready to land
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants