Commit 6f3e02d2 authored by zhouteng's avatar zhouteng

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

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