Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

[Bug] Read button doesn't appear if an article is opened in the main app from a custom tab #5472

Closed
Trevonn opened this issue Sep 21, 2019 · 3 comments
Labels
🐞 bug Crashes, Something isn't working, .. Feature:CustomTabs Feature:ReaderMode needs:ac Needs Android Component Work P3 Some future sprint wontfix

Comments

@Trevonn
Copy link

Trevonn commented Sep 21, 2019

Steps to reproduce

  1. Open article in a custom tab
  2. Use three dot menu to open in Firefox Preview

Expected behavior

Read button appears alongside share sand bookmark buttons

Actual behavior

Only share and bookmark buttons appear.
Refreshing the page will cause the read button to now appear as expected.

Device information

  • Android device: Pixel 3 - Android 10 (Sept Patch)
  • Fenix version: Nightly 190919 18:00 (Build #12621820)
    📦: 14.0.0, 0681a1e65
    🦎: 71.0a1-20190916093313

┆Issue is synchronized with this Jira Task

@Trevonn Trevonn added the 🐞 bug Crashes, Something isn't working, .. label Sep 21, 2019
@Trevonn Trevonn changed the title [Bug] Read button doesn't appear if an article is opened in the main from a custom tab [Bug] Read button doesn't appear if an article is opened in the main app from a custom tab Sep 21, 2019
@liuche liuche added the P3 Some future sprint label Oct 4, 2019
@ValentinTimisica
Copy link
Contributor

I investigated this bug and the problem is that when you open a custom tab in Firefox Preview, the onPortMessage callback from ReaderViewContentMessageHandler is not triggered and therefore the ReaderActiveStateChange is not changing in initializeUI, so the Read button remains hidden.

I tried to manually call checkReaderable but seems like the port is not connected for the active session thus extensionController.portConnected(engineSession) returning false, so I'm currently stuck going forward with this proposed solution.

Does anybody has any idea on how to proceed with the above scenario or has any other solution?

@csadilek
Copy link
Contributor

csadilek commented Nov 7, 2019

@ValentinTimisica Yes, the reason for this is that the content script (readerview.js) injected by the ReaderViewFeature web extension runs when the page is loaded. If the page is loaded in a CustomTab, it won't run at all, because we don't start this feature for custom tabs. When the tab is then opened in / migrated to the main app it is too late. The page has already loaded. If you reload, you will see it working.

Since we don't want to reload in this case, we would have to start the ReaderViewFeature for custom tabs as well. This would require the following changes:

  • In Fenix: Start the ReaderViewFeature in the BaseBrowserFragment instead of the BrowserFragment
  • In A-C: Allow the ReaderViewFeature to operate on a specific (provided) session, not just the selected session

So, it's not a straight forward fix, unfortunately.

@ekager ekager added needs:ac Needs Android Component Work and removed needs:investigation labels Jul 24, 2020
@stale
Copy link

stale bot commented Feb 4, 2021

See: #17373 This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Feb 4, 2021
@stale stale bot closed this as completed Feb 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐞 bug Crashes, Something isn't working, .. Feature:CustomTabs Feature:ReaderMode needs:ac Needs Android Component Work P3 Some future sprint wontfix
Projects
None yet
Development

No branches or pull requests

6 participants