fix WRITE_EXTERNAL_STORAGE in scoped storage & remove LegacyExternalStorage

This commit is contained in:
luvletter2333 2022-11-03 16:51:26 +08:00
parent a5393e9e9d
commit 50f2b934c5
No known key found for this signature in database
GPG Key ID: A26A8880836E1978
2 changed files with 2 additions and 4 deletions

View File

@ -121,9 +121,7 @@
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="false"
android:requestLegacyExternalStorage="true"
android:hasFragileUserData="true"
android:preserveLegacyExternalStorage="true"
android:allowAudioPlaybackCapture="true"
tools:replace="android:supportsRtl">

View File

@ -30200,7 +30200,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
builder.setTitle(LocaleController.getString("DeleteDownloadedFile"));
builder.setMessage(LocaleController.getString("DeleteDownloadedFileConfirm"));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), (dialogInterface, i) -> {
if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
if (Build.VERSION.SDK_INT >= 23 && (Build.VERSION.SDK_INT <= 28 || BuildVars.NO_SCOPED_STORAGE) && getParentActivity().checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
getParentActivity().requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 4);
return;
}
@ -30306,7 +30306,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
break;
}
case nkbtn_stickerdl: {
if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
if (Build.VERSION.SDK_INT >= 23 && (Build.VERSION.SDK_INT <= 28 || BuildVars.NO_SCOPED_STORAGE) && getParentActivity().checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
getParentActivity().requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 4);
selectedObject = null;
selectedObjectGroup = null;