1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-12-23 05:16:58 +00:00

show proper error for download category

This commit is contained in:
Austin Huang 2021-06-22 12:11:16 -04:00
parent ac4bb2e027
commit d031998123
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
4 changed files with 9 additions and 2 deletions

View File

@ -81,6 +81,10 @@ public class DirectorySelectActivity extends BaseLanguageActivity {
showErrorDialog(getString(R.string.select_a_folder));
return;
}
if (!"com.android.externalstorage.documents".equals(data.getData().getAuthority())) {
showErrorDialog(getString(R.string.dir_select_no_download_folder));
return;
}
AppExecutors.INSTANCE.getMainThread().execute(() -> {
try {
viewModel.setupSelectedDir(data);

View File

@ -102,7 +102,9 @@ public class DownloadsPreferencesFragment extends BasePreferencesFragment {
final ConfirmDialogFragment dialogFragment = ConfirmDialogFragment.newInstance(
123,
R.string.error,
"Please report this error to the developers:\n\n" + sw.toString(),
"com.android.externalstorage.documents".equals(data.getData().getAuthority())
? "Please report this error to the developers:\n\n" + sw.toString()
: getString(R.string.dir_select_no_download_folder),
R.string.ok,
0,
0

View File

@ -68,7 +68,7 @@ public final class DownloadUtils {
if (TextUtils.isEmpty(barinstaDirUri)) {
throw new ReselectDocumentTreeException("folder path is null or empty");
}
if (!barinstaDirUri.startsWith("content")) {
if (!barinstaDirUri.startsWith("content://com.android.externalstorage.documents")) {
// reselect the folder in selector view
throw new ReselectDocumentTreeException(Uri.parse(barinstaDirUri));
}

View File

@ -512,6 +512,7 @@
<string name="dir_select_folder_not_exist">The previously selected folder does not exist now:</string>
<string name="dir_select_message2">Re-select the directory or select a new directory by clicking the button below.</string>
<string name="select_a_folder">No folder selected!</string>
<string name="dir_select_no_download_folder">Please choose a directory from your storage, not a category on the sidebar.</string>
<string name="dir_select_success_message">Success! Please wait. Starting app…</string>
<string name="barinsta_folder">Barinsta folder</string>
<string name="top">Top</string>