Open JReinhold opened 5 years ago
Thanks for this. Yes, this is a known issue. It's due to the fact that Firefox Mobile doesn't (yet) support the windows
API and so LeechBlock can't detect when the app loses focus. The workaround is to switch to another tab before closing/minimizing the app. Sorry, I know that's a pain!
BTW, add-on API support for Firefox Mobile is still pretty patchy, so it's a miracle LB works at all!
Oh yeah I see, that's a bummer. And it is pretty amazing that LB works on mobile, great work on that!
FWIW I added my two cents about this to an existing issue about the windows
API on Bugzilla.
Thanks for posting to Bugzilla. I didn't realize it had been raised as an issue there. I've posted my two cents also! In the meantime, I'll keep looking for a workaround.
I'm also seeing this issue. The interesting thing is that if you set a delay page and either turn off the screen with the power button, or switch away from Firefox, the delay countdown stops and has a line shown through it. Obviously, the delay page knows that the tab is no longer active, so I can't see any reason why it shouldn't be possible to fix this problem now?
It's not quite that simple. The way that LB detects whether a page within the browser has lost focus (specifically, the delaying page) is not the same as the way it detects whether the entire browser has lost focus. The latter has not yet been implemented by the Firefox for Android developers.
Do you really need to know when the entire browser has lost focus?
It appears that when the browser loses focus, LB is detecting that the page within the browser has lost focus (at least on the delaying page) so couldn't that also be used to stop the counter on regular pages as well, or is there something special about the delay page that means that method won't work for regular pages?
The delaying page is an internal extension page, and the code detecting the loss of focus is a script within that page, so yes, the page is special those respects. However, it may be possible to put an event hook in regular pages as a substitute for browser window focus events in the Android version. It won't be trivial to implement, but I'll look into it.
OK, fair enough. If it's something that you can do, that would be great.
I've recently hit a similar issue.
I'm pretty sure this didn't happen when using Leechblock previously, but it happens now.
i.e. if I leave the tab focussed on Firefox Mobile, but e.g. lock my screen or just go to another app, the countdown still keeps counting. This never used to happen on my old phone, but it happens on my new Teracube 2e with /e/ OS installed.
Perhaps there was some Google-something that was making it work previously that now doesn't work on my de-googled phone?
Either way, it kinda defeats the purpose of the extension because now I end up disabling it (because it blocks before I've actually used my allotted time). For now I'll try to remember to actually close the tab, or switch to another, but would be much better if it worked again like it used to.
This is possibly a stupid question, but I wonder if it is possible to add some option to pause the timer if no meaningful activity happens in some time (the user doesn't scroll the page, or doesn't move cursor, or doesn't click anywhere, etc.). Any of the activities is fine would help a lot, pausing a timer if no scrolling happened or no URL has changed in over a minute could already help a lot with the issue: while it doesn't cover the scenario with watching videos, it covers nearly any other case I could possibly imagine. However, I am a complete zero in JS, and more specifically, Firefox addons. As far as I understand, we can get from extension the current window handle, and there we have "onscroll" event and so on. Does it at least sound viable?
Good idea. I'll look into it.
With the bugzilla issue being closed, is this still blocked?
With the bugzilla issue being closed, is this still blocked?
According to the Mozilla WebExtensions documentation, the windows API is still not supported by Firefox for Android:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/windows
When using LeechBlock NG on Firefox Mobile, there is an issue with counting the time.
If I just close/minimize the app while the counted tab is still open, LeechBlock will continue counting in the background. When I open Firefox 10 minutes later, I can see that the counter is 10 minutes less than it was when I closed it.
This doesn't happen if I remember to close the tab, or switch to a new tab before I close the app. If I kill Firefox Mobile completely, the counter also stops counting.
This is also reported by https://github.com/proginosko/LeechBlockNG/issues/69#issuecomment-409372109