From 03fafccc8b725b10059f38df098eb9f4dc1e6699 Mon Sep 17 00:00:00 2001 From: hevin Date: Wed, 31 May 2017 17:16:13 +0800 Subject: [PATCH 1/3] Fix package name --- src/android/JMessagePlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/android/JMessagePlugin.java b/src/android/JMessagePlugin.java index 2f51583..0d4333a 100644 --- a/src/android/JMessagePlugin.java +++ b/src/android/JMessagePlugin.java @@ -1,4 +1,4 @@ -package cn.jmessage.phonegap; +package cn.jiguang.cordova.im; import android.Manifest; import android.app.Activity; From 27a25a8aa069fab8b5d05129846aa040effd7564 Mon Sep 17 00:00:00 2001 From: hevin Date: Wed, 31 May 2017 17:32:18 +0800 Subject: [PATCH 2/3] Update npm version --- README.md | 2 +- package.json | 2 +- plugin.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9724285..49642ac 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # JMessage PhoneGap / Cordova Plugin -[![release](https://img.shields.io/badge/release-2.4.2-blue.svg)](https://github.com/jpush/jmessage-phonegap-plugin/releases) +[![release](https://img.shields.io/badge/release-2.4.3-blue.svg)](https://github.com/jpush/jmessage-phonegap-plugin/releases) [![platforms](https://img.shields.io/badge/platforms-iOS%7CAndroid-lightgrey.svg)](https://github.com/jpush/jmessage-phonegap-plugin) [![QQ Group](https://img.shields.io/badge/QQ%20Group-413602425-red.svg)](https://github.com/jpush/jmessage-phonegap-plugin) [![weibo](https://img.shields.io/badge/weibo-JPush-blue.svg)](http://weibo.com/jpush?refer_flag=1001030101_&is_all=1) diff --git a/package.json b/package.json index 9dacff2..0fdb889 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jmessage-phonegap-plugin", - "version": "2.4.2", + "version": "2.4.3", "description": "JMessage Cordova Plugin.", "cordova": { "id": "jmessage-phonegap-plugin", diff --git a/plugin.xml b/plugin.xml index f7f2924..be1b400 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="2.4.3"> JMessage 集成极光 IM 和推送功能 From c5c821ae72e8658214c8cba7d1cf055fe17be3ee Mon Sep 17 00:00:00 2001 From: hevin Date: Wed, 31 May 2017 17:34:03 +0800 Subject: [PATCH 3/3] Fix bug OfflineMessages --- src/android/JMessagePlugin.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/android/JMessagePlugin.java b/src/android/JMessagePlugin.java index 0d4333a..1a0fe90 100644 --- a/src/android/JMessagePlugin.java +++ b/src/android/JMessagePlugin.java @@ -149,9 +149,10 @@ public void onEvent(OfflineMessageEvent event) { final JSONArray msgJsonArr = new JSONArray(); int lastMediaMsgIndex = -1; - for (int i = 0; i < event.getOfflineMessageList().size(); i++) { + for (int i = event.getOfflineMessageList().size() - 1; i >= 0; i--) { if (isMediaMessage(event.getOfflineMessageList().get(i))) { lastMediaMsgIndex = i; + break; } } @@ -171,6 +172,7 @@ public void onEvent(OfflineMessageEvent event) { public void onComplete(int status, String desc, File file) { try { msgJsonArr.put(getMessageJSONObject(msg)); + json.put("messageList", msgJsonArr); fireEvent("onSyncOfflineMessage", json.toString()); } catch (JSONException e) { e.printStackTrace(); @@ -184,6 +186,7 @@ public void onComplete(int status, String desc, File file) { public void onComplete(int status, String desc, File file) { try { msgJsonArr.put(getMessageJSONObject(msg)); + json.put("messageList", msgJsonArr); fireEvent("onSyncOfflineMessage", json.toString()); } catch (JSONException e) { e.printStackTrace(); @@ -197,6 +200,7 @@ public void onComplete(int status, String desc, File file) { public void onComplete(int status, String desc, File file) { try { msgJsonArr.put(getMessageJSONObject(msg)); + json.put("messageList", msgJsonArr); fireEvent("onSyncOfflineMessage", json.toString()); } catch (JSONException e) { e.printStackTrace(); @@ -207,6 +211,11 @@ public void onComplete(int status, String desc, File file) { } } } + + if (lastMediaMsgIndex == -1) { + json.put("messageList", msgJsonArr); + fireEvent("onSyncOfflineMessage", json.toString()); + } } catch (JSONException e) { e.printStackTrace(); }