From e806f8c4e602697eddeb7525e71ca5fe14d4d8fa Mon Sep 17 00:00:00 2001
From: litetex <40789489+litetex@users.noreply.github.com>
Date: Wed, 8 Dec 2021 20:22:26 +0100
Subject: [PATCH] Android 10+ only allows SAF -> Respect that in the dialog
---
.../streams/io/NoFileManagerSafeGuard.java | 17 +++++++++++++----
app/src/main/res/values/strings.xml | 1 +
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/app/src/main/java/org/schabi/newpipe/streams/io/NoFileManagerSafeGuard.java b/app/src/main/java/org/schabi/newpipe/streams/io/NoFileManagerSafeGuard.java
index c7dcb9975..df43c34c1 100644
--- a/app/src/main/java/org/schabi/newpipe/streams/io/NoFileManagerSafeGuard.java
+++ b/app/src/main/java/org/schabi/newpipe/streams/io/NoFileManagerSafeGuard.java
@@ -2,6 +2,7 @@ package org.schabi.newpipe.streams.io;
import android.content.ActivityNotFoundException;
import android.content.Context;
+import android.os.Build;
import android.util.Log;
import androidx.activity.result.ActivityResultLauncher;
@@ -27,12 +28,20 @@ public final class NoFileManagerSafeGuard {
"Unable to open no file manager alert dialog: Context is null");
}
+ final String message;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
+ // Android 10+ only allows SAF
+ message = context.getString(R.string.no_appropriate_file_manager_message_android_10);
+ } else {
+ message = context.getString(
+ R.string.no_appropriate_file_manager_message,
+ context.getString(R.string.downloads_storage_use_saf_title));
+ }
+
+
new AlertDialog.Builder(context)
.setTitle(R.string.no_app_to_open_intent)
- .setMessage(
- context.getString(
- R.string.no_appropriate_file_manager_message,
- context.getString(R.string.downloads_storage_use_saf_title)))
+ .setMessage(message)
.setPositiveButton(R.string.ok, null)
.show();
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 8d82c3dd7..22051939b 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -672,6 +672,7 @@
Chapters
No app on your device can open this
No appropriate file manager was found for this action.\nPlease install a file manager or try to disable \'%s\' in the download settings.
+ No appropriate file manager was found for this action.\nPlease install a Storage Access Framework compatible file manager.
This content is not available in your country.
This is a SoundCloud Go+ track, at least in your country, so it cannot be streamed or downloaded by NewPipe.
This content is private, so it cannot be streamed or downloaded by NewPipe.