1 package com.netease.nimlib.sdk.qchat.param;
3 import android.util.Log;
4 import androidx.annotation.NonNull;
12 import java.util.ArrayList;
13 import java.util.List;
21 private static final String TAG =
"SendSystemNotification";
27 private final Long serverId;
31 private final Long channelId;
35 private final List<String> toAccids;
43 private String attach;
47 private Map<String, Object> extension;
51 private Integer status;
55 private Map<String, Object> pushPayload;
59 private String pushContent;
64 private boolean persistEnable =
false;
68 private boolean pushEnable =
false;
72 private boolean needBadge =
true;
76 private boolean needPushNick =
true;
96 private final Integer toType;
104 private final String uuid;
147 this.serverId = serverId;
149 this.channelId = channelId;
151 this.channelId = null;
153 this.toAccids = toAccids;
155 this.toType = toType;
157 this.uuid = StringUtil.get32UUID();
181 this.attach = attach;
189 this.extension = extension;
197 this.status = status;
205 this.pushPayload = pushPayload;
213 this.pushContent = pushContent;
286 return persistEnable;
294 if (persistEnable && (toAccids == null || toAccids.isEmpty())) {
295 if (BuildConfig.DEBUG) {
296 throw new IllegalArgumentException(
"set persistEnable = true only if toAccids is not null");
298 if (LogDesensitizationConfigHelper.printToLogcat()) {
299 Log.e(TAG,
"set persistEnable = true only if toAccids is not null");
303 this.persistEnable = persistEnable;
328 this.pushEnable = pushEnable;
344 this.needBadge = needBadge;
360 this.needPushNick = needPushNick;
376 isRouteEnable = routeEnable;
421 return QChatSystemNotificationImpl.from(
this);
List< String > getToAccids()
获取通知的账号列表
QChatSendSystemNotificationParam(long serverId, List< String > toAccids)
通知给服务器成员
boolean isRouteEnable()
是否需要抄送,默认true
SERVER_ACCIDS
服务器成员,serverId/toAccids必填
String getPushContent()
获取推送内容
boolean isNeedPushNick()
是否需要推送昵称,默认true
Integer getToType()
获取通知发送对象类型
void setPersistEnable(boolean persistEnable)
设置是否存离线
QChatSystemNotificationType getType()
获取系统通知类型,用户发送的系统通知一定是 QChatSystemMsgType.CUSTOM
QChatSendSystemNotificationParam(long serverId, long channelId, List< String > toAccids)
通知给频道成员
String getUuid()
获取系统通知uuid
Long getServerId()
获取服务器id
boolean isPersistEnable()
是否存离线
CHANNEL_ACCIDS
频道成员,serverId/channelId/toAccids必填
Map< String, Object > getPushPayload()
获取推送payload
String getAttach()
获取附件字符串
QChatSystemNotification toSystemNotification()
转换成QChatSystemNotification
QChatSendSystemNotificationParam(long serverId, long channelId)
通知给频道
CHANNEL
频道,serverId/channelId必填
void setAttach(String attach)
设置通知附件
void setNeedPushNick(boolean needPushNick)
设置是否需要推送昵称
void setBody(String body)
设置通知内容
String getEnv()
获取环境变量 用户可以根据不同的env配置不同的抄送和回调地址
boolean isNeedBadge()
是否需要消息计数,默认true
void setNeedBadge(boolean needBadge)
设置是否需要消息计数
void setRouteEnable(boolean routeEnable)
设置是否需要抄送
Long getChannelId()
获取频道id
QChatSendSystemNotificationParam(long serverId)
通知给服务器
void setPushEnable(boolean pushEnable)
设置是否需要推送
void setStatus(Integer status)
如果设置状态,状态只能设置成自定义的状态(status>= 10000),否则提示414参数错误
boolean isPushEnable()
是否需要推送,默认true
void setExtension(Map< String, Object > extension)
设置扩展字段
Map< String, Object > getExtension()
获取扩展字段
void setPushPayload(Map< String, Object > pushPayload)
设置推送payload
void setEnv(String env)
设置环境变量 用户可以根据不同的env配置不同的抄送和回调地址
void setPushContent(String pushContent)
设置推送内容