I've never used the information, and it makes navigation of the crash log
more difficult than it should be
I'll face the consequences if I'm incorrect here.
* Update ScopedStorageService.kt
Fixed warnings in ScopedStorageService.kt.
issue: #13282
* Removed lines in ScopedStorageService.kt
Deleted the code that was commented out.
- will abort (like before) if play store rejects us or play build fails
- will only commit/push build tag if play store works
- universal builds happen after play upload so universal doesn't upload
- migration completion notification and dialog
- added showAsyncDialogFragment to show the alert dialog/notification
- added callback in application to get current activity
---
* Refactor MigrationSuccessDialogFragment & add MigrationFailedDialogFragment
First of all, this moves MigrationSuccessDialogFragment to
com/ichi2/anki/ui/dialogs/ActivityAgnosticDialogs.kt along with the
related code that tracks the started activities and runs code on start
of any of them.
This also adds MigrationFailedDialogFragment. As we currently lack the
knowledge about what exactly can realistically fail and how, it just
shows the exception text and allows copying the debug info in the same
way as the notification does. It would be nice to try to account for
the most common errors here.
Also this:
* makes the above dialogs not cancellable on touch outside;
* adds DefaultActivityLifecycleCallbacks--same as
Application.ActivityLifecycleCallbacks but with all methods having
default implementations--for simplicity;
* adds Activity.canProperlyShowSnackbars() to determine if a
snackbar, if shown in an activity, will animate properly, or if
a toast should be shown instead;
* fixes a slight issue in Snackbars.kt where an activity with a view
with the ID root_layout would be treated as one that can properly
show a snackbar--the code wasn't checking whether or not the view
was CoordinatorLayout so it could produce the wrong result.
* Extract & change strings related to migration success or failure
* Dismiss migration progress dialog when done
* add real URL to storage migration error doc
---------
Co-authored-by: Ashish Yadav <48384865+criticalAY@users.noreply.github.com>
Co-authored-by: Mike Hardy <github@mikehardy.net>
Cause: `getDefaultAnkiDroidDirectory` caused recursion.
This recursion is normally gated on the existence of PREF_COLLECTION_PATH
But we didn't take this into account when in INSTRUMENTATION_TEST mode
This is fixed incidentally by 6dcf23fd10,
but the underlying cause wasn't handled
Tested by rebasing onto d88ad6251c
and running tests on `playDebug` (API 32 emulator)
Tests now fail due to an alternate setup issue
```
java.lang.NullPointerException
at com.ichi2.anki.TestUtils.isScreenSw600dp(TestUtils.kt:78)
at com.ichi2.anki.DeckPickerTest.checkIfStudyOptionsIsDisplayedOnTablet(DeckPickerTest.kt:91)
```
Fixes 13644
Scenario:
* The user can request 'MANAGE_EXTERNAL_STORAGE' (non-Play build)
* The collection path is `/storage/emulated/0/AnkiDroid`
* The user is on API 30
* The user reinstalled & kept data
Expected Result:
* We require 'MANAGE_EXTERNAL_STORAGE' to continue to access data
Previously:
1. We requested READ/WRITE_EXTERNAL_STORAGE
2. When accepted: 'StorageAccessException': User no longer had access
to legacy storage.
Implementation:
This splits `hasLegacyStoragePermissions` into two concepts:
1. Do we have a legacy collection
2. Does Android allow us to use legacy folders
Previously we only checked for (1) whereas we needed both
* Replace MaterialDialog with AlertDialog in SharedDecksDownloadFragment.kt
* Replace AlertDialog.Builder with
MaterialAlertDialogBuilder in SharedDecksDownloadFragment.kt
* Remove Suppress onBackPressed deprecation
in SharedDecksDownloadFragment.kt
* Add Suppress onBackPressed deprecation
in SharedDecksDownloadFragment.kt
* Replace MaterialAlertDialogBuilder
with AlertDialog.Builder in SharedDecksDownloadFragment.kt
* Replace MaterialAlertDialogBuilder
with AlertDialog.Builder in SharedDecksDownloadFragment.kt
* Revert "Replace MaterialAlertDialogBuilder"
This reverts commit b0d358cb6c.
* Remove .create()
in showCancelConfirmationDialog()
in SharedDecksDownloadFragment.kt
this was previously a permissions check, which should
have had priority. Now we no longer request permissions,
this check should have been moved down, and not added to
(Use an alternate design for the icon of the backup suggestion dialog box
if the user doesn't use the sync feature)
The current icon with an upward arrow in a cloud alludes uploading data to cloud (AnkiWeb).
Its design is misleading for encouraging backup to those who don't use the sync feature.
By this commit, an icon which generally means "Setting backup restore" will be shown
instead of the current icon when the user hasn't logged in to their AnkiWeb account.
As I found the code quite confusing to read, I rewrote it to split in three cases:
* source does not exists
* destination exists
* move can occur as expected
Only change: if a move from a non-existing file to an existing file is
requested, report progress 0. After all, 0 bytes were copied, but one
instruction was executed.
Fixed: #13170
We were using the condition `allFileAccessPermissionGranted`
But this returns false before API 30
Instead define and use `collectionWillBeMadeInaccessibleAfterUninstall`
which takes this condition into account
Fixes 13612
* Fix "Access denied" errors after upgrading from 2.15.6
selectAnkiDroidFolder() didn't handle the case of the user keeping the legacy storage permissions on an Android 11+ device
* fixup! Fix "Access denied" errors after upgrading from 2.15.6
* NF: Use named argument
This moves the creation of MigrateUserData to a background thread.
Note that this does move the creation of an instance of
UserDataMigrationPreferences to the background thread as well.
This moves the creation of MigrateUserData to a background thread.
Note that this does move the creation of an instance of
UserDataMigrationPreferences to the background thread as well.
As requested. Terminology:
* TODO BEFORE-MERGE means that the TODO SHOULD be resolved before the
commit is merged into main;
* TODO BEFORE-RELEASE means that the TODO SHOULD be resolved before the
release of the new stable version;
* If the tag is followed by an exclamation mark, e.g.
TODO BEFORE-MERGE!, replace SHOULD with MUST, as per RFC 2119.
Splitting this into several commits would be too hard, so sorry about
this commit doing a lot of things at once.
* Migration service is refactored in a major way. For progress,
StateFlow is used. Progress now includes not only the transfer stage,
but also the stage of calculating transfer size and success/failure
states. UI reads this progress directly.
* Binding to the service is performed using coroutines, which should
simplify integrating services with UI.
* The ongoing-migration toolbar button in DeckPicker now starts at 5% so
that the user sees at least some of the circular progress indicator in
the very beginning.