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
}
private void share(List<String> list, String type, String sharePanelTitle, String subject) {
ArrayList<Uri> uriList = new ArrayList<>();;
if (list == null || list.isEmpty()) {
throw new IllegalArgumentException("Non-empty list expected");
}
......@@ -85,7 +87,6 @@ public class ShareExtendPlugin implements MethodChannel.MethodCallHandler, Plugi
}
}
ArrayList<Uri> uriList = new ArrayList<>();
for (String path : list) {
File f = new File(path);
Uri uri = ShareUtils.getUriForFile(getContext(), f);
......@@ -108,15 +109,17 @@ public class ShareExtendPlugin implements MethodChannel.MethodCallHandler, Plugi
}
ShareUtils.grantUriPermission(getContext(), uriList, shareIntent);
}
startChooserActivity(shareIntent, sharePanelTitle);
startChooserActivity(shareIntent, sharePanelTitle, uriList);
}
private Context getContext() {
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);
ShareUtils.grantUriPermission(getContext(), uriList, chooserIntent);
if (mRegistrar.activity() != null) {
mRegistrar.activity().startActivity(chooserIntent);
} 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