aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorChristian Schneppe <christian.schneppe@pix-art.de>2019-11-03 19:08:29 +0100
committerChristian Schneppe <christian.schneppe@pix-art.de>2019-11-03 19:08:29 +0100
commit78ef54d600163638e74cdccb1f44f19dfa7ec3b4 (patch)
treeab7a3026ff4ef0b1554cfb1501429c9352d4faf3 /src/main/java
parent94b1f705c5f603ec80f6a482a5c9574d14041d07 (diff)
catch security exception when passing on share intent that didn't give us permission
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ChooseAccountForProfilePictureActivity.java8
-rw-r--r--src/main/java/de/pixart/messenger/ui/ShareWithActivity.java12
2 files changed, 16 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ChooseAccountForProfilePictureActivity.java b/src/main/java/de/pixart/messenger/ui/ChooseAccountForProfilePictureActivity.java
index 2d109809e..23214e228 100644
--- a/src/main/java/de/pixart/messenger/ui/ChooseAccountForProfilePictureActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ChooseAccountForProfilePictureActivity.java
@@ -4,6 +4,7 @@ import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.widget.ListView;
+import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
@@ -75,7 +76,12 @@ public class ChooseAccountForProfilePictureActivity extends XmppActivity {
intent.putExtra(EXTRA_ACCOUNT, account.getJid().asBareJid().toString());
intent.setData(uri);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
- startActivity(intent);
+ try {
+ startActivity(intent);
+ } catch (SecurityException e) {
+ Toast.makeText(this, R.string.sharing_application_not_grant_permission, Toast.LENGTH_SHORT).show();
+ return;
+ }
}
finish();
}
diff --git a/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java b/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java
index badace094..62442830f 100644
--- a/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java
@@ -4,13 +4,14 @@ import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
import java.util.ArrayList;
import java.util.List;
@@ -178,7 +179,12 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
} else if (share.text != null) {
intent.setAction(ConversationsActivity.ACTION_VIEW_CONVERSATION);
intent.putExtra(Intent.EXTRA_TEXT, share.text);
- intent.putExtra(ConversationsActivity.EXTRA_AS_QUOTE, share.asQuote);
+ try {
+ startActivity(intent);
+ } catch (SecurityException e) {
+ Toast.makeText(this, R.string.sharing_application_not_grant_permission, Toast.LENGTH_SHORT).show();
+ return;
+ }
}
startActivity(intent);
finish();