Modify Query History Message

This commit is contained in:
SL 2023-09-05 11:40:55 +08:00
parent a3343eb5e2
commit a5c5d6cb96
7 changed files with 22 additions and 15 deletions

View File

@ -14,4 +14,5 @@
* Update sending messages without notification to refresh conversation messsage * Update sending messages without notification to refresh conversation messsage
### 1.0.7 ### 1.0.7
* Support message receipts * Support message receipts
### 1.0.8
* Modify Query History Message

View File

@ -9,7 +9,7 @@
#### 安装 #### 安装
``` ```
dependencies: dependencies:
wukongimfluttersdk: ^1.0.7 wukongimfluttersdk: ^1.0.8
``` ```
#### 引入 #### 引入
```dart ```dart

View File

@ -56,7 +56,7 @@ class ListViewShowDataState extends State<ListViewShowData> {
setState(() {}); setState(() {});
}); });
WKIM.shared.conversationManager.addOnRefreshMsgListener('chat_conversation', WKIM.shared.conversationManager.addOnRefreshMsgListener('chat_conversation',
(msg, isEnd) { (msg, isEnd) async {
bool isAdd = true; bool isAdd = true;
for (var i = 0; i < msgList.length; i++) { for (var i = 0; i < msgList.length; i++) {
if (msgList[i].msg.channelID == msg.channelID && if (msgList[i].msg.channelID == msg.channelID &&

View File

@ -499,7 +499,7 @@ packages:
path: ".." path: ".."
relative: true relative: true
source: path source: path
version: "1.0.7" version: "1.0.8"
x25519: x25519:
dependency: transitive dependency: transitive
description: description:

View File

@ -177,18 +177,18 @@ class MessaggeDB {
if (pullMode == 0) { if (pullMode == 0) {
if (contain) { if (contain) {
sql = sql =
"SELECT * FROM (SELECT $messageCols,$extraCols FROM ${WKDBConst.tableMessage} LEFT JOIN ${WKDBConst.tableMessageExtra} on ${WKDBConst.tableMessage}.message_id=${WKDBConst.tableMessageExtra}.message_id WHERE ${WKDBConst.tableMessage}.channel_id='$channelId' and ${WKDBConst.tableMessage}.channel_type=$channelType and ${WKDBConst.tableMessage}..type<>0 and ${WKDBConst.tableMessage}.type<>99 AND ${WKDBConst.tableMessage}.order_seq<=$oldestOrderSeq) where is_deleted=0 and is_mutual_deleted=0 order by order_seq desc limit 0,$limit"; "SELECT * FROM (SELECT $messageCols,$extraCols FROM ${WKDBConst.tableMessage} LEFT JOIN ${WKDBConst.tableMessageExtra} on ${WKDBConst.tableMessage}.message_id=${WKDBConst.tableMessageExtra}.message_id WHERE ${WKDBConst.tableMessage}.channel_id='$channelId' and ${WKDBConst.tableMessage}.channel_type=$channelType and ${WKDBConst.tableMessage}.type<>0 and ${WKDBConst.tableMessage}.type<>99 AND ${WKDBConst.tableMessage}.order_seq<=$oldestOrderSeq) where is_deleted=0 and is_mutual_deleted=0 order by order_seq desc limit 0,$limit";
} else { } else {
sql = sql =
"SELECT * FROM (SELECT $messageCols,$extraCols FROM ${WKDBConst.tableMessage} LEFT JOIN ${WKDBConst.tableMessageExtra} on ${WKDBConst.tableMessage}.message_id=${WKDBConst.tableMessageExtra}.message_id WHERE ${WKDBConst.tableMessage}.channel_id='$channelId' and ${WKDBConst.tableMessage}.channel_type=$channelType and ${WKDBConst.tableMessage}..type<>0 and ${WKDBConst.tableMessage}${WKDBConst.tableMessage}.type<>99 AND ${WKDBConst.tableMessage}.order_seq<$oldestOrderSeq) where is_deleted=0 and is_mutual_deleted=0 order by order_seq desc limit 0,$limit"; "SELECT * FROM (SELECT $messageCols,$extraCols FROM ${WKDBConst.tableMessage} LEFT JOIN ${WKDBConst.tableMessageExtra} on ${WKDBConst.tableMessage}.message_id=${WKDBConst.tableMessageExtra}.message_id WHERE ${WKDBConst.tableMessage}.channel_id='$channelId' and ${WKDBConst.tableMessage}.channel_type=$channelType and ${WKDBConst.tableMessage}.type<>0 and ${WKDBConst.tableMessage}.type<>99 AND ${WKDBConst.tableMessage}.order_seq<$oldestOrderSeq) where is_deleted=0 and is_mutual_deleted=0 order by order_seq desc limit 0,$limit";
} }
} else { } else {
if (contain) { if (contain) {
sql = sql =
"SELECT * FROM (SELECT $messageCols,$extraCols FROM ${WKDBConst.tableMessage} LEFT JOIN ${WKDBConst.tableMessageExtra} on ${WKDBConst.tableMessage}.message_id=${WKDBConst.tableMessageExtra}.message_id WHERE ${WKDBConst.tableMessage}.channel_id='$channelId' and ${WKDBConst.tableMessage}.channel_type=$channelType and ${WKDBConst.tableMessage}..type<>0 and ${WKDBConst.tableMessage}.type<>99 AND ${WKDBConst.tableMessage}.order_seq>=$oldestOrderSeq) where is_deleted=0 and is_mutual_deleted=0 order by order_seq asc limit 0,$limit"; "SELECT * FROM (SELECT $messageCols,$extraCols FROM ${WKDBConst.tableMessage} LEFT JOIN ${WKDBConst.tableMessageExtra} on ${WKDBConst.tableMessage}.message_id=${WKDBConst.tableMessageExtra}.message_id WHERE ${WKDBConst.tableMessage}.channel_id='$channelId' and ${WKDBConst.tableMessage}.channel_type=$channelType and ${WKDBConst.tableMessage}.type<>0 and ${WKDBConst.tableMessage}.type<>99 AND ${WKDBConst.tableMessage}.order_seq>=$oldestOrderSeq) where is_deleted=0 and is_mutual_deleted=0 order by order_seq asc limit 0,$limit";
} else { } else {
sql = sql =
"SELECT * FROM (SELECT $messageCols,$extraCols FROM ${WKDBConst.tableMessage} LEFT JOIN ${WKDBConst.tableMessageExtra} on ${WKDBConst.tableMessage}.message_id=${WKDBConst.tableMessageExtra}.message_id WHERE ${WKDBConst.tableMessage}.channel_id='$channelId' and ${WKDBConst.tableMessage}.channel_type=$channelType and ${WKDBConst.tableMessage}..type<>0 and ${WKDBConst.tableMessage}.type<>99 AND ${WKDBConst.tableMessage}.order_seq>$oldestOrderSeq) where is_deleted=0 and is_mutual_deleted=0 order by order_seq asc limit 0,$limit"; "SELECT * FROM (SELECT $messageCols,$extraCols FROM ${WKDBConst.tableMessage} LEFT JOIN ${WKDBConst.tableMessageExtra} on ${WKDBConst.tableMessage}.message_id=${WKDBConst.tableMessageExtra}.message_id WHERE ${WKDBConst.tableMessage}.channel_id='$channelId' and ${WKDBConst.tableMessage}.channel_type=$channelType and ${WKDBConst.tableMessage}.type<>0 and ${WKDBConst.tableMessage}.type<>99 AND ${WKDBConst.tableMessage}.order_seq>$oldestOrderSeq) where is_deleted=0 and is_mutual_deleted=0 order by order_seq asc limit 0,$limit";
} }
} }
} }

View File

@ -124,9 +124,11 @@ class WKConversationManager {
List<WKMsg> msgList = []; List<WKMsg> msgList = [];
List<WKMsgReaction> msgReactionList = []; List<WKMsgReaction> msgReactionList = [];
List<WKMsgExtra> msgExtraList = []; List<WKMsgExtra> msgExtraList = [];
List<WKUIConversationMsg> uiMsgList = [];
if (syncChat.conversations != null && syncChat.conversations!.isNotEmpty) { if (syncChat.conversations != null && syncChat.conversations!.isNotEmpty) {
for (int i = 0, size = syncChat.conversations!.length; i < size; i++) { for (int i = 0, size = syncChat.conversations!.length; i < size; i++) {
WKConversationMsg conversationMsg = WKConversationMsg(); WKConversationMsg conversationMsg = WKConversationMsg();
int channelType = syncChat.conversations![i].channelType; int channelType = syncChat.conversations![i].channelType;
String channelID = syncChat.conversations![i].channelID; String channelID = syncChat.conversations![i].channelID;
if (channelType == WKChannelType.communityTopic) { if (channelType == WKChannelType.communityTopic) {
@ -142,6 +144,8 @@ class WKConversationManager {
conversationMsg.lastMsgTimestamp = syncChat.conversations![i].timestamp; conversationMsg.lastMsgTimestamp = syncChat.conversations![i].timestamp;
conversationMsg.unreadCount = syncChat.conversations![i].unread; conversationMsg.unreadCount = syncChat.conversations![i].unread;
conversationMsg.version = syncChat.conversations![i].version; conversationMsg.version = syncChat.conversations![i].version;
WKUIConversationMsg uiMsg =
ConversationDB.shared.getUIMsg(conversationMsg);
// //
if (syncChat.conversations![i].recents != null && if (syncChat.conversations![i].recents != null &&
syncChat.conversations![i].recents!.isNotEmpty) { syncChat.conversations![i].recents!.isNotEmpty) {
@ -153,6 +157,8 @@ class WKConversationManager {
//fromUID //fromUID
if (conversationMsg.lastClientMsgNO == msg.clientMsgNO) { if (conversationMsg.lastClientMsgNO == msg.clientMsgNO) {
conversationMsg.isDeleted = msg.isDeleted; conversationMsg.isDeleted = msg.isDeleted;
uiMsg.isDeleted = conversationMsg.isDeleted;
uiMsg.setWkMsg(msg);
} }
if (wkSyncRecent.messageExtra != null) { if (wkSyncRecent.messageExtra != null) {
WKMsgExtra extra = WKIM.shared.messageManager WKMsgExtra extra = WKIM.shared.messageManager
@ -164,23 +170,23 @@ class WKConversationManager {
} }
} }
conversationMsgList.add(conversationMsg); conversationMsgList.add(conversationMsg);
uiMsgList.add(uiMsg);
} }
} }
if (msgExtraList.isNotEmpty) { if (msgExtraList.isNotEmpty) {
MessaggeDB.shared.insertOrUpdateMsgExtras(msgExtraList); MessaggeDB.shared.insertOrUpdateMsgExtras(msgExtraList);
} }
List<WKUIConversationMsg> uiMsgList = [];
if (conversationMsgList.isNotEmpty || msgList.isNotEmpty) { if (conversationMsgList.isNotEmpty || msgList.isNotEmpty) {
if (msgList.isNotEmpty) { if (msgList.isNotEmpty) {
MessaggeDB.shared.insertMsgList(msgList); MessaggeDB.shared.insertMsgList(msgList);
} }
if (conversationMsgList.isNotEmpty) { if (conversationMsgList.isNotEmpty) {
for (int i = 0, size = conversationMsgList.length; i < size; i++) { // for (int i = 0, size = conversationMsgList.length; i < size; i++) {
WKUIConversationMsg uiMsg = // WKUIConversationMsg uiMsg =
ConversationDB.shared.getUIMsg(conversationMsgList[i]); // ConversationDB.shared.getUIMsg(conversationMsgList[i]);
uiMsgList.add(uiMsg); // uiMsgList.add(uiMsg);
} // }
// //
ConversationDB.shared.insertMsgList(conversationMsgList); ConversationDB.shared.insertMsgList(conversationMsgList);

View File

@ -15,7 +15,7 @@ description: wukong IM flutter sdk
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 1.0.7 version: 1.0.8
homepage: https://github.com/WuKongIM/WuKongIMFlutterSDK homepage: https://github.com/WuKongIM/WuKongIMFlutterSDK
environment: environment: