Commit Graph

1083 Commits

Author SHA1 Message Date
Aayush Gupta
ad64d512e5 DownloadWorker: Resume download when possible
* If file still exists, resume the download using range requests.
* Avoid deleting files when download fails as we can resume the download again.
* Assert for expected SHA and actual SHA to match
* Verify SHA after download is finished to avoid complicated logic

Ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-22 16:19:53 +05:30
Aayush Gupta
dcddfc74bd AppDetailsFragment: Better check for running downloads on setup
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-22 14:07:56 +05:30
Aayush Gupta
42a38ef741 DownloadWorker: Also consider speed when updating progress
This should fix the issue where progress gets stuck because download speed
gets really low but UI still mentions old speed and time remaining

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-22 13:51:44 +05:30
Aayush Gupta
1edc0b3f53 AppDetailsFragment: Access DetailsClusterViewModel using viewModels method
* Leftover of the great migration

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-20 19:17:08 +05:30
Aayush Gupta
795d0dddb7 BaseClusterViewModel: Use original cluster ID to append apps
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-20 17:56:14 +05:30
Aayush Gupta
b187096869 InstalledAppsFragment: Move event handling to fragment
* Just fetch the list again, its not that expensive

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-20 17:24:04 +05:30
Aayush Gupta
0b07c3cecb [LeakCanary] Fragment: Explicity set viewpager2 adapter to null
* Also use viewLifecycleOwner to get lifecycle

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-20 17:24:04 +05:30
Aayush Gupta
3a27fa719b ui: sheets: Use BottomSheetDialogFragment directly
We don't need base class anymore. Also use view binding the recommended
way for fragments.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-20 17:24:04 +05:30
Aayush Gupta
5cf7fa6b3c Fragment: Multiple improvements to fragments
* Use viewModels method to get ViewModel instances
* Use view binding as recommended for fragments
* Mark possible variables as private and val

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-20 17:24:04 +05:30
Aayush Gupta
c3bae480c4 ViewModel: Switch to Hilt for accessing application context
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-20 17:24:04 +05:30
Aayush Gupta
13a88afa09 AppUtil: Move installed and updatable app logic to separate class
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-19 18:55:08 +05:30
Aayush Gupta
d030a7ac2e Respect battery optimization setting when auto-updating
* Don't enable auto-install for updates if battery optimization permission
  is not granted during onboarding.
* Drop showing warning in toolbar, show it instead if they want auto-install
* Don't check for the same during downloads. Failing is better instead.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-18 22:01:38 +05:30
Aayush Gupta
c72b860b4d Supress deprecation warning for compat methods
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-18 15:32:54 +05:30
Aayush Gupta
61e148f58b model: Drop unused model classes
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-14 11:59:26 +05:30
Aayush Gupta
d4f4b4bca5 OnboardingFragment: Drop theme and accent fragments
Still available in the settings

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-14 11:46:44 +05:30
Aayush Gupta
9b9cfd8de2 Implement Material3 based EditTextPreference
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-07 18:38:45 +05:30
Aayush Gupta
8f09c7d6ed NetworkPreference: Move proxy validation logic into viewModel
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-07 17:19:59 +05:30
Aayush Gupta
2a41baf69d DownloadWorker: Download files using proxy when exists
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-07 14:37:19 +05:30
Aayush Gupta
00b94fbac3 SessionInstaller: Automatically pick the best install location
This ensures that if an app is installed in external storage, it continues
to install it there, otherwise defaults to internal like existing behaviour.

Ref: https://cs.android.com/android/platform/superproject/+/main:frameworks/base/core/java/com/android/internal/content/InstallLocationUtils.java;l=328

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-06 19:23:00 +05:30
Aayush Gupta
28ba1ac17c SplashFragment: Fixes for AuthState.Failed
* Make menu invisible instead of clearing it
* Apply appropriate margin to the status textView

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-05 14:52:28 +05:30
Aayush Gupta
72d077decf BasePreferenceFragment: Move Material3 preference logic to new fragment
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-05 14:42:56 +05:30
Aayush Gupta
ac3065ab2c Improve and fix proxy setup/usage
* Switch connectivitycheck URL to HTTPS as cleartext communication is disabled
* Use GlobalScope to verify and setup proxy URL
* Ignore proxy setup in HttpClient if its empty

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-05 14:17:11 +05:30
Aayush Gupta
29ce733611 UpdatesFragment: Move Update All button to FAB
* Also link BlacklistFragment in in it's place as requested by users

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-04 14:50:15 +05:30
Aayush Gupta
caf6dd18c1 Cleanup and retire non-working download options
* External storage download uses external files directory and not the SD card
  to downloads while the description states otherwise. This is in-accurate and
  thus dropped (See #985).

* Custom download path is broken which was implemented as a workaround for the
  above (See #1003).

* Move downloads storage to internal files directory which is sandboxed and only
  accessible to us.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-04 12:55:39 +05:30
Aayush Gupta
2f5d39106a UpdateWorker: Merge self-updates logic for non-fdroid builds
Treat Aurora Store as a normal app for non-fdroid builds and check
for its updates based on auto-update preference.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-02 13:26:54 +05:30
Aayush Gupta
3b9efeed11 UpdateWorker: Move update notification logic to NotificationUtil
* All notification related logic should be in this class

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-03-02 10:48:16 +05:30
Aayush Gupta
804d37a579 MainActivity: Move search FAB to fragment_apps_games layout
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-02-27 22:46:08 +05:30
Aayush Gupta
361707f0cc SelfUpdateWorker: Make update check interval configurable
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-02-24 06:39:10 +05:30
Aayush Gupta
3091679c4c ShortcutManagerUtil: Ensure app has a launch intent
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-02-23 12:53:52 +05:30
Aayush Gupta
89fdf1186f AppDetailsFragment: Show menu action to create app shortcut if supported
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-02-23 12:25:48 +05:30
Aayush Gupta
dd584b5b7b SplashFragment: Remove from backstack when launching an intent
SplashFragment always removes itself from backstack in every other case, do same
when launching the app detail page to handle intents as well.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-02-22 18:27:48 +05:30
Aayush Gupta
98fe3e3cb3 fixup! DownloadWorkerUtil: Rework cancelAll logic to only cancel request downloads
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-02-22 13:50:39 +05:30
Aayush Gupta
14729ad7ca fixup! DownloadWorkerUtil: Cancel all failed downloads on init
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-02-22 11:49:30 +05:30
Aayush Gupta
defd6272d2 SplashFragment: Build secure anonymous data when requested
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-02-21 21:08:24 +05:30
Aayush Gupta
e0d1185f16 DownloadWorker: Always run onSuccess block as NonCancellable
* Change context in SessionInstaller when starting activity instead

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-02-21 20:31:17 +05:30
Aayush Gupta
1108edc303 DownloadWorkerUtil: Cancel all failed downloads on init
WorkManager downloads can fail due to n number of reason. Regardless of the reason
there might be not enough time to mark the download as failed within the worker
causing the download to keep the status as downloading on next startup, thus blocking
the queue.

Always check for downloads with downloading status on init and cancel them if work
manager cannot find atleast one ongoing work for it.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-02-21 20:00:22 +05:30
Aayush Gupta
1a01f96f08 DownloadWorkerUtil: Rework cancelAll logic to only cancel request downloads
We don't want to cancel all downloads when user requests to cancel only updates.
Also, update the download's status to cancelled atomically.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-02-21 20:00:17 +05:30
Aayush Gupta
11ac8092e2 DownloadWorker: Update file and sharedLib list atomically
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-02-21 17:54:06 +05:30
Aayush Gupta
4e8d2cd78a UpdatesPreferences: Fix updating the work frequency
Missed during 3339d4a395

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-02-20 18:49:37 +05:30
Aayush Gupta
45b1fdf44b DownloadWorkerUtil: Cancel download regardless of status when requested
This is useful when an active download is stuck which could happen if the app
was force stopped by user or killed by Android.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-02-19 18:11:28 +05:30
Aayush Gupta
b3cada603c DownloadWorker: Split out download database update logic
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-02-19 15:43:08 +05:30
Aayush Gupta
94f724ee66 fixup! DownloadWorker: Only update appropriate status field on status change
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-02-17 15:36:09 +05:30
Aayush Gupta
295f7decfa fixup! CertUtil: Fix & improve fdroid app check
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-02-17 15:20:30 +05:30
Aayush Gupta
3c25626a75 DownloadWorker: Only update appropriate status field on status change
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-02-17 15:04:37 +05:30
Aayush Gupta
b35f6e0f1d UpdatesViewModel: Only cancel updates with cancelAll button
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-02-16 18:19:48 +05:30
Aayush Gupta
b3f991b8d7 DownloadFragment: Bring back force clear all menu action
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-02-16 17:59:28 +05:30
Aayush Gupta
2e19eac1c4 CertUtil: Fix & improve fdroid app check
* Check for fdroid basic as install source as well
* Check for fdroid.org as organization name in signing certificate attribute

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-02-15 19:43:54 +05:30
Aayush Gupta
42c182bdb7 Revert "AppUpdateView: Show icons on incompatible updates buttons"
This reverts commit d4552007a7.
2024-02-15 17:27:21 +05:30
Aayush Gupta
d4552007a7 AppUpdateView: Show icons on incompatible updates buttons
- Slashed circle: Disabled
- Shield with a cross: Fails certificate verification

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-02-12 15:03:42 +05:30
Aayush Gupta
41b13c3429 UpdatesViewModel: Allow users to filter cert-verification failed updates
If a user has incompatible updates turned on, show them updates which fails
certificate verification as well.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2024-02-12 15:03:42 +05:30