Fix strange behaviour when app loses access to saf download folder

This commit is contained in:
Stypox 2021-01-16 15:46:50 +01:00
parent 3399ed2b30
commit c6ad9b8f66
2 changed files with 14 additions and 2 deletions

View file

@ -682,12 +682,15 @@ public class DownloadDialog extends DialogFragment
throw new RuntimeException("No stream selected");
}
if (!askForSavePath && (mainStorage == null || (mainStorage.isDirect()
== NewPipeSettings.useStorageAccessFramework(context)))) {
if (!askForSavePath
&& (mainStorage == null
|| mainStorage.isDirect() == NewPipeSettings.useStorageAccessFramework(context)
|| mainStorage.isInvalidSafStorage())) {
// Pick new download folder if one of:
// - Download folder is not set
// - Download folder uses SAF while SAF is disabled
// - Download folder doesn't use SAF while SAF is enabled
// - Download folder uses SAF but the user manually revoked access to it
Toast.makeText(context, getString(R.string.no_dir_yet),
Toast.LENGTH_LONG).show();