This requests user's confirmation before uninstallation every time which
is what we want to happen as well.
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This would be useful for self-updates when they get downloaded but user
isn't automatically installed.
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This results in their state never being updated when passed to menu fragment.
Store the ongoing downloads in a list and find it when required using the
package name instead.
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Switch to LinearProgressIndicator where possible and show an indeterminate
progress bar while download progress is below 1%
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Don't show failure notification if download was cancelled by the user
on Android 12+ devices. Sadly the method is not backwards compt nor I
want to spend time on it.
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
* Only show updates for devices that has atleast one matching certificate
* On Android 9.0+ devices, purchase apps with latest certificate's hash while updating
to support key rotations
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Old android versions get binder transaction errors otherwise. Also move out the
logic to fetch icon into the Worker to avoid fetching it 100 times. Keep the install
logic in place as that method is only called once after installation.
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Move app installation logic to onSuccess method in worker under a NonCancellable
context and convert the receiver class to be a generic status handler for anything
except success which should be handled in PackageManagerReceiver.
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Sometimes when download gets completed, the progress hasn't been updated which
results in no notification data and downloads showing status as completed with
a progress less than 100%.
Set progress manually to 100% and avoid checking progress in notificationUtil if
download has succeded. Also avoid calling onProgress again if download has finished.
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Path is only available since Android 8.0+ and it makes no sense to
add a dependency upon desugaring lib for it.
Switch to File class instead which is available on all Android versions
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
On old android versions, work manager runs expedited jobs using FGS which
seem to require a work notification as soon as the service starts by automatically
calling getForegroundInfo method.
This causes an exception as we haven't parsed the data yet. Use a generic
download notification for such cases.
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
* Make BaseFragment an abstract class, no reason to keep this open
* This also fixes memory leak that happens after onboarding is finished
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Considering we will be having a room database instance soon for downloads
and already have tons of other instances everywhere, feels right time to
use Hilt to manage them to avoid more memory leaks.
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This allows us to keep all the modifications related to DownloadWorker in a
single place.
Also, drop the 3seconds delay and do the cleanup instead of delegating it to
worker if last job was failed. This is better and more error-proof.
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
* Keep results for 7 days atleast
* Cancel download using tag & remove app from download queue
* Tag downloads and updates. This will allow a user to query & cancel all updates or downloads in one click
* Default to cancel all downloads & updates
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>