feat: Add periodic background bundle updates
This is still WIP, but I open the PR to both get feedback and to keep track of what I'm doing.
Feature:
Basically what is described here https://github.com/ReVanced/revanced-manager/issues/2189: A scheduled job will run each X time (choosable by the user); it will check if an update is available for every remote bundle. A bundle can be excluded by deselecting the "Search for updates" toggle in the bundle settings. If an update was found, send a push notification (if permission were granted, else do not run the job).
Edit: I've removed the TODO list since it would contains too many item now, I've made too many changes :^). I'll provide a video explaining what I did.
Open points:
- [ ] My devices will force close the app when swiping the app away from the recent app menu. Force closing the app will stop every background task. Pretty sure there is nothing that can be done, but if anyone knows a way for the job to run even of force close please let me know.
- [x] ~~Does it still make sense to have the auto update on app opening? Should that send a notification as well if it updates a bundle?~~ Edit: Yes. The bundles are going to be updated still on app opening, while the search will be in the background
Any feedback is appreciated :).
I feel like time options less than a day shouldn't be available, as it would encourage users to immediately update when updates drop
Wouldn't this be better if it were push notifications instead? The patch bundle source would be needed to host something but it would prevent the ReVanced Manager from having to poll for updates so frequently if we're going to include such little times
Push notifications requires some kind of web socket server from what I understand. Poll works fine thanks to Cloudflare caching as well as the /version response which is small
Current behavior:
https://github.com/user-attachments/assets/7493074d-eacf-4cc9-93e0-a5dc12484e25
I feel like time options less than a day shouldn't be available, as it would encourage users to immediately update when updates drop
Time options and strings shown to the user can (and should) be adjusted. For now the time options are like this because it's easier for me to understand if the job is running correctly.
If the user doesn't wish to be notified of the bundle update then no background polling should happen, the bundles should be updated on app launch in that case