From 72f757cd7226347956c133db6b41f89a4d5d3fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B6=E5=BC=80=E6=9D=B0?= Date: Wed, 16 Oct 2024 19:10:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9=20Android=20=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E5=88=86=E4=BA=AB=E5=A4=A7=E5=B0=8F=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 二、图片类型分享示例 WXImageObject (WXMediaMessage.IMediaObject 的派生类,用于描述一个图片对象) 根据微信官方文档 imageData 图片的二进制数据 内容大小不超过 1MB imagePath 图片的本地路径 对应图片内容大小不超过 25MB --- .../kotlin/com/jarvan/fluwx/handlers/FluwxShareHandler.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/android/src/main/kotlin/com/jarvan/fluwx/handlers/FluwxShareHandler.kt b/android/src/main/kotlin/com/jarvan/fluwx/handlers/FluwxShareHandler.kt index 66dd7a79..f9f2e853 100644 --- a/android/src/main/kotlin/com/jarvan/fluwx/handlers/FluwxShareHandler.kt +++ b/android/src/main/kotlin/com/jarvan/fluwx/handlers/FluwxShareHandler.kt @@ -105,7 +105,11 @@ internal interface FluwxShareHandler : CoroutineScope { val uint8List = map["uint8List"] as? ByteArray val imageObject = uint8List?.let { WXImageObject().apply { - imageData = it + if (supportFileProvider && targetHigherThanN) { + setImagePath(getFileContentUri(it.toCacheFile(context, ".png"))) + } else { + imagePath = it.toExternalCacheFile(context, ".png")?.absolutePath + } imgDataHash = imgHash } }?:run {