mirror of
https://github.com/WuKongIM/WuKongIMAndroidSDK
synced 2025-06-07 01:58:29 +00:00
fix:update message content model
This commit is contained in:
parent
deaf7fbbc8
commit
564727d44f
@ -3,13 +3,11 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdk 33
|
compileSdk 34
|
||||||
buildToolsVersion '33.0.2'
|
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.xinbida.wukongdemo"
|
applicationId "com.xinbida.wukongdemo"
|
||||||
minSdkVersion 19
|
minSdkVersion 21
|
||||||
targetSdkVersion 33
|
targetSdkVersion 34
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
@ -31,13 +29,11 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':wkim')
|
implementation project(':wkim')
|
||||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
implementation 'androidx.appcompat:appcompat:1.7.0'
|
||||||
implementation 'com.google.android.material:material:1.1.0'
|
implementation 'com.google.android.material:material:1.12.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||||
implementation 'org.jetbrains:annotations:15.0'
|
implementation 'org.jetbrains:annotations:23.0.0'
|
||||||
testImplementation 'junit:junit:4.+'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
|
||||||
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.7'
|
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.7'
|
||||||
implementation 'com.github.li-xiaojun:XPopup:2.9.19'
|
implementation 'com.github.li-xiaojun:XPopup:2.9.19'
|
||||||
implementation 'com.github.bigdongdong:ChatView:2.0' //添加依赖
|
implementation 'com.github.bigdongdong:ChatView:2.0' //添加依赖
|
||||||
|
@ -3,7 +3,6 @@ package com.xinbida.wukongdemo;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -16,6 +15,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
|
|
||||||
import com.lxj.xpopup.XPopup;
|
import com.lxj.xpopup.XPopup;
|
||||||
import com.xinbida.wukongim.WKIM;
|
import com.xinbida.wukongim.WKIM;
|
||||||
|
import com.xinbida.wukongim.entity.WKChannel;
|
||||||
import com.xinbida.wukongim.entity.WKChannelType;
|
import com.xinbida.wukongim.entity.WKChannelType;
|
||||||
import com.xinbida.wukongim.entity.WKMsg;
|
import com.xinbida.wukongim.entity.WKMsg;
|
||||||
import com.xinbida.wukongim.message.type.WKConnectStatus;
|
import com.xinbida.wukongim.message.type.WKConnectStatus;
|
||||||
@ -72,7 +72,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WKIM.getInstance().getMsgManager().sendMessage(new WKTextContent(content), channelID, channelType);
|
WKIM.getInstance().getMsgManager().send(new WKTextContent(content), new WKChannel(channelID,channelType));
|
||||||
contentEt.setText("");
|
contentEt.setText("");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -9,10 +9,10 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="30dp"
|
android:layout_marginTop="30dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textStyle="bold"
|
|
||||||
android:text="悟空IM登录"
|
android:text="悟空IM登录"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="28sp" />
|
android:textSize="28sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/descTv"
|
android:id="@+id/descTv"
|
||||||
@ -22,7 +22,7 @@
|
|||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_marginEnd="30dp"
|
android:layout_marginEnd="30dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="悟空IM演示程序。当前SDK版本:V1.0.0"
|
android:text="悟空IM演示程序。当前SDK版本:"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="18sp" />
|
android:textSize="18sp" />
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ buildscript {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:8.4.1'
|
classpath 'com.android.tools.build:gradle:8.5.2'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -23,10 +23,10 @@ afterEvaluate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdk 33
|
compileSdk 34
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 19
|
minSdkVersion 21
|
||||||
targetSdkVersion 33
|
targetSdkVersion 34
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
consumerProguardFiles "consumer-rules.pro"
|
consumerProguardFiles "consumer-rules.pro"
|
||||||
|
@ -13,13 +13,12 @@ import com.xinbida.wukongim.manager.ReminderManager;
|
|||||||
import com.xinbida.wukongim.manager.RobotManager;
|
import com.xinbida.wukongim.manager.RobotManager;
|
||||||
import com.xinbida.wukongim.message.MessageHandler;
|
import com.xinbida.wukongim.message.MessageHandler;
|
||||||
import com.xinbida.wukongim.utils.CryptoUtils;
|
import com.xinbida.wukongim.utils.CryptoUtils;
|
||||||
import com.xinbida.wukongim.utils.WKLoggerUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 5/20/21 5:25 PM
|
* 5/20/21 5:25 PM
|
||||||
*/
|
*/
|
||||||
public class WKIM {
|
public class WKIM {
|
||||||
private final String Version = "V1.1.7";
|
private final String Version = "V1.1.9";
|
||||||
|
|
||||||
private WKIM() {
|
private WKIM() {
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@ import java.util.UUID;
|
|||||||
public class WKIMApplication {
|
public class WKIMApplication {
|
||||||
private final String sharedName = "wk_account_config";
|
private final String sharedName = "wk_account_config";
|
||||||
//协议版本
|
//协议版本
|
||||||
public final byte defaultProtocolVersion = 4;
|
|
||||||
public byte protocolVersion = 4;
|
public byte protocolVersion = 4;
|
||||||
|
|
||||||
private WKIMApplication() {
|
private WKIMApplication() {
|
||||||
@ -208,38 +207,6 @@ public class WKIMApplication {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
//
|
|
||||||
// ConnectivityManager connectivity = (ConnectivityManager) mContext.get().getSystemService(Context.CONNECTIVITY_SERVICE);
|
|
||||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
||||||
// if (connectivity != null) {
|
|
||||||
// Network networks = connectivity.getActiveNetwork();
|
|
||||||
// NetworkCapabilities networkCapabilities = connectivity.getNetworkCapabilities(networks);
|
|
||||||
// if (networkCapabilities != null) {
|
|
||||||
// if (networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) {
|
|
||||||
// success = true;
|
|
||||||
// } else if (networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR)) {
|
|
||||||
// success = true;
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// success = false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// } else {
|
|
||||||
// NetworkInfo.State state = connectivity.getNetworkInfo(
|
|
||||||
// ConnectivityManager.TYPE_WIFI).getState(); // 获取网络连接状态
|
|
||||||
// if (NetworkInfo.State.CONNECTED == state) {
|
|
||||||
// // 判断是否正在使用WIFI网络
|
|
||||||
// success = true;
|
|
||||||
// } else {
|
|
||||||
// state = connectivity.getNetworkInfo(
|
|
||||||
// ConnectivityManager.TYPE_MOBILE).getState(); // 获取网络连接状态
|
|
||||||
// if (NetworkInfo.State.CONNECTED == state) { // 判断是否正在使用GPRS网络
|
|
||||||
// success = true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFileCacheDir(String fileDir) {
|
public void setFileCacheDir(String fileDir) {
|
||||||
|
@ -34,6 +34,29 @@ public class ChannelDBManager {
|
|||||||
return ChannelDBManagerBinder.channelDBManager;
|
return ChannelDBManagerBinder.channelDBManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<WKChannel> queryWithChannelIds(List<String> channelIDs) {
|
||||||
|
List<WKChannel> list = new ArrayList<>();
|
||||||
|
if (WKIMApplication
|
||||||
|
.getInstance()
|
||||||
|
.getDbHelper() == null) {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
try (Cursor cursor = WKIMApplication
|
||||||
|
.getInstance()
|
||||||
|
.getDbHelper()
|
||||||
|
.select(channel, "channel_id in (" + WKCursor.getPlaceholders(channelIDs.size()) + ")", channelIDs.toArray(new String[0]), null)) {
|
||||||
|
if (cursor == null) {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
|
||||||
|
WKChannel channel = serializableChannel(cursor);
|
||||||
|
list.add(channel);
|
||||||
|
}
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
public List<WKChannel> queryWithChannelIdsAndChannelType(List<String> channelIDs, byte channelType) {
|
public List<WKChannel> queryWithChannelIdsAndChannelType(List<String> channelIDs, byte channelType) {
|
||||||
List<WKChannel> list = new ArrayList<>();
|
List<WKChannel> list = new ArrayList<>();
|
||||||
if (WKIMApplication
|
if (WKIMApplication
|
||||||
|
@ -16,6 +16,7 @@ import com.xinbida.wukongim.entity.WKChannelType;
|
|||||||
import com.xinbida.wukongim.entity.WKConversationMsg;
|
import com.xinbida.wukongim.entity.WKConversationMsg;
|
||||||
import com.xinbida.wukongim.entity.WKConversationMsgExtra;
|
import com.xinbida.wukongim.entity.WKConversationMsgExtra;
|
||||||
import com.xinbida.wukongim.entity.WKMsg;
|
import com.xinbida.wukongim.entity.WKMsg;
|
||||||
|
import com.xinbida.wukongim.entity.WKMsgExtra;
|
||||||
import com.xinbida.wukongim.entity.WKUIConversationMsg;
|
import com.xinbida.wukongim.entity.WKUIConversationMsg;
|
||||||
import com.xinbida.wukongim.manager.ConversationManager;
|
import com.xinbida.wukongim.manager.ConversationManager;
|
||||||
import com.xinbida.wukongim.utils.WKCommonUtils;
|
import com.xinbida.wukongim.utils.WKCommonUtils;
|
||||||
@ -85,18 +86,88 @@ public class ConversationDbManager {
|
|||||||
if (cursor == null) {
|
if (cursor == null) {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
List<String> clientMsgNos = new ArrayList<>();
|
||||||
for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
|
for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
|
||||||
WKConversationMsg msg = serializeMsg(cursor);
|
WKConversationMsg msg = serializeMsg(cursor);
|
||||||
if (msg.isDeleted == 0) {
|
if (msg.isDeleted == 0) {
|
||||||
WKUIConversationMsg uiMsg = getUIMsg(msg, cursor);
|
WKUIConversationMsg uiMsg = getUIMsg(msg, cursor);
|
||||||
list.add(uiMsg);
|
list.add(uiMsg);
|
||||||
|
clientMsgNos.add(uiMsg.clientMsgNo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {
|
if (!clientMsgNos.isEmpty()) {
|
||||||
|
List<WKMsg> msgList = queryWithClientMsgNos(clientMsgNos);
|
||||||
|
List<String> msgIds = new ArrayList<>();
|
||||||
|
if (WKCommonUtils.isNotEmpty(msgList)) {
|
||||||
|
for (WKUIConversationMsg uiMsg : list) {
|
||||||
|
for (WKMsg msg : msgList) {
|
||||||
|
if (uiMsg.clientMsgNo.equals(msg.clientMsgNO)) {
|
||||||
|
uiMsg.setWkMsg(msg);
|
||||||
|
if (!TextUtils.isEmpty(msg.messageID)) {
|
||||||
|
msgIds.add(msg.messageID);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<WKMsgExtra> extraList = queryWithMsgIds(msgIds);
|
||||||
|
if (WKCommonUtils.isNotEmpty(extraList)) {
|
||||||
|
for (WKUIConversationMsg uiMsg : list) {
|
||||||
|
for (WKMsgExtra extra : extraList) {
|
||||||
|
if (uiMsg.getWkMsg() != null && !TextUtils.isEmpty(uiMsg.getWkMsg().messageID) && uiMsg.getWkMsg().messageID.equals(extra.messageID)) {
|
||||||
|
uiMsg.getWkMsg().remoteExtra = extra;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
WKLoggerUtils.getInstance().e(TAG, "queryAll error");
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<WKMsgExtra> queryWithMsgIds(List<String> msgIds) {
|
||||||
|
List<WKMsgExtra> msgExtraList = new ArrayList<>();
|
||||||
|
List<String> ids = new ArrayList<>();
|
||||||
|
for (int i = 0, size = msgIds.size(); i < size; i++) {
|
||||||
|
if (ids.size() == 200) {
|
||||||
|
List<WKMsgExtra> list = MsgDbManager.getInstance().queryMsgExtrasWithMsgIds(ids);
|
||||||
|
if (WKCommonUtils.isNotEmpty(list)) {
|
||||||
|
msgExtraList.addAll(list);
|
||||||
|
}
|
||||||
|
ids.clear();
|
||||||
|
}
|
||||||
|
ids.add(msgIds.get(i));
|
||||||
|
}
|
||||||
|
return msgExtraList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<WKMsg> queryWithClientMsgNos(List<String> clientMsgNos) {
|
||||||
|
List<WKMsg> msgList = new ArrayList<>();
|
||||||
|
List<String> nos = new ArrayList<>();
|
||||||
|
for (int i = 0, size = clientMsgNos.size(); i < size; i++) {
|
||||||
|
if (nos.size() == 200) {
|
||||||
|
List<WKMsg> list = MsgDbManager.getInstance().queryWithClientMsgNos(nos);
|
||||||
|
if (WKCommonUtils.isNotEmpty(list)) {
|
||||||
|
msgList.addAll(list);
|
||||||
|
}
|
||||||
|
nos.clear();
|
||||||
|
}
|
||||||
|
nos.add(clientMsgNos.get(i));
|
||||||
|
}
|
||||||
|
if (!nos.isEmpty()) {
|
||||||
|
List<WKMsg> list = MsgDbManager.getInstance().queryWithClientMsgNos(nos);
|
||||||
|
if (WKCommonUtils.isNotEmpty(list)) {
|
||||||
|
msgList.addAll(list);
|
||||||
|
}
|
||||||
|
nos.clear();
|
||||||
|
}
|
||||||
|
return msgList;
|
||||||
|
}
|
||||||
|
|
||||||
public List<WKUIConversationMsg> queryWithChannelIds(List<String> channelIds) {
|
public List<WKUIConversationMsg> queryWithChannelIds(List<String> channelIds) {
|
||||||
String sql = "select " + conversation + ".*," + channelCols + "," + extraCols + " from " + conversation + " left join " + channel + " on " + conversation + ".channel_id=" + channel + ".channel_id and " + conversation + ".channel_type=" + channel + ".channel_type left join " + conversationExtra + " on " + conversation + ".channel_id=" + conversationExtra + ".channel_id and " + conversation + ".channel_type=" + conversationExtra + ".channel_type where " + conversation + ".is_deleted=0 and " + conversation + ".channel_id in (" + WKCursor.getPlaceholders(channelIds.size()) + ")";
|
String sql = "select " + conversation + ".*," + channelCols + "," + extraCols + " from " + conversation + " left join " + channel + " on " + conversation + ".channel_id=" + channel + ".channel_id and " + conversation + ".channel_type=" + channel + ".channel_type left join " + conversationExtra + " on " + conversation + ".channel_id=" + conversationExtra + ".channel_id and " + conversation + ".channel_type=" + conversationExtra + ".channel_type where " + conversation + ".is_deleted=0 and " + conversation + ".channel_id in (" + WKCursor.getPlaceholders(channelIds.size()) + ")";
|
||||||
List<WKUIConversationMsg> list = new ArrayList<>();
|
List<WKUIConversationMsg> list = new ArrayList<>();
|
||||||
|
@ -21,9 +21,12 @@ import com.xinbida.wukongim.entity.WKMsg;
|
|||||||
import com.xinbida.wukongim.entity.WKMsgExtra;
|
import com.xinbida.wukongim.entity.WKMsgExtra;
|
||||||
import com.xinbida.wukongim.entity.WKMsgReaction;
|
import com.xinbida.wukongim.entity.WKMsgReaction;
|
||||||
import com.xinbida.wukongim.entity.WKMsgSetting;
|
import com.xinbida.wukongim.entity.WKMsgSetting;
|
||||||
|
import com.xinbida.wukongim.entity.WKSyncChannelMsg;
|
||||||
|
import com.xinbida.wukongim.entity.WKSyncRecent;
|
||||||
import com.xinbida.wukongim.interfaces.IGetOrSyncHistoryMsgBack;
|
import com.xinbida.wukongim.interfaces.IGetOrSyncHistoryMsgBack;
|
||||||
import com.xinbida.wukongim.manager.MsgManager;
|
import com.xinbida.wukongim.manager.MsgManager;
|
||||||
import com.xinbida.wukongim.message.type.WKSendMsgResult;
|
import com.xinbida.wukongim.message.type.WKSendMsgResult;
|
||||||
|
import com.xinbida.wukongim.msgmodel.WKFormatErrorContent;
|
||||||
import com.xinbida.wukongim.msgmodel.WKMessageContent;
|
import com.xinbida.wukongim.msgmodel.WKMessageContent;
|
||||||
import com.xinbida.wukongim.utils.WKCommonUtils;
|
import com.xinbida.wukongim.utils.WKCommonUtils;
|
||||||
import com.xinbida.wukongim.utils.WKLoggerUtils;
|
import com.xinbida.wukongim.utils.WKLoggerUtils;
|
||||||
@ -60,6 +63,7 @@ public class MsgDbManager {
|
|||||||
|
|
||||||
private int requestCount;
|
private int requestCount;
|
||||||
// private int more = 1;
|
// private int more = 1;
|
||||||
|
private final HashMap<String, Long> channelMinMsgSeqs = new HashMap<>();
|
||||||
|
|
||||||
public void queryOrSyncHistoryMessages(String channelId, byte channelType, long oldestOrderSeq, boolean contain, int pullMode, int limit, final IGetOrSyncHistoryMsgBack iGetOrSyncHistoryMsgBack) {
|
public void queryOrSyncHistoryMessages(String channelId, byte channelType, long oldestOrderSeq, boolean contain, int pullMode, int limit, final IGetOrSyncHistoryMsgBack iGetOrSyncHistoryMsgBack) {
|
||||||
//获取原始数据
|
//获取原始数据
|
||||||
@ -167,8 +171,16 @@ public class MsgDbManager {
|
|||||||
startMsgSeq = 0;
|
startMsgSeq = 0;
|
||||||
endMsgSeq = 0;
|
endMsgSeq = 0;
|
||||||
}
|
}
|
||||||
|
String key = channelId + "_" + channelType;
|
||||||
if (!isSyncMsg) {
|
if (!isSyncMsg) {
|
||||||
if (minMessageSeq == 1) {
|
long minSeq = 1;
|
||||||
|
if (channelMinMsgSeqs.containsKey(key)) {
|
||||||
|
Object s = channelMinMsgSeqs.get(key);
|
||||||
|
if (s != null) {
|
||||||
|
minSeq = Long.parseLong(s.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (minMessageSeq == minSeq) {
|
||||||
requestCount = 0;
|
requestCount = 0;
|
||||||
// more = 1;
|
// more = 1;
|
||||||
new Handler(Looper.getMainLooper()).post(() -> iGetOrSyncHistoryMsgBack.onResult(list));
|
new Handler(Looper.getMainLooper()).post(() -> iGetOrSyncHistoryMsgBack.onResult(list));
|
||||||
@ -202,10 +214,9 @@ public class MsgDbManager {
|
|||||||
requestCount++;
|
requestCount++;
|
||||||
MsgManager.getInstance().setSyncChannelMsgListener(channelId, channelType, startMsgSeq, endMsgSeq, limit, pullMode, syncChannelMsg -> {
|
MsgManager.getInstance().setSyncChannelMsgListener(channelId, channelType, startMsgSeq, endMsgSeq, limit, pullMode, syncChannelMsg -> {
|
||||||
if (syncChannelMsg != null) {
|
if (syncChannelMsg != null) {
|
||||||
if (oldestMsgSeq == 0) {
|
if (oldestMsgSeq == 0 || (syncChannelMsg.messages != null && syncChannelMsg.messages.size() < limit)) {
|
||||||
requestCount = 5;
|
requestCount = 5;
|
||||||
}
|
}
|
||||||
// more = syncChannelMsg.more;
|
|
||||||
queryOrSyncHistoryMessages(channelId, channelType, oldestOrderSeq, contain, pullMode, limit, iGetOrSyncHistoryMsgBack);
|
queryOrSyncHistoryMessages(channelId, channelType, oldestOrderSeq, contain, pullMode, limit, iGetOrSyncHistoryMsgBack);
|
||||||
} else {
|
} else {
|
||||||
requestCount = 0;
|
requestCount = 0;
|
||||||
@ -218,7 +229,30 @@ public class MsgDbManager {
|
|||||||
// more = 1;
|
// more = 1;
|
||||||
new Handler(Looper.getMainLooper()).post(() -> iGetOrSyncHistoryMsgBack.onResult(list));
|
new Handler(Looper.getMainLooper()).post(() -> iGetOrSyncHistoryMsgBack.onResult(list));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private long getMinSeq(WKSyncChannelMsg syncChannelMsg, List<WKMsg> tempList) {
|
||||||
|
long minSeq = 0;
|
||||||
|
if (WKCommonUtils.isNotEmpty(syncChannelMsg.messages)) {
|
||||||
|
for (WKSyncRecent recent : syncChannelMsg.messages) {
|
||||||
|
if (minSeq == 0) {
|
||||||
|
minSeq = recent.message_seq;
|
||||||
|
} else {
|
||||||
|
minSeq = Math.min(minSeq, recent.message_seq);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (WKCommonUtils.isNotEmpty(tempList)) {
|
||||||
|
for (WKMsg msg : tempList) {
|
||||||
|
if (minSeq == 0) {
|
||||||
|
minSeq = msg.messageSeq;
|
||||||
|
} else {
|
||||||
|
minSeq = Math.min(minSeq, msg.messageSeq);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return minSeq;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<WKMsg> queryWithFlame() {
|
public List<WKMsg> queryWithFlame() {
|
||||||
@ -888,7 +922,7 @@ public class MsgDbManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<WKMsgExtra> queryMsgExtrasWithMsgIds(List<String> msgIds) {
|
public List<WKMsgExtra> queryMsgExtrasWithMsgIds(List<String> msgIds) {
|
||||||
List<WKMsgExtra> list = new ArrayList<>();
|
List<WKMsgExtra> list = new ArrayList<>();
|
||||||
try (Cursor cursor = WKIMApplication.getInstance().getDbHelper().select(messageExtra, "message_id in (" + WKCursor.getPlaceholders(msgIds.size()) + ")", msgIds.toArray(new String[0]), null)) {
|
try (Cursor cursor = WKIMApplication.getInstance().getDbHelper().select(messageExtra, "message_id in (" + WKCursor.getPlaceholders(msgIds.size()) + ")", msgIds.toArray(new String[0]), null)) {
|
||||||
if (cursor == null) {
|
if (cursor == null) {
|
||||||
@ -1638,6 +1672,7 @@ public class MsgDbManager {
|
|||||||
jsonObject = new JSONObject(msg.content);
|
jsonObject = new JSONObject(msg.content);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
WKLoggerUtils.getInstance().e(TAG, "getMsgModel error content not json format");
|
WKLoggerUtils.getInstance().e(TAG, "getMsgModel error content not json format");
|
||||||
|
return new WKFormatErrorContent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return WKIM.getInstance()
|
return WKIM.getInstance()
|
||||||
|
@ -34,6 +34,16 @@ public class ReminderDBManager {
|
|||||||
return ReminderDBManagerBinder.binder;
|
return ReminderDBManagerBinder.binder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void doneWithReminderIds(List<Long> ids) {
|
||||||
|
ContentValues cv = new ContentValues();
|
||||||
|
cv.put("done", 1);
|
||||||
|
String[] strings = new String[ids.size()];
|
||||||
|
for (int i = 0; i < ids.size(); i++) {
|
||||||
|
strings[i] = ids.get(i) + "";
|
||||||
|
}
|
||||||
|
WKIMApplication.getInstance().getDbHelper().update(reminders, cv, "reminder_id in (" + WKCursor.getPlaceholders(ids.size()) + ")", strings);
|
||||||
|
}
|
||||||
|
|
||||||
public long queryMaxVersion() {
|
public long queryMaxVersion() {
|
||||||
String sql = "select * from " + reminders + " order by version desc limit 1";
|
String sql = "select * from " + reminders + " order by version desc limit 1";
|
||||||
long version = 0;
|
long version = 0;
|
||||||
|
@ -233,7 +233,7 @@ class WKSqlContentValues {
|
|||||||
cv.put("keep_message_seq", extra.keepMessageSeq);
|
cv.put("keep_message_seq", extra.keepMessageSeq);
|
||||||
cv.put("keep_offset_y", extra.keepOffsetY);
|
cv.put("keep_offset_y", extra.keepOffsetY);
|
||||||
cv.put("draft", extra.draft);
|
cv.put("draft", extra.draft);
|
||||||
cv.put("draft_updated_at", extra.version);
|
cv.put("draft_updated_at", extra.draftUpdatedAt);
|
||||||
cv.put("version", extra.version);
|
cv.put("version", extra.version);
|
||||||
return cv;
|
return cv;
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,7 @@ public class WKMsg implements Parcelable {
|
|||||||
public int viewed;
|
public int viewed;
|
||||||
// 查看时间戳
|
// 查看时间戳
|
||||||
public long viewedAt;
|
public long viewedAt;
|
||||||
|
public String robotID;
|
||||||
// 话题ID
|
// 话题ID
|
||||||
public String topicID;
|
public String topicID;
|
||||||
//消息设置
|
//消息设置
|
||||||
@ -97,6 +98,7 @@ public class WKMsg implements Parcelable {
|
|||||||
this.expireTimestamp = 0;
|
this.expireTimestamp = 0;
|
||||||
status = WKSendMsgResult.send_loading;
|
status = WKSendMsgResult.send_loading;
|
||||||
clientMsgNO = WKIM.getInstance().getMsgManager().createClientMsgNO();
|
clientMsgNO = WKIM.getInstance().getMsgManager().createClientMsgNO();
|
||||||
|
setting=new WKMsgSetting();
|
||||||
header = new WKMsgHeader();
|
header = new WKMsgHeader();
|
||||||
remoteExtra = new WKMsgExtra();
|
remoteExtra = new WKMsgExtra();
|
||||||
}
|
}
|
||||||
@ -138,6 +140,7 @@ public class WKMsg implements Parcelable {
|
|||||||
topicID = in.readString();
|
topicID = in.readString();
|
||||||
expireTime = in.readInt();
|
expireTime = in.readInt();
|
||||||
expireTimestamp = in.readLong();
|
expireTimestamp = in.readLong();
|
||||||
|
robotID = in.readString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Creator<WKMsg> CREATOR = new Creator<WKMsg>() {
|
public static final Creator<WKMsg> CREATOR = new Creator<WKMsg>() {
|
||||||
@ -192,6 +195,7 @@ public class WKMsg implements Parcelable {
|
|||||||
dest.writeString(topicID);
|
dest.writeString(topicID);
|
||||||
dest.writeInt(expireTime);
|
dest.writeInt(expireTime);
|
||||||
dest.writeLong(expireTimestamp);
|
dest.writeLong(expireTimestamp);
|
||||||
|
dest.writeString(robotID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLocalMapExtraString() {
|
public String getLocalMapExtraString() {
|
||||||
|
@ -4,7 +4,7 @@ import android.os.Parcel;
|
|||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
public class WKMsgHeader implements Parcelable {
|
public class WKMsgHeader implements Parcelable {
|
||||||
//是否持久化[是否保存在数据库]
|
//是否持久化[是否不保存在数据库]
|
||||||
public boolean noPersist;
|
public boolean noPersist;
|
||||||
//对方是否显示红点
|
//对方是否显示红点
|
||||||
public boolean redDot = true;
|
public boolean redDot = true;
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.xinbida.wukongim.entity;
|
||||||
|
|
||||||
|
public class WKSendOptions {
|
||||||
|
public int expire = 0;
|
||||||
|
public String topicID;
|
||||||
|
public int flame;
|
||||||
|
public int flameSecond;
|
||||||
|
public String robotID;
|
||||||
|
public WKMsgSetting setting = new WKMsgSetting();
|
||||||
|
public WKMsgHeader header = new WKMsgHeader();
|
||||||
|
}
|
@ -271,6 +271,10 @@ public class ChannelManager extends BaseManager {
|
|||||||
return ChannelDBManager.getInstance().queryWithChannelIdsAndChannelType(channelIds, channelType);
|
return ChannelDBManager.getInstance().queryWithChannelIdsAndChannelType(channelIds, channelType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<WKChannel> getChannels(List<String> channelIds) {
|
||||||
|
return ChannelDBManager.getInstance().queryWithChannelIds(channelIds);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 搜索频道
|
* 搜索频道
|
||||||
*
|
*
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package com.xinbida.wukongim.manager;
|
package com.xinbida.wukongim.manager;
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.xinbida.wukongim.WKIM;
|
import com.xinbida.wukongim.WKIM;
|
||||||
import com.xinbida.wukongim.WKIMApplication;
|
import com.xinbida.wukongim.WKIMApplication;
|
||||||
@ -17,6 +20,7 @@ import com.xinbida.wukongim.entity.WKMsg;
|
|||||||
import com.xinbida.wukongim.entity.WKMsgExtra;
|
import com.xinbida.wukongim.entity.WKMsgExtra;
|
||||||
import com.xinbida.wukongim.entity.WKMsgReaction;
|
import com.xinbida.wukongim.entity.WKMsgReaction;
|
||||||
import com.xinbida.wukongim.entity.WKMsgSetting;
|
import com.xinbida.wukongim.entity.WKMsgSetting;
|
||||||
|
import com.xinbida.wukongim.entity.WKSendOptions;
|
||||||
import com.xinbida.wukongim.entity.WKSyncExtraMsg;
|
import com.xinbida.wukongim.entity.WKSyncExtraMsg;
|
||||||
import com.xinbida.wukongim.entity.WKSyncMsg;
|
import com.xinbida.wukongim.entity.WKSyncMsg;
|
||||||
import com.xinbida.wukongim.entity.WKSyncMsgReaction;
|
import com.xinbida.wukongim.entity.WKSyncMsgReaction;
|
||||||
@ -39,13 +43,16 @@ import com.xinbida.wukongim.interfaces.IUploadAttachmentListener;
|
|||||||
import com.xinbida.wukongim.interfaces.IUploadMsgExtraListener;
|
import com.xinbida.wukongim.interfaces.IUploadMsgExtraListener;
|
||||||
import com.xinbida.wukongim.message.MessageHandler;
|
import com.xinbida.wukongim.message.MessageHandler;
|
||||||
import com.xinbida.wukongim.message.WKConnection;
|
import com.xinbida.wukongim.message.WKConnection;
|
||||||
|
import com.xinbida.wukongim.message.WKRead;
|
||||||
import com.xinbida.wukongim.message.type.WKMsgContentType;
|
import com.xinbida.wukongim.message.type.WKMsgContentType;
|
||||||
import com.xinbida.wukongim.message.type.WKSendMsgResult;
|
import com.xinbida.wukongim.message.type.WKSendMsgResult;
|
||||||
|
import com.xinbida.wukongim.msgmodel.WKFormatErrorContent;
|
||||||
import com.xinbida.wukongim.msgmodel.WKImageContent;
|
import com.xinbida.wukongim.msgmodel.WKImageContent;
|
||||||
import com.xinbida.wukongim.msgmodel.WKMessageContent;
|
import com.xinbida.wukongim.msgmodel.WKMessageContent;
|
||||||
import com.xinbida.wukongim.msgmodel.WKMsgEntity;
|
import com.xinbida.wukongim.msgmodel.WKMsgEntity;
|
||||||
import com.xinbida.wukongim.msgmodel.WKReply;
|
import com.xinbida.wukongim.msgmodel.WKReply;
|
||||||
import com.xinbida.wukongim.msgmodel.WKTextContent;
|
import com.xinbida.wukongim.msgmodel.WKTextContent;
|
||||||
|
import com.xinbida.wukongim.msgmodel.WKUnknownContent;
|
||||||
import com.xinbida.wukongim.msgmodel.WKVideoContent;
|
import com.xinbida.wukongim.msgmodel.WKVideoContent;
|
||||||
import com.xinbida.wukongim.msgmodel.WKVoiceContent;
|
import com.xinbida.wukongim.msgmodel.WKVoiceContent;
|
||||||
import com.xinbida.wukongim.utils.DateUtils;
|
import com.xinbida.wukongim.utils.DateUtils;
|
||||||
@ -157,6 +164,9 @@ public class MsgManager extends BaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public WKMessageContent getMsgContentModel(String jsonStr) {
|
public WKMessageContent getMsgContentModel(String jsonStr) {
|
||||||
|
if (TextUtils.isEmpty(jsonStr)) {
|
||||||
|
return new WKFormatErrorContent();
|
||||||
|
}
|
||||||
JSONObject jsonObject = null;
|
JSONObject jsonObject = null;
|
||||||
try {
|
try {
|
||||||
jsonObject = new JSONObject(jsonStr);
|
jsonObject = new JSONObject(jsonStr);
|
||||||
@ -164,15 +174,17 @@ public class MsgManager extends BaseManager {
|
|||||||
WKLoggerUtils.getInstance().e(TAG, "getMsgContentModel The parameter is not a JSON");
|
WKLoggerUtils.getInstance().e(TAG, "getMsgContentModel The parameter is not a JSON");
|
||||||
}
|
}
|
||||||
if (jsonObject == null) {
|
if (jsonObject == null) {
|
||||||
return new WKMessageContent();
|
return new WKFormatErrorContent();
|
||||||
} else
|
}
|
||||||
return getMsgContentModel(jsonObject);
|
return getMsgContentModel(jsonObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WKMessageContent getMsgContentModel(int contentType, JSONObject jsonObject) {
|
public WKMessageContent getMsgContentModel(int contentType, JSONObject jsonObject) {
|
||||||
if (jsonObject == null) jsonObject = new JSONObject();
|
if (jsonObject == null) jsonObject = new JSONObject();
|
||||||
WKMessageContent baseContentMsgModel = getContentMsgModel(contentType, jsonObject);
|
WKMessageContent baseContentMsgModel = getContentMsgModel(contentType, jsonObject);
|
||||||
if (baseContentMsgModel != null) {
|
if (baseContentMsgModel == null) {
|
||||||
|
baseContentMsgModel = new WKUnknownContent();
|
||||||
|
}
|
||||||
//解析@成员列表
|
//解析@成员列表
|
||||||
if (jsonObject.has("mention")) {
|
if (jsonObject.has("mention")) {
|
||||||
JSONObject tempJson = jsonObject.optJSONObject("mention");
|
JSONObject tempJson = jsonObject.optJSONObject("mention");
|
||||||
@ -207,6 +219,9 @@ public class MsgManager extends BaseManager {
|
|||||||
baseContentMsgModel.flame = jsonObject.optInt("flame");
|
baseContentMsgModel.flame = jsonObject.optInt("flame");
|
||||||
if (jsonObject.has("flame_second"))
|
if (jsonObject.has("flame_second"))
|
||||||
baseContentMsgModel.flameSecond = jsonObject.optInt("flame_second");
|
baseContentMsgModel.flameSecond = jsonObject.optInt("flame_second");
|
||||||
|
if (jsonObject.has("robot_id"))
|
||||||
|
baseContentMsgModel.robotID = jsonObject.optString("robot_id");
|
||||||
|
|
||||||
//判断消息中是否包含回复情况
|
//判断消息中是否包含回复情况
|
||||||
if (jsonObject.has("reply")) {
|
if (jsonObject.has("reply")) {
|
||||||
baseContentMsgModel.reply = new WKReply();
|
baseContentMsgModel.reply = new WKReply();
|
||||||
@ -215,8 +230,7 @@ public class MsgManager extends BaseManager {
|
|||||||
baseContentMsgModel.reply = baseContentMsgModel.reply.decodeMsg(replyJson);
|
baseContentMsgModel.reply = baseContentMsgModel.reply.decodeMsg(replyJson);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (jsonObject.has("robot_id"))
|
|
||||||
baseContentMsgModel.robotID = jsonObject.optString("robot_id");
|
|
||||||
if (jsonObject.has("entities")) {
|
if (jsonObject.has("entities")) {
|
||||||
JSONArray jsonArray = jsonObject.optJSONArray("entities");
|
JSONArray jsonArray = jsonObject.optJSONArray("entities");
|
||||||
if (jsonArray != null && jsonArray.length() > 0) {
|
if (jsonArray != null && jsonArray.length() > 0) {
|
||||||
@ -232,9 +246,6 @@ public class MsgManager extends BaseManager {
|
|||||||
}
|
}
|
||||||
baseContentMsgModel.entities = list;
|
baseContentMsgModel.entities = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return baseContentMsgModel;
|
return baseContentMsgModel;
|
||||||
}
|
}
|
||||||
@ -259,6 +270,7 @@ public class MsgManager extends BaseManager {
|
|||||||
} catch (IllegalAccessException | InstantiationException | NoSuchMethodException |
|
} catch (IllegalAccessException | InstantiationException | NoSuchMethodException |
|
||||||
InvocationTargetException e) {
|
InvocationTargetException e) {
|
||||||
WKLoggerUtils.getInstance().e(TAG, "getContentMsgModel error" + e.getLocalizedMessage());
|
WKLoggerUtils.getInstance().e(TAG, "getContentMsgModel error" + e.getLocalizedMessage());
|
||||||
|
return new WKUnknownContent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -268,8 +280,9 @@ public class MsgManager extends BaseManager {
|
|||||||
}
|
}
|
||||||
} catch (IllegalAccessException | InstantiationException e) {
|
} catch (IllegalAccessException | InstantiationException e) {
|
||||||
WKLoggerUtils.getInstance().e(TAG, "getContentMsgModel decodeMsg error");
|
WKLoggerUtils.getInstance().e(TAG, "getContentMsgModel decodeMsg error");
|
||||||
|
return new WKUnknownContent();
|
||||||
}
|
}
|
||||||
return null;
|
return new WKUnknownContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getOrNearbyMsgSeq(long orderSeq) {
|
private long getOrNearbyMsgSeq(long orderSeq) {
|
||||||
@ -934,7 +947,6 @@ public class MsgManager extends BaseManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void saveSyncChannelMSGs(List<WKSyncRecent> list) {
|
public void saveSyncChannelMSGs(List<WKSyncRecent> list) {
|
||||||
if (WKCommonUtils.isEmpty(list)) return;
|
if (WKCommonUtils.isEmpty(list)) return;
|
||||||
List<WKMsg> msgList = new ArrayList<>();
|
List<WKMsg> msgList = new ArrayList<>();
|
||||||
@ -1122,29 +1134,11 @@ public class MsgManager extends BaseManager {
|
|||||||
JSONObject jsonObject = new JSONObject(wkSyncRecent.payload);
|
JSONObject jsonObject = new JSONObject(wkSyncRecent.payload);
|
||||||
msg.content = jsonObject.toString();
|
msg.content = jsonObject.toString();
|
||||||
}
|
}
|
||||||
JSONObject jsonObject = null;
|
|
||||||
if (!TextUtils.isEmpty(msg.content)) {
|
|
||||||
try {
|
|
||||||
jsonObject = new JSONObject(msg.content);
|
|
||||||
if (jsonObject.has("type"))
|
|
||||||
msg.type = jsonObject.optInt("type");
|
|
||||||
jsonObject.put(WKDBColumns.WKMessageColumns.from_uid, msg.fromUID);
|
|
||||||
if (jsonObject.has("flame"))
|
|
||||||
msg.flame = jsonObject.optInt("flame");
|
|
||||||
if (jsonObject.has("flame_second"))
|
|
||||||
msg.flameSecond = jsonObject.optInt("flame_second");
|
|
||||||
msg.content = jsonObject.toString();
|
|
||||||
} catch (JSONException e) {
|
|
||||||
WKLoggerUtils.getInstance().e(TAG, "WKSyncRecent2WKMsg message content not a JSON");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 处理消息回应
|
// 处理消息回应
|
||||||
if (WKCommonUtils.isNotEmpty(wkSyncRecent.reactions)) {
|
if (WKCommonUtils.isNotEmpty(wkSyncRecent.reactions)) {
|
||||||
msg.reactionList = getMsgReaction(wkSyncRecent);
|
msg.reactionList = getMsgReaction(wkSyncRecent);
|
||||||
}
|
}
|
||||||
if (msg.type != WKMsgContentType.WK_SIGNAL_DECRYPT_ERROR && msg.type != WKMsgContentType.WK_CONTENT_FORMAT_ERROR)
|
msg = MessageHandler.getInstance().parsingMsg(msg);
|
||||||
msg.baseContentMsgModel = WKIM.getInstance().getMsgManager().getMsgContentModel(msg.type, jsonObject);
|
|
||||||
|
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1209,7 +1203,7 @@ public class MsgManager extends BaseManager {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
List<WKMsgExtra> list = MsgDbManager.getInstance().queryMsgExtraWithNeedUpload(1);
|
List<WKMsgExtra> list = MsgDbManager.getInstance().queryMsgExtraWithNeedUpload(1);
|
||||||
if (list != null && list.size() > 0) {
|
if (WKCommonUtils.isNotEmpty(list)) {
|
||||||
for (WKMsgExtra extra : list) {
|
for (WKMsgExtra extra : list) {
|
||||||
if (iUploadMsgExtraListener != null) {
|
if (iUploadMsgExtraListener != null) {
|
||||||
iUploadMsgExtraListener.onUpload(extra);
|
iUploadMsgExtraListener.onUpload(extra);
|
||||||
@ -1236,7 +1230,7 @@ public class MsgManager extends BaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void pushNewMsg(List<WKMsg> wkMsgList) {
|
public void pushNewMsg(List<WKMsg> wkMsgList) {
|
||||||
if (newMsgListenerMap != null && newMsgListenerMap.size() > 0) {
|
if (newMsgListenerMap != null && !newMsgListenerMap.isEmpty()) {
|
||||||
runOnMainThread(() -> {
|
runOnMainThread(() -> {
|
||||||
for (Map.Entry<String, INewMsgListener> entry : newMsgListenerMap.entrySet()) {
|
for (Map.Entry<String, INewMsgListener> entry : newMsgListenerMap.entrySet()) {
|
||||||
entry.getValue().newMsg(wkMsgList);
|
entry.getValue().newMsg(wkMsgList);
|
||||||
@ -1257,13 +1251,35 @@ public class MsgManager extends BaseManager {
|
|||||||
pushNewMsg(msgs);
|
pushNewMsg(msgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deprecated 后续版本将会移除
|
||||||
|
*
|
||||||
|
* @param messageContent 消息体
|
||||||
|
* @param channelID 频道ID
|
||||||
|
* @param channelType 频道类型
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public void sendMessage(WKMessageContent messageContent, String channelID, byte channelType) {
|
public void sendMessage(WKMessageContent messageContent, String channelID, byte channelType) {
|
||||||
WKConnection.getInstance().sendMessage(messageContent, channelID, channelType);
|
send(messageContent, new WKChannel(channelID, channelType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deprecated 后续版本将会移除
|
||||||
|
*
|
||||||
|
* @param messageContent 消息体
|
||||||
|
* @param setting 消息设置
|
||||||
|
* @param channelID 频道ID
|
||||||
|
* @param channelType 频道类型
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public void sendMessage(WKMessageContent messageContent, WKMsgSetting setting, String channelID, byte channelType) {
|
public void sendMessage(WKMessageContent messageContent, WKMsgSetting setting, String channelID, byte channelType) {
|
||||||
WKConnection.getInstance().sendMessage(messageContent, setting, channelID, channelType);
|
WKSendOptions options = new WKSendOptions();
|
||||||
|
options.setting = setting;
|
||||||
|
WKChannel channel = WKIM.getInstance().getChannelManager().getChannel(channelID, channelType);
|
||||||
|
if (channel == null) {
|
||||||
|
channel = new WKChannel(channelID, channelType);
|
||||||
|
}
|
||||||
|
sendWithOptions(messageContent, channel, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1271,10 +1287,47 @@ public class MsgManager extends BaseManager {
|
|||||||
*
|
*
|
||||||
* @param msg 消息对象
|
* @param msg 消息对象
|
||||||
*/
|
*/
|
||||||
public void sendMessage(WKMsg msg) {
|
public void sendMessage(@NonNull WKMsg msg) {
|
||||||
WKConnection.getInstance().sendMessage(msg);
|
WKConnection.getInstance().sendMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送消息
|
||||||
|
*
|
||||||
|
* @param contentModel 消息体
|
||||||
|
* @param channel 频道
|
||||||
|
*/
|
||||||
|
public void send(@NonNull WKMessageContent contentModel, @NonNull WKChannel channel) {
|
||||||
|
sendWithOptions(contentModel, channel, new WKSendOptions());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送消息
|
||||||
|
*
|
||||||
|
* @param contentModel 消息体
|
||||||
|
* @param channel 频道
|
||||||
|
* @param options 高级设置
|
||||||
|
*/
|
||||||
|
public void sendWithOptions(@NonNull WKMessageContent contentModel, @NonNull WKChannel channel, @NonNull WKSendOptions options) {
|
||||||
|
final WKMsg wkMsg = new WKMsg();
|
||||||
|
wkMsg.type = contentModel.type;
|
||||||
|
wkMsg.channelID = channel.channelID;
|
||||||
|
wkMsg.channelType = channel.channelType;
|
||||||
|
wkMsg.baseContentMsgModel = contentModel;
|
||||||
|
wkMsg.flame = options.flame;
|
||||||
|
wkMsg.flameSecond = options.flameSecond;
|
||||||
|
wkMsg.expireTime = options.expire;
|
||||||
|
if (!TextUtils.isEmpty(options.topicID)) {
|
||||||
|
wkMsg.topicID = options.topicID;
|
||||||
|
}
|
||||||
|
if (!TextUtils.isEmpty(options.robotID)) {
|
||||||
|
wkMsg.robotID = options.robotID;
|
||||||
|
}
|
||||||
|
wkMsg.setting = options.setting;
|
||||||
|
wkMsg.header = options.header;
|
||||||
|
sendMessage(wkMsg);
|
||||||
|
}
|
||||||
|
|
||||||
public String createClientMsgNO() {
|
public String createClientMsgNO() {
|
||||||
return UUID.randomUUID().toString().replaceAll("-", "") + "1";
|
return UUID.randomUUID().toString().replaceAll("-", "") + "1";
|
||||||
}
|
}
|
||||||
|
@ -95,4 +95,7 @@ public class ReminderManager extends BaseManager {
|
|||||||
return ReminderDBManager.getInstance().queryMaxVersion();
|
return ReminderDBManager.getInstance().queryMaxVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void done() {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ public class MessageHandler {
|
|||||||
|
|
||||||
mIReceivedMsgListener
|
mIReceivedMsgListener
|
||||||
.sendAckMsg(sendAckMsg);
|
.sendAckMsg(sendAckMsg);
|
||||||
} else if (g_msg.packetType == WKMsgType.RECVEIVED) {
|
} else if (g_msg.packetType == WKMsgType.RECEIVED) {
|
||||||
//收到消息
|
//收到消息
|
||||||
WKMsg message = WKProto.getInstance().baseMsg2WKMsg(g_msg);
|
WKMsg message = WKProto.getInstance().baseMsg2WKMsg(g_msg);
|
||||||
message.header.noPersist = no_persist == 1;
|
message.header.noPersist = no_persist == 1;
|
||||||
@ -328,22 +328,8 @@ public class MessageHandler {
|
|||||||
if (lastMsg == null) {
|
if (lastMsg == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
JSONObject jsonObject = null;
|
|
||||||
if (!TextUtils.isEmpty(list.get(i).wkMsg.content)) {
|
lastMsg = parsingMsg(lastMsg);
|
||||||
try {
|
|
||||||
jsonObject = new JSONObject(list.get(i).wkMsg.content);
|
|
||||||
} catch (JSONException e) {
|
|
||||||
WKLoggerUtils.getInstance().e(TAG, "groupMsg content is not a JSON struct");
|
|
||||||
jsonObject = new JSONObject();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (lastMsg.baseContentMsgModel == null) {
|
|
||||||
lastMsg.baseContentMsgModel = WKIM.getInstance().getMsgManager().getMsgContentModel(lastMsg.type, jsonObject);
|
|
||||||
if (lastMsg.baseContentMsgModel != null) {
|
|
||||||
lastMsg.flame = lastMsg.baseContentMsgModel.flame;
|
|
||||||
lastMsg.flameSecond = lastMsg.baseContentMsgModel.flameSecond;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
boolean isSave = false;
|
boolean isSave = false;
|
||||||
if (lastMsg.baseContentMsgModel != null && lastMsg.baseContentMsgModel.mentionAll == 1 && list.get(i).red_dot == 1) {
|
if (lastMsg.baseContentMsgModel != null && lastMsg.baseContentMsgModel.mentionAll == 1 && list.get(i).red_dot == 1) {
|
||||||
isSave = true;
|
isSave = true;
|
||||||
@ -390,29 +376,37 @@ public class MessageHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public WKMsg parsingMsg(WKMsg message) {
|
public WKMsg parsingMsg(WKMsg message) {
|
||||||
|
if (message.type == WKMsgContentType.WK_SIGNAL_DECRYPT_ERROR || message.type == WKMsgContentType.WK_CONTENT_FORMAT_ERROR) {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
JSONObject json = null;
|
JSONObject json = null;
|
||||||
if (message.type != WKMsgContentType.WK_SIGNAL_DECRYPT_ERROR) {
|
|
||||||
try {
|
try {
|
||||||
if (TextUtils.isEmpty(message.content)) return message;
|
if (TextUtils.isEmpty(message.content)) return message;
|
||||||
json = new JSONObject(message.content);
|
json = new JSONObject(message.content);
|
||||||
if (json.has(WKDBColumns.WKMessageColumns.type)) {
|
if (json.has("type")) {
|
||||||
message.content = json.toString();
|
message.content = json.toString();
|
||||||
message.type = json.optInt(WKDBColumns.WKMessageColumns.type);
|
message.type = json.optInt("type");
|
||||||
}
|
}
|
||||||
if (TextUtils.isEmpty(message.fromUID)) {
|
if (TextUtils.isEmpty(message.fromUID)) {
|
||||||
if (json.has(WKDBColumns.WKMessageColumns.from_uid)) {
|
if (json.has("from_uid")) {
|
||||||
message.fromUID = json.optString(WKDBColumns.WKMessageColumns.from_uid);
|
message.fromUID = json.optString("from_uid");
|
||||||
} else {
|
} else {
|
||||||
message.fromUID = message.channelID;
|
message.fromUID = message.channelID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (json.has("flame")) {
|
||||||
|
message.flame = json.optInt("flame");
|
||||||
|
}
|
||||||
|
if (json.has("flame_second")) {
|
||||||
|
message.flameSecond = json.optInt("flame_second");
|
||||||
|
}
|
||||||
|
if (json.has("root_id")) {
|
||||||
|
message.robotID = json.optString("root_id");
|
||||||
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
message.type = WKMsgContentType.WK_CONTENT_FORMAT_ERROR;
|
message.type = WKMsgContentType.WK_CONTENT_FORMAT_ERROR;
|
||||||
WKLoggerUtils.getInstance().e(TAG, "Parsing message error, message is not a JSON structure");
|
WKLoggerUtils.getInstance().e(TAG, "Parsing message error, message is not a JSON structure");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (json == null) {
|
if (json == null) {
|
||||||
if (message.type != WKMsgContentType.WK_SIGNAL_DECRYPT_ERROR)
|
if (message.type != WKMsgContentType.WK_SIGNAL_DECRYPT_ERROR)
|
||||||
@ -421,15 +415,10 @@ public class MessageHandler {
|
|||||||
|
|
||||||
if (message.type == WKMsgContentType.WK_INSIDE_MSG) {
|
if (message.type == WKMsgContentType.WK_INSIDE_MSG) {
|
||||||
CMDManager.getInstance().handleCMD(json, message.channelID, message.channelType);
|
CMDManager.getInstance().handleCMD(json, message.channelID, message.channelType);
|
||||||
}
|
return message;
|
||||||
if (message.type != WKMsgContentType.WK_SIGNAL_DECRYPT_ERROR && message.type != WKMsgContentType.WK_CONTENT_FORMAT_ERROR) {
|
|
||||||
message.baseContentMsgModel = WKIM.getInstance().getMsgManager().getMsgContentModel(message.type, json);
|
|
||||||
if (message.baseContentMsgModel != null) {
|
|
||||||
message.flame = message.baseContentMsgModel.flame;
|
|
||||||
message.flameSecond = message.baseContentMsgModel.flameSecond;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message.baseContentMsgModel = WKIM.getInstance().getMsgManager().getMsgContentModel(message.type, json);
|
||||||
//如果是单聊先将channelId改成发送者ID
|
//如果是单聊先将channelId改成发送者ID
|
||||||
if (!TextUtils.isEmpty(message.channelID)
|
if (!TextUtils.isEmpty(message.channelID)
|
||||||
&& !TextUtils.isEmpty(message.fromUID)
|
&& !TextUtils.isEmpty(message.fromUID)
|
||||||
|
@ -25,7 +25,6 @@ import com.xinbida.wukongim.message.type.WKSendMsgResult;
|
|||||||
import com.xinbida.wukongim.message.type.WKSendingMsg;
|
import com.xinbida.wukongim.message.type.WKSendingMsg;
|
||||||
import com.xinbida.wukongim.msgmodel.WKImageContent;
|
import com.xinbida.wukongim.msgmodel.WKImageContent;
|
||||||
import com.xinbida.wukongim.msgmodel.WKMediaMessageContent;
|
import com.xinbida.wukongim.msgmodel.WKMediaMessageContent;
|
||||||
import com.xinbida.wukongim.msgmodel.WKMessageContent;
|
|
||||||
import com.xinbida.wukongim.msgmodel.WKVideoContent;
|
import com.xinbida.wukongim.msgmodel.WKVideoContent;
|
||||||
import com.xinbida.wukongim.protocol.WKBaseMsg;
|
import com.xinbida.wukongim.protocol.WKBaseMsg;
|
||||||
import com.xinbida.wukongim.protocol.WKConnectMsg;
|
import com.xinbida.wukongim.protocol.WKConnectMsg;
|
||||||
@ -379,33 +378,6 @@ public class WKConnection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendMessage(WKMessageContent baseContentModel, WKMsgSetting wkMsgSetting, String channelID, byte channelType) {
|
|
||||||
final WKMsg wkMsg = new WKMsg();
|
|
||||||
wkMsg.type = baseContentModel.type;
|
|
||||||
wkMsg.setting = wkMsgSetting;
|
|
||||||
//设置会话信息
|
|
||||||
wkMsg.channelID = channelID;
|
|
||||||
wkMsg.channelType = channelType;
|
|
||||||
//检查频道信息
|
|
||||||
wkMsg.baseContentMsgModel = baseContentModel;
|
|
||||||
wkMsg.baseContentMsgModel.fromUID = wkMsg.fromUID;
|
|
||||||
wkMsg.flame = baseContentModel.flame;
|
|
||||||
wkMsg.flameSecond = baseContentModel.flameSecond;
|
|
||||||
wkMsg.topicID = baseContentModel.topicID;
|
|
||||||
sendMessage(wkMsg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发送消息
|
|
||||||
*
|
|
||||||
* @param baseContentModel 消息model
|
|
||||||
* @param channelID 频道ID
|
|
||||||
* @param channelType 频道类型
|
|
||||||
*/
|
|
||||||
public void sendMessage(WKMessageContent baseContentModel, String channelID, byte channelType) {
|
|
||||||
WKMsgSetting setting = new WKMsgSetting();
|
|
||||||
sendMessage(baseContentModel, setting, channelID, channelType);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void sendMessage(WKMsg msg) {
|
public void sendMessage(WKMsg msg) {
|
||||||
if (TextUtils.isEmpty(msg.fromUID)) {
|
if (TextUtils.isEmpty(msg.fromUID)) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.xinbida.wukongim.message;
|
package com.xinbida.wukongim.message;
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import com.xinbida.wukongim.WKIM;
|
import com.xinbida.wukongim.WKIM;
|
||||||
import com.xinbida.wukongim.WKIMApplication;
|
import com.xinbida.wukongim.WKIMApplication;
|
||||||
@ -33,6 +34,7 @@ import org.json.JSONObject;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 5/21/21 11:28 AM
|
* 5/21/21 11:28 AM
|
||||||
@ -57,6 +59,8 @@ class WKProto {
|
|||||||
if (msg.packetType == WKMsgType.CONNECT) {
|
if (msg.packetType == WKMsgType.CONNECT) {
|
||||||
// 连接
|
// 连接
|
||||||
bytes = WKProto.getInstance().enConnectMsg((WKConnectMsg) msg);
|
bytes = WKProto.getInstance().enConnectMsg((WKConnectMsg) msg);
|
||||||
|
String str = Arrays.toString(bytes);
|
||||||
|
WKLoggerUtils.getInstance().e(str);
|
||||||
} else if (msg.packetType == WKMsgType.REVACK) {
|
} else if (msg.packetType == WKMsgType.REVACK) {
|
||||||
// 收到消息回执
|
// 收到消息回执
|
||||||
bytes = WKProto.getInstance().enReceivedAckMsg((WKReceivedAckMsg) msg);
|
bytes = WKProto.getInstance().enReceivedAckMsg((WKReceivedAckMsg) msg);
|
||||||
@ -72,7 +76,6 @@ class WKProto {
|
|||||||
}
|
}
|
||||||
|
|
||||||
byte[] enConnectMsg(WKConnectMsg connectMsg) {
|
byte[] enConnectMsg(WKConnectMsg connectMsg) {
|
||||||
WKIMApplication.getInstance().protocolVersion = WKIMApplication.getInstance().defaultProtocolVersion;
|
|
||||||
byte[] remainingBytes = WKTypeUtils.getInstance().getRemainingLengthByte(connectMsg.getRemainingLength());
|
byte[] remainingBytes = WKTypeUtils.getInstance().getRemainingLengthByte(connectMsg.getRemainingLength());
|
||||||
int totalLen = connectMsg.getTotalLen();
|
int totalLen = connectMsg.getTotalLen();
|
||||||
WKWrite wkWrite = new WKWrite(totalLen);
|
WKWrite wkWrite = new WKWrite(totalLen);
|
||||||
@ -252,7 +255,7 @@ class WKProto {
|
|||||||
return deSendAckMsg(wkRead);
|
return deSendAckMsg(wkRead);
|
||||||
} else if (packetType == WKMsgType.DISCONNECT) {
|
} else if (packetType == WKMsgType.DISCONNECT) {
|
||||||
return deDisconnectMsg(wkRead);
|
return deDisconnectMsg(wkRead);
|
||||||
} else if (packetType == WKMsgType.RECVEIVED) {
|
} else if (packetType == WKMsgType.RECEIVED) {
|
||||||
return deReceivedMsg(wkRead);
|
return deReceivedMsg(wkRead);
|
||||||
} else if (packetType == WKMsgType.PONG) {
|
} else if (packetType == WKMsgType.PONG) {
|
||||||
return new WKPongMsg();
|
return new WKPongMsg();
|
||||||
@ -306,6 +309,9 @@ class WKProto {
|
|||||||
if (!TextUtils.isEmpty(msg.baseContentMsgModel.robotID)) {
|
if (!TextUtils.isEmpty(msg.baseContentMsgModel.robotID)) {
|
||||||
jsonObject.put("robot_id", msg.baseContentMsgModel.robotID);
|
jsonObject.put("robot_id", msg.baseContentMsgModel.robotID);
|
||||||
}
|
}
|
||||||
|
if (!TextUtils.isEmpty(msg.robotID)) {
|
||||||
|
jsonObject.put("robot_id", msg.robotID);
|
||||||
|
}
|
||||||
if (WKCommonUtils.isNotEmpty(msg.baseContentMsgModel.entities)) {
|
if (WKCommonUtils.isNotEmpty(msg.baseContentMsgModel.entities)) {
|
||||||
JSONArray jsonArray = new JSONArray();
|
JSONArray jsonArray = new JSONArray();
|
||||||
for (WKMsgEntity entity : msg.baseContentMsgModel.entities) {
|
for (WKMsgEntity entity : msg.baseContentMsgModel.entities) {
|
||||||
@ -322,10 +328,10 @@ class WKProto {
|
|||||||
jsonObject.put("flame_second", msg.flameSecond);
|
jsonObject.put("flame_second", msg.flameSecond);
|
||||||
jsonObject.put("flame", msg.flame);
|
jsonObject.put("flame", msg.flame);
|
||||||
}
|
}
|
||||||
if (msg.baseContentMsgModel.flame != 0) {
|
// if (msg.baseContentMsgModel.flame != 0) {
|
||||||
jsonObject.put("flame_second", msg.baseContentMsgModel.flameSecond);
|
// jsonObject.put("flame_second", msg.baseContentMsgModel.flameSecond);
|
||||||
jsonObject.put("flame", msg.baseContentMsgModel.flame);
|
// jsonObject.put("flame", msg.baseContentMsgModel.flame);
|
||||||
}
|
// }
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
WKLoggerUtils.getInstance().e(TAG, "getSendPayload error");
|
WKLoggerUtils.getInstance().e(TAG, "getSendPayload error");
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ public class WKMsgType {
|
|||||||
//收到消息确认的报文(s2c)
|
//收到消息确认的报文(s2c)
|
||||||
public static final short SENDACK = 4;
|
public static final short SENDACK = 4;
|
||||||
//收取消息(s2c)
|
//收取消息(s2c)
|
||||||
public static final short RECVEIVED = 5;
|
public static final short RECEIVED = 5;
|
||||||
//收取消息确认(c2s)
|
//收取消息确认(c2s)
|
||||||
public static final short REVACK = 6;
|
public static final short REVACK = 6;
|
||||||
//ping请求
|
//ping请求
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.xinbida.wukongim.msgmodel;
|
||||||
|
|
||||||
|
import com.xinbida.wukongim.message.type.WKMsgContentType;
|
||||||
|
|
||||||
|
public class WKFormatErrorContent extends WKMessageContent {
|
||||||
|
public WKFormatErrorContent() {
|
||||||
|
this.type = WKMsgContentType.WK_CONTENT_FORMAT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDisplayContent() {
|
||||||
|
return "[消息格式错误]";
|
||||||
|
}
|
||||||
|
}
|
@ -16,9 +16,15 @@ import java.util.List;
|
|||||||
public class WKMessageContent implements Parcelable {
|
public class WKMessageContent implements Parcelable {
|
||||||
//内容
|
//内容
|
||||||
public String content;
|
public String content;
|
||||||
//发送者id
|
/**
|
||||||
|
* Deprecated 后续版本将删除该字段
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public String fromUID;
|
public String fromUID;
|
||||||
//发送者名称
|
/**
|
||||||
|
* Deprecated 后续版本将删除该字段
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public String fromName;
|
public String fromName;
|
||||||
//消息内容类型
|
//消息内容类型
|
||||||
public int type;
|
public int type;
|
||||||
@ -31,11 +37,25 @@ public class WKMessageContent implements Parcelable {
|
|||||||
//搜索关键字
|
//搜索关键字
|
||||||
public String searchableWord;
|
public String searchableWord;
|
||||||
//最近会话提示文字
|
//最近会话提示文字
|
||||||
public String displayContent;
|
private String displayContent;
|
||||||
// public int isDelete;
|
/**
|
||||||
|
* Deprecated 后续版本将删除该字段
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public String robotID;
|
public String robotID;
|
||||||
|
/**
|
||||||
|
* Deprecated 后续版本将删除该字段
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public int flame;
|
public int flame;
|
||||||
|
/**
|
||||||
|
* Deprecated 后续版本将删除该字段
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public int flameSecond;
|
public int flameSecond;
|
||||||
|
/**
|
||||||
|
* Deprecated 后续版本将删除该字段
|
||||||
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public String topicID;
|
public String topicID;
|
||||||
public List<WKMsgEntity> entities;
|
public List<WKMsgEntity> entities;
|
||||||
@ -54,7 +74,6 @@ public class WKMessageContent implements Parcelable {
|
|||||||
searchableWord = in.readString();
|
searchableWord = in.readString();
|
||||||
displayContent = in.readString();
|
displayContent = in.readString();
|
||||||
reply = in.readParcelable(WKReply.class.getClassLoader());
|
reply = in.readParcelable(WKReply.class.getClassLoader());
|
||||||
// isDelete = in.readInt();
|
|
||||||
robotID = in.readString();
|
robotID = in.readString();
|
||||||
entities = in.createTypedArrayList(WKMsgEntity.CREATOR);
|
entities = in.createTypedArrayList(WKMsgEntity.CREATOR);
|
||||||
flame = in.readInt();
|
flame = in.readInt();
|
||||||
@ -73,7 +92,6 @@ public class WKMessageContent implements Parcelable {
|
|||||||
dest.writeString(searchableWord);
|
dest.writeString(searchableWord);
|
||||||
dest.writeString(displayContent);
|
dest.writeString(displayContent);
|
||||||
dest.writeParcelable(reply, flags);
|
dest.writeParcelable(reply, flags);
|
||||||
// dest.writeInt(isDelete);
|
|
||||||
dest.writeString(robotID);
|
dest.writeString(robotID);
|
||||||
dest.writeTypedList(entities);
|
dest.writeTypedList(entities);
|
||||||
dest.writeInt(flame);
|
dest.writeInt(flame);
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.xinbida.wukongim.msgmodel;
|
||||||
|
|
||||||
|
import com.xinbida.wukongim.message.type.WKMsgContentType;
|
||||||
|
|
||||||
|
public class WKUnknownContent extends WKMessageContent{
|
||||||
|
public WKUnknownContent(){
|
||||||
|
this.type = WKMsgContentType.WK_CONTENT_FORMAT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDisplayContent() {
|
||||||
|
return "[未知消息]";
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,5 @@
|
|||||||
package com.xinbida.wukongim.protocol;
|
package com.xinbida.wukongim.protocol;
|
||||||
|
|
||||||
import com.xinbida.wukongim.WKIMApplication;
|
|
||||||
import com.xinbida.wukongim.message.type.WKMsgType;
|
import com.xinbida.wukongim.message.type.WKMsgType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,7 +55,7 @@ public class WKReceivedMsg extends WKBaseMsg {
|
|||||||
public int topicIDContentLength = 0;
|
public int topicIDContentLength = 0;
|
||||||
|
|
||||||
public WKReceivedMsg() {
|
public WKReceivedMsg() {
|
||||||
packetType = WKMsgType.RECVEIVED;
|
packetType = WKMsgType.RECEIVED;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPayloadLength(int remainingLength) {
|
public int getPayloadLength(int remainingLength) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user