mirror of
https://github.com/WuKongIM/WuKongIMAndroidSDK
synced 2025-06-03 23:58:19 +00:00
新增获取channel消息正在同步通知到UI功能
This commit is contained in:
parent
75d9dc8173
commit
4f3e435ab0
Binary file not shown.
@ -1 +1 @@
|
||||
6be2d9ec1b26667d621f57e2a291a074
|
||||
d53953cb6725f743bf1c49c7d0658ea8
|
@ -1 +1 @@
|
||||
a17ded59f323c4f09095f4203cbf7dcc07025da5
|
||||
17d75f193748861f66b61f20f9c54ebaa0b91262
|
@ -1 +1 @@
|
||||
5ea5cc3a46e2a3af3a2c2aa6868da5d8deddff4eb50bf2fe776d2ff7a28430bd
|
||||
4fa99bb7afb13d3d7ea538f606f657c6fd171694104086654248c6cfc0a27e98
|
@ -1 +1 @@
|
||||
81f68231418225581b0a4a5f8c9b9d97b4c99bc57d567fb2a1275b0884d9fbaa0b3d223ab6b64b3f6b450c484dcd46f0ed52966db28252fe193f86a760496054
|
||||
49c454767f6fffb22f4a0a12e4909d6cdc72063f1096c01d2dd9930d498bd3ad53a94d43198786e96d95b41f59a176fd5f33f78ef9d279086b52fb90b74cc597
|
@ -8,6 +8,6 @@
|
||||
<versions>
|
||||
<version>1.0.1</version>
|
||||
</versions>
|
||||
<lastUpdated>20230720075529</lastUpdated>
|
||||
<lastUpdated>20230721053224</lastUpdated>
|
||||
</versioning>
|
||||
</metadata>
|
||||
|
@ -1 +1 @@
|
||||
65f3905d05116a1ba2776ba0b236742e
|
||||
77e4620414ea04f13f5bd680d032b9ba
|
@ -1 +1 @@
|
||||
8d0196ef615d28b8806e3300083cd40f5e3306cb
|
||||
8da581777455276cd03006de20371472b7c357c2
|
@ -1 +1 @@
|
||||
47b453b1cda5a48515575d4b5b22bc71fbf9bec08218840108a58ddaa963be58
|
||||
b2d97befbbb89742a4ba5f19249abeed5055f8f2cbf62d903418bb5a6e21548b
|
@ -1 +1 @@
|
||||
1661c6ab616cdd0f4db6fa441a270e4b2581cbd2dddfd98132835e5646bd153717f7cd7f1fb9e3881ea3d23bae177d432631426b2a68add5029625a68d248519
|
||||
68c7e8e7ec1049cc8c01b01cb45ce41659d812e70b7b152779506e462760d68aa7b6c008723f3790804534e1039998af67606fe91f49f6d63b2d82a0a636b06f
|
@ -23,7 +23,6 @@ import com.xinbida.wukongim.interfaces.IGetOrSyncHistoryMsgBack;
|
||||
import com.xinbida.wukongim.manager.MsgManager;
|
||||
import com.xinbida.wukongim.message.type.WKSendMsgResult;
|
||||
import com.xinbida.wukongim.protocol.WKMessageContent;
|
||||
import com.xinbida.wukongim.utils.WKLoggerUtils;
|
||||
import com.xinbida.wukongim.utils.WKTypeUtils;
|
||||
|
||||
import org.json.JSONException;
|
||||
@ -65,7 +64,6 @@ public class MsgDbManager {
|
||||
for (int i = 0, size = list.size(); i < size; i++) {
|
||||
tempList.add(list.get(i));
|
||||
}
|
||||
WKLoggerUtils.getInstance().e("查询参数oldestOrderSeq:" + oldestOrderSeq + ",contain:" + contain + ",pullMode" + pullMode + ",limit:" + limit + ",查询到的总数:" + tempList.size());
|
||||
|
||||
//先通过message_seq排序
|
||||
if (tempList.size() > 0)
|
||||
@ -93,38 +91,39 @@ public class MsgDbManager {
|
||||
if (oldestOrderSeq % 1000 != 0)
|
||||
oldestMsgSeq = getMsgSeq(channelId, channelType, oldestOrderSeq, pullMode);
|
||||
else oldestMsgSeq = oldestOrderSeq / 1000;
|
||||
WKLoggerUtils.getInstance().e("计算出的最大seq:" + maxMessageSeq + "最小seq:" + minMessageSeq + "及oldestMsgSeq:" + oldestMsgSeq);
|
||||
if (pullMode == 0) {
|
||||
//下拉获取消息
|
||||
if (maxMessageSeq != 0 && oldestMsgSeq != 0) {
|
||||
if (maxMessageSeq != 0 && oldestMsgSeq != 0 && oldestMsgSeq - maxMessageSeq > 1) {
|
||||
isSyncMsg = true;
|
||||
startMsgSeq = oldestMsgSeq;
|
||||
endMsgSeq = maxMessageSeq;
|
||||
// 从大往小同步
|
||||
if (oldestMsgSeq - maxMessageSeq > 1) {
|
||||
startMsgSeq = oldestMsgSeq;
|
||||
endMsgSeq = maxMessageSeq;
|
||||
} else {
|
||||
startMsgSeq = maxMessageSeq;
|
||||
endMsgSeq = oldestMsgSeq;
|
||||
}
|
||||
// if (oldestMsgSeq - maxMessageSeq > 1) {
|
||||
// startMsgSeq = oldestMsgSeq;
|
||||
// endMsgSeq = maxMessageSeq;
|
||||
// } else {
|
||||
// startMsgSeq = maxMessageSeq;
|
||||
// endMsgSeq = oldestMsgSeq;
|
||||
// }
|
||||
|
||||
}
|
||||
} else {
|
||||
//上拉获取消息
|
||||
if (minMessageSeq != 0 && oldestMsgSeq != 0) {
|
||||
if (minMessageSeq != 0 && oldestMsgSeq != 0 && minMessageSeq - oldestMsgSeq > 1) {
|
||||
isSyncMsg = true;
|
||||
startMsgSeq = oldestMsgSeq;
|
||||
endMsgSeq = minMessageSeq;
|
||||
// 从小往大同步
|
||||
if (minMessageSeq - oldestMsgSeq > 1) {
|
||||
startMsgSeq = oldestMsgSeq;
|
||||
endMsgSeq = minMessageSeq;
|
||||
} else {
|
||||
startMsgSeq = minMessageSeq;
|
||||
endMsgSeq = oldestMsgSeq;
|
||||
}
|
||||
// if (minMessageSeq - oldestMsgSeq > 1) {
|
||||
// startMsgSeq = oldestMsgSeq;
|
||||
// endMsgSeq = minMessageSeq;
|
||||
// } else {
|
||||
// startMsgSeq = minMessageSeq;
|
||||
// endMsgSeq = oldestMsgSeq;
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
WKLoggerUtils.getInstance().e("第一次计算同步信息isSyncMsg:" + isSyncMsg + "最大seq:" + maxMessageSeq + ",最小seq:" + minMessageSeq + "及oldestMsgSeq:" + oldestMsgSeq);
|
||||
|
||||
if (!isSyncMsg) {
|
||||
//判断当前页是否连续
|
||||
for (int i = 0, size = tempList.size(); i < size; i++) {
|
||||
@ -156,7 +155,6 @@ public class MsgDbManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
WKLoggerUtils.getInstance().e("判断连续性同步信息isSyncMsg:" + isSyncMsg + "最大seq:" + maxMessageSeq + ",最小seq:" + minMessageSeq + "及oldestMsgSeq:" + oldestMsgSeq);
|
||||
|
||||
if (!isSyncMsg) {
|
||||
if (minMessageSeq == 1) {
|
||||
@ -179,9 +177,11 @@ public class MsgDbManager {
|
||||
endMsgSeq = 0;
|
||||
}
|
||||
}
|
||||
WKLoggerUtils.getInstance().e("计算本地消息总数小于limit后同步信息isSyncMsg:" + isSyncMsg + "最大seq:" + maxMessageSeq + ",最小seq:" + minMessageSeq + "及oldestMsgSeq:" + oldestMsgSeq);
|
||||
|
||||
if (isSyncMsg && startMsgSeq != endMsgSeq && requestCount < 5) {
|
||||
if (requestCount == 0) {
|
||||
iGetOrSyncHistoryMsgBack.onSyncing();
|
||||
}
|
||||
//同步消息
|
||||
requestCount++;
|
||||
MsgManager.getInstance().setSyncChannelMsgListener(channelId, channelType, startMsgSeq, endMsgSeq, limit, pullMode, syncChannelMsg -> {
|
||||
|
@ -10,5 +10,6 @@ import java.util.List;
|
||||
* 获取或同步消息返回
|
||||
*/
|
||||
public interface IGetOrSyncHistoryMsgBack {
|
||||
void onSyncing();
|
||||
void onResult(List<WKMsg> msgs);
|
||||
}
|
||||
|
@ -294,6 +294,7 @@ public class MsgManager extends BaseManager {
|
||||
if (aroundMsgOrderSeq != 0) {
|
||||
long maxMsgSeq = getMaxMessageSeq(channelId, channelType);
|
||||
long aroundMsgSeq = getOrNearbyMsgSeq(aroundMsgOrderSeq);
|
||||
|
||||
if (maxMsgSeq >= aroundMsgSeq && maxMsgSeq - aroundMsgSeq <= limit) {
|
||||
// 显示最后一页数据
|
||||
// oldestOrderSeq = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user