Skip to content

Commit 8c3f03c

Browse files
KenChoiKenChoi
authored andcommitted
prepare release 2.0.0-beta3
1 parent 7efa62f commit 8c3f03c

File tree

4 files changed

+24
-25
lines changed

4 files changed

+24
-25
lines changed

android/src/io/jchat/android/JMessageModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public boolean canOverrideExistingModule() {
104104
}
105105

106106
@ReactMethod
107-
public void init(ReadableMap map) {
107+
public void setup(ReadableMap map) {
108108
try {
109109
boolean isOpenMessageRoaming = map.getBoolean(Constant.IS_OPEN_MESSAGE_ROAMING);
110110
JMessageClient.init(getReactApplicationContext(), isOpenMessageRoaming);

android/src/io/jchat/android/utils/ResultUtils.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static WritableMap toJSObject(Map<String, String> map) {
5959

6060
public static WritableMap toJSObject(final UserInfo userInfo) {
6161
if (userInfo == null) {
62-
return null;
62+
return Arguments.createMap();
6363
}
6464
final WritableMap result = Arguments.createMap();
6565
result.putString("type", "user");
@@ -109,7 +109,7 @@ public static WritableMap toJSObject(GroupInfo groupInfo) {
109109
public static WritableMap toJSObject(Message msg) {
110110
WritableMap result = Arguments.createMap();
111111
try {
112-
result.putInt("id", msg.getId());
112+
result.putString("id", String.valueOf(msg.getId()));
113113
result.putMap("from", toJSObject(msg.getFromUser()));
114114

115115
if (msg.getDirect() == MessageDirect.send) {
@@ -127,8 +127,6 @@ public static WritableMap toJSObject(Message msg) {
127127
MessageContent content = msg.getContent();
128128
if (content.getStringExtras() != null) {
129129
result.putMap("extras", toJSObject(content.getStringExtras()));
130-
} else {
131-
result.putNull("extras");
132130
}
133131

134132
result.putDouble("createTime", msg.getCreateTime());
@@ -195,13 +193,11 @@ public static WritableMap toJSObject(Conversation conversation) {
195193

196194
try {
197195
map.putString("title", conversation.getTitle());
198-
map.putString("conversationType", conversation.getType().getLabel());
196+
map.putString("conversationType", conversation.getType().name());
199197
map.putInt("unreadCount", conversation.getUnReadMsgCnt());
200198

201199
if (conversation.getLatestMessage() != null) {
202200
map.putMap("latestMessage", toJSObject(conversation.getLatestMessage()));
203-
} else {
204-
map.putNull("latestMessage");
205201
}
206202

207203
if (conversation.getType() == ConversationType.single) {

index.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export default class JMessage {
154154

155155
/**
156156
* @param {object} params = {
157-
* 'id': Number, // message id
157+
* 'id': String, // message id
158158
* 'type': String, // 'single' / 'group'
159159
* 'groupId': String, // 当 type = group 时,groupId 不能为空
160160
* 'username': String, // 当 type = single 时,username 不能为空
@@ -869,20 +869,20 @@ export default class JMessage {
869869
}
870870

871871
static removeMessageRetractListener(listener) {
872-
if (!listeners[listener]) {
873-
return;
872+
if (!listeners[listener]) {
873+
return;
874+
}
875+
listeners[listener].remove();
876+
listeners[listener] = null;
874877
}
875-
listeners[listener].remove();
876-
listeners[listener] = null;
877-
}
878-
/**
879-
*
880-
* @param {function} listener = function (result) {}
881-
* result = {
882-
* messageId = String, // 消息 Id
883-
* progress = Float // 消息文件上传的进度
884-
* }
885-
*/
878+
/**
879+
*
880+
* @param {function} listener = function (result) {}
881+
* result = {
882+
* messageId = String, // 消息 Id
883+
* progress = Float // 消息文件上传的进度
884+
* }
885+
*/
886886
static addUploadProgressListener(listener) {
887887
listeners[listener] = DeviceEventEmitter.addListener(uploadProgress,
888888
(message) => {
@@ -897,5 +897,5 @@ export default class JMessage {
897897
listeners[listener].remove();
898898
listeners[listener] = null;
899899
}
900-
900+
901901
}

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jmessage-react-plugin",
3-
"version": "2.0.0-beta2",
3+
"version": "2.0.0-beta3",
44
"description": "a jmessage plugin for react native application",
55
"main": "index.js",
66
"repository": {
@@ -41,5 +41,8 @@
4141
]
4242
}
4343
},
44-
"homepage": "https://github.com/jpush/jmessage-react-plugin#readme"
44+
"homepage": "https://github.com/jpush/jmessage-react-plugin#readme",
45+
"dependencies": {
46+
"jcore-react-native": "^1.1.8-beta2"
47+
}
4548
}

0 commit comments

Comments
 (0)