JadeMaveric / patronus

A browser extension that listens to your gMeets for you. And notifies you if something important is mentioned
MIT License
10 stars 2 forks source link

Port extension to chrome #2

Closed JadeMaveric closed 3 years ago

JadeMaveric commented 3 years ago

I use firefox like 90% of the time. Since this started out as a personal project. It made a lot of sense to develop it for firefox.

The Firefox extension API uses the standard broswer.* namespace with Promises. This is what most browsers should be using, and it's what Edge has also adopted.

However, Chrome uses it's own chrome.* namespace, and the older callback mechanism. Functionality between the two are similar. And firefox does offer compatiblity for the chrome.* namespace. Porting this extension to chrome should be easy.

I'm leaving this one open for Hacktoberfest

mo-pat commented 3 years ago

Hey @JadeMaveric, I can take care of this

JadeMaveric commented 3 years ago

Hey @mo-jinbuu, are you working on this?

luharinos commented 3 years ago

@JadeMaveric - if you do not mind, I would like to give this a try! :)

mo-pat commented 3 years ago

Hey @mo-jinbuu, are you working on this?

Yeah I'm still working on this but I've been running into some issues.

image

Getting this error on chrome. Seems like promised-based approach is only valid in Firefox according to this stack overflow thread (https://stackoverflow.com/questions/45957590/chrome-tabs-queryobject-doesnt-match-definition). We can either turn chrome.tabs.query into a callback function or include Mozilla's Polyfill API that should take care of converting that method.

Tried including the polyfill api but having some issues with that. Going to try to make that tabs.query method into a callback and see if that fixes the issue.

JadeMaveric commented 3 years ago

@mo-jinbuu Yup, the callback paradigm definitely seems easier at this point. At some point I'll consider using the Polyfill to make a one size fits all addon. But for now the callback will do. For consistency, put all the chrome related code in it's own folder

@er-raoniz Sorry, @mo-jinbuu already started working on this. There's plenty other issues to try out :smile_cat:

mo-pat commented 3 years ago

Opened a PR for this #7. Took me awhile but it works for me on Chrome and Firefox. There is one issue though which I need some input on:

image

Chrome doesn't allow inline scripts (source: https://developer.chrome.com/extensions/contentSecurityPolicy#relaxing-inline-script). The issue is that I don't see where these functions are coming from (handleApply() and handleToggle). May be they're legacy code and aren't being used. Not sure exactly.

JadeMaveric commented 3 years ago

@mo-jinbuu I checked out the PR, good job! You're right, the handleToggle and handleApply are legacy and have been replaced with the document event handler. You can remove the onclick attribute, and everything should be fine.

Add that to the PR and I'll accept it.

luharinos commented 3 years ago

@JadeMaveric - If it's still open and unfixed, can I close this quickly with a PR?

JadeMaveric commented 3 years ago

@er-raoniz The PR was updated and accepted yesterday. I should mark this as closed to avoid any confusion