Commit 78168f3a authored by zhouteng's avatar zhouteng Committed by GitHub

Merge pull request #43 from sgehrman/master

fixed image permission error
parents bac5b67c 1a4e054f
...@@ -66,6 +66,8 @@ public class ShareExtendPlugin implements MethodChannel.MethodCallHandler, Plugi ...@@ -66,6 +66,8 @@ public class ShareExtendPlugin implements MethodChannel.MethodCallHandler, Plugi
} }
private void share(List<String> list, String type, String sharePanelTitle, String subject) { private void share(List<String> list, String type, String sharePanelTitle, String subject) {
ArrayList<Uri> uriList = new ArrayList<>();;
if (list == null || list.isEmpty()) { if (list == null || list.isEmpty()) {
throw new IllegalArgumentException("Non-empty list expected"); throw new IllegalArgumentException("Non-empty list expected");
} }
...@@ -85,7 +87,6 @@ public class ShareExtendPlugin implements MethodChannel.MethodCallHandler, Plugi ...@@ -85,7 +87,6 @@ public class ShareExtendPlugin implements MethodChannel.MethodCallHandler, Plugi
} }
} }
ArrayList<Uri> uriList = new ArrayList<>();
for (String path : list) { for (String path : list) {
File f = new File(path); File f = new File(path);
Uri uri = ShareUtils.getUriForFile(getContext(), f); Uri uri = ShareUtils.getUriForFile(getContext(), f);
...@@ -108,15 +109,17 @@ public class ShareExtendPlugin implements MethodChannel.MethodCallHandler, Plugi ...@@ -108,15 +109,17 @@ public class ShareExtendPlugin implements MethodChannel.MethodCallHandler, Plugi
} }
ShareUtils.grantUriPermission(getContext(), uriList, shareIntent); ShareUtils.grantUriPermission(getContext(), uriList, shareIntent);
} }
startChooserActivity(shareIntent, sharePanelTitle); startChooserActivity(shareIntent, sharePanelTitle, uriList);
} }
private Context getContext() { private Context getContext() {
return mRegistrar.activity() != null ? mRegistrar.activity() : mRegistrar.context(); return mRegistrar.activity() != null ? mRegistrar.activity() : mRegistrar.context();
} }
private void startChooserActivity(Intent shareIntent, String sharePanelTitle) { private void startChooserActivity(Intent shareIntent, String sharePanelTitle, ArrayList<Uri> uriList) {
Intent chooserIntent = Intent.createChooser(shareIntent, sharePanelTitle); Intent chooserIntent = Intent.createChooser(shareIntent, sharePanelTitle);
ShareUtils.grantUriPermission(getContext(), uriList, chooserIntent);
if (mRegistrar.activity() != null) { if (mRegistrar.activity() != null) {
mRegistrar.activity().startActivity(chooserIntent); mRegistrar.activity().startActivity(chooserIntent);
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment