fix: Optimization of loading channel messages without the latest messages and multiple synchronization issues

This commit is contained in:
SL 2024-02-28 17:28:52 +08:00
parent e57a9a505c
commit 3900a39b66
5 changed files with 12 additions and 3 deletions

View File

@ -64,3 +64,5 @@
* fix: synchronization channel message multiple synchronization issue * fix: synchronization channel message multiple synchronization issue
### 1.3.2 ### 1.3.2
* fix: Optimization of loading channel messages without the latest messages and multiple synchronization issues * fix: Optimization of loading channel messages without the latest messages and multiple synchronization issues
### 1.3.3
* fix: Optimization of loading channel messages without the latest messages and multiple synchronization issues

View File

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

View File

@ -80,6 +80,7 @@ class HttpUtils {
int pullMode, int pullMode,
Function(WKSyncChannelMsg) back) async { Function(WKSyncChannelMsg) back) async {
final dio = Dio(); final dio = Dio();
print('同不消息');
final response = await dio.post('$apiURL/channel/messagesync', data: { final response = await dio.post('$apiURL/channel/messagesync', data: {
"login_uid": UserInfo.uid, // uid "login_uid": UserInfo.uid, // uid
"channel_id": channelID, // ID "channel_id": channelID, // ID

View File

@ -308,6 +308,7 @@ class MessageDB {
} }
var requestCount = 0; var requestCount = 0;
var isMore = 1;
void getOrSyncHistoryMessages( void getOrSyncHistoryMessages(
String channelId, String channelId,
int channelType, int channelType,
@ -359,7 +360,9 @@ class MessageDB {
} else { } else {
oldestMsgSeq = oldestOrderSeq ~/ 1000; oldestMsgSeq = oldestOrderSeq ~/ 1000;
} }
if (oldestMsgSeq == 1) { if (oldestMsgSeq == 1 || isMore == 0) {
isMore = 1;
requestCount = 0;
iGetOrSyncHistoryMsgBack(list); iGetOrSyncHistoryMsgBack(list);
return; return;
} }
@ -460,15 +463,18 @@ class MessageDB {
if (syncChannelMsg != null && if (syncChannelMsg != null &&
syncChannelMsg.messages != null && syncChannelMsg.messages != null &&
syncChannelMsg.messages!.isNotEmpty) { syncChannelMsg.messages!.isNotEmpty) {
isMore = syncChannelMsg.more;
getOrSyncHistoryMessages(channelId, channelType, oldestOrderSeq, getOrSyncHistoryMessages(channelId, channelType, oldestOrderSeq,
contain, pullMode, limit, iGetOrSyncHistoryMsgBack, syncBack); contain, pullMode, limit, iGetOrSyncHistoryMsgBack, syncBack);
} else { } else {
requestCount = 0; requestCount = 0;
isMore = 1;
iGetOrSyncHistoryMsgBack(list); iGetOrSyncHistoryMsgBack(list);
} }
}); });
} else { } else {
requestCount = 0; requestCount = 0;
isMore = 1;
iGetOrSyncHistoryMsgBack(list); iGetOrSyncHistoryMsgBack(list);
} }
} }

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.3.2 version: 1.3.3
homepage: https://github.com/WuKongIM/WuKongIMFlutterSDK homepage: https://github.com/WuKongIM/WuKongIMFlutterSDK
environment: environment: