1
0
Fork 0
mirror of https://github.com/KokaKiwi/BarInsta synced 2026-04-03 09:31:34 +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));
}