Open TheAnh188 opened 1 day ago
@override void onInit() { super.onInit(); _setMessageListener(); } void _setMessageListener() { openim.OnAdvancedMsgListener advancedMsgListener = openim.OnAdvancedMsgListener( onRecvNewMessage: (message) async { print('Da nhan tin nhan : 1 ' + message.textElem!.content!); _handleIncomingMessage(message); }, onRecvOfflineNewMessage: (message) async { print('Da nhan tin nhan : 2 ' + message.textElem!.content!); _handleIncomingMessage(message); }, onRecvOnlineOnlyMessage: (message) async { print('Da nhan tin nhan : 3 ' + message.textElem!.content!); _handleIncomingMessage(message); }, onMsgDeleted: (message) { print('Da nhan tin nhan : 4 ' + message.textElem!.content!); messages.removeWhere( (chatMessage) => chatMessage.getId == message.clientMsgID); }, onNewRecvMessageRevoked: (info) { print('Da nhan tin nhan : 5 ' + info.revokeTime.toString()); messages.removeWhere( (chatMessage) => chatMessage.getId == info.clientMsgID); }, //Xử lý trường hợp đối phương đã đọc tin nhắn onRecvC2CReadReceipt: (list) { print('Da nhan tin nhan : 6 ' + list.first.userID!); _handleReadReceipts(list); }, ); openim.OpenIM.iMManager.messageManager .setAdvancedMsgListener(advancedMsgListener); }
flutter_openim_sdk 3.8.1+2
@override void onInit() { super.onInit(); _setMessageListener(); } void _setMessageListener() { openim.OnAdvancedMsgListener advancedMsgListener = openim.OnAdvancedMsgListener( onRecvNewMessage: (message) async { print('Da nhan tin nhan : 1 ' + message.textElem!.content!); _handleIncomingMessage(message); }, onRecvOfflineNewMessage: (message) async { print('Da nhan tin nhan : 2 ' + message.textElem!.content!); _handleIncomingMessage(message); }, onRecvOnlineOnlyMessage: (message) async { print('Da nhan tin nhan : 3 ' + message.textElem!.content!); _handleIncomingMessage(message); }, onMsgDeleted: (message) { print('Da nhan tin nhan : 4 ' + message.textElem!.content!); messages.removeWhere( (chatMessage) => chatMessage.getId == message.clientMsgID); }, onNewRecvMessageRevoked: (info) { print('Da nhan tin nhan : 5 ' + info.revokeTime.toString()); messages.removeWhere( (chatMessage) => chatMessage.getId == info.clientMsgID); }, //Xử lý trường hợp đối phương đã đọc tin nhắn onRecvC2CReadReceipt: (list) { print('Da nhan tin nhan : 6 ' + list.first.userID!); _handleReadReceipts(list); }, ); openim.OpenIM.iMManager.messageManager .setAdvancedMsgListener(advancedMsgListener); }