Closed Bug 1950555 Opened 8 months ago Closed 7 months ago

Introduce a use case wrapper to consolidate the use cases in HomeActivity#load

Categories

(Firefox for Android :: Homepage, task, P3)

All
Android
task

Tracking

()

RESOLVED FIXED
138 Branch
Tracking Status
firefox138 --- fixed

People

(Reporter: gl, Assigned: gl)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

HomeActivity#openToBrowserAndLoad is an use case with a lot of different consumers (Searchfox) that handles the action of loading a search term or URL in the browser and navigating to the Browser screen.

As part of Homepage as a New Tab, we are looking to take advantage of this to centralized all actions around loading the provided URL or search term in a tab with HomeActivity#load except we would want to open within the the current tab instead of a new tab as part of the new navigation model. This allows us to have a single use case for handling this action and can ensure the behaviour is consistent throughout the application.

As part of this bug, we are refactoring HomeActivity#load to utilize the existing of UseCases patterns so that we can move the logic away from the HomeActivity (Rationale: Separation of Concerns from Activity and Fragment). This new use case will be a wrapper around the existing search and session use cases that are invoked by load(), and serves as the decision tree between loading a URL or search term depending on the parameters that are provided.

This initial refactor will allow us to more easily add unit testing of the HomeActivity#load functionality ensuring that we have appropriate test coverage for this important action.

The long term goal here would be to completely remove the usage of HomeActivity#openToBrowserAndLoad in favour of the new UseCases introduced here and navigation would be handle in their respective controller or navigation middleware. However, we will not be looking to remove all the usages in this initial refactor and subsequent followup bugs will be filed.

The task here is to do the following:

  • Refactors the use cases usage in HomeActivity#load into a centralized UseCases wrapper.
  • Migrate an existing consumer of HomeActivity#openToBrowserAndLoad to the new UseCases wrapper.
  • Refactors the use cases usage in HomeActivity#load into a centralized UseCases wrapper.
  • This allows for unit testing and provides a starting point for moving the HomeActivity#openBrowserAndLoad logic out of the HomeActivity.
No longer depends on: homepage-as-new-tab
Attachment #9468545 - Attachment description: WIP: Bug 1950555 - Part 1: Refactor `HomeActivity#load` to simplify getting the `private` boolean value → Bug 1950555 - Part 1: Refactor `HomeActivity#load` to simplify getting the `private` boolean value
Attachment #9468546 - Attachment description: WIP: Bug 1950555 - Part 2: Introduce a FenixBrowserUseCases wrapper to consolidate the use cases in HomeActivity#load → Bug 1950555 - Part 2: Introduce a FenixBrowserUseCases wrapper to consolidate the use cases in HomeActivity#load
Attachment #9468547 - Attachment description: WIP: Bug 1950555 - Part 3: Refactor `HomeActivity.load` profiler marker into FenixBrowserUseCases#loadUrlOrSearch → Bug 1950555 - Part 3: Refactor `HomeActivity.load` profiler marker into FenixBrowserUseCases#loadUrlOrSearch
Attachment #9468548 - Attachment description: WIP: Bug 1950555 - Part 4: Refactor `HomeActivity.openToBrowserAndLoad` usage to `FenixBrowserUseCases.loadUrlOrSearch` in SearchDialogController → Bug 1950555 - Part 4: Refactor `HomeActivity.openToBrowserAndLoad` usage to `FenixBrowserUseCases.loadUrlOrSearch` in SearchDialogController
Keywords: leave-open
Pushed by gluong@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e3d14b08be0e Part 1: Refactor `HomeActivity#load` to simplify getting the `private` boolean value r=android-reviewers,pollymce
Keywords: leave-open
Pushed by gluong@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c13202fe302c Part 2: Introduce a FenixBrowserUseCases wrapper to consolidate the use cases in HomeActivity#load r=android-reviewers,pollymce https://hg.mozilla.org/integration/autoland/rev/279d443870f3 Part 3: Refactor `HomeActivity.load` profiler marker into FenixBrowserUseCases#loadUrlOrSearch r=android-reviewers,jonalmeida https://hg.mozilla.org/integration/autoland/rev/7e20ee359025 Part 4: Refactor `HomeActivity.openToBrowserAndLoad` usage to `FenixBrowserUseCases.loadUrlOrSearch` in SearchDialogController r=android-reviewers,pollymce
Pushed by csabou@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/eb2c3644f040 Part 2: Introduce a FenixBrowserUseCases wrapper to consolidate the use cases in HomeActivity#load r=android-reviewers,pollymce https://hg.mozilla.org/integration/autoland/rev/dd6c1b9e56fe Part 3: Refactor `HomeActivity.load` profiler marker into FenixBrowserUseCases#loadUrlOrSearch r=android-reviewers,jonalmeida https://hg.mozilla.org/integration/autoland/rev/8bef67ab32b6 Part 4: Refactor `HomeActivity.openToBrowserAndLoad` usage to `FenixBrowserUseCases.loadUrlOrSearch` in SearchDialogController r=android-reviewers,pollymce

Relanded this, for the fenix failures Bug 1956618 was filed.

Flags: needinfo?(gl)
Status: ASSIGNED → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → 138 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: