Commit 6f3e02d2 authored by zhouteng's avatar zhouteng

修改了FileProvider的authorities,采用继承的FileProvider

parent 5bc96ef8
## 1.0.7
* Android端修改了FileProvider的authorities,继承FileProvider,防止FileProvider冲突
## 1.0.6
* 修复了android端分享应用沙盒内文件可能出错的bug
* 优化了android端分享时的权限请求逻辑
......
......@@ -5,7 +5,7 @@
```
dependencies:
share_extend: "^1.0.6"
share_extend: "^1.0.7"
```
## 导入
```
......
......@@ -7,13 +7,13 @@
<application>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:name="com.zt.shareextend.ShareExtendProvider"
android:authorities="${applicationId}.shareextend.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_provider_path" />
android:resource="@xml/share_extend_provider_path" />
</provider>
</application>
......
......@@ -81,7 +81,7 @@ public class ShareExtendPlugin implements MethodChannel.MethodCallHandler, Plugi
}
}
Uri uri = ShareUtils.getUriForFile(mRegistrar.context(), f, type);
Uri uri = ShareUtils.getUriForFile(mRegistrar.activity(), f, type);
if ("image".equals(type)) {
shareIntent.setType("image/*");
......
package com.zt.shareextend;
import androidx.core.content.FileProvider;
public class ShareExtendProvider extends FileProvider {
}
......@@ -19,7 +19,7 @@ public class ShareUtils {
/// get the uri for file
public static Uri getUriForFile(Context context, File file, String type) {
String authorities = context.getPackageName() + ".fileprovider";
String authorities = context.getPackageName() + ".shareextend.fileprovider";
Uri uri;
// 低版本直接用 Uri.fromFile
......
name: share_extend
description: A flutter plugin to share text, image, file with system ui. It is compatible with both andorid and ios.
version: 1.0.6
version: 1.0.7
author: zhouteng <qfszyq@gmail.com>
homepage: https://github.com/zhouteng0217/ShareExtend
......
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