Chrome compatibility

Issue #14 open
零欸特 created an issue

I tried to port the extension to Chrome: https://bitbucket.org/eight04/in-my-pocket/branch/dev-chrome.

image

Some observation:

  1. The extension cannot use page action and browser action at the same time, which means:

    • The page action manifest key needs to be removed in Chrome. (prepare another manifest.json when targeting chrome build)
    • To set the icon indicator, set the icon on browser action.
  2. The version field in manifest.json support only numbers i.e. it cannot include a (alpha flag).

  3. To use browser API in Chrome, browser-polyfill is added. A problem is that browser-polyfill assumes the API is used in the promise style, but some code uses callback style.
  4. Chrome does not support icons in context menus.
  5. The width and the height of SVG icons have to be set to 32. (not sure why but 32 works)

IMHO, even if we don't want to support Chrome, we should stick to promise-based API. Currently, the different styles are mixed everywhere.

Comments (16)

  1. Pierre-Adrien Buisson repo owner

    Wow impressive!

    As for the overall Chrome addons thing (and Opera, while we're at it), I'm not aware of how to build and submit addons for Chrome, but now that IMP has become more stable and with a more solid tooling, that might be worth looking into it. Anyway, we can still start streamlining the addon code to be compatible with other browsers, and publish it later.

    To be honest, this "Chrome compatibility" ticket has been in my backlog for some time now... but I always prioritise new features first and never get to this todo 😄

    I'll check this out shortly and keep you updated. Thanks!

  2. Pierre-Adrien Buisson repo owner
    • changed status to open

    I haven't been very active on this. Still, I have streamlined the API calls lately to make sure they're all using browser and not chrome, and use the promise-style API (I was in favor of this, didn't think we had callback calls anywhere in the code tbh).

    I just started developing a tiny addon today, I'll try to make it cross-browser compliant. It'll be a perfect time to test the other points that you noticed and dig into the manifest, build and distribution topics at the same time.

  3. Pierre-Adrien Buisson repo owner

    Wow that's really crazy. SVG and vector images in general look like the best option for that kind of usage, I'm surprised they don't support it yet.

  4. 零欸特 reporter

    We can still keep using SVG in browser_action. In Chrome, we can call browserAction.setIcon API to set the default icon when the extension is loaded.

    browserAction API supports SVG but browser_action in manifest doesn't.

  5. Pierre-Adrien Buisson repo owner

    Hey, just an update here, I've started working on this. I've worked on adapting the build scripts so that I can create the addon with different rules (and particularly different manifest.json files). Not perfect yet, I guess, but I'll be testing this and try to get a chrome-compatible version beginning of 2019. I'll keep this updated and ask if I need help :-)

  6. JJ

    I think it would be nice to make PageAction optional in FF, additionally updating the Add current page button in popup to reflect actual state. Adn while at it probably move Refresh list button somewhere else, maybe even hide it somewhere in options

  7. Pierre-Adrien Buisson repo owner

    Long time no news 🙂 I've worked on this today, updated the CHORE-chrome-compatibility branch. I now need to make the page action optional (not the hardest part) and find a nice way to make the addon experience good without this important piece (not so easy 🙂).

  8. JJ

    there's official Save to Pocket Chromium extension (what's interesting it uses BrowserAction, but IMO it makes more sense as this button is visible on all pages) and you have Add current page to list button just below the button on popup so it’s pretty convenient to use one or another

    Maybe you could change the color of main button if page is in the list like you do with PageAction currently

  9. Pierre-Adrien Buisson repo owner

    I surely will update the icon colour if the page is in the pocket list. However, it’s a bit different from the Save to Pocket extension, in a sense that my browser action triggers something else than just adding to the page. Maybe I’ll have to reorganize the actions in the top row of the popup to get an easy access to “archive/delete page”.

    iwillril on chrome seems to allow “Mark as read” only from the popup item list or the context menu. Does not seem very handy to me.

  10. 零欸特 reporter

    Currently, I’m using the keyboard shortcut (Alt + W) to add/archive a page. When I click the browser action, it displays the popup.

  11. Pierre-Adrien Buisson repo owner

    Yep that’s the way it’s behaving right now. The context menu should be working as well to add/archive/delete pages, isn’t it?

  12. Log in to comment