fix: Compatibility message extension editing content is empty, parsing error issue

This commit is contained in:
SL 2024-09-13 14:51:57 +08:00
parent b5d6723950
commit 5a61be1b94
6 changed files with 77 additions and 11 deletions

View File

@ -103,4 +103,6 @@
### 1.5.1
* fix: Add connection ack and return nodeId
### 1.5.2
* fix: Add search channel and message method
* fix: Add search channel and message method
### 1.5.3
* fix: Compatibility message extension editing content is empty, parsing error issue

View File

@ -319,9 +319,12 @@ class ChatListDataState extends State<ChatList> {
'清空记录',
style: TextStyle(color: Color.fromARGB(255, 4, 80, 194)),
),
onPressed: () {
WKIM.shared.messageManager
.clearWithChannel(channelID, channelType);
onPressed: () async {
var v = await WKIM.shared.messageManager
.getMaxExtraVersionWithChannel(channelID, channelType);
print(v);
// WKIM.shared.messageManager
// .clearWithChannel(channelID, channelType);
}),
],
),
@ -360,7 +363,23 @@ class ChatListDataState extends State<ChatList> {
),
MaterialButton(
onPressed: () {
getLast();
WKMsgExtra extra = WKMsgExtra();
extra.messageID = "112";
extra.channelID = channelID;
extra.channelType = channelType;
extra.readed = 1;
extra.extraVersion = 100871;
List<WKMsgExtra> list = [];
list.add(extra);
WKMsgExtra extra1 = WKMsgExtra();
extra1.messageID = "1122";
extra1.channelID = channelID;
extra1.channelType = channelType;
extra1.readed = 1;
extra1.extraVersion = 100872;
list.add(extra1);
WKIM.shared.messageManager.saveRemoteExtraMsg(list);
// getLast();
},
color: Colors.brown,
child:

View File

@ -2,6 +2,7 @@ import 'dart:convert';
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:dio/io.dart';
import 'package:example/const.dart';
import 'package:wukongimfluttersdk/entity/conversation.dart';
import 'package:wukongimfluttersdk/entity/msg.dart';
@ -10,7 +11,17 @@ class HttpUtils {
static String apiURL = "https://api.githubim.com";
static Future<int> login(String uid, String token) async {
final httpClient = HttpClient();
httpClient.badCertificateCallback =
(X509Certificate cert, String host, int port) {
//
return true;
};
final dio = Dio();
dio.httpClientAdapter = DefaultHttpClientAdapter()
..onHttpClientCreate = (client) {
return httpClient;
};
final response = await dio.post("$apiURL/user/token", data: {
'uid': uid,
'token': token,
@ -21,7 +32,17 @@ class HttpUtils {
}
static Future<String> getIP() async {
final httpClient = HttpClient();
httpClient.badCertificateCallback =
(X509Certificate cert, String host, int port) {
//
return true;
};
final dio = Dio();
dio.httpClientAdapter = DefaultHttpClientAdapter()
..onHttpClientCreate = (client) {
return httpClient;
};
String ip = '';
final response = await dio.get('$apiURL/route');
if (response.statusCode == HttpStatus.ok) {
@ -32,7 +53,17 @@ class HttpUtils {
static syncConversation(String lastSsgSeqs, int msgCount, int version,
Function(WKSyncConversation) back) async {
final httpClient = HttpClient();
httpClient.badCertificateCallback =
(X509Certificate cert, String host, int port) {
//
return true;
};
final dio = Dio();
dio.httpClientAdapter = DefaultHttpClientAdapter()
..onHttpClientCreate = (client) {
return httpClient;
};
final response = await dio.post('$apiURL/conversation/sync', data: {
"uid": UserInfo.uid, // uid
"version": version, // (version0)
@ -84,7 +115,17 @@ class HttpUtils {
int limit,
int pullMode,
Function(WKSyncChannelMsg) back) async {
final httpClient = HttpClient();
httpClient.badCertificateCallback =
(X509Certificate cert, String host, int port) {
//
return true;
};
final dio = Dio();
dio.httpClientAdapter = DefaultHttpClientAdapter()
..onHttpClientCreate = (client) {
return httpClient;
};
final response = await dio.post('$apiURL/channel/messagesync', data: {
"login_uid": UserInfo.uid, // uid
"channel_id": channelID, // ID

View File

@ -114,7 +114,7 @@ class ChannelDB {
Future<List<WKChannelSearchResult>> search(String keyword) async {
List<WKChannelSearchResult> list = [];
var sql =
"select t.*,cm.member_name,cm.member_remark from (select ${WKDBConst.tableChannel}.*,max( ${WKDBConst.tableChannelMember}.id) mid from ${WKDBConst.tableChannel}, ${WKDBConst.tableChannelMember} where ${WKDBConst.tableChannel}.channel_id=${WKDBConst.tableChannelMember}.channel_id and ${WKDBConst.tableChannel}.channel_type=${WKDBConst.tableChannelMember}.channel_type and (${WKDBConst.tableChannel}.channel_name like ? or ${WKDBConst.tableChannel}.channel_remark like ? or ${WKDBConst.tableChannelMember}.member_name like ? or ${WKDBConst.tableChannelMember}.member_remark like ?) group by ${WKDBConst.tableChannel}.channel_id,${WKDBConst.tableChannel}.channel_type) t,${WKDBConst.tableChannelMember} cm where t.channel_id=cm.channel_id and t.channel_type=cm.channel_type and t.mid=cm.id";
"select t.*,cm.member_name,cm.member_remark from (select ${WKDBConst.tableChannel}.*,max(${WKDBConst.tableChannelMember}.id) mid from ${WKDBConst.tableChannel}, ${WKDBConst.tableChannelMember} where ${WKDBConst.tableChannel}.channel_id=${WKDBConst.tableChannelMember}.channel_id and ${WKDBConst.tableChannel}.channel_type=${WKDBConst.tableChannelMember}.channel_type and (${WKDBConst.tableChannel}.channel_name like ? or ${WKDBConst.tableChannel}.channel_remark like ? or ${WKDBConst.tableChannelMember}.member_name like ? or ${WKDBConst.tableChannelMember}.member_remark like ?) group by ${WKDBConst.tableChannel}.channel_id,${WKDBConst.tableChannel}.channel_type) t,${WKDBConst.tableChannelMember} cm where t.channel_id=cm.channel_id and t.channel_type=cm.channel_type and t.mid=cm.id";
List<Map<String, Object?>> results = await WKDBHelper.shared
.getDB()!
.rawQuery(

View File

@ -51,13 +51,17 @@ class WKDBConst {
msg.localExtraMap = readDynamic(data, 'extra');
if (msg.content != '') {
dynamic contentJson = jsonDecode(msg.content);
msg.messageContent = WKIM.shared.messageManager
.getMessageModel(msg.contentType, contentJson);
if (contentJson != null && contentJson != '') {
msg.messageContent = WKIM.shared.messageManager
.getMessageModel(msg.contentType, contentJson);
}
}
if (msg.wkMsgExtra!.contentEdit != '') {
dynamic json = jsonDecode(msg.wkMsgExtra!.contentEdit);
msg.wkMsgExtra!.messageContent = WKIM.shared.messageManager
.getMessageModel(WkMessageContentType.text, json);
if (json != null && json != '') {
msg.wkMsgExtra!.messageContent = WKIM.shared.messageManager
.getMessageModel(WkMessageContentType.text, json);
}
}
return msg;

View File

@ -15,7 +15,7 @@ description: wukong IM flutter sdk
# 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
# of the product and file versions while build-number is used as the build suffix.
version: 1.5.2
version: 1.5.3
homepage: https://github.com/WuKongIM/WuKongIMFlutterSDK
environment: