Commit 58661e28 authored by zhouteng's avatar zhouteng

更新版本号,修复FileProvider在低版本下的用法

parent 1028417f
......@@ -5,7 +5,7 @@
```
dependencies:
share_extend: "^0.0.1"
share_extend: "^1.0.0"
```
## 导入
```
......
......@@ -4,9 +4,11 @@ import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.PluginRegistry.Registrar;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.support.v4.content.FileProvider;
......@@ -57,7 +59,7 @@ public class ShareExtendPlugin implements MethodChannel.MethodCallHandler {
shareIntent.setType("text/plain");
} else {
File f = new File(text);
Uri uri = FileProvider.getUriForFile(mRegistrar.context(), authorities,f);
Uri uri = getUriForFile(mRegistrar.context(), authorities,f);
if ("file".equals(type)) {
shareIntent.setType("application/*");
}
......@@ -75,4 +77,12 @@ public class ShareExtendPlugin implements MethodChannel.MethodCallHandler {
mRegistrar.context().startActivity(chooserIntent);
}
}
public static Uri getUriForFile(Context context, String authories, File file) {
if (Build.VERSION.SDK_INT >= 24) {
return FileProvider.getUriForFile(context, authories, file);
} else {
return Uri.fromFile(file);
}
}
}
name: share_extend
description: A flutter plugin to share text, image, file with systemui.
version: 0.0.1
description: A flutter plugin to share text, image, file with systemui. 一个调用系统分享的flutter插件,支持分享文本,图片和文件。
version: 1.0.0
author: zhouteng <qfszyq@gmail.com>
homepage: https://github.com/zhouteng0217/ShareExtend.git
......
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