1 package com.netease.nimlib.sdk.msg.model;
7 import org.json.JSONObject;
9 import java.io.Serializable;
20 private final String fromAccount;
21 private final long replyType;
22 private final long time;
23 private final String ext;
24 private final boolean needPush;
25 private final boolean needBadge;
26 private final String pushTitle;
27 private final String pushContent;
28 private final Map<String, Object> pushPayloadMap;
29 private final String pushPayload;
32 String fromAccount =
property.get(ITalkExtensionService.QuickCommentTag.fromAccount);
33 long replyType =
property.getLong(ITalkExtensionService.QuickCommentTag.replyType);
34 long time =
property.getLong(ITalkExtensionService.QuickCommentTag.time);
35 String ext =
property.get(ITalkExtensionService.QuickCommentTag.ext);
36 boolean needPush =
property.getInteger(ITalkExtensionService.QuickCommentTag.needPush) == 1;
37 boolean needBadge =
property.getInteger(ITalkExtensionService.QuickCommentTag.needBadge) == 1;
38 String pushTitle =
property.get(ITalkExtensionService.QuickCommentTag.pushTitle);
39 String pushContent =
property.get(ITalkExtensionService.QuickCommentTag.pushContent);
40 String pushPayload =
property.get(ITalkExtensionService.QuickCommentTag.pushPayload);
41 Map<String, Object> pushPayloadMap = MsgHelper.getMapFromJsonString(pushPayload);
42 return new QuickCommentOption(fromAccount, replyType, time, ext, needPush, needBadge, pushTitle, pushContent, pushPayloadMap, pushPayload);
46 String fromAccount = obj.optString(String.valueOf(ITalkExtensionService.QuickCommentTag.fromAccount));
47 long replyType = obj.optLong(String.valueOf(ITalkExtensionService.QuickCommentTag.replyType));
48 long time = obj.optLong(String.valueOf(ITalkExtensionService.QuickCommentTag.time));
49 String ext = obj.optString(String.valueOf(ITalkExtensionService.QuickCommentTag.ext));
50 boolean needPush = obj.optInt(String.valueOf(ITalkExtensionService.QuickCommentTag.needPush)) == 1;
51 boolean needBadge = obj.optInt(String.valueOf(ITalkExtensionService.QuickCommentTag.needBadge)) == 1;
52 String pushTitle = obj.optString(String.valueOf(ITalkExtensionService.QuickCommentTag.pushTitle));
53 String pushContent = obj.optString(String.valueOf(ITalkExtensionService.QuickCommentTag.pushContent));
54 String pushPayload = obj.optString(String.valueOf(ITalkExtensionService.QuickCommentTag.pushPayload));
55 Map<String, Object> pushPayloadMap = MsgHelper.getMapFromJsonString(pushPayload);
56 return new QuickCommentOption(fromAccount, replyType, time, ext, needPush, needBadge, pushTitle, pushContent, pushPayloadMap, pushPayload);
60 this(fromAccount, replyType, time, ext,
false,
false,
"",
"", null,
"");
63 public QuickCommentOption(String fromAccount,
long replyType,
long time, String ext,
boolean needPush,
64 boolean needBadge, String pushTitle, String pushContent, Map<String, Object> pushPayload) {
65 this(fromAccount, replyType, time, ext, needPush, needBadge, pushTitle, pushContent, pushPayload, pushContent == null ?
"" : MsgHelper.getJsonStringFromMap(pushPayload));
68 public QuickCommentOption(String fromAccount,
long replyType,
long time, String ext,
boolean needPush,
69 boolean needBadge, String pushTitle, String pushContent, String pushPayload) {
70 this(fromAccount, replyType, time, ext, needPush, needBadge, pushTitle, pushContent, null, pushPayload);
73 private QuickCommentOption(String fromAccount,
long replyType,
long time, String ext,
boolean needPush,
74 boolean needBadge, String pushTitle, String pushContent, Map<String, Object> pushPayloadMap, String pushPayload) {
75 this.fromAccount = fromAccount;
76 this.replyType = replyType;
79 this.needPush = needPush;
80 this.needBadge = needBadge;
81 this.pushTitle = pushTitle;
82 this.pushContent = pushContent;
83 this.pushPayloadMap = pushPayloadMap;
84 this.pushPayload = pushPayload;
123 return pushPayloadMap;