mirror of
https://github.com/WuKongIM/WuKongIMFlutterSDK
synced 2025-05-30 15:37:25 +00:00
fix:Add send message can reminder member method
This commit is contained in:
parent
1ea17b9cdb
commit
0398d2b015
@ -71,4 +71,6 @@
|
|||||||
### 1.3.5
|
### 1.3.5
|
||||||
* fix: Add clear channel messages method
|
* fix: Add clear channel messages method
|
||||||
### 1.3.6
|
### 1.3.6
|
||||||
* fix: Add clear all channel red dots method
|
* fix: Add clear all channel red dots method
|
||||||
|
### 1.3.7
|
||||||
|
* fix: Add send message can reminder member method
|
@ -9,7 +9,7 @@
|
|||||||
#### 安装
|
#### 安装
|
||||||
```
|
```
|
||||||
dependencies:
|
dependencies:
|
||||||
wukongimfluttersdk: ^1.3.6
|
wukongimfluttersdk: ^1.3.7
|
||||||
```
|
```
|
||||||
#### 引入
|
#### 引入
|
||||||
```dart
|
```dart
|
||||||
|
@ -151,6 +151,7 @@ class ChatListDataState extends State<ChatList> {
|
|||||||
oldestOrderSeq, oldestOrderSeq == 0, pullMode, 10, 0, (list) {
|
oldestOrderSeq, oldestOrderSeq == 0, pullMode, 10, 0, (list) {
|
||||||
List<UIMsg> uiList = [];
|
List<UIMsg> uiList = [];
|
||||||
for (int i = 0; i < list.length; i++) {
|
for (int i = 0; i < list.length; i++) {
|
||||||
|
print(list[i].content);
|
||||||
if (pullMode == 0 && !isReset) {
|
if (pullMode == 0 && !isReset) {
|
||||||
uiList.add(UIMsg(list[i]));
|
uiList.add(UIMsg(list[i]));
|
||||||
// msgList.insert(0, UIMsg(list[i]));
|
// msgList.insert(0, UIMsg(list[i]));
|
||||||
@ -368,6 +369,7 @@ class ChatListDataState extends State<ChatList> {
|
|||||||
_textEditingController.text = '';
|
_textEditingController.text = '';
|
||||||
Setting setting = Setting();
|
Setting setting = Setting();
|
||||||
setting.receipt = 1; //开启回执
|
setting.receipt = 1; //开启回执
|
||||||
|
// 回复
|
||||||
WKTextContent text = WKTextContent(content);
|
WKTextContent text = WKTextContent(content);
|
||||||
WKReply reply = WKReply();
|
WKReply reply = WKReply();
|
||||||
reply.messageId = "11";
|
reply.messageId = "11";
|
||||||
@ -377,6 +379,7 @@ class ChatListDataState extends State<ChatList> {
|
|||||||
WKTextContent payloadText = WKTextContent("dds");
|
WKTextContent payloadText = WKTextContent("dds");
|
||||||
reply.payload = payloadText;
|
reply.payload = payloadText;
|
||||||
text.reply = reply;
|
text.reply = reply;
|
||||||
|
// 标记
|
||||||
List<WKMsgEntity> list = [];
|
List<WKMsgEntity> list = [];
|
||||||
WKMsgEntity entity = WKMsgEntity();
|
WKMsgEntity entity = WKMsgEntity();
|
||||||
entity.offset = 0;
|
entity.offset = 0;
|
||||||
@ -384,6 +387,11 @@ class ChatListDataState extends State<ChatList> {
|
|||||||
entity.length = 1;
|
entity.length = 1;
|
||||||
list.add(entity);
|
list.add(entity);
|
||||||
text.entities = list;
|
text.entities = list;
|
||||||
|
// 艾特
|
||||||
|
WKMentionInfo mentionInfo = WKMentionInfo();
|
||||||
|
mentionInfo.mentionAll = true;
|
||||||
|
mentionInfo.uids = ['uid_1', 'uid_2'];
|
||||||
|
text.mentionInfo = mentionInfo;
|
||||||
// CustomMsg customMsg = CustomMsg(content);
|
// CustomMsg customMsg = CustomMsg(content);
|
||||||
WKIM.shared.messageManager.sendMessageWithSetting(
|
WKIM.shared.messageManager.sendMessageWithSetting(
|
||||||
text, WKChannel(channelID, channelType), setting);
|
text, WKChannel(channelID, channelType), setting);
|
||||||
|
@ -4,6 +4,7 @@ class UIConversation {
|
|||||||
String lastContent = '';
|
String lastContent = '';
|
||||||
String channelAvatar = '';
|
String channelAvatar = '';
|
||||||
String channelName = '';
|
String channelName = '';
|
||||||
|
int isMentionMe = 0;
|
||||||
WKUIConversationMsg msg;
|
WKUIConversationMsg msg;
|
||||||
UIConversation(this.msg);
|
UIConversation(this.msg);
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import 'package:example/const.dart';
|
import 'package:example/const.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:wukongimfluttersdk/entity/conversation.dart';
|
import 'package:wukongimfluttersdk/entity/conversation.dart';
|
||||||
|
import 'package:wukongimfluttersdk/entity/reminder.dart';
|
||||||
import 'package:wukongimfluttersdk/type/const.dart';
|
import 'package:wukongimfluttersdk/type/const.dart';
|
||||||
import 'package:wukongimfluttersdk/wkim.dart';
|
import 'package:wukongimfluttersdk/wkim.dart';
|
||||||
|
|
||||||
@ -127,6 +128,28 @@ class ListViewShowDataState extends State<ListViewShowData> {
|
|||||||
return uiConversation.lastContent;
|
return uiConversation.lastContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getReminderText(UIConversation uiConversation) {
|
||||||
|
String content = "";
|
||||||
|
if (uiConversation.isMentionMe == 0) {
|
||||||
|
uiConversation.msg.getReminderList().then((value) {
|
||||||
|
if (value != null && value.isNotEmpty) {
|
||||||
|
for (var i = 0; i < value.length; i++) {
|
||||||
|
if (value[i].type == WKMentionType.wkReminderTypeMentionMe &&
|
||||||
|
value[i].done == 0) {
|
||||||
|
content = value[i].data;
|
||||||
|
uiConversation.isMentionMe = 1;
|
||||||
|
setState(() {});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
content = "[有人@你]";
|
||||||
|
}
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
String getChannelAvatarURL(UIConversation uiConversation) {
|
String getChannelAvatarURL(UIConversation uiConversation) {
|
||||||
if (uiConversation.channelAvatar == '') {
|
if (uiConversation.channelAvatar == '') {
|
||||||
uiConversation.msg.getWkChannel().then((channel) {
|
uiConversation.msg.getWkChannel().then((channel) {
|
||||||
@ -207,6 +230,13 @@ class ListViewShowDataState extends State<ListViewShowData> {
|
|||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
|
Text(
|
||||||
|
getReminderText(uiMsg),
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Color.fromARGB(255, 247, 2, 2),
|
||||||
|
fontSize: 14),
|
||||||
|
maxLines: 1,
|
||||||
|
),
|
||||||
Text(
|
Text(
|
||||||
getShowContent(uiMsg),
|
getShowContent(uiMsg),
|
||||||
style:
|
style:
|
||||||
@ -245,7 +275,7 @@ class ListViewShowDataState extends State<ListViewShowData> {
|
|||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => ChatPage(),
|
builder: (context) => const ChatPage(),
|
||||||
settings: RouteSettings(
|
settings: RouteSettings(
|
||||||
arguments: ChatChannel(
|
arguments: ChatChannel(
|
||||||
msgList[pos].msg.channelID,
|
msgList[pos].msg.channelID,
|
||||||
@ -274,7 +304,35 @@ class ListViewShowDataState extends State<ListViewShowData> {
|
|||||||
WKIM.shared.conversationManager.clearAllRedDot();
|
WKIM.shared.conversationManager.clearAllRedDot();
|
||||||
},
|
},
|
||||||
child: const Text(
|
child: const Text(
|
||||||
'清除所有未读',
|
'清除未读',
|
||||||
|
style: TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: const Color.fromARGB(255, 240, 2, 133),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
if (msgList.isEmpty) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<WKReminder> list = [];
|
||||||
|
WKReminder reminder = WKReminder();
|
||||||
|
reminder.needUpload = 0;
|
||||||
|
reminder.type = WKMentionType.wkReminderTypeMentionMe;
|
||||||
|
reminder.data = '[有人@你]';
|
||||||
|
reminder.done = 0;
|
||||||
|
reminder.reminderID = 11;
|
||||||
|
reminder.version = 1;
|
||||||
|
reminder.publisher = "uid_1";
|
||||||
|
reminder.channelID = msgList[0].msg.channelID;
|
||||||
|
reminder.channelType = msgList[0].msg.channelType;
|
||||||
|
list.add(reminder);
|
||||||
|
WKIM.shared.reminderManager.saveOrUpdateReminders(list);
|
||||||
|
},
|
||||||
|
child: const Text(
|
||||||
|
'提醒项',
|
||||||
style: TextStyle(color: Colors.white),
|
style: TextStyle(color: Colors.white),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -286,7 +344,7 @@ class ListViewShowDataState extends State<ListViewShowData> {
|
|||||||
WKIM.shared.connectionManager.disconnect(false);
|
WKIM.shared.connectionManager.disconnect(false);
|
||||||
},
|
},
|
||||||
child: const Text(
|
child: const Text(
|
||||||
'断开连接',
|
'断开',
|
||||||
style: TextStyle(color: Colors.white),
|
style: TextStyle(color: Colors.white),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -225,7 +225,7 @@ class WKDBConst {
|
|||||||
reminder.version = readInt(data, 'version');
|
reminder.version = readInt(data, 'version');
|
||||||
reminder.done = readInt(data, 'done');
|
reminder.done = readInt(data, 'done');
|
||||||
String data1 = readString(data, 'data');
|
String data1 = readString(data, 'data');
|
||||||
reminder.needUpload = readInt(data, 'needUpload');
|
reminder.needUpload = readInt(data, 'need_upload');
|
||||||
reminder.publisher = readString(data, 'publisher');
|
reminder.publisher = readString(data, 'publisher');
|
||||||
if (data1 != '') {
|
if (data1 != '') {
|
||||||
reminder.data = jsonDecode(data1);
|
reminder.data = jsonDecode(data1);
|
||||||
|
@ -177,7 +177,7 @@ class ReminderDB {
|
|||||||
map['text'] = reminder.text;
|
map['text'] = reminder.text;
|
||||||
map['version'] = reminder.version;
|
map['version'] = reminder.version;
|
||||||
map['done'] = reminder.done;
|
map['done'] = reminder.done;
|
||||||
map['needUpload'] = reminder.needUpload;
|
map['need_upload'] = reminder.needUpload;
|
||||||
map['publisher'] = reminder.publisher;
|
map['publisher'] = reminder.publisher;
|
||||||
if (reminder.data != null) {
|
if (reminder.data != null) {
|
||||||
map['data'] = jsonEncode(reminder.data);
|
map['data'] = jsonEncode(reminder.data);
|
||||||
|
@ -286,3 +286,9 @@ class WKSyncChannelMsg {
|
|||||||
int more = 0;
|
int more = 0;
|
||||||
List<WKSyncMsg>? messages = [];
|
List<WKSyncMsg>? messages = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class WKMentionInfo {
|
||||||
|
bool isMentionMe = false;
|
||||||
|
bool mentionAll = false;
|
||||||
|
List<String>? uids;
|
||||||
|
}
|
||||||
|
@ -14,3 +14,10 @@ class WKReminder {
|
|||||||
int needUpload = 0;
|
int needUpload = 0;
|
||||||
String publisher = '';
|
String publisher = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class WKMentionType {
|
||||||
|
//有人@我
|
||||||
|
static const int wkReminderTypeMentionMe = 1;
|
||||||
|
//申请加群
|
||||||
|
static const int wkApplyJoinGroupApprove = 2;
|
||||||
|
}
|
||||||
|
@ -81,6 +81,28 @@ class WKMessageManager {
|
|||||||
}
|
}
|
||||||
content.entities = list;
|
content.entities = list;
|
||||||
}
|
}
|
||||||
|
// 解析艾特
|
||||||
|
var mentionJson = json['mention'];
|
||||||
|
if (mentionJson != null) {
|
||||||
|
var mentionInfo = WKMentionInfo();
|
||||||
|
var mentionAll = WKDBConst.readInt(mentionJson, 'all');
|
||||||
|
var uidList = mentionJson['uids'];
|
||||||
|
if (uidList != null) {
|
||||||
|
List<String> uids = [];
|
||||||
|
for (var uid in uidList) {
|
||||||
|
uids.add(uid);
|
||||||
|
if (uid == WKIM.shared.options.uid) {
|
||||||
|
mentionInfo.isMentionMe = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mentionInfo.uids = uids;
|
||||||
|
}
|
||||||
|
if (mentionAll == 1) {
|
||||||
|
mentionInfo.mentionAll = true;
|
||||||
|
mentionInfo.isMentionMe = true;
|
||||||
|
}
|
||||||
|
content.mentionInfo = mentionInfo;
|
||||||
|
}
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -617,6 +639,22 @@ class WKMessageManager {
|
|||||||
}
|
}
|
||||||
json['entities'] = jsonArray;
|
json['entities'] = jsonArray;
|
||||||
}
|
}
|
||||||
|
// 解析艾特
|
||||||
|
if (wkMsg.messageContent!.mentionInfo != null) {
|
||||||
|
var mentionJson = {};
|
||||||
|
if (wkMsg.messageContent!.mentionInfo!.mentionAll) {
|
||||||
|
mentionJson['all'] = 1;
|
||||||
|
}
|
||||||
|
if (wkMsg.messageContent!.mentionInfo!.uids != null &&
|
||||||
|
wkMsg.messageContent!.mentionInfo!.uids!.isNotEmpty) {
|
||||||
|
var jsonArray = [];
|
||||||
|
for (String uid in wkMsg.messageContent!.mentionInfo!.uids!) {
|
||||||
|
jsonArray.add(uid);
|
||||||
|
}
|
||||||
|
mentionJson['uids'] = jsonArray;
|
||||||
|
}
|
||||||
|
json['mention'] = mentionJson;
|
||||||
|
}
|
||||||
return jsonEncode(json);
|
return jsonEncode(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ class WKMessageContent {
|
|||||||
String topicId = "";
|
String topicId = "";
|
||||||
WKReply? reply;
|
WKReply? reply;
|
||||||
List<WKMsgEntity>? entities;
|
List<WKMsgEntity>? entities;
|
||||||
|
WKMentionInfo? mentionInfo;
|
||||||
Map<String, dynamic> encodeJson() {
|
Map<String, dynamic> encodeJson() {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -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.6
|
version: 1.3.7
|
||||||
homepage: https://github.com/WuKongIM/WuKongIMFlutterSDK
|
homepage: https://github.com/WuKongIM/WuKongIMFlutterSDK
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user