mirror of
https://github.com/WuKongIM/WuKongIMFlutterSDK
synced 2025-05-29 15:12:20 +00:00
Modify Query History Message
This commit is contained in:
parent
a5c5d6cb96
commit
37768f3745
@ -15,4 +15,6 @@
|
|||||||
### 1.0.7
|
### 1.0.7
|
||||||
* Support message receipts
|
* Support message receipts
|
||||||
### 1.0.8
|
### 1.0.8
|
||||||
* Modify Query History Message
|
* Modify Query History Message
|
||||||
|
### 1.0.9
|
||||||
|
* Optimize Query History Message
|
@ -9,7 +9,7 @@
|
|||||||
#### 安装
|
#### 安装
|
||||||
```
|
```
|
||||||
dependencies:
|
dependencies:
|
||||||
wukongimfluttersdk: ^1.0.8
|
wukongimfluttersdk: ^1.0.9
|
||||||
```
|
```
|
||||||
#### 引入
|
#### 引入
|
||||||
```dart
|
```dart
|
||||||
|
@ -58,8 +58,8 @@ class ChatListDataState extends State<ChatList> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
getMsgList();
|
|
||||||
initListener();
|
initListener();
|
||||||
|
getMsgList(50000, 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
initListener() {
|
initListener() {
|
||||||
@ -117,16 +117,48 @@ class ChatListDataState extends State<ChatList> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getMsgList() {
|
getPrevious() {
|
||||||
WKIM.shared.messageManager.getOrSyncHistoryMessages(
|
var oldOrderSeq = 0;
|
||||||
channelID, channelType, 0, true, 0, 100, 0, (list) {
|
for (var msg in msgList) {
|
||||||
|
if (oldOrderSeq == 0 || oldOrderSeq > msg.wkMsg.orderSeq) {
|
||||||
|
oldOrderSeq = msg.wkMsg.orderSeq;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getMsgList(oldOrderSeq, 0, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
getLast() {
|
||||||
|
var oldOrderSeq = 0;
|
||||||
|
for (var msg in msgList) {
|
||||||
|
if (oldOrderSeq == 0 || oldOrderSeq < msg.wkMsg.orderSeq) {
|
||||||
|
oldOrderSeq = msg.wkMsg.orderSeq;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getMsgList(oldOrderSeq, 1, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
getMsgList(int oldestOrderSeq, int pullMode, bool isReset) {
|
||||||
|
WKIM.shared.messageManager.getOrSyncHistoryMessages(channelID, channelType,
|
||||||
|
oldestOrderSeq, oldestOrderSeq == 0, pullMode, 20, 0, (list) {
|
||||||
|
List<UIMsg> uiList = [];
|
||||||
for (int i = 0; i < list.length; i++) {
|
for (int i = 0; i < list.length; i++) {
|
||||||
msgList.add(UIMsg(list[i]));
|
print(list[i].orderSeq);
|
||||||
|
if (pullMode == 0 && !isReset) {
|
||||||
|
uiList.add(UIMsg(list[i]));
|
||||||
|
// msgList.insert(0, UIMsg(list[i]));
|
||||||
|
} else {
|
||||||
|
msgList.add(UIMsg(list[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (uiList.isNotEmpty) {
|
||||||
|
msgList.insertAll(0, uiList);
|
||||||
}
|
}
|
||||||
setState(() {});
|
setState(() {});
|
||||||
Future.delayed(const Duration(milliseconds: 300), () {
|
if (isReset) {
|
||||||
_scrollController.jumpTo(_scrollController.position.maxScrollExtent);
|
Future.delayed(const Duration(milliseconds: 300), () {
|
||||||
});
|
_scrollController.jumpTo(_scrollController.position.maxScrollExtent);
|
||||||
|
});
|
||||||
|
}
|
||||||
}, () {
|
}, () {
|
||||||
print('消息同步中');
|
print('消息同步中');
|
||||||
});
|
});
|
||||||
@ -295,6 +327,22 @@ class ChatListDataState extends State<ChatList> {
|
|||||||
decoration: const InputDecoration(hintText: '请输入内容'),
|
decoration: const InputDecoration(hintText: '请输入内容'),
|
||||||
autofocus: true),
|
autofocus: true),
|
||||||
),
|
),
|
||||||
|
MaterialButton(
|
||||||
|
onPressed: () {
|
||||||
|
getPrevious();
|
||||||
|
},
|
||||||
|
color: Colors.brown,
|
||||||
|
child:
|
||||||
|
const Text("上一页", style: TextStyle(color: Colors.white)),
|
||||||
|
),
|
||||||
|
MaterialButton(
|
||||||
|
onPressed: () {
|
||||||
|
getLast();
|
||||||
|
},
|
||||||
|
color: Colors.brown,
|
||||||
|
child:
|
||||||
|
const Text("下一页", style: TextStyle(color: Colors.white)),
|
||||||
|
),
|
||||||
MaterialButton(
|
MaterialButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (content != '') {
|
if (content != '') {
|
||||||
|
@ -38,7 +38,7 @@ class HttpUtils {
|
|||||||
"version": version, // 当前客户端的会话最大版本号(从保存的结果里取最大的version,如果本地没有数据则传0),
|
"version": version, // 当前客户端的会话最大版本号(从保存的结果里取最大的version,如果本地没有数据则传0),
|
||||||
"last_msg_seqs":
|
"last_msg_seqs":
|
||||||
lastSsgSeqs, // 客户端所有频道会话的最后一条消息序列号拼接出来的同步串 格式: channelID:channelType:last_msg_seq|channelID:channelType:last_msg_seq (此字段非必填,如果不填就获取全量数据,填写了获取增量数据,看你自己的需求。)
|
lastSsgSeqs, // 客户端所有频道会话的最后一条消息序列号拼接出来的同步串 格式: channelID:channelType:last_msg_seq|channelID:channelType:last_msg_seq (此字段非必填,如果不填就获取全量数据,填写了获取增量数据,看你自己的需求。)
|
||||||
"msg_count": 20 // 每个会话获取最大的消息数量,一般为app点进去第一屏的数据
|
"msg_count": 10 // 每个会话获取最大的消息数量,一般为app点进去第一屏的数据
|
||||||
});
|
});
|
||||||
WKSyncConversation conversation = WKSyncConversation();
|
WKSyncConversation conversation = WKSyncConversation();
|
||||||
conversation.conversations = [];
|
conversation.conversations = [];
|
||||||
|
@ -15,7 +15,8 @@ class UIMsg {
|
|||||||
if (wkMsg.wkMsgExtra != null) {
|
if (wkMsg.wkMsgExtra != null) {
|
||||||
readCount = wkMsg.wkMsgExtra!.readedCount;
|
readCount = wkMsg.wkMsgExtra!.readedCount;
|
||||||
}
|
}
|
||||||
return "${wkMsg.messageContent!.displayText()} [是否需要回执:${wkMsg.setting.receipt}],[已读数量:$readCount]";
|
return wkMsg.messageContent!.displayText();
|
||||||
|
// return "${wkMsg.messageContent!.displayText()} [是否需要回执:${wkMsg.setting.receipt}],[已读数量:$readCount]";
|
||||||
}
|
}
|
||||||
|
|
||||||
String getShowTime() {
|
String getShowTime() {
|
||||||
|
@ -499,7 +499,7 @@ packages:
|
|||||||
path: ".."
|
path: ".."
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "1.0.8"
|
version: "1.0.9"
|
||||||
x25519:
|
x25519:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -434,7 +434,7 @@ class MessaggeDB {
|
|||||||
Future<int> getDeletedCount(int minMessageSeq, int maxMessageSeq,
|
Future<int> getDeletedCount(int minMessageSeq, int maxMessageSeq,
|
||||||
String channelID, int channelType) async {
|
String channelID, int channelType) async {
|
||||||
String sql =
|
String sql =
|
||||||
"select count(*) num from ${WKDBConst.tableMessage} where channel_id=$channelID and channel_type=$channelType and message_seq>$minMessageSeq and message_seq<$maxMessageSeq and is_deleted=1";
|
"select count(*) num from ${WKDBConst.tableMessage} where channel_id='$channelID' and channel_type=$channelType and message_seq>$minMessageSeq and message_seq<$maxMessageSeq and is_deleted=1";
|
||||||
int num = 0;
|
int num = 0;
|
||||||
List<Map<String, Object?>> list =
|
List<Map<String, Object?>> list =
|
||||||
await WKDBHelper.shared.getDB().rawQuery(sql);
|
await WKDBHelper.shared.getDB().rawQuery(sql);
|
||||||
|
@ -39,6 +39,7 @@ class WKMsg {
|
|||||||
WKMessageContent? messageContent;
|
WKMessageContent? messageContent;
|
||||||
|
|
||||||
WKMsg() {
|
WKMsg() {
|
||||||
|
clientSeq = 0;
|
||||||
clientMsgNO = WKIM.shared.messageManager.generateClientMsgNo();
|
clientMsgNO = WKIM.shared.messageManager.generateClientMsgNo();
|
||||||
timestamp = (DateTime.now().millisecondsSinceEpoch / 1000).truncate();
|
timestamp = (DateTime.now().millisecondsSinceEpoch / 1000).truncate();
|
||||||
}
|
}
|
||||||
|
@ -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.8
|
version: 1.0.9
|
||||||
homepage: https://github.com/WuKongIM/WuKongIMFlutterSDK
|
homepage: https://github.com/WuKongIM/WuKongIMFlutterSDK
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user