From b367a6e0a0650cd02755e263c971d60b52612666 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 10 Feb 2021 17:59:10 +0100 Subject: [PATCH] Import with read permissions --- app/src/main/java/eu/faircode/email/ActivitySetup.java | 4 +++- app/src/main/java/eu/faircode/email/FragmentRules.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ActivitySetup.java b/app/src/main/java/eu/faircode/email/ActivitySetup.java index 16633c897a..dd28fc23a3 100644 --- a/app/src/main/java/eu/faircode/email/ActivitySetup.java +++ b/app/src/main/java/eu/faircode/email/ActivitySetup.java @@ -19,6 +19,7 @@ package eu.faircode.email; Copyright 2018-2021 by Marcel Bokhorst (M66B) */ +import android.Manifest; import android.app.Dialog; import android.app.NotificationChannel; import android.app.NotificationChannelGroup; @@ -712,7 +713,8 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac Uri uri = args.getParcelable("uri"); String password = args.getString("password"); - if (!"content".equals(uri.getScheme())) { + if (!"content".equals(uri.getScheme()) && + !Helper.hasPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE)) { Log.w("Import uri=" + uri); throw new IllegalArgumentException(context.getString(R.string.title_no_stream)); } diff --git a/app/src/main/java/eu/faircode/email/FragmentRules.java b/app/src/main/java/eu/faircode/email/FragmentRules.java index aae4713da5..fa210139dc 100644 --- a/app/src/main/java/eu/faircode/email/FragmentRules.java +++ b/app/src/main/java/eu/faircode/email/FragmentRules.java @@ -19,6 +19,7 @@ package eu.faircode.email; Copyright 2018-2021 by Marcel Bokhorst (M66B) */ +import android.Manifest; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; @@ -392,7 +393,8 @@ public class FragmentRules extends FragmentBase { long fid = args.getLong("folder"); Uri uri = args.getParcelable("uri"); - if (!"content".equals(uri.getScheme())) { + if (!"content".equals(uri.getScheme()) && + !Helper.hasPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE)) { Log.w("Import uri=" + uri); throw new IllegalArgumentException(context.getString(R.string.title_no_stream)); }