clockify / browser-extension

Clockify Browser Extension
https://clockify.me/chrome-time-tracking
BSD 3-Clause "New" or "Revised" License
183 stars 172 forks source link

[Microsoft Planner] Integration with MS Planner not working #195

Open krajniks opened 2 years ago

krajniks commented 2 years ago

Hi,

during testing I have found, that integration with MS Planner is broken. Extension is triggered, but the button is never added to web page. I did a bit of investigation and found, that in background.js aBrowser.tabs.onUpdated.addListener listener is triggered once (when page is opened or refreshed), but changeInfo.status is not "complete" but "loading". After that, it is never triggered again, so button is not even starting to load.

This was tested on chrome browser, firefox and edge also do not work (but I am not sure if there is the same problem).

aBrowser.tabs.onUpdated.addListener(async (tabId, changeInfo, tab) => { // <== fires only once

    const isIdentityRedirectUrl = tab.url.includes(aBrowser.identity.getRedirectURL())
    if (!isIdentityRedirectUrl && tab.url.includes("clockify.me")) {
        return;
    }

    if (changeInfo.status === "complete") { // <== this is never true, so it never starts to load
        aBrowser.storage.local.get('permissions', async (result) => {
            let domain = await extractDomain(tab.url, result.permissions);
            const isLoggedIn = await TokenService.isLoggedIn();
            if (!tab.url.includes("chrome://") && isLoggedIn) {
                if (!!domain.file) {

I am not a web developer, so I don't know how to fix this. I imagine it will also impact other integrations, as this is the base code.

Can you fix this?

strahinjaclockify commented 2 years ago

Hi @krajniks, thanks for reporting this issue! I let our dev team know about it, and we'll fix the issue in version 2.6.0.