突破分享路径限制
This commit is contained in:
parent
ff1263e4ea
commit
0957d6155b
@ -1,3 +1,8 @@
|
|||||||
|
## 4.0.1
|
||||||
|
|
||||||
|
* fix
|
||||||
|
* shareMultiImage/shareVideo
|
||||||
|
|
||||||
## 4.0.0
|
## 4.0.0
|
||||||
|
|
||||||
* 升级 Flutter 3.0
|
* 升级 Flutter 3.0
|
||||||
|
@ -36,6 +36,8 @@ android {
|
|||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resourcePrefix 'weibo_kit'
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
|
|
||||||
|
15
android/src/vendor/AndroidManifest.xml
vendored
15
android/src/vendor/AndroidManifest.xml
vendored
@ -1,4 +1,5 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="io.github.v7lin.weibo_kit">
|
package="io.github.v7lin.weibo_kit">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
@ -8,4 +9,18 @@
|
|||||||
<!-- targetSdkVersion>=30 -> Android 11 软件包可见性 -->
|
<!-- targetSdkVersion>=30 -> Android 11 软件包可见性 -->
|
||||||
<package android:name="com.sina.weibo" />
|
<package android:name="com.sina.weibo" />
|
||||||
</queries>
|
</queries>
|
||||||
|
|
||||||
|
<application>
|
||||||
|
<!--覆盖 aar -->
|
||||||
|
<provider
|
||||||
|
android:name="com.sina.weibo.sdk.content.FileProvider"
|
||||||
|
android:authorities="${applicationId}.fileprovider"
|
||||||
|
android:exported="false"
|
||||||
|
android:grantUriPermissions="true" >
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
|
android:resource="@xml/weibo_kit_filepaths"
|
||||||
|
tools:replace="android:resource"/>
|
||||||
|
</provider>
|
||||||
|
</application>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
26
android/src/vendor/res/xml/weibo_kit_filepaths.xml
vendored
Normal file
26
android/src/vendor/res/xml/weibo_kit_filepaths.xml
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<paths>
|
||||||
|
<!-- 指定共享文件的目录路径-->
|
||||||
|
|
||||||
|
<!-- 等同于 Context.getExternalFilesDir(null)-->
|
||||||
|
<!--
|
||||||
|
<external-files-path
|
||||||
|
name="share_files"
|
||||||
|
path="." />
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- 等同于 Context.getExternalCacheDirs(null)-->
|
||||||
|
<!--
|
||||||
|
<external-cache-path
|
||||||
|
name="share_cache_files"
|
||||||
|
path="." />
|
||||||
|
-->
|
||||||
|
|
||||||
|
<root-path name="root" path="" />
|
||||||
|
<files-path name="files" path="" />
|
||||||
|
<cache-path name="cache" path="" />
|
||||||
|
<external-path name="external" path="" />
|
||||||
|
<external-files-path name="external_files" path="" />
|
||||||
|
<external-cache-path name="external_cache" path="" />
|
||||||
|
<external-media-path name="external_media" path="" />
|
||||||
|
</paths>
|
@ -140,26 +140,26 @@ class _HomeState extends State<Home> {
|
|||||||
ListTile(
|
ListTile(
|
||||||
title: Text('图片分享'),
|
title: Text('图片分享'),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
File file = await DefaultCacheManager().getSingleFile(
|
final File file = await DefaultCacheManager().getSingleFile(
|
||||||
'https://www.baidu.com/img/bd_logo1.png?where=super');
|
'https://www.baidu.com/img/bd_logo1.png?where=super');
|
||||||
if (Platform.isAndroid) {
|
// if (Platform.isAndroid) {
|
||||||
// 仅支持 Context.getExternalFilesDir(null)/Context.getExternalCacheDirs(null) 路径分享
|
// // 仅支持 Context.getExternalFilesDir(null)/Context.getExternalCacheDirs(null) 路径分享
|
||||||
// path_provider.getExternalCacheDirectories();
|
// // path_provider.getExternalCacheDirectories();
|
||||||
// path_provider.getExternalStorageDirectory();
|
// // path_provider.getExternalStorageDirectory();
|
||||||
final Directory temporaryDir =
|
// final Directory temporaryDir =
|
||||||
await path_provider.getTemporaryDirectory();
|
// await path_provider.getTemporaryDirectory();
|
||||||
if (path.isWithin(temporaryDir.parent.path, file.path)) {
|
// if (path.isWithin(temporaryDir.parent.path, file.path)) {
|
||||||
// 复制
|
// // 复制
|
||||||
final File copyFile = File(path.join(
|
// final File copyFile = File(path.join(
|
||||||
(await path_provider.getExternalStorageDirectory())!.path,
|
// (await path_provider.getExternalStorageDirectory())!.path,
|
||||||
path.basename(file.path)));
|
// path.basename(file.path)));
|
||||||
if (copyFile.existsSync()) {
|
// if (copyFile.existsSync()) {
|
||||||
await copyFile.delete();
|
// await copyFile.delete();
|
||||||
}
|
// }
|
||||||
await copyFile.writeAsBytes(await file.readAsBytes());
|
// await copyFile.writeAsBytes(await file.readAsBytes());
|
||||||
file = copyFile;
|
// file = copyFile;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
await Weibo.instance.shareMultiImage(
|
await Weibo.instance.shareMultiImage(
|
||||||
text: 'Share Text',
|
text: 'Share Text',
|
||||||
imageUris: <Uri>[Uri.file(file.path)],
|
imageUris: <Uri>[Uri.file(file.path)],
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: weibo_kit
|
name: weibo_kit
|
||||||
description: A powerful Flutter plugin allowing developers to auth/share with natvie Android & iOS Weibo SDKs.
|
description: A powerful Flutter plugin allowing developers to auth/share with natvie Android & iOS Weibo SDKs.
|
||||||
version: 4.0.0
|
version: 4.0.1
|
||||||
# author: v7lin <v7lin@qq.com>
|
# author: v7lin <v7lin@qq.com>
|
||||||
homepage: https://github.com/RxReader/weibo_kit.git
|
homepage: https://github.com/RxReader/weibo_kit.git
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user