fix:修复分享时bitmap可能为空导致的崩溃问题;

master
yangbingqiao 2022-04-15 19:16:35 +08:00
parent a14045ca6d
commit 3c8bcea19e
1 changed files with 7 additions and 5 deletions

View File

@ -23,12 +23,12 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.json.JSONObject;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.io.ByteArrayOutputStream;
import io.flutter.plugin.common.MethodChannel;
@ -63,10 +63,12 @@ public class AppletHandlerModule extends BaseApi {
Map<String, Object> params = new HashMap<>();
params.put("appletInfo", GsonUtil.gson.fromJson(s, new TypeToken<Map<String, Object>>() {
}.getType()));
if (bitmap != null) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
byte[] data = baos.toByteArray();
params.put("bitmap", data);
}
handler.post(() -> {
channel.invokeMethod("extensionApi:forwardApplet", params, new MethodChannel.Result() {
@Override