mirror of
https://github.com/NekoX-Dev/NekoX.git
synced 2024-12-13 13:29:32 +01:00
Disable NO_SCOPED_STORAGE on Android 11+
This enables system file picker. Side effects are not tested.
This commit is contained in:
parent
dea17045af
commit
a08f0973a4
@ -12,6 +12,7 @@ import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
public class BuildVars {
|
||||
@ -20,7 +21,7 @@ public class BuildVars {
|
||||
public static boolean DEBUG_PRIVATE_VERSION = DEBUG_VERSION;
|
||||
public static boolean LOGS_ENABLED = DEBUG_PRIVATE_VERSION;
|
||||
public static boolean USE_CLOUD_STRINGS = true;
|
||||
public static boolean NO_SCOPED_STORAGE = true;
|
||||
public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
|
||||
|
||||
public static int BUILD_VERSION; // generated
|
||||
public static String BUILD_VERSION_STRING;
|
||||
|
@ -50,15 +50,9 @@ object EnvUtil {
|
||||
@JvmStatic
|
||||
fun getTelegramPath(): File {
|
||||
|
||||
if (NekomuraConfig.cachePath.String() == null) {
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
// https://github.com/NekoX-Dev/NekoX/issues/284
|
||||
NekomuraConfig.cachePath.setConfigString(File(ApplicationLoader.getDataDirFixed(), "cache/media").path)
|
||||
} else {
|
||||
NekomuraConfig.cachePath.setConfigString(ApplicationLoader.applicationContext.getExternalFilesDir("files")?.parent ?: File(ApplicationLoader.getDataDirFixed(), "cache/media").path)
|
||||
}
|
||||
|
||||
if (NekomuraConfig.cachePath.String() == "") {
|
||||
// https://github.com/NekoX-Dev/NekoX/issues/284
|
||||
NekomuraConfig.cachePath.setConfigString(availableDirectories[2]);
|
||||
}
|
||||
|
||||
var telegramPath = File(NekomuraConfig.cachePath.String())
|
||||
@ -69,6 +63,8 @@ object EnvUtil {
|
||||
|
||||
}
|
||||
|
||||
// fallback
|
||||
|
||||
telegramPath = ApplicationLoader.applicationContext.getExternalFilesDir(null) ?: File(ApplicationLoader.getDataDirFixed(), "cache/files")
|
||||
|
||||
if (telegramPath.isDirectory || telegramPath.mkdirs()) {
|
||||
|
Loading…
Reference in New Issue
Block a user