-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
安卓分享图片的共享路径问题 #50
Comments
微博SDK和文档写的和狗屎没差别,我今天更新了一下,多图分享直接跪 |
路径方式分享功能似乎已经跪的妥妥的 ... |
搞定了,傻吊微博SDK辣么大的更新居然没个文档,你先用 git 方式引入,没问题后我再发布正式版本 File file = await DefaultCacheManager().getSingleFile(
'https://www.baidu.com/img/bd_logo1.png?where=super');
if (Platform.isAndroid) {
// 仅支持 Context.getExternalFilesDir(null)/Context.getExternalCacheDirs(null) 路径分享
// path_provider.getExternalCacheDirectories();
// path_provider.getExternalStorageDirectory();
final Directory temporaryDir =
await path_provider.getTemporaryDirectory();
if (path.isWithin(temporaryDir.parent.path, file.path)) {
// 复制
final File copyFile = File(path.join(
(await path_provider.getExternalStorageDirectory())!.path,
path.basename(file.path)));
if (copyFile.existsSync()) {
await copyFile.delete();
}
await copyFile.writeAsBytes(await file.readAsBytes());
file = copyFile;
}
}
await Weibo.instance.shareMultiImage(
text: 'Share Text',
imageUris: <Uri>[Uri.file(file.path)],
); |
我再试试覆盖傻逼微博SDK的FileProvider,突破一下路径限制 |
复制了上面的代码,还是不可用,请问还有解决方式吗 @droplet-js |
这个可以,我测试了华为 mate20(android9);小米10S(android12);但是如果是分享单图的接口 |
Open
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
微博分享图片目前是不能传本地图片地址的,除非你在主工程配置ProviderPath,即使如此也可能是找不到的。
目前imageUri:需要的是网络图片下载到本地的地址,而不是网络图片url,因此建议不使用imageUri,只使用imageData。
await wbkit.Weibo.instance.shareImage(
text: '${info.title}。${info.brief}',
imageData: await getNetworkImageData(info.url),
imageUri: Uri.parse(info.href),
);
The text was updated successfully, but these errors were encountered: