From ffa25ec9734eebe3e499fe6f3a69c1fc14c49049 Mon Sep 17 00:00:00 2001 From: Hevin Lau Date: Thu, 5 Jan 2017 23:27:14 +0800 Subject: [PATCH] Fix bug. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 解决 getMyInfo 方法无法获取头像缩略图的问题。 --- src/android/JMessagePlugin.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/android/JMessagePlugin.java b/src/android/JMessagePlugin.java index ceb8aca..d20628c 100644 --- a/src/android/JMessagePlugin.java +++ b/src/android/JMessagePlugin.java @@ -392,10 +392,15 @@ public void getMyInfo(JSONArray data, CallbackContext callback) { try { String json = mGson.toJson(myInfo); JSONObject jsonObject = new JSONObject(json); - String avatarPath = ""; - if (myInfo.getAvatarFile() != null) { - avatarPath = myInfo.getAvatarFile().getAbsolutePath(); - } + String avatarPath = myInfo.getAvatarFile().getAbsolutePath(); + myInfo.getAvatarBitmap(new GetAvatarBitmapCallback() { + @Override + public void gotResult(int status, String desc, Bitmap bitmap) { + if (status != 0) { + callback.error(status + ": " + desc); + } + } + }); jsonObject.put("avatarPath", avatarPath); callback.success(jsonObject.toString()); } catch (JSONException e) {