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.
This PR mainly fixes issues with the app logo in landscape when on screens with bigger sizes and also changes how the
gradient works to better cover the screen in landscape.
The string R.string.ankidroid_init_failed_webview is a string resource which uses a placeholder value which was not registered
corectly in IntroductionActivity.
has caused spurious errors from other runners as well and from
individual contributors. Feels like the global maven central CDN
is not in sync but that is also not in our control, so revert
On my desktop, running `./tools/storage/set_scopde_storage.sh` led to
> Alienware% ./tools/storage/set_scoped_storage.sh
> First argument missing.
> \nPossible arguments:
> limited\t\tEquivalent to a fresh install. /AnkiDroid/ is inaccessible
> full\t\tEquivalent to an upgrade from targetSdkVersion 29 to 30. /AnkiDroid/ is accessible\n
Adding `-e` ensures the characters are printed as expected.
Otherwise, bash is not used. Instead, I get
> ./tools/storage/set_scoped_storage.sh: 5: Syntax error: "(" unexpected
because `function` is not basic shell I guess.
* Migrate to AlertDialog in SimpleMessageDialog.kt
* Use apply to prevent double show
* Use AlertDialog message directly
* Make button param non-null
* Use setMessage method
* Use AlertDialog method
* Fix test
* Replace MaterialDialog with AlertDialog
- Specifcally, in the files CardTemplateEditor which necessitated changing it in other places
- Thus in DiscardChangesDialog and whoever else called the function DiscardChangesDialog.showDialog
- Thus in NoteEditor
* Remove deprecations, they cause build failures
* Feedback
- Remove unneeded assertion
- Add assertion to make sure View is present within Dialog
- Other minor cleanup