智慧城市 v1.2.1版本的 MD5 值为:d4aeacb5153a2710d0b6882be5dd2b15
以下内容为反编译后的 NativeClient.java 源代码,内容仅作参考
package io.rong.imlib;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.RemoteException;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import androidx.core.app.NotificationCompat;
import cn.rongcloud.rtc.utils.RCConsts;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import io.rong.common.FileInfo;
import io.rong.common.FileUtils;
import io.rong.common.JSONUtils;
import io.rong.common.LibStorageUtils;
import io.rong.common.RLog;
import io.rong.common.fwlog.FwLog;
import io.rong.common.fwlog.LogSplitUtil;
import io.rong.common.rlog.IRealTimeLogListener;
import io.rong.imlib.IRongCoreEnum;
import io.rong.imlib.NativeObject;
import io.rong.imlib.common.DeviceUtils;
import io.rong.imlib.common.SavePathUtils;
import io.rong.imlib.filetransfer.FtConst;
import io.rong.imlib.filetransfer.FtUtilities;
import io.rong.imlib.filetransfer.download.MediaDownloadEngine;
import io.rong.imlib.filetransfer.upload.MediaUploadEngine;
import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.ConversationIdentifier;
import io.rong.imlib.model.ConversationTagInfo;
import io.rong.imlib.model.Group;
import io.rong.imlib.model.Message;
import io.rong.imlib.model.MessageConfig;
import io.rong.imlib.model.MessageContent;
import io.rong.imlib.model.MessagePushConfig;
import io.rong.imlib.model.RCEncryptedSession;
import io.rong.imlib.model.RTCStatusDate;
import io.rong.imlib.model.RTCUser;
import io.rong.imlib.model.RemoteHistoryMsgOption;
import io.rong.imlib.model.SearchConversationResult;
import io.rong.imlib.model.SendMessageOption;
import io.rong.imlib.model.TagInfo;
import io.rong.imlib.model.UnknownMessage;
import io.rong.imlib.model.UserData;
import io.rong.imlib.navigation.NavigationCacheHelper;
import io.rong.imlib.navigation.NavigationClient;
import io.rong.imlib.navigation.NetDetection;
import io.rong.message.FileMessage;
import io.rong.message.GIFMessage;
import io.rong.message.HQVoiceMessage;
import io.rong.message.ImageMessage;
import io.rong.message.LogCmdMessage;
import io.rong.message.MediaMessageContent;
import io.rong.message.MessageExpansionMessage;
import io.rong.message.MessageHandler;
import io.rong.message.SightMessage;
import io.rong.message.TextMessage;
import io.rong.rtlog.upload.RtLogUploadManager;
import java.io.File;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
import okhttp3.HttpUrl;
import okhttp3.internal.ws.RealWebSocket;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public final class NativeClient {
private static final int CHANNEL_ID_MAX_LENGTH = 20;
private static final int EXPANSION_MAX_COUNT = 300;
private static final int EXPANSION_SINGLE_MAX_COUNT = 20;
private static final String TAG = "NativeClient";
private static Context mContext;
private static IMessageExpansionListener messageExpansionListener;
private String appKey;
private String curUserId;
private String dbPath;
private String deviceId;
private ScheduledThreadPoolExecutor executorService;
private ConcurrentHashMap<String, IMLibExtensionModuleIPC> extensionModuleMap;
private Set<String> mCmdObjectNameSet;
private String mFileServer;
private Handler mWorkHandler;
private HashMap<String, Constructor<? extends MessageContent>> messageContentConstructorMap;
private HashMap<String, MessageHandler> messageHandlerMap;
private IPCMessageInterceptor messageInterceptor;
private NativeObject nativeObj;
private NavigationClient.NaviUpdateListener naviUpdateListener;
private Executor receiveMessageExecutor;
private List<OnReceiveMessageListener> receiveMessageListenerList;
private List<String> unknownMessageTypeList;
public interface GetNotificationQuietHoursCallback {
void onError(int i);
void onSuccess(String str, int i);
}
public interface ICodeListener {
void onChanged(int i);
}
public interface IConnectResultCallback<T> extends IResultCallback<T> {
void OnDatabaseOpened(int i);
}
public interface IDownloadMediaFileCallback<T> extends IDownloadMediaMessageCallback<T> {
void onFileNameChanged(String str);
}
public interface IDownloadMediaMessageCallback<T> {
void onCanceled();
void onError(int i);
void onProgress(int i);
void onSuccess(T t);
}
public interface IPCMessageInterceptor {
Message onReceiveMessageBeforeDB(Message message);
Message onSendMessageAfterDB(Message message);
Message onUploadMediaMessage(Message message);
}
public interface IRTCSignalingCallback {
void OnError(int i);
void OnSuccess(byte[] bArr);
}
public interface IResultCallback<T> {
void onError(int i);
void onSuccess(T t);
}
public interface IResultCallbackEx<T, K> {
void onError(int i);
void onSuccess(T t, K k);
}
public interface IResultProgressCallback<T> {
void onCanceled(int i);
void onError(int i);
void onProgress(int i);
void onSuccess(T t);
}
public interface ISendMediaMessageCallback<T> {
void onAttached(T t);
void onCanceled(T t);
void onError(T t, int i);
void onProgress(T t, int i);
void onSuccess(T t);
}
public interface ISendMessageCallback<T> {
void onAttached(T t);
void onError(T t, int i);
void onSuccess(T t);
}
public interface OnReceiveMessageListener {
void onReceived(Message message, int i, boolean z, boolean z2, int i2);
}
public interface OperationCallback {
void onError(int i);
void onSuccess();
}
public interface PushNotificationListener {
void OnPushNotificationChanged(long j);
void OnTagChanged();
}
private String replaceNullStr(String str) {
return str == null ? "" : str;
}
private NativeClient() {
ConnectionService.getInstance();
}
public static NativeClient getInstance() {
return NativeClientHolder.client;
}
public static Context getApplicationContext() {
return mContext;
}
public static ThreadFactory threadFactory(final String str, final boolean z) {
return new ThreadFactory() {
@Override
public Thread newThread(Runnable runnable) {
Thread thread = new Thread(runnable, str);
thread.setDaemon(z);
return thread;
}
};
}
public NativeObject.Message transformMessage(Message message) {
NativeObject.Message message2 = new NativeObject.Message();
message2.setConversationType(message.getConversationType().getValue());
message2.setTargetId(message.getTargetId());
message2.setChannelId(message.getChannelId());
message2.setMessageId(message.getMessageId());
message2.setMessageDirection(!message.getMessageDirection().equals(Message.MessageDirection.SEND));
message2.setSenderUserId(message.getSenderUserId());
message2.setReadStatus(message.getReceivedStatus().getFlag());
message2.setSentStatus(message.getSentStatus().getValue());
message2.setReceivedTime(message.getReceivedTime());
message2.setSentTime(message.getSentTime());
message2.setReadTime(message.getReadTime());
message2.setObjectName(message.getObjectName());
message2.setUId(message.getUId());
message2.setExtra(message.getExtra());
message2.setExtSupport(message.isCanIncludeExpansion());
message2.setExtra(JSONUtils.hashMapToJson(message.getExpansion()));
message2.setContent(message.getContent().encode());
if (message.getReadReceiptInfo() != null) {
message2.setReadReceiptInfo(message.getReadReceiptInfo().toJSON().toString());
}
if (message.getGroupReadReceiptInfoV2() != null) {
message2.setGroupReadReceiptInfoV2(message.getGroupReadReceiptInfoV2().toJSON().toString());
}
if (message.getMessageConfig() != null) {
message2.setDisableNotification(message.getMessageConfig().isDisableNotification());
}
if (message.getMessagePushConfig() != null) {
message2.setPushTitle(message.getMessagePushConfig().getPushTitle());
message2.setPushContent(message.getMessagePushConfig().getPushContent());
message2.setForcePushDetail(message.getMessagePushConfig().isForceShowDetailContent());
if (message.getMessagePushConfig().getAndroidConfig() != null) {
message2.setPushId(message.getMessagePushConfig().getAndroidConfig().getNotificationId());
}
}
return message2;
}
public void init(Context context, String str, String str2) {
mContext = context.getApplicationContext();
String appKey = NavigationCacheHelper.getAppKey(context);
if (!TextUtils.isEmpty(appKey) && !appKey.equals(str)) {
NavigationCacheHelper.clearNaviCache(context);
NavigationCacheHelper.clearCache(context);
}
this.appKey = str;
this.deviceId = str2;
this.nativeObj = new NativeObject(context);
this.messageHandlerMap = new HashMap<>();
this.messageContentConstructorMap = new HashMap<>();
this.extensionModuleMap = new ConcurrentHashMap<>();
this.mCmdObjectNameSet = new TreeSet();
this.receiveMessageListenerList = new ArrayList();
this.unknownMessageTypeList = new ArrayList();
HandlerThread handlerThread = new HandlerThread("IPC_WORK");
handlerThread.start();
this.mWorkHandler = new Handler(handlerThread.getLooper());
initThreadPool();
File filesDir = mContext.getFilesDir();
if (filesDir == null || !filesDir.exists()) {
if (filesDir == null) {
filesDir = mContext.getDir("rcdb", 0);
} else if (!filesDir.mkdirs()) {
RLog.e(TAG, "Created folders UnSuccessfully");
}
this.dbPath = filesDir.getPath();
} else {
this.dbPath = filesDir.getPath();
}
int InitClient = this.nativeObj.InitClient(str, context.getPackageName(), str2, this.dbPath, "5.1.3.5");
NavigationClient.getInstance().init(context);
ConnectionService.getInstance().initService(mContext, this.nativeObj, str);
HeartBeatManager.getInstance().init(context, this.nativeObj);
this.nativeObj.RegisterEncryptMessage(this.messageInterceptor != null);
this.nativeObj.SetRealTimeLogListener(new IRealTimeLogListener() {
@Override
public void OnLogUpload(String str3) {
try {
for (Map.Entry<String, JsonElement> entry : new JsonParser().parse(str3).getAsJsonObject().entrySet()) {
String key = entry.getKey();
if (key.equals("level")) {
int asInt = entry.getValue().getAsInt();
if (asInt >= 0 && asInt <= 6) {
io.rong.common.rlog.RLog.setLogLevel(asInt, false);
}
} else if (key.equals("upload")) {
io.rong.common.rlog.RLog.uploadRLog(false);
}
}
} catch (Exception e) {
io.rong.common.rlog.RLog.e("OnLogUpload", "json error:" + str3, e);
}
}
});
ApplicationInfo applicationInfo = context.getApplicationInfo();
setLogStatus(applicationInfo != null && (applicationInfo.flags & 2) != 0 ? 2 : 3, new NativeObject.NativeLogInfoListener() {
@Override
public void OnLogInfo(String str3, boolean z) {
FwLog.onProtocolLog(str3, z);
io.rong.common.rlog.RLog.d("OnLogInfo", str3);
}
});
NavigationClient.getInstance().setNaviUpdateListener(new NavigationClient.NaviUpdateListener() {
@Override
public void onNaviUpdate() {
RtLogUploadManager.getInstance().updateTimingUploadConfig(NavigationClient.getInstance().getUploadLogConfigInfo(NativeClient.mContext));
if (NativeClient.this.naviUpdateListener != null) {
NativeClient.this.naviUpdateListener.onNaviUpdate();
}
}
});
FwLog.write(3, 1, FwLog.LogTag.L_INIT_O.getTag(), "appkey|deviceId|dbPath|initResult", str, str2, this.dbPath, Integer.valueOf(InitClient));
}
private void initThreadPool() {
ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(1, threadFactory("Get ChatRoomEntry", false));
this.executorService = scheduledThreadPoolExecutor;
scheduledThreadPoolExecutor.setKeepAliveTime(60L, TimeUnit.SECONDS);
this.executorService.allowCoreThreadTimeOut(true);
this.receiveMessageExecutor = Executors.newSingleThreadExecutor(threadFactory("IPC_RECEIVEMSG_WORK", false));
}
private void setLogStatus(int i, NativeObject.NativeLogInfoListener nativeLogInfoListener) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
nativeObject.SetLogStatus(i, nativeLogInfoListener);
}
public void initAppendixModule() {
RtLogUploadManager.getInstance().init(mContext, "5.1.3.5", this.deviceId, this.appKey);
}
public void registerMessageType(Class<? extends MessageContent> cls) {
try {
MessageTag messageTag = (MessageTag) cls.getAnnotation(MessageTag.class);
if (messageTag != null) {
String value = messageTag.value();
Constructor<? extends MessageContent> declaredConstructor = cls.getDeclaredConstructor(byte[].class);
this.messageHandlerMap.put(value, messageTag.messageHandler().getConstructor(Context.class).newInstance(mContext));
this.messageContentConstructorMap.put(value, declaredConstructor);
registerMessageType(value, messageTag.flag());
} else {
String tag = FwLog.LogTag.L_REGTYPE_E.getTag();
FwLog.write(1, 1, tag, "msg_type" + cls.getName(), new Object[0]);
}
} catch (Exception e) {
String tag2 = FwLog.LogTag.L_REGTYPE_E.getTag();
FwLog.write(1, 1, tag2, "msg_type|stacks" + cls.getName(), Arrays.toString(e.getStackTrace()));
}
}
private void registerMessageType(String str, int i) {
if (i == 16) {
i = 0;
}
this.nativeObj.RegisterMessageType(str, i);
}
public void registerMessageType(List<Class<? extends MessageContent>> list) {
if (list == null || list.size() == 0) {
return;
}
for (Class<? extends MessageContent> cls : list) {
try {
MessageTag messageTag = (MessageTag) cls.getAnnotation(MessageTag.class);
if (messageTag != null) {
String value = messageTag.value();
Constructor<? extends MessageContent> declaredConstructor = cls.getDeclaredConstructor(byte[].class);
this.messageHandlerMap.put(value, messageTag.messageHandler().getConstructor(Context.class).newInstance(mContext));
this.messageContentConstructorMap.put(value, declaredConstructor);
registerMessageType(value, messageTag.flag());
} else {
String tag = FwLog.LogTag.L_REGTYPE_E.getTag();
FwLog.write(1, 1, tag, "msg_type" + cls.getName(), new Object[0]);
}
} catch (Exception e) {
String tag2 = FwLog.LogTag.L_REGTYPE_E.getTag();
FwLog.write(1, 1, tag2, "msg_type|stacks" + cls.getName(), Arrays.toString(e.getStackTrace()));
}
}
}
public void setIpcConnectTimeOut() {
ConnectionService.getInstance().setIpcConnectTimeOut();
}
public void initIPCEnviroment(String str, int i) {
ConnectionService.getInstance().initIPCEnviroment(str, i);
}
public void connect(String str, boolean z, boolean z2, IConnectResultCallback<String> iConnectResultCallback) {
setEnvInfo(mContext);
RtLogUploadManager.getInstance().startTimingUploadTask();
ConnectionService.getInstance().connect(str, z, z2, iConnectResultCallback);
}
private void setEnvInfo(Context context) {
String str;
ConnectivityManager connectivityManager;
try {
connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
} catch (SecurityException e) {
e = e;
str = "";
}
if (connectivityManager == null) {
io.rong.common.rlog.RLog.e(TAG, "connectivityManager is null");
} else {
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
if (activeNetworkInfo != null) {
str = activeNetworkInfo.getTypeName();
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
String str2 = telephonyManager == null ? telephonyManager.getNetworkOperator() : "";
String str3 = str;
String str4 = Build.MANUFACTURER;
String str5 = Build.MODEL;
this.nativeObj.SetDeviceInfo(str4 == null ? "" : str4, str5 == null ? "" : str5, String.valueOf(Build.VERSION.SDK_INT), str3, str2);
}
}
str = "";
TelephonyManager telephonyManager2 = (TelephonyManager) context.getSystemService("phone");
String str22 = telephonyManager2 == null ? telephonyManager2.getNetworkOperator() : "";
String str32 = str;
String str42 = Build.MANUFACTURER;
String str52 = Build.MODEL;
this.nativeObj.SetDeviceInfo(str42 == null ? "" : str42, str52 == null ? "" : str52, String.valueOf(Build.VERSION.SDK_INT), str32, str22);
}
public void disconnect() {
disconnect(true);
}
public void disconnect(boolean z) {
ConnectionService.getInstance().disconnect(z, true);
}
public List<Conversation> getConversationList(String str) {
int[] iArr = {Conversation.ConversationType.PRIVATE.getValue(), Conversation.ConversationType.DISCUSSION.getValue(), Conversation.ConversationType.GROUP.getValue(), Conversation.ConversationType.SYSTEM.getValue()};
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
return getConversationList(iArr, str);
}
public List<Conversation> getConversationList(int[] iArr, String str) {
NativeObject.Conversation[] conversationArr;
try {
conversationArr = this.nativeObj.GetConversationListEx(iArr, str);
} catch (Exception e) {
io.rong.common.rlog.RLog.e(TAG, "getConversationList Exception", e);
conversationArr = null;
}
if (conversationArr == null) {
return null;
}
ArrayList arrayList = new ArrayList();
for (NativeObject.Conversation conversation : conversationArr) {
arrayList.add(renderConversationFromNative(conversation));
}
return arrayList;
}
private Conversation renderConversationFromNative(NativeObject.Conversation conversation) {
Conversation conversation2 = new Conversation();
conversation2.setTargetId(conversation.getTargetId());
conversation2.setLatestMessageId((int) conversation.getMessageId());
conversation2.setConversationTitle(conversation.getConversationTitle());
conversation2.setUnreadMessageCount(conversation.getUnreadMessageCount());
conversation2.setConversationType(Conversation.ConversationType.setValue(conversation.getConversationType()));
conversation2.setChannelId(conversation.getChannelId());
conversation2.setTop(conversation.isTop());
conversation2.setObjectName(conversation.getObjectName());
if (conversation.getMessageId() > 0) {
Message message = new Message();
message.setMessageId((int) conversation.getMessageId());
message.setSenderUserId(conversation.getSenderUserId());
conversation2.setLatestMessage(renderMessageContent(conversation.getObjectName(), conversation.getContent(), message));
}
conversation2.setReceivedStatus(new Message.ReceivedStatus(conversation.getReadStatus()));
conversation2.setReceivedTime(conversation.getReceivedTime());
conversation2.setSentTime(conversation.getSentTime());
conversation2.setSenderUserId(conversation.getSenderUserId());
conversation2.setSentStatus(Message.SentStatus.setValue(conversation.getSentStatus()));
conversation2.setSenderUserName(conversation.getSenderName());
conversation2.setDraft(conversation.getDraft());
conversation2.setPortraitUrl(conversation.getPortraitUrl());
conversation2.setNotificationStatus(conversation.isBlockPush() ? Conversation.ConversationNotificationStatus.DO_NOT_DISTURB : Conversation.ConversationNotificationStatus.NOTIFY);
conversation2.setMentionedCount(conversation.getMentionCount());
return conversation2;
}
public MessageContent renderMessageContent(String str, byte[] bArr, Message message) {
MessageContent newMessageContent = newMessageContent(str, bArr);
if (newMessageContent instanceof UnknownMessage) {
return newMessageContent;
}
MessageHandler messageHandler = getMessageHandler(str);
if (messageHandler != null) {
messageHandler.decodeMessage(message, newMessageContent);
} else {
io.rong.common.rlog.RLog.e(TAG, "This message is not registered, please call the RegisterMessageType method to register。");
}
return newMessageContent;
}
public MessageContent newMessageContent(String str, byte[] bArr) {
Constructor<? extends MessageContent> constructor = this.messageContentConstructorMap.get(str);
if (constructor == null || bArr == null) {
if (!this.unknownMessageTypeList.contains(str)) {
this.unknownMessageTypeList.add(str);
FwLog.write(1, 1, FwLog.LogTag.L_DECODE_MSG_E.getTag(), "msg_type", str);
}
return new UnknownMessage(bArr);
}
try {
return constructor.newInstance(bArr);
} catch (Exception e) {
UnknownMessage unknownMessage = new UnknownMessage(bArr);
if (!this.unknownMessageTypeList.contains(str)) {
this.unknownMessageTypeList.add(str);
FwLog.write(1, 1, FwLog.LogTag.L_DECODE_MSG_E.getTag(), "msg_type|stacks", str, FwLog.stackToString(e));
}
return unknownMessage;
}
}
public MessageHandler getMessageHandler(String str) {
MessageHandler messageHandler = this.messageHandlerMap.get(str);
if (messageHandler == null) {
io.rong.common.rlog.RLog.e(TAG, "getMessageHandler not found,objName:" + str);
}
return messageHandler;
}
public List<Conversation> getConversationList(int[] iArr) {
return getConversationList(iArr, "");
}
public List<Conversation> getBlockedConversationList(int[] iArr, String str) {
NativeObject.Conversation[] GetBlockedConversations = this.nativeObj.GetBlockedConversations(iArr, str);
if (GetBlockedConversations == null) {
return null;
}
ArrayList arrayList = new ArrayList();
for (NativeObject.Conversation conversation : GetBlockedConversations) {
arrayList.add(renderConversationFromNative(conversation));
}
return arrayList;
}
public List<Conversation> getTopConversationList(int[] iArr, String str) {
NativeObject.Conversation[] conversationArr;
try {
conversationArr = this.nativeObj.GetTopConversations(iArr, str);
} catch (Exception e) {
io.rong.common.rlog.RLog.e(TAG, "getTopConversationList Exception", e);
conversationArr = null;
}
if (conversationArr == null) {
return null;
}
ArrayList arrayList = new ArrayList();
for (NativeObject.Conversation conversation : conversationArr) {
arrayList.add(renderConversationFromNative(conversation));
}
return arrayList;
}
public List<Conversation> getConversationListByPage(int[] iArr, long j, int i, String str) {
NativeObject.Conversation[] conversationArr;
try {
conversationArr = this.nativeObj.GetConversationList(iArr, j, i, str);
} catch (Exception e) {
io.rong.common.rlog.RLog.e(TAG, "getConversationListByPage Exception", e);
conversationArr = null;
}
if (conversationArr == null) {
return null;
}
ArrayList arrayList = new ArrayList();
for (NativeObject.Conversation conversation : conversationArr) {
arrayList.add(renderConversationFromNative(conversation));
}
return arrayList;
}
public Conversation getConversation(Conversation.ConversationType conversationType, String str, String str2) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationType == null || TextUtils.isEmpty(str)) {
throw new IllegalArgumentException("ConversationType and TargetId parameters are abnormal");
}
NativeObject.Conversation GetConversationEx = this.nativeObj.GetConversationEx(str, conversationType.getValue(), str2);
if (GetConversationEx == null) {
return null;
}
Conversation renderConversationFromNative = renderConversationFromNative(GetConversationEx);
renderConversationFromNative.setConversationType(conversationType);
return renderConversationFromNative;
}
public boolean removeConversation(Conversation.ConversationType conversationType, String str, String str2) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationType == null || TextUtils.isEmpty(str) || TextUtils.isEmpty(str.trim())) {
throw new IllegalArgumentException("ConversationType and TargetId parameters are abnormal");
}
return this.nativeObj.RemoveConversation(conversationType.getValue(), str.trim(), str2);
}
public boolean setConversationToTop(Conversation.ConversationType conversationType, String str, String str2, boolean z, boolean z2) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationType == null || TextUtils.isEmpty(str)) {
throw new IllegalArgumentException("Abnormal conversationType or targetId parameter");
}
return this.nativeObj.SetIsTop(conversationType.getValue(), str, z, z2, str2);
}
public boolean createEncryptedConversation(String str, RCEncryptedSession rCEncryptedSession) {
preCheck(str, rCEncryptedSession);
return this.nativeObj.CreateEncryptedConversation(replaceNullStr(str), replaceNullStr(rCEncryptedSession.getTargetId()), replaceNullStr(rCEncryptedSession.getRemoteEncId()), replaceNullStr(rCEncryptedSession.getEncKey()), replaceNullStr(rCEncryptedSession.getEncXA()), rCEncryptedSession.getEncStatus());
}
private void preCheck(Object... objArr) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (objArr == null) {
return;
}
for (Object obj : objArr) {
if (obj == null || ((obj instanceof String) && TextUtils.isEmpty((String) obj))) {
throw new IllegalArgumentException("Parameter abnormal");
}
}
}
public RCEncryptedSession getEncryptedConversation(String str) {
preCheck(str);
RCEncryptedSession GetEncryptedConversationInfo = this.nativeObj.GetEncryptedConversationInfo(str);
StringBuilder sb = new StringBuilder();
sb.append("getEncryptedConversation --> ");
sb.append(GetEncryptedConversationInfo == null ? "null" : GetEncryptedConversationInfo.toString());
io.rong.common.rlog.RLog.d(TAG, sb.toString());
return GetEncryptedConversationInfo;
}
public List<RCEncryptedSession> getAllEncryptedConversations() {
preCheck(new Object[0]);
return this.nativeObj.GetEncryptedConversations();
}
public boolean setEncryptedConversation(String str, RCEncryptedSession rCEncryptedSession) {
preCheck(str, rCEncryptedSession);
return this.nativeObj.SetEncryptedConversationInfo(replaceNullStr(str), replaceNullStr(rCEncryptedSession.getTargetId()), replaceNullStr(rCEncryptedSession.getRemoteEncId()), replaceNullStr(rCEncryptedSession.getEncKey()), replaceNullStr(rCEncryptedSession.getEncXA()), rCEncryptedSession.getEncStatus());
}
public boolean removeEncryptedConversation(String str) {
preCheck(str);
return this.nativeObj.RemoveEncryptedConversation(replaceNullStr(str));
}
public boolean clearEncryptedConversations() {
preCheck(new Object[0]);
return this.nativeObj.ClearEncryptedConversations();
}
public int getTotalUnreadCount(String str) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
return nativeObject.GetTotalUnreadCount(str);
}
public int getUnreadCount(Conversation.ConversationType conversationType, String str, String str2) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (TextUtils.isEmpty(str) || conversationType == null) {
throw new IllegalArgumentException("Abnormal conversationType or targetId parameter");
}
return this.nativeObj.GetUnreadCount(str, conversationType.getValue(), str2);
}
public int getMessageCount(Conversation.ConversationType conversationType, String str, String str2) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (TextUtils.isEmpty(str) || conversationType == null) {
throw new IllegalArgumentException("Abnormal conversationType or targetId parameter");
}
return this.nativeObj.GetMessageCount(str, conversationType.getValue(), str2);
}
public int getTotalUnreadCount(Conversation... conversationArr) {
NativeObject.Conversation[] conversationArr2 = new NativeObject.Conversation[conversationArr.length];
for (int i = 0; i < conversationArr.length; i++) {
NativeObject.Conversation conversation = new NativeObject.Conversation();
conversation.setConversationType(conversationArr[i].getConversationType().getValue());
conversation.setTargetId(conversationArr[i].getTargetId());
conversation.setChannelId(conversationArr[i].getChannelId());
conversationArr2[i] = conversation;
}
return this.nativeObj.GetDNDUnreadCount(conversationArr2);
}
public int getUnreadCount(String str, Conversation.ConversationType... conversationTypeArr) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationTypeArr == null || conversationTypeArr.length == 0) {
throw new IllegalArgumentException("ConversationTypes parameter abnormal。");
}
int[] iArr = new int[conversationTypeArr.length];
int i = 0;
for (Conversation.ConversationType conversationType : conversationTypeArr) {
iArr[i] = conversationType.getValue();
i++;
}
return this.nativeObj.GetCateUnreadCount(iArr, true, str);
}
public int getUnreadCount(String str, boolean z, Conversation.ConversationType... conversationTypeArr) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationTypeArr == null || conversationTypeArr.length == 0) {
throw new IllegalArgumentException("ConversationTypes parameter abnormal。");
}
int[] iArr = new int[conversationTypeArr.length];
int i = 0;
for (Conversation.ConversationType conversationType : conversationTypeArr) {
iArr[i] = conversationType.getValue();
i++;
}
return this.nativeObj.GetCateUnreadCount(iArr, z, str);
}
public List<Message> getLatestMessages(Conversation.ConversationType conversationType, String str, String str2, int i) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationType == null || TextUtils.isEmpty(str)) {
throw new IllegalArgumentException("ConversationTypes or targetId arguments are abnormal。");
}
return getHistoryMessages(conversationType, str.trim(), str2, -1L, i);
}
public List<Message> getHistoryMessages(Conversation.ConversationType conversationType, String str, String str2, long j, int i) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationType == null || TextUtils.isEmpty(str)) {
throw new IllegalArgumentException("ConversationTypes or targetId arguments are abnormal。");
}
NativeObject.Message[] GetHistoryMessagesEx = this.nativeObj.GetHistoryMessagesEx(str.trim(), conversationType.getValue(), "", j, i, true, str2);
ArrayList arrayList = new ArrayList();
if (GetHistoryMessagesEx == null) {
return arrayList;
}
for (NativeObject.Message message : GetHistoryMessagesEx) {
Message message2 = new Message(message);
message2.setContent(renderMessageContent(message.getObjectName(), message.getContent(), message2));
arrayList.add(message2);
}
return arrayList;
}
public List<Message> getHistoryMessages(Conversation.ConversationType conversationType, String str, String str2, String str3, long j, int i) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationType == null || TextUtils.isEmpty(str) || TextUtils.isEmpty(str3)) {
throw new IllegalArgumentException("ConversationTypes, objectName or targetId arguments are abnormal。");
}
NativeObject.Message[] GetHistoryMessagesEx = this.nativeObj.GetHistoryMessagesEx(str.trim(), conversationType.getValue(), str3, j, i, true, str2);
ArrayList arrayList = new ArrayList();
if (GetHistoryMessagesEx == null) {
return null;
}
for (NativeObject.Message message : GetHistoryMessagesEx) {
Message message2 = new Message(message);
message2.setContent(renderMessageContent(message.getObjectName(), message.getContent(), message2));
arrayList.add(message2);
}
return arrayList;
}
public List<Message> getHistoryMessages(Conversation.ConversationType conversationType, String str, String str2, String str3, long j, int i, boolean z) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationType == null || TextUtils.isEmpty(str) || TextUtils.isEmpty(str3)) {
throw new IllegalArgumentException("ConversationTypes, objectName or targetId arguments are abnormal。");
}
NativeObject.Message[] GetHistoryMessagesEx = this.nativeObj.GetHistoryMessagesEx(str.trim(), conversationType.getValue(), str3, j, i, z, str2);
ArrayList arrayList = new ArrayList();
if (GetHistoryMessagesEx == null) {
return null;
}
for (NativeObject.Message message : GetHistoryMessagesEx) {
Message message2 = new Message(message);
message2.setContent(renderMessageContent(message.getObjectName(), message.getContent(), message2));
arrayList.add(message2);
}
return arrayList;
}
public List<Message> getHistoryMessages(Conversation.ConversationType conversationType, String str, String str2, List<String> list, long j, int i, boolean z) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationType == null || TextUtils.isEmpty(str) || list == null || list.size() == 0) {
throw new IllegalArgumentException("ConversationTypes, objectName or targetId arguments are abnormal。");
}
NativeObject.Message[] GetHistoryMessagesByObjectNames = this.nativeObj.GetHistoryMessagesByObjectNames(str.trim(), conversationType.getValue(), (String[]) list.toArray(new String[list.size()]), j, i, z, str2);
ArrayList arrayList = new ArrayList();
if (GetHistoryMessagesByObjectNames == null) {
return null;
}
for (NativeObject.Message message : GetHistoryMessagesByObjectNames) {
Message message2 = new Message(message);
message2.setContent(renderMessageContent(message.getObjectName(), message.getContent(), message2));
arrayList.add(message2);
}
return arrayList;
}
public void getRemoteHistoryMessages(Conversation.ConversationType conversationType, String str, String str2, long j, int i, final IResultCallback<List<Message>> iResultCallback) {
io.rong.common.rlog.RLog.i(TAG, "getRemoteHistoryMessages call");
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationType == null || TextUtils.isEmpty(str) || iResultCallback == null) {
throw new IllegalArgumentException("ConversationTypes, callback or targetId parameters are abnormal。");
}
String trim = str.trim();
if (NavigationClient.getInstance().isGetRemoteHistoryEnabled(mContext)) {
this.nativeObj.LoadHistoryMessage(trim, conversationType.getValue(), j, i, new NativeObject.HistoryMessageListener() {
@Override
public void onReceived(NativeObject.Message[] messageArr, long j2) {
ArrayList arrayList = new ArrayList();
if (messageArr != null && messageArr.length > 0) {
for (NativeObject.Message message : messageArr) {
Message message2 = new Message(message);
message2.setContent(NativeClient.this.renderMessageContent(message.getObjectName(), message.getContent(), message2));
arrayList.add(message2);
}
}
iResultCallback.onSuccess(arrayList);
}
@Override
public void onError(int i2) {
iResultCallback.onError(i2);
}
}, str2);
} else {
iResultCallback.onError(33007);
}
}
public void getRemoteHistoryMessages(Conversation.ConversationType conversationType, String str, String str2, RemoteHistoryMsgOption remoteHistoryMsgOption, final IResultCallback<List<Message>> iResultCallback) {
io.rong.common.rlog.RLog.i(TAG, "getRemoteHistoryMessages call");
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationType == null || TextUtils.isEmpty(str) || iResultCallback == null) {
throw new IllegalArgumentException("ConversationTypes, callback or targetId parameters are abnormal。");
}
String trim = str.trim();
if (NavigationClient.getInstance().isGetRemoteHistoryEnabled(mContext)) {
this.nativeObj.LoadHistoryMessageOption(trim, conversationType.getValue(), remoteHistoryMsgOption.getDataTime(), remoteHistoryMsgOption.getCount(), remoteHistoryMsgOption.getOrder(), remoteHistoryMsgOption.isIncludeLocalExistMessage(), new NativeObject.HistoryMessageListener() {
@Override
public void onReceived(NativeObject.Message[] messageArr, long j) {
ArrayList arrayList = new ArrayList();
if (messageArr != null && messageArr.length > 0) {
for (NativeObject.Message message : messageArr) {
Message message2 = new Message(message);
message2.setContent(NativeClient.this.renderMessageContent(message.getObjectName(), message.getContent(), message2));
arrayList.add(message2);
}
}
iResultCallback.onSuccess(arrayList);
}
@Override
public void onError(int i) {
iResultCallback.onError(i);
}
}, str2);
} else {
iResultCallback.onError(33007);
}
}
public void getUserStatus(String str, final IResultCallbackEx<String, Integer> iResultCallbackEx) {
this.nativeObj.GetUserStatus(str, new NativeObject.CreateDiscussionCallback() {
@Override
public void OnSuccess(String str2) {
iResultCallbackEx.onSuccess(str2, 0);
}
@Override
public void OnError(int i) {
iResultCallbackEx.onError(i);
}
});
}
public void subscribeStatus(List<String> list, final IResultCallbackEx<Integer, Integer> iResultCallbackEx) {
this.nativeObj.SubscribeStatus((String[]) list.toArray(new String[list.size()]), new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i, String str, long j) {
if (i == 0) {
iResultCallbackEx.onSuccess(Integer.valueOf(i), 0);
} else {
iResultCallbackEx.onError(i);
}
}
});
}
public void setSubscribeStatusListener(final IResultCallbackEx<String, String> iResultCallbackEx) {
this.nativeObj.SetSubscribeStatusListener(new NativeObject.UserStatusListener() {
@Override
public void onStatusReceived(String str, String str2) {
iResultCallbackEx.onSuccess(str, str2);
}
});
}
public void setPushSetting(int i, String str, final IResultCallback<Long> iResultCallback) {
this.nativeObj.SetPushSetting(i, str, new NativeObject.SetPushSettingListener() {
@Override
public void onSuccess(long j) {
iResultCallback.onSuccess(Long.valueOf(j));
}
@Override
public void onError(int i2) {
iResultCallback.onError(i2);
}
});
}
public String getPushSetting(int i) {
return this.nativeObj.GetPushSetting(i);
}
public void setUserStatus(int i, final IResultCallback<Integer> iResultCallback) {
this.nativeObj.SetUserStatus(i, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i2, String str, long j) {
if (i2 == 0) {
iResultCallback.onSuccess(0);
} else {
iResultCallback.onError(i2);
}
}
});
}
public boolean deleteMessages(int[] iArr) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
int length = iArr.length;
if (iArr == null || length == 0) {
throw new IllegalArgumentException("MessageIds parameter exception。");
}
long[] jArr = new long[length];
for (int i = 0; i < length; i++) {
jArr[i] = iArr[i];
}
return this.nativeObj.DeleteMessages(jArr);
}
public boolean deleteMessage(Conversation.ConversationType conversationType, String str, String str2) {
return this.nativeObj.ClearMessages(conversationType.getValue(), str, true, str2);
}
public void deleteMessages(Conversation.ConversationType conversationType, String str, String str2, Message[] messageArr, final OperationCallback operationCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (messageArr == null || messageArr.length == 0) {
throw new IllegalArgumentException("The messages parameter is abnormal。");
}
NativeObject.Message[] messageArr2 = new NativeObject.Message[messageArr.length];
StringBuilder sb = new StringBuilder();
for (int i = 0; i < messageArr.length; i++) {
messageArr2[i] = new NativeObject.Message();
messageArr2[i].setUId(messageArr[i].getUId());
messageArr2[i].setSentTime(messageArr[i].getSentTime());
messageArr2[i].setMessageDirection(messageArr[i].getMessageDirection().equals(Message.MessageDirection.RECEIVE));
sb.append(messageArr[i].getUId());
sb.append("/");
}
FwLog.write(4, 1, FwLog.LogTag.L_DELETE_MESSAGES_S.getTag(), "messageUIds:", sb.toString());
this.nativeObj.DeleteRemoteMessages(conversationType.getValue(), str, messageArr2, true, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i2, String str3, long j) {
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 == null) {
return;
}
if (i2 == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i2);
}
}
}, str2);
}
public boolean clearMessages(Conversation.ConversationType conversationType, String str, String str2) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationType == null || TextUtils.isEmpty(str)) {
throw new IllegalArgumentException("Abnormal conversationType or targetId parameter。");
}
return this.nativeObj.ClearMessages(conversationType.getValue(), str, false, str2);
}
public void cleanRemoteHistoryMessages(Conversation.ConversationType conversationType, String str, String str2, long j, final OperationCallback operationCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationType == null || TextUtils.isEmpty(str)) {
throw new IllegalArgumentException("Abnormal conversationType or targetId parameter。");
}
this.nativeObj.CleanRemoteHistoryMessage(conversationType.getValue(), str, j, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i, String str3, long j2) {
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 == null) {
return;
}
if (i == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i);
}
}
}, str2);
}
public void cleanHistoryMessages(Conversation.ConversationType conversationType, String str, String str2, long j, OperationCallback operationCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationType == null || TextUtils.isEmpty(str)) {
throw new IllegalArgumentException("Abnormal conversationType or targetId parameter。");
}
boolean CleanHistoryMessages = this.nativeObj.CleanHistoryMessages(conversationType.getValue(), str, j, str2);
if (operationCallback != null) {
if (CleanHistoryMessages) {
operationCallback.onSuccess();
} else {
operationCallback.onError(-1);
}
}
}
public boolean clearMessagesUnreadStatus(Conversation.ConversationType conversationType, String str, String str2) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationType == null || TextUtils.isEmpty(str)) {
throw new IllegalArgumentException("Abnormal conversationType or targetId parameter。");
}
return this.nativeObj.ClearUnread(conversationType.getValue(), str, str2);
}
public boolean setMessageExtra(int i, String str) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject != null) {
if (i == 0) {
throw new IllegalArgumentException("The messageId parameter is abnormal。");
}
return nativeObject.SetMessageExtra(i, str);
}
throw new RuntimeException("NativeClient has not been initialized yet!");
}
public boolean setMessageReceivedStatus(int i, Message.ReceivedStatus receivedStatus) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject != null) {
if (receivedStatus == null || i == 0) {
throw new IllegalArgumentException("The receivedStatus or messageId parameter is abnormal。");
}
return nativeObject.SetReadStatus(i, receivedStatus.getFlag());
}
throw new RuntimeException("NativeClient has not been initialized yet!");
}
public boolean setMessageSentStatus(int i, Message.SentStatus sentStatus) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject != null) {
if (sentStatus == null || i == 0) {
throw new IllegalArgumentException("sentStatus or messageId parameter is abnormal。");
}
return nativeObject.SetSendStatus(i, sentStatus.getValue());
}
throw new RuntimeException("NativeClient has not been initialized yet!");
}
public boolean clearTextMessageDraft(Conversation.ConversationType conversationType, String str, String str2) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationType == null || TextUtils.isEmpty(str)) {
throw new IllegalArgumentException("Abnormal conversationType or targetId parameter。");
}
if (TextUtils.isEmpty(getTextMessageDraft(conversationType, str, str2))) {
return true;
}
return saveTextMessageDraft(conversationType, str, str2, "");
}
public String getTextMessageDraft(Conversation.ConversationType conversationType, String str, String str2) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationType == null || TextUtils.isEmpty(str)) {
io.rong.common.rlog.RLog.e(TAG, "Abnormal conversationType or targetId parameter");
return "";
}
return this.nativeObj.GetTextMessageDraft(conversationType.getValue(), str, str2);
}
public boolean saveTextMessageDraft(Conversation.ConversationType conversationType, String str, String str2, String str3) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationType == null || TextUtils.isEmpty(str)) {
throw new IllegalArgumentException("Abnormal conversationType or targetId parameter。");
}
return this.nativeObj.SetTextMessageDraft(conversationType.getValue(), str, str3, str2);
}
public Message getMessage(int i) {
NativeObject.Message GetMessageById = this.nativeObj.GetMessageById(i);
if (GetMessageById == null) {
return null;
}
Message message = new Message(GetMessageById);
message.setContent(renderMessageContent(GetMessageById.getObjectName(), GetMessageById.getContent(), message));
return message;
}
public void sendMessage(Conversation.ConversationType conversationType, String str, MessageContent messageContent, String str2, String str3, ISendMessageCallback<Message> iSendMessageCallback) {
sendMessage(Message.obtain(str, conversationType, messageContent), str2, str3, null, iSendMessageCallback);
}
public void sendMessage(Message message, String str, String str2, String[] strArr, ISendMessageCallback<Message> iSendMessageCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (message.getConversationType() == null || TextUtils.isEmpty(message.getTargetId()) || message.getContent() == null) {
throw new IllegalArgumentException("Abnormal message or conversationType or targetId parameter。");
}
MessageTag messageTag = (MessageTag) message.getContent().getClass().getAnnotation(MessageTag.class);
if (messageTag == null) {
io.rong.common.rlog.RLog.e(TAG, "sendMessage MessageTag is null");
return;
}
if (TextUtils.isEmpty(message.getSenderUserId())) {
message.setSenderUserId(this.curUserId);
}
message.setMessageDirection(Message.MessageDirection.SEND);
message.setSentStatus(Message.SentStatus.SENDING);
message.setSentTime(System.currentTimeMillis());
message.setObjectName(messageTag.value());
boolean isCanIncludeExpansion = message.isCanIncludeExpansion();
String mapTsCombineJson = JSONUtils.mapTsCombineJson(message.getExpansion(), timeDisposal(message));
String hashMapToJson = JSONUtils.hashMapToJson(message.getExpansion());
byte[] bArr = new byte[1];
if ((messageTag.flag() & 1) == 1 && message.getMessageId() <= 0) {
MessageConfig messageConfig = message.getMessageConfig();
int SaveMessage = (int) this.nativeObj.SaveMessage(message.getTargetId(), message.getConversationType().getValue(), messageTag.value(), message.getSenderUserId(), bArr, false, 0, Message.SentStatus.SENDING.getValue(), System.currentTimeMillis(), getSearchableWord(message.getContent()), 1, "", messageConfig != null ? messageConfig.isDisableNotification() : false, isCanIncludeExpansion, mapTsCombineJson, message.getChannelId());
if (SaveMessage < 0) {
message.setSentStatus(Message.SentStatus.FAILED);
if (SaveMessage == IRongCoreEnum.CoreErrorCode.PARAMETER_ERROR.getValue()) {
iSendMessageCallback.onError(message, IRongCoreEnum.CoreErrorCode.PARAMETER_ERROR.getValue());
return;
} else {
iSendMessageCallback.onError(message, IRongCoreEnum.CoreErrorCode.BIZ_ERROR_DATABASE_ERROR.getValue());
return;
}
}
message.setMessageId(SaveMessage);
}
int i = messageTag.flag() == 16 ? 1 : 3;
MessageHandler messageHandler = getMessageHandler(messageTag.value());
if (messageHandler == null) {
io.rong.common.rlog.RLog.e(TAG, "sendMessage MessageHandler is null");
if (iSendMessageCallback != null) {
iSendMessageCallback.onError(message, IRongCoreEnum.CoreErrorCode.PARAMETER_ERROR.getValue());
return;
}
return;
}
messageHandler.encodeMessage(message);
byte[] encode = message.getContent().encode();
if (iSendMessageCallback != null) {
iSendMessageCallback.onAttached(message);
}
boolean z = message.getContent().getMentionedInfo() != null;
if (message.getMessageId() > 0) {
this.nativeObj.SetMessageContent(message.getMessageId(), encode, "");
}
internalSendMessage(message, str, str2, strArr, iSendMessageCallback, messageTag, encode, i, z, isCanIncludeExpansion, hashMapToJson);
}
private long timeDisposal(Message message) {
return message.getSentTime() - 1596211200000L;
}
public String getSearchableWord(MessageContent messageContent) {
List<String> searchableWord;
if (messageContent == null || (searchableWord = messageContent.getSearchableWord()) == null || searchableWord.size() <= 0) {
return "";
}
StringBuilder sb = new StringBuilder();
for (String str : searchableWord) {
sb.append(str);
sb.append("\n");
}
return sb.toString();
}
public void internalSendMessage(Message message, String str, String str2, String[] strArr, ISendMessageCallback<Message> iSendMessageCallback, MessageTag messageTag, byte[] bArr, int i, boolean z, boolean z2, String str3) {
internalSendMessage(message, str, str2, strArr, iSendMessageCallback, messageTag, bArr, i, z, false, false, z2, str3);
}
private void internalSendMessage(final Message message, String str, String str2, String[] strArr, final ISendMessageCallback<Message> iSendMessageCallback, MessageTag messageTag, byte[] bArr, int i, boolean z, boolean z2, boolean z3, boolean z4, String str3) {
final MessageTag messageTag2;
byte[] bArr2;
int i2;
Message message2;
if (hasIPCMessageInterceptor()) {
message2 = this.messageInterceptor.onSendMessageAfterDB(message);
if (message2 == null || message2.getContent() == null) {
FwLog.write(2, 1, FwLog.LogTag.L_INTERCEPT_MSG_S.getTag(), "method|code", "onSendMessageAfterDB", Integer.valueOf(IRongCoreEnum.CoreErrorCode.RC_MESSAGE_NULL_EXCEPTION.code));
this.nativeObj.SetSendStatus(message.getMessageId(), Message.SentStatus.FAILED.getValue());
message.setSentStatus(Message.SentStatus.FAILED);
if (iSendMessageCallback != null) {
iSendMessageCallback.onError(message, IRongCoreEnum.CoreErrorCode.RC_MESSAGE_NULL_EXCEPTION.code);
return;
}
return;
}
messageTag2 = (MessageTag) message2.getContent().getClass().getAnnotation(MessageTag.class);
int i3 = messageTag2.flag() != 16 ? 3 : 1;
bArr2 = message2.getContent().encode();
i2 = i3;
} else {
messageTag2 = messageTag;
bArr2 = bArr;
i2 = i;
message2 = message;
}
if (message2.getContent() instanceof MediaMessageContent) {
Uri localPath = ((MediaMessageContent) message2.getContent()).getLocalPath();
getMessageHandler(messageTag2.value()).encodeMessage(message);
((MediaMessageContent) message2.getContent()).setLocalPath(null);
bArr2 = message2.getContent().encode();
((MediaMessageContent) message2.getContent()).setLocalPath(localPath);
}
byte[] bArr3 = bArr2;
MessageConfig messageConfig = message.getMessageConfig();
boolean isDisableNotification = messageConfig != null ? messageConfig.isDisableNotification() : false;
NativeObject.PushConfig buildPushConfig = buildPushConfig(message, str, str2);
String channelId = message.getChannelId();
if (channelId != null && channelId.length() > 20) {
io.rong.common.rlog.RLog.e(TAG, "channelId exceed 20 !");
if (iSendMessageCallback != null) {
iSendMessageCallback.onError(message, IRongCoreEnum.CoreErrorCode.PARAMETER_ERROR.getValue());
return;
}
return;
}
this.nativeObj.sendMessageWithOption(message2.getTargetId(), message2.getConversationType().getValue(), i2, messageTag2.value(), bArr3, buildPushConfig, message2.getMessageId(), strArr, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i4, String str4, long j) {
io.rong.common.rlog.RLog.d(NativeClient.TAG, "sendMessage code = " + i4 + ", id = " + message.getMessageId() + ", uid = " + str4 + " " + message.getObjectName());
if (i4 == 0) {
NativeClient.this.nativeObj.SetSendStatus(message.getMessageId(), Message.SentStatus.SENT.getValue());
message.setSentStatus(Message.SentStatus.SENT);
message.setSentTime(j);
message.setUId(str4);
ISendMessageCallback iSendMessageCallback2 = iSendMessageCallback;
if (iSendMessageCallback2 != null) {
iSendMessageCallback2.onSuccess(message);
return;
}
return;
}
FwLog.write(1, 1, FwLog.LogTag.P_SEND_MSG_S.getTag(), "code|type|id|tag", Integer.valueOf(i4), Integer.valueOf(message.getConversationType().getValue()), message.getTargetId(), messageTag2.value());
if (i4 == IRongCoreEnum.CoreErrorCode.RC_MSG_BLOCKED_SENSITIVE_WORD.getValue()) {
NativeClient.this.nativeObj.SetSendStatus(message.getMessageId(), Message.SentStatus.FAILED.getValue());
message.setSentStatus(Message.SentStatus.FAILED);
} else if (i4 == IRongCoreEnum.CoreErrorCode.RC_MSG_REPLACED_SENSITIVE_WORD.getValue()) {
NativeClient.this.nativeObj.SetSendStatus(message.getMessageId(), Message.SentStatus.SENT.getValue());
message.setSentStatus(Message.SentStatus.SENT);
message.setSentTime(j);
message.setUId(str4);
} else {
NativeClient.this.nativeObj.SetSendStatus(message.getMessageId(), Message.SentStatus.FAILED.getValue());
message.setSentStatus(Message.SentStatus.FAILED);
}
ISendMessageCallback iSendMessageCallback3 = iSendMessageCallback;
if (iSendMessageCallback3 != null) {
iSendMessageCallback3.onError(message, i4);
}
}
}, z, z2, z3, isDisableNotification, z4, str3, channelId);
}
public boolean hasIPCMessageInterceptor() {
return this.messageInterceptor != null;
}
private NativeObject.PushConfig buildPushConfig(Message message, String str, String str2) {
NativeObject.PushConfig pushConfig = new NativeObject.PushConfig();
MessagePushConfig messagePushConfig = message.getMessagePushConfig();
if (messagePushConfig != null) {
pushConfig.setDisablePushTitle(messagePushConfig.isDisablePushTitle());
if (!TextUtils.isEmpty(messagePushConfig.getPushTitle())) {
pushConfig.setPushTitle(messagePushConfig.getPushTitle());
}
if (!TextUtils.isEmpty(messagePushConfig.getPushContent())) {
pushConfig.setPushContent(messagePushConfig.getPushContent());
} else {
pushConfig.setPushContent(str);
}
if (!TextUtils.isEmpty(messagePushConfig.getPushData())) {
pushConfig.setPushData(messagePushConfig.getPushData());
} else {
pushConfig.setPushData(str2);
}
pushConfig.setForceShowDetailContent(messagePushConfig.isForceShowDetailContent());
if (messagePushConfig.getAndroidConfig() != null) {
pushConfig.setNotificationId(messagePushConfig.getAndroidConfig().getNotificationId());
}
if (!TextUtils.isEmpty(messagePushConfig.channelToJson())) {
pushConfig.setChannelConfig(messagePushConfig.channelToJson());
}
pushConfig.setTemplateId(messagePushConfig.getTemplateId());
} else {
pushConfig.setPushContent(str);
pushConfig.setPushData(str2);
}
return pushConfig;
}
public void sendMediaMessage(Message message, String str, String str2, ISendMediaMessageCallback<Message> iSendMediaMessageCallback) {
sendMediaMessage(message, null, str, str2, iSendMediaMessageCallback);
}
public void sendMediaMessage(final Message message, final String[] strArr, final String str, final String str2, final ISendMediaMessageCallback<Message> iSendMediaMessageCallback) {
final MessageTag messageTag = (MessageTag) message.getContent().getClass().getAnnotation(MessageTag.class);
if (TextUtils.isEmpty(message.getSenderUserId())) {
message.setSenderUserId(this.curUserId);
}
message.setSentTime(System.currentTimeMillis());
message.setObjectName(messageTag.value());
final boolean isCanIncludeExpansion = message.isCanIncludeExpansion();
String mapTsCombineJson = JSONUtils.mapTsCombineJson(message.getExpansion(), timeDisposal(message));
final String hashMapToJson = JSONUtils.hashMapToJson(message.getExpansion());
byte[] bArr = new byte[1];
final boolean z = message.getContent().getMentionedInfo() != null;
final MediaMessageContent mediaMessageContent = (MediaMessageContent) message.getContent();
final MessageHandler messageHandler = getMessageHandler(messageTag.value());
if (messageHandler == null) {
io.rong.common.rlog.RLog.e(TAG, "sendMediaMessage MessageHandler is null");
if (iSendMediaMessageCallback != null) {
iSendMediaMessageCallback.onError(message, IRongCoreEnum.CoreErrorCode.PARAMETER_ERROR.getValue());
return;
}
return;
}
if (message.getMessageId() <= 0) {
MessageConfig messageConfig = message.getMessageConfig();
int SaveMessage = (int) this.nativeObj.SaveMessage(message.getTargetId(), message.getConversationType().getValue(), messageTag.value(), message.getSenderUserId(), bArr, false, 0, Message.SentStatus.SENDING.getValue(), System.currentTimeMillis(), getSearchableWord(message.getContent()), 1, "", messageConfig != null ? messageConfig.isDisableNotification() : false, isCanIncludeExpansion, mapTsCombineJson, message.getChannelId());
if (SaveMessage < 0 && iSendMediaMessageCallback != null) {
message.setSentStatus(Message.SentStatus.FAILED);
if (SaveMessage == IRongCoreEnum.CoreErrorCode.PARAMETER_ERROR.getValue()) {
iSendMediaMessageCallback.onError(message, IRongCoreEnum.CoreErrorCode.PARAMETER_ERROR.getValue());
return;
} else {
iSendMediaMessageCallback.onError(message, IRongCoreEnum.CoreErrorCode.BIZ_ERROR_DATABASE_ERROR.getValue());
return;
}
}
message.setMessageId(SaveMessage);
} else {
this.nativeObj.SetSendStatus(message.getMessageId(), Message.SentStatus.SENDING.getValue());
}
message.setSentStatus(Message.SentStatus.SENDING);
message.setMessageDirection(Message.MessageDirection.SEND);
messageHandler.encodeMessage(message);
byte[] encode = message.getContent().encode();
this.nativeObj.SetMessageContent(message.getMessageId(), encode, "");
if (iSendMediaMessageCallback != null) {
iSendMediaMessageCallback.onAttached(message);
}
if (mediaMessageContent.getMediaUrl() == null || (mediaMessageContent.getMediaUrl() != null && TextUtils.isEmpty(mediaMessageContent.getMediaUrl().toString()))) {
uploadMedia(message, new IResultProgressCallback<String>() {
@Override
public void onSuccess(String str3) {
mediaMessageContent.setMediaUrl(Uri.parse(str3));
messageHandler.encodeMessage(message);
message.setContent(mediaMessageContent);
byte[] encode2 = mediaMessageContent.encode();
NativeClient.this.nativeObj.SetMessageContent(message.getMessageId(), encode2, "");
NativeClient.this.internalSendMessage(message, str, str2, strArr, new ISendMessageCallback<Message>() {
@Override
public void onAttached(Message message2) {
}
@Override
public void onSuccess(Message message2) {
if (iSendMediaMessageCallback != null) {
iSendMediaMessageCallback.onSuccess(message2);
}
}
@Override
public void onError(Message message2, int i) {
if (iSendMediaMessageCallback != null) {
iSendMediaMessageCallback.onError(message2, i);
}
}
}, messageTag, encode2, 3, z, isCanIncludeExpansion, hashMapToJson);
}
@Override
public void onProgress(int i) {
io.rong.common.rlog.RLog.i(NativeClient.TAG, "upload onProgress " + i);
ISendMediaMessageCallback iSendMediaMessageCallback2 = iSendMediaMessageCallback;
if (iSendMediaMessageCallback2 != null) {
iSendMediaMessageCallback2.onProgress(message, i);
}
}
@Override
public void onError(int i) {
message.setSentStatus(Message.SentStatus.FAILED);
ISendMediaMessageCallback iSendMediaMessageCallback2 = iSendMediaMessageCallback;
if (iSendMediaMessageCallback2 != null) {
iSendMediaMessageCallback2.onError(message, i);
}
NativeClient.this.nativeObj.SetSendStatus(message.getMessageId(), Message.SentStatus.FAILED.getValue());
}
@Override
public void onCanceled(int i) {
message.setSentStatus(Message.SentStatus.CANCELED);
ISendMediaMessageCallback iSendMediaMessageCallback2 = iSendMediaMessageCallback;
if (iSendMediaMessageCallback2 != null) {
iSendMediaMessageCallback2.onCanceled(message);
}
NativeClient.this.nativeObj.SetSendStatus(message.getMessageId(), Message.SentStatus.CANCELED.getValue());
}
});
return;
}
this.nativeObj.SetMessageContent(message.getMessageId(), encode, "");
internalSendMessage(message, str, str2, strArr, new ISendMessageCallback<Message>() {
@Override
public void onAttached(Message message2) {
}
@Override
public void onSuccess(Message message2) {
ISendMediaMessageCallback iSendMediaMessageCallback2 = iSendMediaMessageCallback;
if (iSendMediaMessageCallback2 != null) {
iSendMediaMessageCallback2.onSuccess(message2);
}
}
@Override
public void onError(Message message2, int i) {
ISendMediaMessageCallback iSendMediaMessageCallback2 = iSendMediaMessageCallback;
if (iSendMediaMessageCallback2 != null) {
iSendMediaMessageCallback2.onError(message2, i);
}
}
}, messageTag, encode, 3, z, isCanIncludeExpansion, hashMapToJson);
}
public void uploadMedia(Message message, IResultProgressCallback<String> iResultProgressCallback) {
if (message == null || message.getConversationType() == null || TextUtils.isEmpty(message.getTargetId()) || message.getContent() == null) {
io.rong.common.rlog.RLog.e(TAG, "conversation type or targetId or message content can't be null!");
iResultProgressCallback.onError(IRongCoreEnum.CoreErrorCode.PARAMETER_ERROR.getValue());
return;
}
Uri uri = null;
if (message.getContent() instanceof ImageMessage) {
uri = ((ImageMessage) message.getContent()).getLocalUri();
} else if (message.getContent() instanceof GIFMessage) {
if (((GIFMessage) message.getContent()).getGifDataSize() > getGIFLimitSize() * 1024) {
io.rong.common.rlog.RLog.e(TAG, "Gif size is too long! ");
iResultProgressCallback.onError(IRongCoreEnum.CoreErrorCode.RC_GIF_MSG_SIZE_LIMIT_EXCEED.getValue());
return;
}
uri = ((GIFMessage) message.getContent()).getLocalPath();
} else if (message.getObjectName() != null && message.getObjectName().equals("RC:SightMsg")) {
if (((SightMessage) message.getContent()).getDuration() > getVideoLimitTime()) {
io.rong.common.rlog.RLog.e(TAG, "sight duration is too long! ");
iResultProgressCallback.onError(IRongCoreEnum.CoreErrorCode.RC_SIGHT_MSG_DURATION_LIMIT_EXCEED.getValue());
return;
}
uri = ((MediaMessageContent) message.getContent()).getLocalPath();
} else if (message.getContent() instanceof HQVoiceMessage) {
uri = ((MediaMessageContent) message.getContent()).getLocalPath();
} else if (message.getObjectName() != null && message.getObjectName().equals("RC:CombineMsg")) {
uri = ((MediaMessageContent) message.getContent()).getLocalPath();
} else if (message.getContent() instanceof MediaMessageContent) {
uri = ((MediaMessageContent) message.getContent()).getLocalPath();
}
Uri uri2 = uri;
FileInfo fileInfoByUri = FileUtils.getFileInfoByUri(mContext, uri2);
if (fileInfoByUri == null || fileInfoByUri.getSize() <= 0) {
io.rong.common.rlog.RLog.e(TAG, "file is not exists or length is 0");
iResultProgressCallback.onError(IRongCoreEnum.CoreErrorCode.RC_MEDIA_EXCEPTION.getValue());
return;
}
MediaUploadEngine.getInstance().uploadMedia(this.nativeObj, message, uri2, this.mFileServer, this.appKey, this.curUserId, iResultProgressCallback);
}
public int getGIFLimitSize() {
return NavigationCacheHelper.getGifSizeLimit(mContext);
}
public int getVideoLimitTime() {
return NavigationCacheHelper.getVideoLimitTime(mContext);
}
public Message insertMessage(Conversation.ConversationType conversationType, String str, String str2, MessageContent messageContent, long j) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationType == null || TextUtils.isEmpty(str) || messageContent == null) {
throw new IllegalArgumentException("Abnormal conversationType or targetId parameter。");
}
MessageTag messageTag = (MessageTag) messageContent.getClass().getAnnotation(MessageTag.class);
if (messageTag == null) {
throw new RuntimeException("Custom messages have no annotated information。");
}
if (messageTag.flag() == 16) {
io.rong.common.rlog.RLog.e(TAG, "insertMessage MessageTag can not be STATUS.");
return null;
}
Message message = new Message();
message.setConversationType(conversationType);
message.setTargetId(str);
String str3 = TextUtils.isEmpty(str2) ? this.curUserId : str2;
if (TextUtils.isEmpty(this.curUserId)) {
message.setMessageDirection(Message.MessageDirection.SEND);
message.setSentStatus(Message.SentStatus.SENT);
} else {
message.setMessageDirection(this.curUserId.equals(str3) ? Message.MessageDirection.SEND : Message.MessageDirection.RECEIVE);
message.setSentStatus(this.curUserId.equals(str3) ? Message.SentStatus.SENT : Message.SentStatus.RECEIVED);
}
message.setSenderUserId(str3);
message.setReceivedTime(j);
message.setSentTime(j);
message.setObjectName(messageTag.value());
message.setContent(messageContent);
byte[] bArr = new byte[1];
if (message.getMessageId() <= 0) {
boolean z = message.getMessageDirection() != null && message.getMessageDirection().equals(Message.MessageDirection.RECEIVE);
MessageConfig messageConfig = message.getMessageConfig();
message.setMessageId((int) this.nativeObj.SaveMessage(message.getTargetId(), message.getConversationType().getValue(), messageTag.value(), str3, bArr, z, 0, Message.SentStatus.SENDING.getValue(), message.getSentTime(), getSearchableWord(message.getContent()), 1, "", messageConfig != null ? messageConfig.isDisableNotification() : false, message.isCanIncludeExpansion(), JSONUtils.mapTsCombineJson(message.getExpansion(), timeDisposal(message)), message.getChannelId()));
}
MessageHandler messageHandler = getMessageHandler(messageTag.value());
if (messageHandler != null) {
messageHandler.encodeMessage(message);
this.nativeObj.SetMessageContent(message.getMessageId(), message.getContent().encode(), "");
this.nativeObj.SetSendStatus(message.getMessageId(), Message.SentStatus.SENT.getValue());
io.rong.common.rlog.RLog.d(TAG, "insertMessage Inserted, id = " + message.getMessageId());
} else {
io.rong.common.rlog.RLog.e(TAG, "InsertMessage. The message is not registered, please call the registerMessageType method to register it。");
}
return message;
}
public Message insertSettingMessage(Message message) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (message.getConversationType() == null || TextUtils.isEmpty(message.getTargetId()) || message.getContent() == null) {
throw new IllegalArgumentException("Abnormal conversationType or targetId parameter。");
}
MessageTag messageTag = (MessageTag) message.getContent().getClass().getAnnotation(MessageTag.class);
if (messageTag == null) {
throw new RuntimeException("Custom messages have no annotated information。");
}
if (messageTag.flag() == 16) {
io.rong.common.rlog.RLog.e(TAG, "insertMessage MessageTag can not be STATUS.");
return null;
}
String senderUserId = message.getSenderUserId();
if (TextUtils.isEmpty(senderUserId)) {
senderUserId = this.curUserId;
}
String str = senderUserId;
if (TextUtils.isEmpty(this.curUserId)) {
message.setMessageDirection(Message.MessageDirection.SEND);
message.setSentStatus(Message.SentStatus.SENT);
} else if (message.getMessageDirection().equals(Message.MessageDirection.RECEIVE)) {
message.setSentStatus(Message.SentStatus.RECEIVED);
}
message.setReceivedTime(System.currentTimeMillis());
message.setObjectName(messageTag.value());
byte[] bArr = new byte[1];
if (message.getMessageId() <= 0) {
boolean z = message.getMessageDirection() != null && message.getMessageDirection().equals(Message.MessageDirection.RECEIVE);
int i = (message.getMessageDirection() == Message.MessageDirection.RECEIVE && message.getReceivedStatus().getFlag() == 0 && messageTag.flag() == 3) ? 0 : 1;
MessageConfig messageConfig = message.getMessageConfig();
message.setMessageId((int) this.nativeObj.SaveMessage(message.getTargetId(), message.getConversationType().getValue(), messageTag.value(), str, bArr, z, message.getReceivedStatus().getFlag(), message.getSentStatus().getValue(), message.getSentTime(), getSearchableWord(message.getContent()), i, "", messageConfig != null ? messageConfig.isDisableNotification() : false, message.isCanIncludeExpansion(), JSONUtils.mapTsCombineJson(message.getExpansion(), timeDisposal(message)), message.getChannelId()));
}
MessageHandler messageHandler = getMessageHandler(messageTag.value());
if (messageHandler != null) {
messageHandler.encodeMessage(message);
this.nativeObj.SetMessageContent(message.getMessageId(), message.getContent().encode(), "");
this.nativeObj.SetSendStatus(message.getMessageId(), message.getSentStatus().getValue());
io.rong.common.rlog.RLog.d(TAG, "insertMessage Inserted, id = " + message.getMessageId());
} else {
io.rong.common.rlog.RLog.e(TAG, "InsertMessage.The message is not registered, please call the registerMessageType method to register it。");
}
return message;
}
public void downloadMedia(Conversation.ConversationType conversationType, String str, final int i, final String str2, final IResultProgressCallback<String> iResultProgressCallback) {
if (conversationType == null || TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) {
throw new IllegalArgumentException("ConversationType, imageUrl or targetId parameter is abnormal。");
}
String fileName = FtUtilities.getFileName(FileUtils.getCachePath(mContext, "download"), DeviceUtils.ShortMD5(2, str2));
final Date date = new Date(System.currentTimeMillis());
MediaDownloadEngine.getInstance().download(conversationType.getName() + str + str2, str2, fileName, new MediaDownloadEngine.DownloadEngineCallback() {
@Override
public void onError(int i2) {
FwLog.write(1, 1, FwLog.LogTag.L_MEDIA_S.getTag(), "type|media_type|user_stop|size|fileUri|duration|code", "download", FtConst.MediaType.setValue(i).getName(), false, 0, str2, Long.valueOf(new Date(System.currentTimeMillis()).getTime() - date.getTime()), Integer.valueOf(i2));
io.rong.common.rlog.RLog.d(NativeClient.TAG, "downloadMedia onError code =" + i2);
iResultProgressCallback.onError(i2);
}
@Override
public void onComplete(String str3) {
long time = new Date(System.currentTimeMillis()).getTime() - date.getTime();
FwLog.write(4, 1, FwLog.LogTag.L_MEDIA_S.getTag(), "type|media_type|user_stop|size|fileUri|duration|code", "download", FtConst.MediaType.setValue(i).getName(), false, Long.valueOf(new File(str3).length() / RealWebSocket.DEFAULT_MINIMUM_DEFLATE_SIZE), str2, Long.valueOf(time), 0);
io.rong.common.rlog.RLog.d(NativeClient.TAG, "downloadMedia onComplete fileUri =" + str3);
iResultProgressCallback.onSuccess(str3);
}
@Override
public void onProgress(int i2) {
iResultProgressCallback.onProgress(i2);
}
@Override
public void onCanceled(String str3) {
FwLog.write(4, 1, FwLog.LogTag.L_MEDIA_S.getTag(), "type|media_type|user_stop|size|fileUri|duration|code", "download", FtConst.MediaType.setValue(i).getName(), true, 0, str2, Long.valueOf(new Date(System.currentTimeMillis()).getTime() - date.getTime()), 0);
}
});
}
public void downloadMediaMessage(final Message message, final IDownloadMediaMessageCallback<Message> iDownloadMediaMessageCallback) {
String uri;
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
FtConst.MimeType mimeType = FtConst.MimeType.NONE;
boolean z = message.getContent() instanceof ImageMessage;
String str = LibStorageUtils.FILE;
String str2 = "";
String str3 = null;
if (z && ((ImageMessage) message.getContent()).getRemoteUri() != null) {
str3 = ((ImageMessage) message.getContent()).getRemoteUri().toString();
String name = ((ImageMessage) message.getContent()).getName();
if (TextUtils.isEmpty(name)) {
name = DeviceUtils.ShortMD5(2, str3);
}
str2 = name;
} else if ((message.getContent() instanceof GIFMessage) && ((GIFMessage) message.getContent()).getRemoteUri() != null) {
str3 = ((GIFMessage) message.getContent()).getRemoteUri().toString();
str2 = DeviceUtils.ShortMD5(2, str3) + ".gif";
} else if ((message.getContent() instanceof FileMessage) && ((FileMessage) message.getContent()).getFileUrl() != null) {
uri = ((FileMessage) message.getContent()).getFileUrl().toString();
String name2 = ((FileMessage) message.getContent()).getName();
if (TextUtils.isEmpty(name2)) {
name2 = DeviceUtils.ShortMD5(2, uri);
}
MediaMessageContent mediaMessageContent = (MediaMessageContent) message.getContent();
mediaMessageContent.setLocalPath(null);
this.nativeObj.SetMessageContent(message.getMessageId(), mediaMessageContent.encode(), "");
str2 = name2;
if (TextUtils.isEmpty(uri)) {
}
} else {
if ((message.getContent() instanceof HQVoiceMessage) && ((HQVoiceMessage) message.getContent()).getFileUrl() != null) {
HQVoiceMessage hQVoiceMessage = (HQVoiceMessage) message.getContent();
str3 = hQVoiceMessage.getFileUrl().toString();
String name3 = hQVoiceMessage.getName();
if (TextUtils.isEmpty(name3)) {
name3 = DeviceUtils.ShortMD5(2, str3);
}
str2 = name3;
str = "audio";
} else if (!(message.getContent() instanceof MediaMessageContent) || ((MediaMessageContent) message.getContent()).getMediaUrl() == null) {
str = "media";
} else {
str3 = ((MediaMessageContent) message.getContent()).getMediaUrl().toString();
String name4 = ((MediaMessageContent) message.getContent()).getName();
if (TextUtils.isEmpty(name4)) {
name4 = DeviceUtils.ShortMD5(2, str3);
}
str2 = name4;
if (message.getContent() instanceof SightMessage) {
str = "video";
}
}
uri = str3;
if (TextUtils.isEmpty(uri)) {
io.rong.common.rlog.RLog.e(TAG, "remoteUrl of the media file can't be empty!");
if (iDownloadMediaMessageCallback != null) {
iDownloadMediaMessageCallback.onError(IRongCoreEnum.CoreErrorCode.PARAMETER_ERROR.getValue());
return;
}
return;
}
String fileName = FtUtilities.getFileName(FileUtils.getMediaDownloadDir(mContext, str), message.getMessageId() + "_" + str2);
final FtConst.MimeType mimeType2 = FtUtilities.getMimeType(message);
final Date date = new Date(System.currentTimeMillis());
final String str4 = uri;
MediaDownloadEngine.getInstance().download(String.valueOf(message.getMessageId()), uri, fileName, new MediaDownloadEngine.DownloadEngineCallback() {
@Override
public void onError(int i) {
FwLog.write(1, 1, FwLog.LogTag.L_MEDIA_S.getTag(), "type|media_type|user_stop|size|fileUri|duration|code", "download", mimeType2.getName(), false, 0, str4, Long.valueOf(new Date(System.currentTimeMillis()).getTime() - date.getTime()), Integer.valueOf(i));
io.rong.common.rlog.RLog.d(NativeClient.TAG, "downloadMediaMessage onError code =" + i);
iDownloadMediaMessageCallback.onError(i);
}
@Override
public void onComplete(String str5) {
FwLog.write(4, 1, FwLog.LogTag.L_MEDIA_S.getTag(), "type|media_type|user_stop|size|fileUri|duration|code", "download", mimeType2.getName(), false, Long.valueOf(new File(str5).length() / RealWebSocket.DEFAULT_MINIMUM_DEFLATE_SIZE), str4, Long.valueOf(new Date(System.currentTimeMillis()).getTime() - date.getTime()), 0);
io.rong.common.rlog.RLog.d(NativeClient.TAG, "downloadMediaMessage onComplete fileUri =" + str5);
MediaMessageContent mediaMessageContent2 = (MediaMessageContent) message.getContent();
if (!FileUtils.isValidateLocalUri(Uri.parse(str5))) {
str5 = "file://" + str5;
}
mediaMessageContent2.setLocalPath(Uri.parse(str5));
iDownloadMediaMessageCallback.onSuccess(message);
NativeClient.this.nativeObj.SetMessageContent(message.getMessageId(), mediaMessageContent2.encode(), "");
}
@Override
public void onProgress(int i) {
io.rong.common.rlog.RLog.i(NativeClient.TAG, "download onProgress " + i);
iDownloadMediaMessageCallback.onProgress(i);
}
@Override
public void onCanceled(String str5) {
FwLog.write(4, 1, FwLog.LogTag.L_MEDIA_S.getTag(), "type|media_type|user_stop|size|fileUri|duration|code", "download", mimeType2.getName(), true, 0, str4, Long.valueOf(new Date(System.currentTimeMillis()).getTime() - date.getTime()), 0);
iDownloadMediaMessageCallback.onCanceled();
}
});
return;
}
str = "image";
uri = str3;
if (TextUtils.isEmpty(uri)) {
}
}
public void downloadMediaFile(final String str, final String str2, String str3, String str4, final IDownloadMediaFileCallback<Boolean> iDownloadMediaFileCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
final Date date = new Date(System.currentTimeMillis());
String fileName = FtUtilities.getFileName(str4, str3);
if (!new File(FileUtils.getTempFilePath(mContext, str)).exists()) {
try {
String substring = fileName.substring(str4.length() + 1);
if (!substring.equals(str3)) {
iDownloadMediaFileCallback.onFileNameChanged(substring);
}
} catch (Exception e) {
io.rong.common.rlog.RLog.e(TAG, "downloadMediaFile", e);
}
}
MediaDownloadEngine.getInstance().download(str, str2, fileName, new MediaDownloadEngine.DownloadEngineCallback() {
@Override
public void onError(int i) {
FwLog.write(1, 1, FwLog.LogTag.L_MEDIA_S.getTag(), "type|user_stop|size|fileUri|duration|code", "download", false, 0, str2, Long.valueOf(new Date(System.currentTimeMillis()).getTime() - date.getTime()), Integer.valueOf(i));
io.rong.common.rlog.RLog.d(NativeClient.TAG, "downloadMediaMessage onError code =" + i);
iDownloadMediaFileCallback.onError(i);
}
@Override
public void onComplete(String str5) {
long time = new Date(System.currentTimeMillis()).getTime() - date.getTime();
FwLog.write(4, 1, FwLog.LogTag.L_MEDIA_S.getTag(), "type|user_stop|size|fileUri|duration|code", "download", false, Long.valueOf(new File(str5).length() / RealWebSocket.DEFAULT_MINIMUM_DEFLATE_SIZE), str2, Long.valueOf(time), 0);
io.rong.common.rlog.RLog.d(NativeClient.TAG, "downloadMediaMessage onComplete fileUri =" + str5);
iDownloadMediaFileCallback.onSuccess(true);
}
@Override
public void onProgress(int i) {
io.rong.common.rlog.RLog.i(NativeClient.TAG, "download onProgress " + i + ",tag:" + str);
iDownloadMediaFileCallback.onProgress(i);
}
@Override
public void onCanceled(String str5) {
FwLog.write(4, 1, FwLog.LogTag.L_MEDIA_S.getTag(), "type|user_stop|size|fileUri|duration|code", "download", true, 0, str2, Long.valueOf(new Date(System.currentTimeMillis()).getTime() - date.getTime()), 0);
iDownloadMediaFileCallback.onCanceled();
}
});
}
public void getConversationNotificationStatus(Conversation.ConversationType conversationType, String str, String str2, IResultCallback<Integer> iResultCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationType == null || TextUtils.isEmpty(str) || iResultCallback == null) {
throw new IllegalArgumentException("Abnormal conversationType or targetId parameter。");
}
iResultCallback.onSuccess(Integer.valueOf((this.nativeObj.GetBlockPush(str, conversationType.getValue(), str2) == 100 ? Conversation.ConversationNotificationStatus.DO_NOT_DISTURB : Conversation.ConversationNotificationStatus.NOTIFY).getValue()));
}
public void setConversationNotificationStatus(Conversation.ConversationType conversationType, String str, String str2, final Conversation.ConversationNotificationStatus conversationNotificationStatus, final IResultCallback<Integer> iResultCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationType == null || conversationNotificationStatus == null || TextUtils.isEmpty(str) || iResultCallback == null) {
throw new IllegalArgumentException("The conversationType, notificationStatus or targetId parameter is abnormal。");
}
this.nativeObj.SetBlockPush(str, conversationType.getValue(), conversationNotificationStatus == Conversation.ConversationNotificationStatus.DO_NOT_DISTURB, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i, String str3, long j) {
if (i == 0) {
iResultCallback.onSuccess(Integer.valueOf((conversationNotificationStatus == Conversation.ConversationNotificationStatus.DO_NOT_DISTURB ? Conversation.ConversationNotificationStatus.DO_NOT_DISTURB : Conversation.ConversationNotificationStatus.NOTIFY).getValue()));
return;
}
io.rong.common.rlog.RLog.d(NativeClient.TAG, "setConversationNotificationStatus operationComplete: status = " + i);
iResultCallback.onError(i);
}
}, str2);
}
public void syncGroup(List<Group> list, final OperationCallback operationCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (list == null || list.size() == 0) {
throw new IllegalArgumentException("groups parameter exception。");
}
String[] strArr = new String[list.size()];
String[] strArr2 = new String[list.size()];
int i = 0;
for (Group group : list) {
strArr[i] = group.getId();
strArr2[i] = group.getName();
i++;
}
this.nativeObj.SyncGroups(strArr, strArr2, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i2, String str, long j) {
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 == null) {
return;
}
if (i2 == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i2);
}
}
});
}
public void joinGroup(String str, String str2, final OperationCallback operationCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) {
throw new IllegalArgumentException("Groupid or groupName cannot be empty。");
}
this.nativeObj.JoinGroup(str, str2, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i, String str3, long j) {
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 == null) {
return;
}
if (i == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i);
}
}
});
}
public void quitGroup(String str, final OperationCallback operationCallback) {
this.nativeObj.QuitGroup(str, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i, String str2, long j) {
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 == null) {
return;
}
if (i == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i);
}
}
});
}
public void handleReceivedMessage(NativeObject.Message message, int i, boolean z, boolean z2, int i2, OnReceiveMessageListener onReceiveMessageListener) {
final Message message2 = new Message(message);
message2.setContent(renderMessageContent(message.getObjectName(), message.getContent(), message2));
List<OnReceiveMessageListener> list = this.receiveMessageListenerList;
if (list != null && list.size() > 0) {
for (OnReceiveMessageListener onReceiveMessageListener2 : this.receiveMessageListenerList) {
onReceiveMessageListener2.onReceived(message2, i, z, z2, i2);
}
}
if (message2.getContent() instanceof LogCmdMessage) {
RtLogUploadManager.getInstance().createFullUploadTask(message2);
}
if (!(message2.getContent() instanceof MessageExpansionMessage)) {
if (onReceiveMessageListener != null) {
onReceiveMessageListener.onReceived(message2, i, z, z2, i2);
return;
}
return;
}
Handler handler = this.mWorkHandler;
if (handler != null) {
handler.post(new Runnable() {
@Override
public void run() {
NativeClient.this.handleExpansionMsg(message2);
}
});
}
}
public void setOnReceiveMessageListener(final OnReceiveMessageListener onReceiveMessageListener) {
this.nativeObj.SetMessageListener(new NativeObject.ReceiveMessageListener() {
@Override
public void onReceived(final NativeObject.Message message, final int i, final boolean z, final boolean z2, final int i2) {
io.rong.common.rlog.RLog.d(NativeClient.TAG, "onReceived onLine message:");
NativeClient.this.receiveMessageExecutor.execute(new Runnable() {
@Override
public void run() {
NativeClient.this.handleReceivedMessage(message, i, z, z2, i2, onReceiveMessageListener);
}
});
}
@Override
public void onReceived(final NativeObject.Message[] messageArr, final boolean z, final int i) {
io.rong.common.rlog.RLog.d(NativeClient.TAG, "onReceived batch of messages.");
NativeClient.this.receiveMessageExecutor.execute(new Runnable() {
@Override
public void run() {
int length = messageArr.length;
int i2 = i;
for (int i3 = 0; i3 < length; i3++) {
int i4 = (length - i3) - 1;
if (NativeClient.this.mCmdObjectNameSet.contains(messageArr[i3].getObjectName())) {
i2--;
}
NativeClient nativeClient = NativeClient.this;
NativeObject.Message[] messageArr2 = messageArr;
nativeClient.handleReceivedMessage(messageArr2[i3], i4, messageArr2[i3].isOffLine(), z, i2, onReceiveMessageListener);
}
}
});
}
});
this.nativeObj.SetGetSearchableWordListener(new NativeObject.GetSearchableWordListener() {
@Override
public byte[] getSearchableWord(String str, byte[] bArr) {
String searchableWord;
MessageContent newMessageContent = NativeClient.this.newMessageContent(str, bArr);
if (!(newMessageContent instanceof UnknownMessage)) {
searchableWord = NativeClient.getInstance().getSearchableWord(newMessageContent);
} else {
io.rong.common.rlog.RLog.e(NativeClient.TAG, "result is UnknownMessage");
searchableWord = "";
}
return searchableWord.getBytes();
}
@Override
public NativeObject.Message onEncryptedMessage(NativeObject.Message message) {
Message message2 = new Message(message);
message2.setContent(NativeClient.this.newMessageContent(message.getObjectName(), message.getContent()));
Message onReceiveMessageBeforeDB = NativeClient.this.messageInterceptor.onReceiveMessageBeforeDB(message2);
if (onReceiveMessageBeforeDB == null || onReceiveMessageBeforeDB.getContent() == null) {
FwLog.write(2, 1, FwLog.LogTag.L_INTERCEPT_MSG_S.getTag(), "method|code|uid", "onReceiveMessageBeforeDB", Integer.valueOf(IRongCoreEnum.CoreErrorCode.RC_MESSAGE_NULL_EXCEPTION.code), message.getUId());
return message;
}
return NativeClient.this.transformMessage(onReceiveMessageBeforeDB);
}
});
}
public void setConnectionStatusListener(ICodeListener iCodeListener) {
ConnectionService.getInstance().setMainProgressConnectionStatusListener(iCodeListener);
}
public long getDeltaTime() {
return this.nativeObj.GetDeltaTime();
}
public boolean clearConversations(String str, Conversation.ConversationType... conversationTypeArr) throws IllegalAccessException {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationTypeArr == null || conversationTypeArr.length == 0) {
throw new IllegalAccessException("ConversationTypes parameter abnormal。");
}
int[] iArr = new int[conversationTypeArr.length];
int i = 0;
for (Conversation.ConversationType conversationType : conversationTypeArr) {
iArr[i] = conversationType.getValue();
i++;
}
return this.nativeObj.ClearConversations(iArr, str);
}
public void addToBlacklist(String str, final OperationCallback operationCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (TextUtils.isEmpty(str) || operationCallback == null) {
throw new IllegalArgumentException("Parameter abnormal。");
}
this.nativeObj.AddToBlacklist(str, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i, String str2, long j) {
if (i == 0) {
operationCallback.onSuccess();
} else {
operationCallback.onError(i);
}
}
});
}
public void recallMessage(String str, byte[] bArr, String str2, Message message, final OperationCallback operationCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized.");
}
MessageConfig messageConfig = message.getMessageConfig();
this.nativeObj.RecallMessage(str, bArr, buildPushConfig(message, str2, null), new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i, String str3, long j) {
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
if (i == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i);
}
}
}
}, messageConfig != null ? messageConfig.isDisableNotification() : false, message.getChannelId());
}
public void removeFromBlacklist(String str, final OperationCallback operationCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (TextUtils.isEmpty(str) || operationCallback == null) {
throw new IllegalArgumentException("The user ID parameter is abnormal。");
}
this.nativeObj.RemoveFromBlacklist(str, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i, String str2, long j) {
if (i == 0) {
operationCallback.onSuccess();
} else {
operationCallback.onError(i);
}
}
});
}
public void getBlacklistStatus(String str, final IResultCallback<BlacklistStatus> iResultCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (TextUtils.isEmpty(str) || iResultCallback == null) {
throw new IllegalArgumentException("The user ID parameter is abnormal。");
}
this.nativeObj.GetBlacklistStatus(str, new NativeObject.BizAckListener() {
@Override
public void operationComplete(int i, int i2) {
if (i != 0) {
iResultCallback.onError(i);
} else if (i2 == 0) {
iResultCallback.onSuccess(BlacklistStatus.EXIT_BLACK_LIST);
} else if (i2 == 101) {
iResultCallback.onSuccess(BlacklistStatus.NOT_EXIT_BLACK_LIST);
}
}
});
}
public void getBlacklist(final IResultCallback<String> iResultCallback) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (iResultCallback == null) {
throw new IllegalArgumentException("Parameter abnormal。");
}
nativeObject.GetBlacklist(new NativeObject.SetBlacklistListener() {
@Override
public void OnSuccess(String str) {
if (!TextUtils.isEmpty(str)) {
iResultCallback.onSuccess(str);
} else {
iResultCallback.onSuccess(null);
}
}
@Override
public void OnError(int i) {
iResultCallback.onError(i);
}
});
}
public void setNotificationQuietHours(String str, int i, final OperationCallback operationCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (TextUtils.isEmpty(str) || i <= 0 || i >= 1440 || operationCallback == null) {
throw new IllegalArgumentException("StartTime, spanMinutes or spanMinutes parameter is abnormal。");
}
if (!Pattern.compile("^(([0-1][0-9])|2[0-3]):[0-5][0-9]:([0-5][0-9])$").matcher(str).find()) {
throw new IllegalArgumentException("startTime parameter exception。");
}
this.nativeObj.AddPushSetting(str, i, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i2, String str2, long j) {
if (i2 == 0) {
operationCallback.onSuccess();
} else {
operationCallback.onError(i2);
}
}
});
}
public void removeNotificationQuietHours(final OperationCallback operationCallback) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (operationCallback == null) {
throw new IllegalArgumentException("Parameter abnormal。");
}
nativeObject.RemovePushSetting(new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i, String str, long j) {
if (i == 0) {
operationCallback.onSuccess();
} else {
operationCallback.onError(i);
}
}
});
}
public void getNotificationQuietHours(final GetNotificationQuietHoursCallback getNotificationQuietHoursCallback) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (getNotificationQuietHoursCallback == null) {
throw new IllegalArgumentException("Parameter abnormal。");
}
nativeObject.QueryPushSetting(new NativeObject.PushSettingListener() {
@Override
public void OnSuccess(String str, int i) {
getNotificationQuietHoursCallback.onSuccess(str, i);
}
@Override
public void OnError(int i) {
getNotificationQuietHoursCallback.onError(i);
}
});
}
public void setUserData(UserData userData, final OperationCallback operationCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (userData == null) {
throw new IllegalArgumentException("userData parameter exception。");
}
JSONObject jSONObject = new JSONObject();
try {
if (userData.getPersonalInfo() != null) {
JSONObject jSONObject2 = new JSONObject();
jSONObject2.putOpt("realName", userData.getPersonalInfo().getRealName());
jSONObject2.putOpt("sex", userData.getPersonalInfo().getSex());
jSONObject2.putOpt("age", userData.getPersonalInfo().getAge());
jSONObject2.putOpt("birthday", userData.getPersonalInfo().getBirthday());
jSONObject2.putOpt("job", userData.getPersonalInfo().getJob());
jSONObject2.putOpt("portraitUri", userData.getPersonalInfo().getPortraitUri());
jSONObject2.putOpt("comment", userData.getPersonalInfo().getComment());
jSONObject.put("personalInfo", jSONObject2);
}
if (userData.getAccountInfo() != null) {
JSONObject jSONObject3 = new JSONObject();
jSONObject3.putOpt("appUserId", userData.getAccountInfo().getAppUserId());
jSONObject3.putOpt("userName", userData.getAccountInfo().getUserName());
jSONObject3.putOpt("nickName", userData.getAccountInfo().getNickName());
jSONObject.putOpt("accountInfo", jSONObject3);
}
if (userData.getContactInfo() != null) {
JSONObject jSONObject4 = new JSONObject();
jSONObject4.putOpt("tel", userData.getContactInfo().getTel());
jSONObject4.putOpt(NotificationCompat.CATEGORY_EMAIL, userData.getContactInfo().getEmail());
jSONObject4.putOpt("address", userData.getContactInfo().getAddress());
jSONObject4.putOpt("qq", userData.getContactInfo().getQQ());
jSONObject4.putOpt("weibo", userData.getContactInfo().getWeibo());
jSONObject4.putOpt("weixin", userData.getContactInfo().getWeixin());
jSONObject.putOpt("contactInfo", jSONObject4);
}
if (userData.getClientInfo() != null) {
JSONObject jSONObject5 = new JSONObject();
jSONObject5.putOpt("network", userData.getClientInfo().getNetwork());
jSONObject5.putOpt("carrier", userData.getClientInfo().getCarrier());
jSONObject5.putOpt("systemVersion", userData.getClientInfo().getSystemVersion());
jSONObject5.putOpt("os", userData.getClientInfo().getOs());
jSONObject5.putOpt("device", userData.getClientInfo().getDevice());
jSONObject5.putOpt("mobilePhoneManufacturers", userData.getClientInfo().getMobilePhoneManufacturers());
jSONObject.putOpt("clientInfo", jSONObject5);
}
jSONObject.putOpt("appVersion", userData.getAppVersion());
jSONObject.putOpt(RCConsts.EXTRA, userData.getExtra());
String jSONObject6 = jSONObject.toString();
io.rong.common.rlog.RLog.d(TAG, "UserData " + jSONObject6);
this.nativeObj.SetUserData(jSONObject6, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i, String str, long j) {
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
if (i == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i);
}
}
}
});
} catch (JSONException e) {
e.printStackTrace();
}
}
public boolean updateMessageReceiptStatus(String str, int i, String str2, long j) {
return this.nativeObj.UpdateMessageReceiptStatus(str, i, j, str2);
}
public boolean clearUnreadByReceipt(int i, String str, String str2, long j) {
return this.nativeObj.ClearUnreadByReceipt(str, i, j, str2);
}
public long getSendTimeByMessageId(int i) {
return this.nativeObj.GetSendTimeByMessageId(i);
}
public boolean updateConversationInfo(Conversation.ConversationType conversationType, String str, String str2, String str3, String str4) {
return this.nativeObj.UpdateConversationInfo(str, conversationType.getValue(), str3, str4, str2);
}
public void getVoIPKey(int i, String str, String str2, final IResultCallback<String> iResultCallback) {
this.nativeObj.GetVoIPKey(i, str, str2, new NativeObject.TokenListener() {
@Override
public void OnError(int i2, String str3) {
if (i2 == 0) {
iResultCallback.onSuccess(str3);
} else {
iResultCallback.onError(i2);
}
}
});
}
public String getVoIPCallInfo() {
return NavigationClient.getInstance().getVoIPCallInfo(mContext);
}
public Uri obtainMediaFileSavedUri() {
String ShortMD5 = DeviceUtils.ShortMD5(2, this.appKey, this.curUserId);
String savePath = SavePathUtils.getSavePath(mContext.getFilesDir().getAbsolutePath());
return Uri.parse(savePath + File.separator + ShortMD5);
}
public void setServerInfo(String str, String str2) {
if (str != null) {
NavigationClient.getInstance().setNaviDomainList(str);
}
if (TextUtils.isEmpty(str2)) {
return;
}
this.mFileServer = NavigationClient.getInstance().formatServerAddress(str2, "");
}
public void initHttpDns() {
NavigationClient.getInstance().getNaviString();
HttpDnsManager.getInstance().initHttpDns(mContext, this.nativeObj);
}
public boolean setMessageContent(int i, byte[] bArr, String str) {
return this.nativeObj.SetMessageContent(i, bArr, str);
}
public String getToken() {
return NavigationCacheHelper.getToken(mContext);
}
public boolean isPhrasesEnabled() {
return NavigationCacheHelper.isPhraseEnabled(mContext);
}
public boolean isKvStorageEnabled() {
return NavigationCacheHelper.isKvStorageEnabled(mContext);
}
public boolean isDnsEnabled() {
return NavigationCacheHelper.isDnsEnabled(mContext);
}
public String getDeviceId() {
return this.deviceId;
}
private boolean isMentionedMessage(Message message) {
return (message.getContent() instanceof TextMessage) && ((TextMessage) message.getContent()).getMentionedInfo() != null;
}
public List<Message> getUnreadMentionedMessages(Conversation.ConversationType conversationType, String str, String str2) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (conversationType == null || TextUtils.isEmpty(str)) {
throw new IllegalArgumentException("ConversationTypes or targetId arguments are abnormal。");
}
NativeObject.Message[] GetMentionMessages = this.nativeObj.GetMentionMessages(str.trim(), conversationType.getValue(), str2);
ArrayList arrayList = new ArrayList();
if (GetMentionMessages == null) {
return arrayList;
}
for (NativeObject.Message message : GetMentionMessages) {
Message message2 = new Message(message);
message2.setContent(renderMessageContent(message.getObjectName(), message.getContent(), message2));
arrayList.add(message2);
}
return arrayList;
}
public boolean updateReadReceiptRequestInfo(String str, String str2) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
return nativeObject.UpdateReadReceiptRequestInfo(str, str2);
}
public void registerCmdMsgType(String str) {
if (TextUtils.isEmpty(str)) {
io.rong.common.rlog.RLog.d(TAG, "registerCmdMsgType parameter error");
return;
}
if (this.mCmdObjectNameSet != null) {
io.rong.common.rlog.RLog.d(TAG, "registerCmdMsgType mCmdObjectNameSet is null");
this.mCmdObjectNameSet.add(str);
}
if (this.nativeObj != null) {
io.rong.common.rlog.RLog.d(TAG, "registerCmdMsgType nativeObj is null");
this.nativeObj.RegisterCmdMsgType(new String[]{str});
}
}
public void registerCmdMsgType(List<String> list) {
if (list == null || list.size() == 0) {
io.rong.common.rlog.RLog.d(TAG, "registerCmdMsgType list is empty");
return;
}
ArrayList arrayList = new ArrayList();
for (String str : list) {
if (!TextUtils.isEmpty(str)) {
arrayList.add(str);
}
}
if (this.mCmdObjectNameSet != null) {
io.rong.common.rlog.RLog.d(TAG, "registerCmdMsgType mCmdObjectNameSet is null");
this.mCmdObjectNameSet.addAll(arrayList);
}
if (this.nativeObj != null) {
io.rong.common.rlog.RLog.d(TAG, "registerCmdMsgType nativeObj is null");
this.nativeObj.RegisterCmdMsgType((String[]) arrayList.toArray(new String[0]));
}
}
public void registerDeleteMessageType(List<String> list) {
if (list == null || list.size() <= 0) {
return;
}
io.rong.common.rlog.RLog.e(TAG, "registerDeleteMessageType size: " + list.size());
this.nativeObj.RegisterDeleteMessageType((String[]) list.toArray(new String[0]));
}
public List<Message> searchMessages(String str, Conversation.ConversationType conversationType, String str2, String str3, int i, long j) {
NativeObject.Message[] SearchMessages = this.nativeObj.SearchMessages(str, conversationType.getValue(), str3, i, j, str2);
ArrayList arrayList = new ArrayList();
if (SearchMessages == null) {
return Collections.emptyList();
}
for (NativeObject.Message message : SearchMessages) {
Message message2 = new Message(message);
message2.setContent(renderMessageContent(message.getObjectName(), message.getContent(), message2));
arrayList.add(message2);
}
return arrayList;
}
public List<Message> searchMessagesByTimestamp(String str, int i, String str2, String str3, long j, long j2, int i2, int i3) {
NativeObject.Message[] SearchMessagesByTimestamp = this.nativeObj.SearchMessagesByTimestamp(str, i, str3, j, j2, i2, i3, str2);
if (SearchMessagesByTimestamp == null) {
return Collections.emptyList();
}
ArrayList arrayList = new ArrayList();
for (NativeObject.Message message : SearchMessagesByTimestamp) {
Message message2 = new Message(message);
message2.setContent(renderMessageContent(message.getObjectName(), message.getContent(), message2));
arrayList.add(message2);
}
return arrayList;
}
public List<Message> searchMessagesByUser(String str, Conversation.ConversationType conversationType, String str2, String str3, int i, long j) {
NativeObject.Message[] SearchMessagesByUser = this.nativeObj.SearchMessagesByUser(str, conversationType.getValue(), str3, i, j, str2);
ArrayList arrayList = new ArrayList();
if (SearchMessagesByUser == null) {
return Collections.emptyList();
}
for (NativeObject.Message message : SearchMessagesByUser) {
Message message2 = new Message(message);
message2.setContent(renderMessageContent(message.getObjectName(), message.getContent(), message2));
arrayList.add(message2);
}
return arrayList;
}
public List<SearchConversationResult> searchConversations(String str, int[] iArr, String[] strArr, String str2) {
NativeObject.Conversation[] SearchConversations = this.nativeObj.SearchConversations(str, iArr, strArr, str2);
ArrayList arrayList = new ArrayList();
if (SearchConversations != null) {
for (NativeObject.Conversation conversation : SearchConversations) {
Conversation renderConversationFromNative = renderConversationFromNative(conversation);
SearchConversationResult searchConversationResult = new SearchConversationResult();
searchConversationResult.setConversation(renderConversationFromNative);
searchConversationResult.setMatchCount(conversation.getMatchCount());
arrayList.add(searchConversationResult);
}
}
return arrayList;
}
public List<Message> getMatchedMessages(String str, Conversation.ConversationType conversationType, String str2, long j, int i, int i2) {
NativeObject.Message[] GetMatchedMessages = this.nativeObj.GetMatchedMessages(str, conversationType.getValue(), j, i, i2, str2);
ArrayList arrayList = new ArrayList();
if (GetMatchedMessages != null) {
for (NativeObject.Message message : GetMatchedMessages) {
Message message2 = new Message(message);
message2.setContent(renderMessageContent(message.getObjectName(), message.getContent(), message2));
arrayList.add(message2);
}
}
return arrayList;
}
public void getVendorToken(final IResultCallback<String> iResultCallback) {
this.nativeObj.GetVendorToken("", new NativeObject.TokenListener() {
@Override
public void OnError(int i, String str) {
IResultCallback iResultCallback2 = iResultCallback;
if (iResultCallback2 != null) {
if (i == 0) {
iResultCallback2.onSuccess(str);
} else {
iResultCallback2.onError(i);
}
}
}
});
}
public String getOfflineMessageDuration() {
return this.nativeObj.GetOfflineMessageDuration();
}
public void setOfflineMessageDuration(String str, final IResultCallback<Long> iResultCallback) {
this.nativeObj.SetOfflineMessageDuration(str, new NativeObject.SetOfflineMessageDurationListener() {
@Override
public void onSuccess(long j) {
IResultCallback iResultCallback2 = iResultCallback;
if (iResultCallback2 != null) {
iResultCallback2.onSuccess(Long.valueOf(j));
}
}
@Override
public void onError(int i) {
IResultCallback iResultCallback2 = iResultCallback;
if (iResultCallback2 != null) {
iResultCallback2.onError(i);
}
}
});
}
public void switchAppKey(String str, String str2) {
disconnect(false);
this.appKey = str;
this.deviceId = str2;
NavigationCacheHelper.clearCache(mContext);
NavigationCacheHelper.clearNaviCache(mContext);
ConnectionService.getInstance().initService(mContext, this.nativeObj, str);
this.nativeObj.InitClient(str, mContext.getPackageName(), str2, this.dbPath, "5.1.3.5");
ConnectionService.getInstance().initService(mContext, this.nativeObj, str);
RtLogUploadManager.getInstance().init(mContext, "5.1.3.5", str2, str);
this.mFileServer = null;
}
public Message getTheFirstUnreadMessage(int i, String str, String str2) {
NativeObject.Message GetTheFirstUnreadMessage = this.nativeObj.GetTheFirstUnreadMessage(i, str, str2);
if (GetTheFirstUnreadMessage == null) {
return null;
}
Message message = new Message(GetTheFirstUnreadMessage);
message.setContent(renderMessageContent(GetTheFirstUnreadMessage.getObjectName(), GetTheFirstUnreadMessage.getContent(), message));
return message;
}
public boolean setMessageReadTime(long j, long j2) {
return this.nativeObj.SetReadTime(j, j2);
}
public void setReconnectKickEnable(boolean z) {
ConnectionService.getInstance().setReconnectKickEnable(z);
}
public void SetPushNotificationListener(PushNotificationListener pushNotificationListener) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
nativeObject.SetPushNotificationListener(pushNotificationListener);
}
public void setConversationStatusListener(NativeObject.ConversationStatusListener conversationStatusListener) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
nativeObject.SetConversationStatusListener(conversationStatusListener);
}
public void setConversationListener(NativeObject.RTConversationListener rTConversationListener) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
nativeObject.SetRTConversationListener(rTConversationListener);
}
public void exitRTCRoom(final String str, final OperationCallback operationCallback) {
FwLog.write(3, 2, "P-leaveRoom-T", "roomId", str);
if (TextUtils.isEmpty(str)) {
FwLog.write(1, 2, "P-leaveRoom-E", "roomId|code|desc", str, -1, "RoomId is Null");
throw new IllegalArgumentException("Messages parameter exception。");
} else {
this.nativeObj.ExitRTCRoom(str, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i, String str2, long j) {
if (i == 0) {
FwLog.write(3, 2, "P-leaveRoom-R", "roomId|code", str, Integer.valueOf(i));
} else {
FwLog.write(1, 2, "P-leaveRoom-E", "roomId|code", str, Integer.valueOf(i));
}
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
if (i == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i);
}
}
}
});
}
}
public void getRTCUsers(String str, int i, final IResultCallback<List<RTCUser>> iResultCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (TextUtils.isEmpty(str)) {
throw new IllegalArgumentException("Messages parameter exception。");
}
this.nativeObj.GetRTCUsers(str, i, new NativeObject.RTCUserInfoListener() {
@Override
public void OnSuccess(RTCUser[] rTCUserArr, String str2, String str3, HashMap<String, String> hashMap) {
iResultCallback.onSuccess(new ArrayList(Arrays.asList(rTCUserArr)));
}
@Override
public void OnError(int i2) {
iResultCallback.onError(i2);
}
});
}
public void getRTCUserData(String str, int i, final IResultCallback<List<RTCUser>> iResultCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (TextUtils.isEmpty(str)) {
throw new IllegalArgumentException("Messages parameter exception。");
}
this.nativeObj.GetRTCUserData(str, i, new NativeObject.RTCUserInfoListener() {
@Override
public void OnSuccess(RTCUser[] rTCUserArr, String str2, String str3, HashMap<String, String> hashMap) {
iResultCallback.onSuccess(new ArrayList(Arrays.asList(rTCUserArr)));
}
@Override
public void OnError(int i2) {
iResultCallback.onError(i2);
}
});
}
public void sendRTCPing(String str, final OperationCallback operationCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (TextUtils.isEmpty(str)) {
throw new IllegalArgumentException("Messages parameter exception。");
}
this.nativeObj.SendRTCPing(str, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i, String str2, long j) {
if (i != 0) {
FwLog.write(1, 2, "P-RTCPing-E", "code", Integer.valueOf(i));
}
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
if (i == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i);
}
}
}
});
}
public boolean useRTCOnly() {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
return nativeObject.UseRTCOnly();
}
public void rtcPutInnerData(final String str, int i, String str2, String str3, String str4, String str5, final OperationCallback operationCallback) {
LogSplitUtil.write(3, "P-RTCPutInnerData-T", "roomId|type|fullValues|increValues", str, Integer.valueOf(i), str3, str5);
if (this.nativeObj == null) {
FwLog.write(1, 2, "P-RTCPutInnerData-E", "roomId|code|desc", str, -1, "NativeClient is Null");
throw new RuntimeException("NativeClient has not been initialized yet!");
} else if (TextUtils.isEmpty(str)) {
FwLog.write(1, 2, "P-RTCPutInnerData-E", "roomId|code|desc", str, -1, "RoomId is Null");
io.rong.common.rlog.RLog.e(TAG, "rtcPutInnerData roomId is empty");
operationCallback.onError(IRongCoreEnum.CoreErrorCode.PARAMETER_ERROR.getValue());
} else {
this.nativeObj.RTCPutInnerDatum(str, i, str2, str3, str4, str5, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i2, String str6, long j) {
if (i2 == 0) {
FwLog.write(3, 2, "P-RTCPutInnerData-R", "roomId|code", str, Integer.valueOf(i2));
} else {
FwLog.write(1, 2, "P-RTCPutInnerData-E", "roomId|code", str, Integer.valueOf(i2));
}
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
if (i2 == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i2);
}
}
}
});
}
}
public void rtcPutOuterData(final String str, int i, String str2, String str3, String str4, String str5, final OperationCallback operationCallback) {
LogSplitUtil.write(3, "P-RTCPutOuterData-T", "roomId|type|fullValues|increValues", str, Integer.valueOf(i), str3, str5);
if (this.nativeObj == null) {
FwLog.write(1, 2, "P-RTCPutOuterData-E", "roomId|code|desc", str, -1, "NativeClient is Null");
throw new RuntimeException("NativeClient has not been initialized yet!");
} else if (TextUtils.isEmpty(str)) {
FwLog.write(1, 2, "P-RTCPutOuterData-E", "roomId|code|desc", str, -1, "RoomId is Null");
io.rong.common.rlog.RLog.e(TAG, "rtcPutOuterData roomId is empty");
operationCallback.onError(IRongCoreEnum.CoreErrorCode.PARAMETER_ERROR.getValue());
} else {
this.nativeObj.RTCPutOuterDatum(str, i, str2, str3, str4, str5, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i2, String str6, long j) {
if (i2 == 0) {
FwLog.write(3, 2, "P-RTCPutOuterData-R", "roomId|code", str, 0);
} else {
FwLog.write(1, 2, "P-RTCPutOuterData-E", "roomId|code", str, Integer.valueOf(i2));
}
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
if (i2 == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i2);
}
}
}
});
}
}
public void rtcDeleteInnerData(final String str, int i, String[] strArr, String str2, String str3, final OperationCallback operationCallback) {
if (this.nativeObj == null) {
FwLog.write(1, 2, "P-RTCDeleteInnerData-E", "roomId|code|desc", str, -1, "NativeClient is Null");
throw new RuntimeException("NativeClient has not been initialized yet!");
} else if (TextUtils.isEmpty(str)) {
FwLog.write(1, 2, "P-RTCDeleteInnerData-E", "roomId|code|desc", str, -1, "RoomId is Null");
io.rong.common.rlog.RLog.e(TAG, "rtcDeleteInnerData roomId is empty");
operationCallback.onError(IRongCoreEnum.CoreErrorCode.PARAMETER_ERROR.getValue());
} else {
FwLog.write(3, 2, "P-RTCDeleteInnerData-T", "roomId|type", str, Integer.valueOf(i));
this.nativeObj.RTCDeleteInnerData(str, i, strArr, str2, str3, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i2, String str4, long j) {
if (i2 == 0) {
FwLog.write(3, 2, "P-RTCDeleteInnerData-R", "roomId|code", str, 0);
} else {
FwLog.write(1, 2, "P-RTCDeleteInnerData-E", "roomId|code|desc", str, Integer.valueOf(i2), "Protocol Error");
}
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
if (i2 == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i2);
}
}
}
});
}
}
public void rtcDeleteOuterData(final String str, int i, String[] strArr, String str2, String str3, final OperationCallback operationCallback) {
if (this.nativeObj == null) {
FwLog.write(1, 2, "P-RTCDeleteOuterData-E", "roomId|code|desc", str, -1, "NativeClient is Null");
throw new RuntimeException("NativeClient has not been initialized yet!");
} else if (TextUtils.isEmpty(str)) {
FwLog.write(1, 2, "P-RTCDeleteOuterData-E", "roomId|code|desc", str, -1, "RoomId is Null");
io.rong.common.rlog.RLog.e(TAG, "rtcDeleteOuterData roomId is empty");
operationCallback.onError(IRongCoreEnum.CoreErrorCode.PARAMETER_ERROR.getValue());
} else {
FwLog.write(3, 2, "P-RTCDeleteOuterData-T", "roomId|type", str, Integer.valueOf(i));
this.nativeObj.RTCDeleteOuterData(str, i, strArr, str2, str3, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i2, String str4, long j) {
if (i2 == 0) {
FwLog.write(3, 2, "P-RTCDeleteOuterData-R", "roomId|code", str, 0);
} else {
FwLog.write(1, 2, "P-RTCDeleteOuterData-E", "roomId|code|desc", str, Integer.valueOf(i2), "Protocol Error");
}
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
if (i2 == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i2);
}
}
}
});
}
}
public void rtcGetInnerData(final String str, int i, String[] strArr, final IResultCallback<Map<String, String>> iResultCallback) {
if (this.nativeObj == null) {
FwLog.write(1, 2, "P-RTCGetInnerData-E", "roomId|code|desc", str, -1, "NativeClient is Null");
throw new RuntimeException("NativeClient has not been initialized yet!");
} else if (TextUtils.isEmpty(str)) {
FwLog.write(1, 2, "P-RTCGetInnerData-E", "roomId|code|desc", str, -1, "RoomId is Null");
io.rong.common.rlog.RLog.e(TAG, "rtcGetInnerData roomId is empty");
iResultCallback.onError(IRongCoreEnum.CoreErrorCode.PARAMETER_ERROR.getValue());
} else {
FwLog.write(3, 2, "P-RTCGetInnerData-T", "roomId|type", str, Integer.valueOf(i));
this.nativeObj.RTCGetInnerData(str, i, strArr, new NativeObject.RTCDataListener() {
@Override
public void OnSuccess(Map<String, String> map) {
FwLog.write(3, 2, "P-RTCGetInnerData-R", "roomId|code", str, 0);
iResultCallback.onSuccess(map);
}
@Override
public void OnError(int i2) {
FwLog.write(1, 2, "P-RTCGetInnerData-E", "roomId|code|desc", str, Integer.valueOf(i2), "Protocol Error");
iResultCallback.onError(i2);
}
});
}
}
public void rtcGetOuterData(final String str, int i, String[] strArr, final IResultCallback<Map<String, String>> iResultCallback) {
if (this.nativeObj == null) {
FwLog.write(1, 2, "P-RTCGetOuterData-E", "roomId|code|desc", str, -1, "NativeClient is Null");
throw new RuntimeException("NativeClient has not been initialized yet!");
} else if (TextUtils.isEmpty(str)) {
FwLog.write(1, 2, "P-RTCGetOuterData-E", "roomId|code|desc", str, -1, "RoomId is Null");
io.rong.common.rlog.RLog.e(TAG, "rtcGetOuterData roomId is empty");
iResultCallback.onError(IRongCoreEnum.CoreErrorCode.PARAMETER_ERROR.getValue());
} else {
FwLog.write(3, 2, "P-RTCGetOuterData-T", "roomId|type", str, Integer.valueOf(i));
this.nativeObj.RTCGetOuterData(str, i, strArr, new NativeObject.RTCDataListener() {
@Override
public void OnSuccess(Map<String, String> map) {
FwLog.write(3, 2, "P-RTCGetOuterData-R", "roomId|code", str, 0);
iResultCallback.onSuccess(map);
}
@Override
public void OnError(int i2) {
FwLog.write(1, 2, "P-RTCGetOuterData-E", "roomId|code|desc", str, Integer.valueOf(i2), "Protocol Error");
iResultCallback.onError(i2);
}
});
}
}
public void joinRTCRoomAndGetData(final String str, int i, int i2, String str2, String str3, final IResultCallbackEx<List<RTCUser>, Object[]> iResultCallbackEx) {
FwLog.write(3, 2, "P-joinRoom-T", "roomId|uid|roomType|liveType", str, getCurrentUserId(), Integer.valueOf(i), Integer.valueOf(i2));
if (this.nativeObj == null) {
FwLog.write(1, 2, "P-joinRoom-E", "roomId|code|desc", str, -1, "NativeClient is Null");
throw new RuntimeException("NativeClient has not been initialized yet!");
} else if (TextUtils.isEmpty(str)) {
FwLog.write(1, 2, "P-joinRoom-E", "roomId|code|desc", str, -1, "RoomId is Null");
throw new IllegalArgumentException("Messages parameter exception。");
} else {
this.nativeObj.JoinRTCRoomAndGetData(str, i, i2, str2, str3, new NativeObject.RTCUserInfoListener() {
@Override
public void OnSuccess(RTCUser[] rTCUserArr, String str4, String str5, HashMap<String, String> hashMap) {
String str6;
if (rTCUserArr == null || rTCUserArr.length <= 0) {
str6 = HttpUrl.PATH_SEGMENT_ENCODE_SET_URI;
} else {
JSONArray jSONArray = new JSONArray();
for (RTCUser rTCUser : rTCUserArr) {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("userId", rTCUser.getUid());
JSONObject jSONObject2 = new JSONObject();
if (rTCUser.getData() != null) {
for (Map.Entry<String, String> entry : rTCUser.getData().entrySet()) {
jSONObject2.put(entry.getKey(), entry.getValue());
}
}
jSONObject.put("streamData", jSONObject2);
jSONArray.put(jSONObject);
} catch (JSONException e) {
e.printStackTrace();
}
}
str6 = jSONArray.toString();
}
LogSplitUtil.write(3, "P-joinRoom-R", "roomId|code|remoteUserInfo", str, 0, str6);
iResultCallbackEx.onSuccess(new ArrayList(Arrays.asList(rTCUserArr)), new Object[]{str4, str5, hashMap});
}
@Override
public void OnError(int i3) {
FwLog.write(1, 2, "P-joinRoom-E", "roomId|code|desc", str, Integer.valueOf(i3), "Protocol Error");
iResultCallbackEx.onError(i3);
}
});
}
}
public String getCurrentUserId() {
if (TextUtils.isEmpty(this.curUserId)) {
String userId = NavigationClient.getInstance().getUserId(mContext);
this.curUserId = userId;
return userId;
}
return this.curUserId;
}
public void setCurrentUserId(String str) {
this.curUserId = str;
}
public void getRTCConfig(String str, String str2, long j, String str3, final NativeObject.RTCConfigListener rTCConfigListener) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
nativeObject.GetRTCConfig(str, str2, j, str3, new NativeObject.RTCConfigListener() {
@Override
public void onSuccess(String str4, long j2) {
rTCConfigListener.onSuccess(str4, j2);
}
@Override
public void onError(int i) {
rTCConfigListener.onError(i);
}
});
}
public void getRTCToken(String str, int i, int i2, final IResultCallback<String> iResultCallback) {
FwLog.write(3, 2, "P-getRTCToken-T", "roomId|roomType|mediaType", str, Integer.valueOf(i), Integer.valueOf(i2));
this.nativeObj.RTCGetToken(str, i, i2, new NativeObject.TokenListener() {
@Override
public void OnError(int i3, String str2) {
if (i3 == 0) {
FwLog.write(3, 2, "P-getRTCToken-R", "code|token", 0, str2);
} else {
FwLog.write(1, 2, "P-getRTCToken-E", "code", Integer.valueOf(i3));
}
IResultCallback iResultCallback2 = iResultCallback;
if (iResultCallback2 != null) {
if (i3 == 0) {
iResultCallback2.onSuccess(str2);
} else {
iResultCallback2.onError(i3);
}
}
}
});
}
public void setRTCUserState(String str, String str2, final OperationCallback operationCallback) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
nativeObject.RTCSetUserState(str, str2, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i, String str3, long j) {
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
if (i == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i);
}
}
}
});
}
public void setRTCUserData(String str, int i, Map<String, String> map, String str2, String str3, final OperationCallback operationCallback) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (!(map instanceof HashMap)) {
throw new RuntimeException("setRTCUserData data must be HashMap!");
}
nativeObject.RTCSetUserData(str, i, map, str2, str3, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i2, String str4, long j) {
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
if (i2 == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i2);
}
}
}
});
}
public void getRTCUserDatas(String str, String[] strArr, final IResultCallback<List<RTCUser>> iResultCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (TextUtils.isEmpty(str)) {
throw new IllegalArgumentException("Messages parameter exception。");
}
this.nativeObj.RTCGetUserData(str, strArr, new NativeObject.RTCUserInfoListener() {
@Override
public void OnSuccess(RTCUser[] rTCUserArr, String str2, String str3, HashMap<String, String> hashMap) {
iResultCallback.onSuccess(new ArrayList(Arrays.asList(rTCUserArr)));
}
@Override
public void OnError(int i) {
iResultCallback.onError(i);
}
});
}
public String getRTCProfile() {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
return nativeObject.GetRTCProfile();
}
public void setNaviContentUpdateListener(NavigationClient.NaviUpdateListener naviUpdateListener) {
this.naviUpdateListener = naviUpdateListener;
}
public String getUploadConfigInfo() {
return NavigationClient.getInstance().getUploadLogConfigInfo(mContext);
}
public String getOffLineLogServer() {
return NavigationCacheHelper.getOfflineLogServer(mContext);
}
public void updateVoIPCallInfo(String str) {
NavigationCacheHelper.updateVoIPCallInfo(mContext, str);
}
public void rtcSetUserResource(final String str, RTCStatusDate[] rTCStatusDateArr, String str2, RTCStatusDate[] rTCStatusDateArr2, final OperationCallback operationCallback) {
LogSplitUtil.write(3, "P-RTCSetUserResource-T", "roomId", str);
if (this.nativeObj == null) {
FwLog.write(1, 2, "P-RTCSetUserResource-E", "roomId|code|desc", str, -1, "NativeClient is Null");
throw new RuntimeException("NativeClient has not been initialized yet!");
} else if (TextUtils.isEmpty(str)) {
FwLog.write(1, 2, "P-RTCSetUserResource-E", "roomId|code|desc", str, -1, "RoomId is Null");
io.rong.common.rlog.RLog.e(TAG, "rtcSetUserResource roomId is empty");
operationCallback.onError(IRongCoreEnum.CoreErrorCode.PARAMETER_ERROR.getValue());
} else {
int length = rTCStatusDateArr.length;
int length2 = rTCStatusDateArr2.length;
NativeObject.StatusData[] statusDataArr = new NativeObject.StatusData[length];
for (int i = 0; i < length; i++) {
NativeObject.StatusData statusData = new NativeObject.StatusData();
statusData.setKey(rTCStatusDateArr[i].getKey());
statusData.setValue(rTCStatusDateArr[i].getValue());
statusData.setAutoDelete(rTCStatusDateArr[i].isAutoDelete());
statusData.setOverwrite(rTCStatusDateArr[i].isOverwrite());
statusDataArr[i] = statusData;
}
NativeObject.StatusData[] statusDataArr2 = new NativeObject.StatusData[length2];
for (int i2 = 0; i2 < length2; i2++) {
NativeObject.StatusData statusData2 = new NativeObject.StatusData();
statusData2.setKey(rTCStatusDateArr2[i2].getKey());
statusData2.setValue(rTCStatusDateArr2[i2].getValue());
statusData2.setAutoDelete(rTCStatusDateArr2[i2].isAutoDelete());
statusData2.setOverwrite(rTCStatusDateArr2[i2].isOverwrite());
statusDataArr2[i2] = statusData2;
}
this.nativeObj.RTCSetUserResource(str, statusDataArr, str2, statusDataArr2, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i3, String str3, long j) {
if (i3 == 0) {
FwLog.write(3, 2, "P-RTCSetUserResource-R", "roomId|code", str, Integer.valueOf(i3));
} else {
FwLog.write(1, 2, "P-RTCSetUserResource-E", "roomId|code", str, Integer.valueOf(i3));
}
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
if (i3 == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i3);
}
}
}
});
}
}
public void sdkBackgroundChanged(boolean z) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
nativeObject.sdkBackgroundChanged(z);
}
public void updateMessageExpansion(final Map<String, String> map, final String str, final OperationCallback operationCallback) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
final NativeObject.Message GetMessageByUId = nativeObject.GetMessageByUId(str);
final Message messageByUid = getMessageByUid(str);
if (messageByUid == null || !messageByUid.isCanIncludeExpansion()) {
if (operationCallback != null) {
operationCallback.onError(IRongCoreEnum.CoreErrorCode.RC_MESSAGE_CANT_EXPAND.getValue());
}
} else if (!Conversation.ConversationType.PRIVATE.equals(messageByUid.getConversationType()) && !Conversation.ConversationType.GROUP.equals(messageByUid.getConversationType())) {
if (operationCallback != null) {
io.rong.common.rlog.RLog.e(TAG, "only private or group support expansion");
operationCallback.onError(IRongCoreEnum.CoreErrorCode.RC_MESSAGE_CANT_EXPAND.getValue());
}
} else if (!judgeExpansionExceedLimit(map, GetMessageByUId)) {
sendMessageOption(Message.obtain(messageByUid.getTargetId(), messageByUid.getConversationType(), messageByUid.getChannelId(), MessageExpansionMessage.obtain(str, map)), null, null, null, null, new ISendMessageCallback<Message>() {
@Override
public void onAttached(Message message) {
}
@Override
public void onSuccess(Message message) {
boolean messageExpansion = NativeClient.this.setMessageExpansion(messageByUid.getTargetId(), messageByUid.getConversationType().getValue(), messageByUid.getChannelId(), str, NativeClient.this.getMessageExpansion(message, map, GetMessageByUId.getExtMsg()));
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
if (messageExpansion) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(IRongCoreEnum.CoreErrorCode.RC_MESSAGE_EXPAND_FAIL.getValue());
}
}
}
@Override
public void onError(Message message, int i) {
io.rong.common.rlog.RLog.i(NativeClient.TAG, "updateMessageExpansion onError = " + i);
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
operationCallback2.onError(i);
}
}
});
} else if (operationCallback != null) {
operationCallback.onError(IRongCoreEnum.CoreErrorCode.RC_MSG_EXPANSION_SIZE_LIMIT_EXCEED.getValue());
}
}
public Message getMessageByUid(String str) {
NativeObject.Message GetMessageByUId = this.nativeObj.GetMessageByUId(str);
if (GetMessageByUId == null) {
return null;
}
Message message = new Message(GetMessageByUId);
message.setContent(renderMessageContent(GetMessageByUId.getObjectName(), GetMessageByUId.getContent(), message));
return message;
}
private boolean judgeExpansionExceedLimit(Map<String, String> map, NativeObject.Message message) {
Set<String> keySet = JSONUtils.jsonToExpansionEx(message.getExtMsg()).keySet();
if (map.size() > 20 || keySet.size() > 300) {
return true;
}
HashSet hashSet = new HashSet();
for (String str : keySet) {
hashSet.add(str);
}
for (Map.Entry<String, String> entry : map.entrySet()) {
hashSet.add(entry.getKey().toString());
if (hashSet.size() > 300) {
return true;
}
}
return false;
}
public void sendMessageOption(Message message, String str, String str2, SendMessageOption sendMessageOption, String[] strArr, ISendMessageCallback<Message> iSendMessageCallback) {
sendMessageOption(message, str, str2, sendMessageOption, strArr, false, iSendMessageCallback);
}
public String getMessageExpansion(Message message, Map<String, String> map, String str) {
List<String> mergeJson = JSONUtils.mergeJson(JSONUtils.mapTsCombineJson(map, timeDisposal(message)), str);
return (mergeJson == null || mergeJson.size() == 0) ? "" : mergeJson.get(0);
}
public boolean setMessageExpansion(String str, int i, String str2, String str3, String str4) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
return nativeObject.SetExtraMessageAttribute(str, i, str3, str4, str2);
}
public void sendMessageOption(Message message, String str, String str2, SendMessageOption sendMessageOption, String[] strArr, boolean z, ISendMessageCallback<Message> iSendMessageCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
if (message.getConversationType() == null || TextUtils.isEmpty(message.getTargetId()) || message.getContent() == null) {
throw new IllegalArgumentException("Abnormal message or conversationType or targetId parameter。");
}
MessageTag messageTag = (MessageTag) message.getContent().getClass().getAnnotation(MessageTag.class);
if (TextUtils.isEmpty(message.getSenderUserId())) {
message.setSenderUserId(this.curUserId);
}
message.setMessageDirection(Message.MessageDirection.SEND);
message.setSentStatus(Message.SentStatus.SENDING);
message.setSentTime(System.currentTimeMillis());
message.setObjectName(messageTag.value());
boolean isCanIncludeExpansion = message.isCanIncludeExpansion();
String mapTsCombineJson = JSONUtils.mapTsCombineJson(message.getExpansion(), timeDisposal(message));
String hashMapToJson = JSONUtils.hashMapToJson(message.getExpansion());
byte[] bArr = new byte[1];
if ((messageTag.flag() & 1) == 1 && message.getMessageId() <= 0) {
MessageConfig messageConfig = message.getMessageConfig();
int SaveMessage = (int) this.nativeObj.SaveMessage(message.getTargetId(), message.getConversationType().getValue(), messageTag.value(), message.getSenderUserId(), bArr, false, 0, Message.SentStatus.SENDING.getValue(), System.currentTimeMillis(), getSearchableWord(message.getContent()), 1, "", messageConfig != null ? messageConfig.isDisableNotification() : false, isCanIncludeExpansion, mapTsCombineJson, message.getChannelId());
if (SaveMessage < 0) {
message.setSentStatus(Message.SentStatus.FAILED);
if (SaveMessage == IRongCoreEnum.CoreErrorCode.PARAMETER_ERROR.getValue()) {
iSendMessageCallback.onError(message, IRongCoreEnum.CoreErrorCode.PARAMETER_ERROR.getValue());
return;
} else {
iSendMessageCallback.onError(message, IRongCoreEnum.CoreErrorCode.BIZ_ERROR_DATABASE_ERROR.getValue());
return;
}
}
message.setMessageId(SaveMessage);
}
int i = messageTag.flag() == 16 ? 1 : 3;
MessageHandler messageHandler = getMessageHandler(messageTag.value());
if (messageHandler == null) {
io.rong.common.rlog.RLog.e(TAG, "sendMessage MessageHandler is null");
if (iSendMessageCallback != null) {
iSendMessageCallback.onError(message, IRongCoreEnum.CoreErrorCode.PARAMETER_ERROR.getValue());
return;
}
return;
}
messageHandler.encodeMessage(message);
byte[] encode = message.getContent().encode();
if (iSendMessageCallback != null) {
iSendMessageCallback.onAttached(message);
}
boolean z2 = message.getContent().getMentionedInfo() != null;
boolean isVoIPPush = sendMessageOption != null ? sendMessageOption.isVoIPPush() : false;
if (message.getMessageId() > 0) {
this.nativeObj.SetMessageContent(message.getMessageId(), encode, "");
}
internalSendMessage(message, str, str2, strArr, iSendMessageCallback, messageTag, encode, i, z2, isVoIPPush, z, isCanIncludeExpansion, hashMapToJson);
}
public void removeMessageAllExpansion(String str, final OperationCallback operationCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
final Message messageByUid = getMessageByUid(str);
if (messageByUid != null && messageByUid.isCanIncludeExpansion()) {
sendMessageOption(Message.obtain(messageByUid.getTargetId(), messageByUid.getConversationType(), messageByUid.getChannelId(), MessageExpansionMessage.obtain(str, true)), null, null, null, null, new ISendMessageCallback<Message>() {
@Override
public void onAttached(Message message) {
}
@Override
public void onSuccess(Message message) {
NativeClient.this.removeKeysInExpansionEx(-1L, false, new ArrayList(), messageByUid, operationCallback);
}
@Override
public void onError(Message message, int i) {
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
operationCallback2.onError(i);
}
}
});
} else if (operationCallback != null) {
operationCallback.onError(IRongCoreEnum.CoreErrorCode.RC_MESSAGE_CANT_EXPAND.getValue());
}
}
public void removeKeysInExpansionEx(long j, boolean z, List<String> list, Message message, OperationCallback operationCallback) {
List<Object> removeKeysTSInExpansionEx;
NativeObject.Message GetMessageByUId = this.nativeObj.GetMessageByUId(message.getUId());
if (j == -1) {
removeKeysTSInExpansionEx = JSONUtils.removeKeysInExpansionEx(list, JSONUtils.jsonToExpansionEx(GetMessageByUId.getExtMsg()));
} else {
removeKeysTSInExpansionEx = JSONUtils.removeKeysTSInExpansionEx(j, list, JSONUtils.jsonToExpansionEx(GetMessageByUId.getExtMsg()));
}
List<String> list2 = (List) removeKeysTSInExpansionEx.get(1);
String exMapToJson = JSONUtils.exMapToJson((HashMap) removeKeysTSInExpansionEx.get(0));
boolean messageExpansion = setMessageExpansion(message.getTargetId(), message.getConversationType().getValue(), message.getChannelId(), message.getUId(), exMapToJson);
if (operationCallback != null) {
if (messageExpansion) {
operationCallback.onSuccess();
} else {
operationCallback.onError(IRongCoreEnum.CoreErrorCode.RC_MESSAGE_EXPAND_FAIL.getValue());
}
}
if (messageExpansionListener == null || list2.size() == 0 || !z) {
return;
}
try {
message.setExpansion(JSONUtils.expansionExJSONToMap(exMapToJson));
messageExpansionListener.onMessageExpansionRemove(list2, message);
} catch (RemoteException e) {
io.rong.common.rlog.RLog.e(TAG, e.toString());
}
}
public void removeMessageExpansion(final List<String> list, String str, final OperationCallback operationCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
final Message messageByUid = getMessageByUid(str);
if (messageByUid != null && messageByUid.isCanIncludeExpansion()) {
sendMessageOption(Message.obtain(messageByUid.getTargetId(), messageByUid.getConversationType(), messageByUid.getChannelId(), MessageExpansionMessage.obtain(str, list)), null, null, null, null, new ISendMessageCallback<Message>() {
@Override
public void onAttached(Message message) {
}
@Override
public void onSuccess(Message message) {
NativeClient.this.removeKeysInExpansionEx(-1L, false, list, messageByUid, operationCallback);
}
@Override
public void onError(Message message, int i) {
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
operationCallback2.onError(i);
}
}
});
} else if (operationCallback != null) {
operationCallback.onError(IRongCoreEnum.CoreErrorCode.RC_MESSAGE_CANT_EXPAND.getValue());
}
}
public void handleExpansionMsg(Message message) {
MessageExpansionMessage messageExpansionMessage = (MessageExpansionMessage) message.getContent();
String originalMsgUId = messageExpansionMessage.getOriginalMsgUId();
Message messageByUid = getMessageByUid(originalMsgUId);
if (messageByUid == null) {
io.rong.common.rlog.RLog.e(TAG, "handleMessageExpansionMsg originMsg is null");
return;
}
NativeObject.Message GetMessageByUId = this.nativeObj.GetMessageByUId(originalMsgUId);
Map<String, String> updateExpansion = messageExpansionMessage.getUpdateExpansion();
List<String> removeExpansionKeyList = messageExpansionMessage.getRemoveExpansionKeyList();
boolean isRemoveAllKeys = messageExpansionMessage.isRemoveAllKeys();
long timeDisposal = timeDisposal(message);
if (isRemoveAllKeys) {
removeKeysInExpansionEx(timeDisposal, true, new ArrayList(), messageByUid, null);
} else if (updateExpansion != null) {
MessageExpansionHandle invoke = new MessageExpansionHandle(GetMessageByUId, updateExpansion, timeDisposal).invoke();
String extMsgExpansion = invoke.getExtMsgExpansion();
String updateStr = invoke.getUpdateStr();
boolean messageExpansion = setMessageExpansion(messageByUid.getTargetId(), messageByUid.getConversationType().getValue(), messageByUid.getChannelId(), originalMsgUId, extMsgExpansion);
if (messageExpansionListener != null) {
try {
JSONObject jSONObject = new JSONObject(updateStr);
if (messageExpansion) {
messageByUid.setExpansion(JSONUtils.expansionExJSONToMap(extMsgExpansion));
if (TextUtils.isEmpty(updateStr) || jSONObject.length() == 0) {
return;
}
messageExpansionListener.onMessageExpansionUpdate(JSONUtils.expansionExJSONToMap(updateStr), messageByUid);
}
} catch (RemoteException | JSONException e) {
io.rong.common.rlog.RLog.e(TAG, e.toString());
}
}
} else {
removeKeysInExpansionEx(timeDisposal, true, removeExpansionKeyList, messageByUid, null);
}
}
public void SetRTCHeartbeatListener(NativeObject.RTCHeartbeatListener rTCHeartbeatListener) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
nativeObject.SetRTCHeartbeatListener(rTCHeartbeatListener);
}
public void SendRTCHeartbeat(String[] strArr) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
nativeObject.SendRTCHeartbeat(strArr);
}
public void SendRTCLiveInvitation(final String str, String str2, String str3, String str4, String str5, int i, final OperationCallback operationCallback) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
nativeObject.SendRTCLiveInvitation(str, str2, str3, str4, str5, i, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i2, String str6, long j) {
if (i2 == 0) {
FwLog.write(3, 2, "P-RTCSetUserResource-R", "roomId|code", str, Integer.valueOf(i2));
} else {
FwLog.write(1, 2, "P-RTCSetUserResource-E", "roomId|code", str, Integer.valueOf(i2));
}
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
if (i2 == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i2);
}
}
}
});
}
public void CancelRTCLiveInvitation(final String str, String str2, String str3, String str4, String str5, final OperationCallback operationCallback) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
nativeObject.CancelRTCLiveInvitation(str, str2, str3, str4, str5, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i, String str6, long j) {
if (i == 0) {
FwLog.write(3, 2, "P-RTCSetUserResource-R", "roomId|code", str, Integer.valueOf(i));
} else {
FwLog.write(1, 2, "P-RTCSetUserResource-E", "roomId|code", str, Integer.valueOf(i));
}
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
if (i == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i);
}
}
}
});
}
public void AnswerRTCLiveInvitation(final String str, int i, String str2, String str3, String str4, String str5, String str6, String str7, final OperationCallback operationCallback) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
nativeObject.AnswerRTCLiveInvitation(str, i, str2, str3, str4, str5, str6, str7, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i2, String str8, long j) {
if (i2 == 0) {
FwLog.write(3, 2, "P-RTCSetUserResource-R", "roomId|code", str, Integer.valueOf(i2));
} else {
FwLog.write(1, 2, "P-RTCSetUserResource-E", "roomId|code", str, Integer.valueOf(i2));
}
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
if (i2 == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i2);
}
}
}
});
}
public void HangupRTCLiveInvitation(final String str, String str2, String str3, String str4, String[] strArr, final OperationCallback operationCallback) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
nativeObject.HangupRTCLiveInvitation(str, str2, str3, str4, strArr, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i, String str5, long j) {
if (i == 0) {
FwLog.write(3, 2, "P-RTCSetUserResource-R", "roomId|code", str, Integer.valueOf(i));
} else {
FwLog.write(1, 2, "P-RTCSetUserResource-E", "roomId|code", str, Integer.valueOf(i));
}
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
if (i == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i);
}
}
}
});
}
public void setMessageExpansionListener(IMessageExpansionListener iMessageExpansionListener) {
messageExpansionListener = iMessageExpansionListener;
}
public void setModuleReceiveMessageListener(OnReceiveMessageListener onReceiveMessageListener) {
List<OnReceiveMessageListener> list = this.receiveMessageListenerList;
if (list != null) {
list.add(onReceiveMessageListener);
}
}
public void addModules(Map<String, IMLibExtensionModuleIPC> map) {
this.extensionModuleMap.putAll(map);
}
public void onIPCProcessInit() {
ConcurrentHashMap<String, IMLibExtensionModuleIPC> concurrentHashMap = this.extensionModuleMap;
if (concurrentHashMap == null || concurrentHashMap.size() <= 0) {
return;
}
for (Map.Entry<String, IMLibExtensionModuleIPC> entry : this.extensionModuleMap.entrySet()) {
entry.getValue().onIPCProcessInit(mContext, this.nativeObj);
}
}
public Map onMethodCall(String str, String str2, Map map) {
IMLibExtensionModuleIPC iMLibExtensionModuleIPC;
ConcurrentHashMap<String, IMLibExtensionModuleIPC> concurrentHashMap = this.extensionModuleMap;
if (concurrentHashMap == null || concurrentHashMap.size() <= 0 || (iMLibExtensionModuleIPC = this.extensionModuleMap.get(str)) == null) {
return null;
}
return iMLibExtensionModuleIPC.onMethodCall(str, str2, map, this.nativeObj);
}
public boolean batchInsertMessage(List<Message> list) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient 尚未初始化!");
}
int size = list.size();
NativeObject.Message[] messageArr = new NativeObject.Message[size];
for (int i = 0; i < size; i++) {
NativeObject.Message message = new NativeObject.Message();
if (list.get(i) == null) {
messageArr[i] = message;
} else {
message.setTargetId(list.get(i).getTargetId());
Conversation.ConversationType conversationType = list.get(i).getConversationType();
if (conversationType != null) {
message.setConversationType(conversationType.getValue());
}
String objectName = list.get(i).getObjectName();
MessageTag messageTag = (MessageTag) list.get(i).getContent().getClass().getAnnotation(MessageTag.class);
if (TextUtils.isEmpty(objectName) && messageTag != null) {
objectName = messageTag.value();
}
message.setObjectName(objectName);
message.setSenderUserId(list.get(i).getSenderUserId());
MessageHandler messageHandler = getMessageHandler(objectName);
if (messageHandler != null) {
messageHandler.encodeMessage(list.get(i));
} else {
io.rong.common.rlog.RLog.e(TAG, "batchInsertMessage 该消息未注册,请调用 registerMessageType 方法注册 。");
}
MessageContent content = list.get(i).getContent();
if (content != null) {
message.setContent(content.encode());
}
message.setMessageDirection(Message.MessageDirection.RECEIVE.equals(list.get(i).getMessageDirection()));
Message.ReceivedStatus receivedStatus = list.get(i).getReceivedStatus();
if (receivedStatus != null) {
message.setReadStatus(receivedStatus.getFlag());
}
if (Message.MessageDirection.RECEIVE.equals(list.get(i).getMessageDirection()) && receivedStatus != null && !receivedStatus.isRead() && messageTag != null && messageTag.flag() == 3) {
message.setOffLine(true);
} else {
message.setOffLine(false);
}
Message.SentStatus sentStatus = list.get(i).getSentStatus();
if (sentStatus != null) {
message.setSentStatus(sentStatus.getValue());
}
message.setSentTime(list.get(i).getSentTime());
message.setExtra(list.get(i).getExtra());
messageArr[i] = message;
}
}
return this.nativeObj.SaveMessages(messageArr);
}
public void addTag(TagInfo tagInfo, final OperationCallback operationCallback) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
nativeObject.AddTag(tagInfo.getTagId(), tagInfo.getTagName(), new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i, String str, long j) {
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
if (i == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i);
}
}
}
});
}
public void removeTag(String str, final OperationCallback operationCallback) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
nativeObject.DeleteTag(str, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i, String str2, long j) {
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
if (i == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i);
}
}
}
});
}
public void updateTag(TagInfo tagInfo, final OperationCallback operationCallback) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
nativeObject.RenameTag(tagInfo.getTagId(), tagInfo.getTagName(), new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i, String str, long j) {
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
if (i == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i);
}
}
}
});
}
public List<TagInfo> getTags() {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
NativeObject.ConversationTag[] GetTags = nativeObject.GetTags();
ArrayList arrayList = new ArrayList();
if (GetTags != null && GetTags.length > 0) {
for (NativeObject.ConversationTag conversationTag : GetTags) {
TagInfo tagInfo = new TagInfo();
tagInfo.setTagId(conversationTag.getTagId());
tagInfo.setTagName(conversationTag.getTagName());
tagInfo.setCount(conversationTag.getConversationCount());
tagInfo.setTimestamp(conversationTag.getCreateTime());
arrayList.add(tagInfo);
}
}
return arrayList;
}
public List<ConversationTagInfo> getTagsFromConversation(ConversationIdentifier conversationIdentifier) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
NativeObject.ConversationTag[] GetTagsForConversation = nativeObject.GetTagsForConversation(conversationIdentifier.getTargetId(), conversationIdentifier.getType().getValue(), "");
ArrayList arrayList = new ArrayList();
if (GetTagsForConversation != null && GetTagsForConversation.length > 0) {
for (NativeObject.ConversationTag conversationTag : GetTagsForConversation) {
ConversationTagInfo conversationTagInfo = new ConversationTagInfo();
TagInfo tagInfo = new TagInfo();
tagInfo.setTagId(conversationTag.getTagId());
tagInfo.setTagName(conversationTag.getTagName());
tagInfo.setCount(conversationTag.getConversationCount());
tagInfo.setTimestamp(conversationTag.getCreateTime());
conversationTagInfo.setTagInfo(tagInfo);
conversationTagInfo.setTop(conversationTag.isToTop());
arrayList.add(conversationTagInfo);
}
}
return arrayList;
}
public boolean getConversationTopStatusInTag(ConversationIdentifier conversationIdentifier, String str) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
NativeObject.ConversationTag GetTagForConversation = nativeObject.GetTagForConversation(str, conversationIdentifier.getTargetId(), conversationIdentifier.getType().getValue(), "");
return GetTagForConversation != null && GetTagForConversation.isToTop();
}
public void addConversationsToTag(String str, List<ConversationIdentifier> list, final OperationCallback operationCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
NativeObject.Conversation[] conversationArr = new NativeObject.Conversation[list.size()];
for (int i = 0; i < list.size(); i++) {
NativeObject.Conversation conversation = new NativeObject.Conversation();
Conversation.ConversationType type = list.get(i).getType();
if (type != null) {
conversation.setConversationType(type.getValue());
} else {
conversation.setConversationType(Conversation.ConversationType.PRIVATE.getValue());
}
conversation.setTargetId(list.get(i).getTargetId());
conversationArr[i] = conversation;
}
this.nativeObj.AddConversationsForTag(str, conversationArr, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i2, String str2, long j) {
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
if (i2 == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i2);
}
}
}
});
}
public void removeConversationsFromTag(String str, List<ConversationIdentifier> list, final OperationCallback operationCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
NativeObject.Conversation[] conversationArr = new NativeObject.Conversation[list.size()];
for (int i = 0; i < list.size(); i++) {
NativeObject.Conversation conversation = new NativeObject.Conversation();
Conversation.ConversationType type = list.get(i).getType();
if (type != null) {
conversation.setConversationType(type.getValue());
} else {
conversation.setConversationType(Conversation.ConversationType.PRIVATE.getValue());
}
conversation.setTargetId(list.get(i).getTargetId());
conversationArr[i] = conversation;
}
this.nativeObj.RemoveConversationsForTag(str, conversationArr, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i2, String str2, long j) {
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
if (i2 == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i2);
}
}
}
});
}
public void removeTagsFromConversation(ConversationIdentifier conversationIdentifier, List<String> list, final OperationCallback operationCallback) {
if (this.nativeObj == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
int size = list.size();
String[] strArr = new String[size];
for (int i = 0; i < size; i++) {
strArr[i] = list.get(i);
}
this.nativeObj.RemoveTagsForConversation(conversationIdentifier.getTargetId(), conversationIdentifier.getType().getValue(), "", strArr, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i2, String str, long j) {
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
if (i2 == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i2);
}
}
}
});
}
public List<Conversation> getConversationsFromTagByPage(String str, long j, int i) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
NativeObject.Conversation[] GetConversationsForTagByPage = nativeObject.GetConversationsForTagByPage(str, j, i, "");
ArrayList arrayList = new ArrayList();
if (GetConversationsForTagByPage != null && GetConversationsForTagByPage.length > 0) {
for (NativeObject.Conversation conversation : GetConversationsForTagByPage) {
arrayList.add(renderConversationFromNative(conversation));
}
}
return arrayList;
}
public int getUnreadCountByTag(String str, boolean z) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
return nativeObject.GetConversationUnreadCountForTag(str, z);
}
public void setConversationToTopInTag(String str, ConversationIdentifier conversationIdentifier, String str2, boolean z, final OperationCallback operationCallback) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
nativeObject.SetConversationToTopForTag(str, conversationIdentifier.getTargetId(), conversationIdentifier.getType().getValue(), "", z, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i, String str3, long j) {
OperationCallback operationCallback2 = operationCallback;
if (operationCallback2 != null) {
if (i == 0) {
operationCallback2.onSuccess();
} else {
operationCallback2.onError(i);
}
}
}
});
}
public int getCachedReadReceiptVersion() {
return NavigationCacheHelper.getCachedReadReceiptVersion(mContext);
}
public void sendReadReceiptMessage(String str, String str2, String[] strArr, final ISendReadReceiptMessageCallback iSendReadReceiptMessageCallback) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
nativeObject.SendReadReceiptMessage(str, str2, strArr, new NativeObject.PublishAckListener() {
@Override
public void operationComplete(int i, String str3, long j) {
ISendReadReceiptMessageCallback iSendReadReceiptMessageCallback2 = iSendReadReceiptMessageCallback;
if (iSendReadReceiptMessageCallback2 != null) {
try {
if (i == 0) {
iSendReadReceiptMessageCallback2.onSuccess(str3, j);
} else {
iSendReadReceiptMessageCallback2.onError(i);
}
} catch (RemoteException e) {
io.rong.common.rlog.RLog.e(NativeClient.TAG, "sendReadReceiptMessage RemoteException", e);
}
}
}
});
}
public void getMessageReadUserList(String str, String str2, String str3, final IResultCallbackEx<Integer, NativeObject.UserInfo[]> iResultCallbackEx) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
nativeObject.GetMessageReader(str, str2, str3, new NativeObject.ChatroomInfoListener() {
@Override
public void OnSuccess(int i, NativeObject.UserInfo[] userInfoArr) {
IResultCallbackEx iResultCallbackEx2 = iResultCallbackEx;
if (iResultCallbackEx2 != null) {
iResultCallbackEx2.onSuccess(Integer.valueOf(i), userInfoArr);
}
}
@Override
public void OnError(int i) {
IResultCallbackEx iResultCallbackEx2 = iResultCallbackEx;
if (iResultCallbackEx2 != null) {
iResultCallbackEx2.onError(i);
}
}
});
}
public void updateSDKVersion(String str) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
nativeObject.UploadSDKVersion(str);
}
public void RTCSignaling(String str, String str2, boolean z, byte[] bArr, final IResultCallback<byte[]> iResultCallback) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
nativeObject.RTCSignaling(str, str2, z, bArr, new NativeObject.RTCSignalingCallback() {
@Override
public void OnSuccess(byte[] bArr2) {
IResultCallback iResultCallback2 = iResultCallback;
if (iResultCallback2 != null) {
iResultCallback2.onSuccess(bArr2);
}
}
@Override
public void OnError(int i) {
IResultCallback iResultCallback2 = iResultCallback;
if (iResultCallback2 != null) {
iResultCallback2.onError(i);
}
}
});
}
public void SetRTCRoomEventListener(NativeObject.RTCRoomEventListener rTCRoomEventListener) {
NativeObject nativeObject = this.nativeObj;
if (nativeObject == null) {
throw new RuntimeException("NativeClient has not been initialized yet!");
}
nativeObject.SetRTCRoomEventListener(rTCRoomEventListener);
}
private void detectNaviIfNeedByMesssage(Context context, final int i) {
if (IRongCoreEnum.CoreErrorCode.REJECTED_BY_BLACKLIST.getValue() == i || IRongCoreEnum.CoreErrorCode.MSG_SEND_OVERFREQUENCY.getValue() == i || IRongCoreEnum.CoreErrorCode.RC_REQUEST_OVERFREQUENCY.getValue() == i || IRongCoreEnum.CoreErrorCode.NOT_IN_GROUP.getValue() == i || IRongCoreEnum.CoreErrorCode.FORBIDDEN_IN_GROUP.getValue() == i || IRongCoreEnum.CoreErrorCode.NOT_IN_CHATROOM.getValue() == i || IRongCoreEnum.CoreErrorCode.FORBIDDEN_IN_CHATROOM.getValue() == i || IRongCoreEnum.CoreErrorCode.KICKED_FROM_CHATROOM.getValue() == i || IRongCoreEnum.CoreErrorCode.RC_CHATROOM_NOT_EXIST.getValue() == i || IRongCoreEnum.CoreErrorCode.PARAMETER_ERROR.getValue() == i || IRongCoreEnum.CoreErrorCode.RC_SIGHT_MSG_DURATION_LIMIT_EXCEED.getValue() == i || IRongCoreEnum.CoreErrorCode.RC_GIF_MSG_SIZE_LIMIT_EXCEED.getValue() == i || IRongCoreEnum.CoreErrorCode.RC_MESSAGE_CANT_EXPAND.getValue() == i || IRongCoreEnum.CoreErrorCode.RC_MESSAGE_EXPAND_FAIL.getValue() == i || IRongCoreEnum.CoreErrorCode.RC_MSG_BLOCKED_SENSITIVE_WORD.getValue() == i || IRongCoreEnum.CoreErrorCode.RC_MSG_EXPANSION_SIZE_LIMIT_EXCEED.getValue() == i || IRongCoreEnum.CoreErrorCode.RC_MSG_REPLACED_SENSITIVE_WORD.getValue() == i || IRongCoreEnum.CoreErrorCode.RC_FILE_UPLOAD_FAILED.getValue() == i) {
return;
}
NetDetection.detectNavi(context, true, new NetDetection.DetectionCallback() {
@Override
public void onError() {
}
@Override
public void onSuccess(String str, String str2, String str3) {
FwLog.write(1, 1, FwLog.LogTag.L_DETECT_MSG_S.getTag(), "code|navi|ip|net", Integer.valueOf(i), str, str2, str3);
}
});
}
public IPCMessageInterceptor getMessageInterceptor() {
return this.messageInterceptor;
}
public void setMessageInterceptor(IPCMessageInterceptor iPCMessageInterceptor) {
this.messageInterceptor = iPCMessageInterceptor;
NativeObject nativeObject = this.nativeObj;
if (nativeObject != null) {
nativeObject.RegisterEncryptMessage(iPCMessageInterceptor != null);
}
}
public void setHttpDownloadInterceptor(MediaDownloadEngine.HttpDownloadInterceptor httpDownloadInterceptor) {
MediaDownloadEngine.getInstance().setInterceptor(httpDownloadInterceptor);
}
public enum BlacklistStatus {
EXIT_BLACK_LIST(0),
NOT_EXIT_BLACK_LIST(1);
private int value;
BlacklistStatus(int i) {
this.value = i;
}
public int getValue() {
return this.value;
}
public static BlacklistStatus setValue(int i) {
BlacklistStatus[] values;
for (BlacklistStatus blacklistStatus : values()) {
if (i == blacklistStatus.getValue()) {
return blacklistStatus;
}
}
return NOT_EXIT_BLACK_LIST;
}
}
public static class NativeClientHolder {
private static final NativeClient client = new NativeClient();
private NativeClientHolder() {
}
}
public static class MessageExpansionHandle {
private String extMsgExpansion;
private final NativeObject.Message nativeMsg;
private final long ts;
private final Map<String, String> updateExpansion;
private String updateStr;
MessageExpansionHandle(NativeObject.Message message, Map<String, String> map, long j) {
this.nativeMsg = message;
this.updateExpansion = map;
this.ts = j;
}
String getExtMsgExpansion() {
return this.extMsgExpansion;
}
String getUpdateStr() {
return this.updateStr;
}
MessageExpansionHandle invoke() {
List<String> mergeJson = JSONUtils.mergeJson(JSONUtils.mapTsCombineJson(this.updateExpansion, this.ts), this.nativeMsg.getExtMsg());
if (mergeJson != null && mergeJson.size() != 0) {
this.extMsgExpansion = mergeJson.get(0);
this.updateStr = mergeJson.get(1);
} else {
this.extMsgExpansion = "";
this.updateStr = "";
}
return this;
}
}
}