Closed Bug 1923650 Opened 1 year ago Closed 1 year ago

AppState Browsing mode is not consistent

Categories

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

All
Android
task

Tracking

()

RESOLVED FIXED
141 Branch
Tracking Status
firefox141 --- fixed

People

(Reporter: rsainani, Assigned: mavduevskiy)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fxdroid])

Attachments

(6 files)

Users of AppState.BrowsingMode won't always get the latest browsing mode. This works fine when on the HomeFragment but not otherwise. Discussion from this patch .

I wonder if, for the short term, we can add the following line:

components.appStore.dispatch(AppAction.ModeChange(mode = newMode))

to this section HomeActivity where Browsing Mode Manager is set up, so the AppStore is always updated when the manager is updated.

That's a good idea! We should give this approach a try.

Assignee: nobody → mavduevskiy
Attachment #9488397 - Attachment description: WIP: Bug 1923650 - Consistently update AppState BrowsingMode → WIP: Bug 1923650 - Part 1: Update AppState.mode every time BrowsingModeManager is updated

An attempt to force users to update the mode from BrowserModeManager only, to reduce the chance of them going async.

It was used to update the state in two places; now that we need only update it once, the function could be removed.

For some extra context:

  1. the patch follows in implementation the original [[ https://github.com/mozilla-mobile/firefox-android/pull/5502/files#diff-e9a193a65990d2de50218c9d11e0b45ad43afad7ef28fd81e47be3591fc4cc84R50 | patch ]] of :matt-tighe;
  2. from a discussion with Matt today: though not possible to restrict, we wanted to descourage usage of ModeChange outside of the Manager by changing the name of the ModeChange action to hint that it should only be called from the manager.
Attachment #9488442 - Attachment description: WIP: Bug 1923650 - Part 4: Remove the toggleBrowsingMode helper function from tabstrip → Bug 1923650 - Part 4: Remove the toggleBrowsingMode helper function from tabstrip
Attachment #9488397 - Attachment description: WIP: Bug 1923650 - Part 1: Update AppState.mode every time BrowsingModeManager is updated → Bug 1923650 - Part 1: Update AppState.mode every time BrowsingModeManager is updated
Attachment #9488440 - Attachment description: WIP: Bug 1923650 - Part 2: Discourage usage of ModeChange → Bug 1923650 - Part 2: Discourage usage of ModeChange
Attachment #9488441 - Attachment description: WIP: Bug 1923650 - Part 3: Remove browser mode update action dispatches outsidei of BrowsingModeManager → Bug 1923650 - Part 3: Remove browser mode update action dispatches outsidei of BrowsingModeManager
Whiteboard: [fxdroid]

Currently, changing a theme on homepage relies on ThemeManager restarting the activity, and the HomeFragment being created with the updated theme and content at the same time.

Allowing HomeFragment to be updated by the appstate mode change led to the content being updated, but theme updated was lagging behind and was only applied after the fragment was recreated, leading to a visual glitch.

Blocks: 1966896
Pushed by mavduevskiy@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/f21c5c815073 https://hg.mozilla.org/integration/autoland/rev/b7952c3b476d Part 1: Update AppState.mode every time BrowsingModeManager is updated r=android-reviewers,007 https://github.com/mozilla-firefox/firefox/commit/11227b16a988 https://hg.mozilla.org/integration/autoland/rev/3bbb7778c37a Part 2: Discourage usage of ModeChange r=android-reviewers,007 https://github.com/mozilla-firefox/firefox/commit/d41604b58222 https://hg.mozilla.org/integration/autoland/rev/3a5e4b77ca6f Part 3: Remove browser mode update action dispatches outsidei of BrowsingModeManager r=android-reviewers,007 https://github.com/mozilla-firefox/firefox/commit/062611bfc08c https://hg.mozilla.org/integration/autoland/rev/e2198b52f790 Part 4: Remove the toggleBrowsingMode helper function from tabstrip r=android-reviewers,007 https://github.com/mozilla-firefox/firefox/commit/606b3d18374f https://hg.mozilla.org/integration/autoland/rev/35150c30773d Part 5: Don't update homepage composable on appstate mode change r=android-reviewers,matt-tighe https://github.com/mozilla-firefox/firefox/commit/c5395bfbf87c https://hg.mozilla.org/integration/autoland/rev/4d6a60329173 Part 6: Refactor DefaultBrowserModeManager to avoid spies in tests r=android-reviewers,007
Regressions: 1979522
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: