Skip to content

Commit 6ca3dea

Browse files
committed
fix 名片 type
1 parent f388018 commit 6ca3dea

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

android/src/main/java/com/netease/im/ReactCache.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ public static Object createRecentList(List<RecentContact> recents, int unreadNum
259259
}
260260
break;
261261
case CustomAttachmentType.Card:
262-
if (attachment instanceof RedPacketOpenAttachement) {
263-
String str = "";
262+
if (attachment instanceof CardAttachment) {
263+
String str;
264264
if (fromAccount.equals(LoginService.getInstance().getAccount())) {
265265
str = "推荐了";
266266
} else {
@@ -273,7 +273,7 @@ public static Object createRecentList(List<RecentContact> recents, int unreadNum
273273
if (attachment instanceof DefaultCustomAttachment) {
274274
content = ((DefaultCustomAttachment) attachment).getDigst();
275275
if (TextUtils.isEmpty(content)) {
276-
content = "[自定义消息]";
276+
content = "[未知消息]";
277277
}
278278
}
279279
break;

android/src/main/java/com/netease/im/session/SessionService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -761,10 +761,10 @@ public void sendRedPacketMessage(String type, String comments, String serialNo,
761761
sendMessageSelf(message, onSendMessageListener, false);
762762
}
763763

764-
public void sendCardMessage(String type, String name, String imgPath, String sessionId, OnSendMessageListener onSendMessageListener) {
764+
public void sendCardMessage(String type, String name, String imgPath, String id, OnSendMessageListener onSendMessageListener) {
765765
CustomMessageConfig config = new CustomMessageConfig();
766766
CardAttachment attachment = new CardAttachment();
767-
attachment.setParams(type, name, imgPath, sessionId);
767+
attachment.setParams(type, name, imgPath, id);
768768
IMMessage message = MessageBuilder.createCustomMessage(sessionId, sessionTypeEnum, "[名片] " + name, attachment, config);
769769
sendMessageSelf(message, onSendMessageListener, false);
770770
}

android/src/main/java/com/netease/im/session/extension/CardAttachment.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
public class CardAttachment extends CustomAttachment {
1313

14-
private String type;
14+
private String cardType;
1515
private String name;
1616
private String imgPath;
1717
private String sessionId;
@@ -22,22 +22,21 @@ public CardAttachment() {
2222

2323
@Override
2424
protected void parseData(JSONObject data) {
25-
type = data.getString(MessageConstant.Card.type);
25+
cardType = data.getString(MessageConstant.Card.type);
2626
name = data.getString(MessageConstant.Card.name);
2727
imgPath = data.getString(MessageConstant.Card.imgPath);
2828
sessionId = data.getString(MessageConstant.Card.sessionId);
2929
}
3030

3131
public void setParams(String type, String name, String imgPath, String sessionId) {
32-
this.type = type;
32+
this.cardType = type;
3333
this.name = name;
3434
this.imgPath = imgPath;
3535
this.sessionId = sessionId;
3636
}
3737

38-
@Override
39-
public String getType() {
40-
return type;
38+
public String getCardType() {
39+
return cardType;
4140
}
4241

4342
public String getName() {
@@ -51,7 +50,7 @@ public String getImgPath() {
5150
@Override
5251
protected JSONObject packData() {
5352
JSONObject object = new JSONObject();
54-
object.put(MessageConstant.Card.type, type);
53+
object.put(MessageConstant.Card.type, cardType);
5554
object.put(MessageConstant.Card.name, name);
5655
object.put(MessageConstant.Card.imgPath, imgPath);
5756
object.put(MessageConstant.Card.sessionId, sessionId);
@@ -61,7 +60,7 @@ protected JSONObject packData() {
6160
@Override
6261
public WritableMap toReactNative() {
6362
WritableMap writableMap = Arguments.createMap();
64-
writableMap.putString(MessageConstant.Card.type, type);
63+
writableMap.putString(MessageConstant.Card.type, cardType);
6564
writableMap.putString(MessageConstant.Card.name, name);
6665
writableMap.putString(MessageConstant.Card.imgPath, imgPath);
6766
writableMap.putString(MessageConstant.Card.sessionId, sessionId);

0 commit comments

Comments
 (0)