增加描述 - 宽展代码可读性
This commit is contained in:
parent
c88aa27015
commit
65d34fef4d
19
README.md
19
README.md
@ -11,6 +11,16 @@
|
|||||||
import 'package:wukongimfluttersdk/wkim.dart';
|
import 'package:wukongimfluttersdk/wkim.dart';
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**安装方式**
|
||||||
|
需要手动下载该项目到本地,注意:与你的开发项目在同一目录下
|
||||||
|
1. 打开pubspec
|
||||||
|
项目目录下找到 pubspec.yaml
|
||||||
|
2. 在 dependencies 中添加
|
||||||
|
```yaml
|
||||||
|
wukongimfluttersdk:
|
||||||
|
path: ../wkim/
|
||||||
|
```
|
||||||
|
|
||||||
**初始化sdk**
|
**初始化sdk**
|
||||||
```dart
|
```dart
|
||||||
WKIM.shared.setup(Options.newDefault('uid', 'token'));
|
WKIM.shared.setup(Options.newDefault('uid', 'token'));
|
||||||
@ -27,6 +37,7 @@ WKIM.shared.options.getAddr = (Function(String address) complete) async {
|
|||||||
```dart
|
```dart
|
||||||
WKIM.shared.connectionManager.connect();
|
WKIM.shared.connectionManager.connect();
|
||||||
```
|
```
|
||||||
|
|
||||||
**断开**
|
**断开**
|
||||||
```dart
|
```dart
|
||||||
// isLogout true:退出并不再重连 false:退出保持重连
|
// isLogout true:退出并不再重连 false:退出保持重连
|
||||||
@ -57,18 +68,21 @@ WKIM.shared.connectionManager.addOnConnectionStatus('home',
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
**消息入库**
|
**消息入库**
|
||||||
```dart
|
```dart
|
||||||
WKIM.shared.messageManager.addOnMsgInsertedListener((wkMsg) {
|
WKIM.shared.messageManager.addOnMsgInsertedListener((wkMsg) {
|
||||||
// todo 展示在UI上
|
// todo 展示在UI上
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
**收到新消息**
|
**收到新消息**
|
||||||
```dart
|
```dart
|
||||||
WKIM.shared.messageManager.addOnNewMsgListener('chat', (msgs) {
|
WKIM.shared.messageManager.addOnNewMsgListener('chat', (msgs) {
|
||||||
// todo 展示在UI上
|
// todo 展示在UI上
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
**刷新某条消息**
|
**刷新某条消息**
|
||||||
```dart
|
```dart
|
||||||
WKIM.shared.messageManager.addOnRefreshMsgListener('chat', (wkMsg) {
|
WKIM.shared.messageManager.addOnRefreshMsgListener('chat', (wkMsg) {
|
||||||
@ -82,6 +96,7 @@ WKIM.shared.cmdManager.addOnCmdListener('chat', (cmdMsg) {
|
|||||||
// todo 按需处理cmd消息
|
// todo 按需处理cmd消息
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
- 包含`key`的事件监听均有移除监听的方法,为了避免重复收到事件回掉,在退出或销毁页面时通过传入的`key`移除事件
|
- 包含`key`的事件监听均有移除监听的方法,为了避免重复收到事件回掉,在退出或销毁页面时通过传入的`key`移除事件
|
||||||
|
|
||||||
**发送消息时间**
|
**发送消息时间**
|
||||||
@ -100,8 +115,8 @@ ntp7.aliyun.com
|
|||||||
**Socket链接逻辑**
|
**Socket链接逻辑**
|
||||||
将socket链接分成两部分: (链接成功之前,链接成功之后)这里是根据是否有返回消息/结合onDone来判断
|
将socket链接分成两部分: (链接成功之前,链接成功之后)这里是根据是否有返回消息/结合onDone来判断
|
||||||
1.链接成功之前:(链接中)
|
1.链接成功之前:(链接中)
|
||||||
当前没有任何处理,链接不成功的话不回重复链接。
|
链接不成功 时 每隔5秒重新链接。即没有返回消息并且onDone触发时会触发 5秒 后断线重连
|
||||||
需求是 链接不成功 时 每隔1.5秒重新链接。
|
当 WKIM.shared.connectionManager.disconnect 时会清理掉计时器。
|
||||||
2.链接成功之后
|
2.链接成功之后
|
||||||
接首到消息返回,开启心跳检测/网络异常监听
|
接首到消息返回,开启心跳检测/网络异常监听
|
||||||
|
|
||||||
|
@ -1,49 +1,70 @@
|
|||||||
import '../type/const.dart';
|
import '../type/const.dart';
|
||||||
|
|
||||||
|
/// 频道
|
||||||
class WKChannel {
|
class WKChannel {
|
||||||
String channelID = "";
|
String channelID = "";
|
||||||
int channelType = WKChannelType.personal;
|
int channelType = WKChannelType.personal;
|
||||||
String channelName = "";
|
String channelName = "";
|
||||||
//频道备注(频道的备注名称,个人的话就是个人备注,群的话就是群别名)
|
|
||||||
|
/// 频道备注(频道的备注名称,个人的话就是个人备注,群的话就是群别名)
|
||||||
String channelRemark = "";
|
String channelRemark = "";
|
||||||
int showNick = 0;
|
int showNick = 0;
|
||||||
//是否置顶
|
|
||||||
|
/// 是否置顶
|
||||||
int top = 0;
|
int top = 0;
|
||||||
//是否保存在通讯录
|
|
||||||
|
/// 是否保存在通讯录
|
||||||
int save = 0;
|
int save = 0;
|
||||||
//免打扰
|
|
||||||
|
/// 免打扰
|
||||||
int mute = 0;
|
int mute = 0;
|
||||||
//禁言
|
|
||||||
|
/// 禁言
|
||||||
int forbidden = 0;
|
int forbidden = 0;
|
||||||
//邀请确认
|
|
||||||
|
/// 邀请确认
|
||||||
int invite = 0;
|
int invite = 0;
|
||||||
//频道状态[1:正常2:黑名单]
|
|
||||||
|
/// 频道状态[1:正常2:黑名单]
|
||||||
int status = 1;
|
int status = 1;
|
||||||
//是否已关注 0.未关注(陌生人) 1.已关注(好友)
|
|
||||||
|
/// 是否已关注 0.未关注(陌生人) 1.已关注(好友)
|
||||||
int follow = 0;
|
int follow = 0;
|
||||||
//是否删除
|
|
||||||
|
/// 是否删除
|
||||||
int isDeleted = 0;
|
int isDeleted = 0;
|
||||||
//创建时间
|
|
||||||
|
/// 创建时间
|
||||||
String createdAt = "";
|
String createdAt = "";
|
||||||
//修改时间
|
|
||||||
|
/// 修改时间
|
||||||
String updatedAt = "";
|
String updatedAt = "";
|
||||||
//频道头像
|
|
||||||
|
/// 频道头像
|
||||||
String avatar = "";
|
String avatar = "";
|
||||||
//版本
|
|
||||||
|
/// 版本
|
||||||
int version = 0;
|
int version = 0;
|
||||||
//扩展字段
|
|
||||||
|
/// 扩展字段
|
||||||
dynamic localExtra;
|
dynamic localExtra;
|
||||||
//是否在线
|
|
||||||
|
/// 是否在线
|
||||||
int online = 0;
|
int online = 0;
|
||||||
//最后一次离线时间
|
|
||||||
|
/// 最后一次离线时间
|
||||||
int lastOffline = 0;
|
int lastOffline = 0;
|
||||||
// 最后一次离线设备标识
|
|
||||||
|
/// 最后一次离线设备标识
|
||||||
int deviceFlag = 0;
|
int deviceFlag = 0;
|
||||||
//是否回执消息
|
|
||||||
|
/// 是否回执消息
|
||||||
int receipt = 0;
|
int receipt = 0;
|
||||||
// 机器人
|
|
||||||
|
/// 机器人
|
||||||
int robot = 0;
|
int robot = 0;
|
||||||
//分类[service:客服]
|
|
||||||
|
/// 分类[service:客服]
|
||||||
String category = "";
|
String category = "";
|
||||||
String username = "";
|
String username = "";
|
||||||
String avatarCacheKey = "";
|
String avatarCacheKey = "";
|
||||||
@ -53,8 +74,10 @@ class WKChannel {
|
|||||||
WKChannel(this.channelID, this.channelType);
|
WKChannel(this.channelID, this.channelType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 频道搜索结果
|
||||||
class WKChannelSearchResult {
|
class WKChannelSearchResult {
|
||||||
WKChannel? channel;
|
WKChannel? channel;
|
||||||
// 包含的成员名称
|
|
||||||
|
/// 包含的成员名称
|
||||||
String containMemberName = '';
|
String containMemberName = '';
|
||||||
}
|
}
|
||||||
|
@ -1,36 +1,53 @@
|
|||||||
|
/// 频道成员
|
||||||
class WKChannelMember {
|
class WKChannelMember {
|
||||||
String channelID = "";
|
String channelID = "";
|
||||||
//频道类型
|
|
||||||
|
/// 频道类型
|
||||||
int channelType = 0;
|
int channelType = 0;
|
||||||
//成员id
|
|
||||||
|
/// 成员id
|
||||||
String memberUID = "";
|
String memberUID = "";
|
||||||
//成员名称
|
|
||||||
|
/// 成员名称
|
||||||
String memberName = "";
|
String memberName = "";
|
||||||
//成员备注
|
|
||||||
|
/// 成员备注
|
||||||
String memberRemark = "";
|
String memberRemark = "";
|
||||||
//成员头像
|
|
||||||
|
/// 成员头像
|
||||||
String memberAvatar = "";
|
String memberAvatar = "";
|
||||||
//成员角色
|
|
||||||
|
/// 成员角色
|
||||||
int role = 0;
|
int role = 0;
|
||||||
//成员状态黑名单等1:正常2:黑名单
|
|
||||||
|
/// 成员状态黑名单等1:正常2:黑名单
|
||||||
int status = 0;
|
int status = 0;
|
||||||
//是否删除
|
|
||||||
|
/// 是否删除
|
||||||
int isDeleted = 0;
|
int isDeleted = 0;
|
||||||
//创建时间
|
|
||||||
|
/// 创建时间
|
||||||
String createdAt = "";
|
String createdAt = "";
|
||||||
//修改时间
|
|
||||||
|
/// 修改时间
|
||||||
String updatedAt = "";
|
String updatedAt = "";
|
||||||
//版本
|
|
||||||
|
/// 版本
|
||||||
int version = 0;
|
int version = 0;
|
||||||
// 机器人0否1是
|
|
||||||
|
/// 机器人0否1是
|
||||||
int robot = 0;
|
int robot = 0;
|
||||||
//扩展字段
|
|
||||||
|
/// 扩展字段
|
||||||
dynamic extraMap;
|
dynamic extraMap;
|
||||||
// 用户备注
|
|
||||||
|
/// 用户备注
|
||||||
String remark = "";
|
String remark = "";
|
||||||
// 邀请者uid
|
|
||||||
|
/// 邀请者uid
|
||||||
String memberInviteUID = "";
|
String memberInviteUID = "";
|
||||||
// 被禁言到期时间
|
|
||||||
|
/// 被禁言到期时间
|
||||||
int forbiddenExpirationTime = 0;
|
int forbiddenExpirationTime = 0;
|
||||||
String memberAvatarCacheKey = "";
|
String memberAvatarCacheKey = "";
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
|
/// 同步命令
|
||||||
class WkSyncCMD {
|
class WkSyncCMD {
|
||||||
String cmd = '';
|
String cmd = '';
|
||||||
dynamic param;
|
dynamic param;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 命令
|
||||||
class WKCMD {
|
class WKCMD {
|
||||||
String cmd = '';
|
String cmd = '';
|
||||||
dynamic param;
|
dynamic param;
|
||||||
|
@ -6,30 +6,40 @@ import 'cmd.dart';
|
|||||||
import 'msg.dart';
|
import 'msg.dart';
|
||||||
import 'reminder.dart';
|
import 'reminder.dart';
|
||||||
|
|
||||||
|
/// 会话消息
|
||||||
class WKConversationMsg {
|
class WKConversationMsg {
|
||||||
//频道id
|
/// 频道id
|
||||||
String channelID = '';
|
String channelID = '';
|
||||||
//频道类型
|
|
||||||
|
/// 频道类型
|
||||||
int channelType = WKChannelType.personal;
|
int channelType = WKChannelType.personal;
|
||||||
//最后一条消息本地ID
|
|
||||||
|
/// 最后一条消息本地ID
|
||||||
String lastClientMsgNO = '';
|
String lastClientMsgNO = '';
|
||||||
//是否删除
|
|
||||||
|
/// 是否删除
|
||||||
int isDeleted = 0;
|
int isDeleted = 0;
|
||||||
//服务器同步版本号
|
|
||||||
|
/// 服务器同步版本号
|
||||||
int version = 0;
|
int version = 0;
|
||||||
//最后一条消息时间
|
|
||||||
|
/// 最后一条消息时间
|
||||||
int lastMsgTimestamp = 0;
|
int lastMsgTimestamp = 0;
|
||||||
//未读消息数量
|
|
||||||
|
/// 未读消息数量
|
||||||
int unreadCount = 0;
|
int unreadCount = 0;
|
||||||
//最后一条消息序号
|
|
||||||
|
/// 最后一条消息序号
|
||||||
int lastMsgSeq = 0;
|
int lastMsgSeq = 0;
|
||||||
//扩展字段
|
|
||||||
|
/// 扩展字段
|
||||||
dynamic localExtraMap;
|
dynamic localExtraMap;
|
||||||
WKConversationMsgExtra? msgExtra;
|
WKConversationMsgExtra? msgExtra;
|
||||||
String parentChannelID = '';
|
String parentChannelID = '';
|
||||||
int parentChannelType = 0;
|
int parentChannelType = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 会话消息扩展
|
||||||
class WKConversationMsgExtra {
|
class WKConversationMsgExtra {
|
||||||
String channelID = '';
|
String channelID = '';
|
||||||
int channelType = 0;
|
int channelType = 0;
|
||||||
@ -41,26 +51,35 @@ class WKConversationMsgExtra {
|
|||||||
int draftUpdatedAt = 0;
|
int draftUpdatedAt = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 用户界面对话消息
|
||||||
class WKUIConversationMsg {
|
class WKUIConversationMsg {
|
||||||
int lastMsgSeq = 0;
|
int lastMsgSeq = 0;
|
||||||
String clientMsgNo = '';
|
String clientMsgNo = '';
|
||||||
//频道ID
|
|
||||||
|
/// 频道ID
|
||||||
String channelID = '';
|
String channelID = '';
|
||||||
//频道类型
|
|
||||||
|
/// 频道类型
|
||||||
int channelType = 0;
|
int channelType = 0;
|
||||||
//最后一条消息时间
|
|
||||||
|
/// 最后一条消息时间
|
||||||
int lastMsgTimestamp = 0;
|
int lastMsgTimestamp = 0;
|
||||||
//消息频道
|
|
||||||
|
/// 消息频道
|
||||||
WKChannel? _wkChannel;
|
WKChannel? _wkChannel;
|
||||||
//消息正文
|
|
||||||
|
/// 消息正文
|
||||||
WKMsg? _wkMsg;
|
WKMsg? _wkMsg;
|
||||||
//未读消息数量
|
|
||||||
|
/// 未读消息数量
|
||||||
int unreadCount = 0;
|
int unreadCount = 0;
|
||||||
int isDeleted = 0;
|
int isDeleted = 0;
|
||||||
WKConversationMsgExtra? _remoteMsgExtra;
|
WKConversationMsgExtra? _remoteMsgExtra;
|
||||||
//高亮内容[{type:1,text:'[有人@你]'}]
|
|
||||||
|
/// 高亮内容[{type:1,text:'[有人@你]'}]
|
||||||
List<WKReminder>? _reminderList;
|
List<WKReminder>? _reminderList;
|
||||||
//扩展字段
|
|
||||||
|
/// 扩展字段
|
||||||
dynamic localExtraMap;
|
dynamic localExtraMap;
|
||||||
String parentChannelID = '';
|
String parentChannelID = '';
|
||||||
int parentChannelType = 0;
|
int parentChannelType = 0;
|
||||||
@ -103,6 +122,7 @@ class WKUIConversationMsg {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 同步对话
|
||||||
class WKSyncConversation {
|
class WKSyncConversation {
|
||||||
int cmdVersion = 0;
|
int cmdVersion = 0;
|
||||||
List<WkSyncCMD>? cmds;
|
List<WkSyncCMD>? cmds;
|
||||||
@ -110,6 +130,7 @@ class WKSyncConversation {
|
|||||||
List<WKSyncConvMsg>? conversations;
|
List<WKSyncConvMsg>? conversations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 同步对话消息
|
||||||
class WKSyncConvMsg {
|
class WKSyncConvMsg {
|
||||||
String channelID = '';
|
String channelID = '';
|
||||||
int channelType = 0;
|
int channelType = 0;
|
||||||
|
@ -10,6 +10,7 @@ import '../type/const.dart';
|
|||||||
import 'channel.dart';
|
import 'channel.dart';
|
||||||
import 'channel_member.dart';
|
import 'channel_member.dart';
|
||||||
|
|
||||||
|
/// 消息
|
||||||
class WKMsg {
|
class WKMsg {
|
||||||
MessageHeader header = MessageHeader();
|
MessageHeader header = MessageHeader();
|
||||||
Setting setting = Setting();
|
Setting setting = Setting();
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/// 消息提醒
|
||||||
class WKReminder {
|
class WKReminder {
|
||||||
int reminderID = 0;
|
int reminderID = 0;
|
||||||
String messageID = '';
|
String messageID = '';
|
||||||
@ -15,6 +16,7 @@ class WKReminder {
|
|||||||
String publisher = '';
|
String publisher = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 提及类型
|
||||||
class WKMentionType {
|
class WKMentionType {
|
||||||
//有人@我
|
//有人@我
|
||||||
static const int wkReminderTypeMentionMe = 1;
|
static const int wkReminderTypeMentionMe = 1;
|
||||||
|
@ -7,27 +7,11 @@ void main() {
|
|||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
const MyApp({super.key});
|
const MyApp({super.key});
|
||||||
|
|
||||||
// This widget is the root of your application.
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: 'Flutter Demo',
|
title: 'Flutter Demo',
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
// This is the theme of your application.
|
|
||||||
//
|
|
||||||
// TRY THIS: Try running your application with "flutter run". You'll see
|
|
||||||
// the application has a blue toolbar. Then, without quitting the app,
|
|
||||||
// try changing the seedColor in the colorScheme below to Colors.green
|
|
||||||
// and then invoke "hot reload" (save your changes or press the "hot
|
|
||||||
// reload" button in a Flutter-supported IDE, or press "r" if you used
|
|
||||||
// the command line to start the app).
|
|
||||||
//
|
|
||||||
// Notice that the counter didn't reset back to zero; the application
|
|
||||||
// state is not lost during the reload. To reset the state, use hot
|
|
||||||
// restart instead.
|
|
||||||
//
|
|
||||||
// This works for code too, not just values: Most code changes can be
|
|
||||||
// tested with just a hot reload.
|
|
||||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
||||||
useMaterial3: true,
|
useMaterial3: true,
|
||||||
),
|
),
|
||||||
@ -38,16 +22,6 @@ class MyApp extends StatelessWidget {
|
|||||||
|
|
||||||
class MyHomePage extends StatefulWidget {
|
class MyHomePage extends StatefulWidget {
|
||||||
const MyHomePage({super.key, required this.title});
|
const MyHomePage({super.key, required this.title});
|
||||||
|
|
||||||
// This widget is the home page of your application. It is stateful, meaning
|
|
||||||
// that it has a State object (defined below) that contains fields that affect
|
|
||||||
// how it looks.
|
|
||||||
|
|
||||||
// This class is the configuration for the state. It holds the values (in this
|
|
||||||
// case the title) provided by the parent (in this case the App widget) and
|
|
||||||
// used by the build method of the State. Fields in a Widget subclass are
|
|
||||||
// always marked "final".
|
|
||||||
|
|
||||||
final String title;
|
final String title;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -59,50 +33,19 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
|
|
||||||
void _incrementCounter() {
|
void _incrementCounter() {
|
||||||
setState(() {
|
setState(() {
|
||||||
// This call to setState tells the Flutter framework that something has
|
|
||||||
// changed in this State, which causes it to rerun the build method below
|
|
||||||
// so that the display can reflect the updated values. If we changed
|
|
||||||
// _counter without calling setState(), then the build method would not be
|
|
||||||
// called again, and so nothing would appear to happen.
|
|
||||||
_counter++;
|
_counter++;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// This method is rerun every time setState is called, for instance as done
|
|
||||||
// by the _incrementCounter method above.
|
|
||||||
//
|
|
||||||
// The Flutter framework has been optimized to make rerunning build methods
|
|
||||||
// fast, so that you can just rebuild anything that needs updating rather
|
|
||||||
// than having to individually change instances of widgets.
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
// TRY THIS: Try changing the color here to a specific color (to
|
|
||||||
// Colors.amber, perhaps?) and trigger a hot reload to see the AppBar
|
|
||||||
// change color while the other colors stay the same.
|
|
||||||
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
||||||
// Here we take the value from the MyHomePage object that was created by
|
|
||||||
// the App.build method, and use it to set our appbar title.
|
|
||||||
title: Text(widget.title),
|
title: Text(widget.title),
|
||||||
),
|
),
|
||||||
body: Center(
|
body: Center(
|
||||||
// Center is a layout widget. It takes a single child and positions it
|
|
||||||
// in the middle of the parent.
|
|
||||||
child: Column(
|
child: Column(
|
||||||
// Column is also a layout widget. It takes a list of children and
|
|
||||||
// arranges them vertically. By default, it sizes itself to fit its
|
|
||||||
// children horizontally, and tries to be as tall as its parent.
|
|
||||||
//
|
|
||||||
// Column has various properties to control how it sizes itself and
|
|
||||||
// how it positions its children. Here we use mainAxisAlignment to
|
|
||||||
// center the children vertically; the main axis here is the vertical
|
|
||||||
// axis because Columns are vertical (the cross axis would be
|
|
||||||
// horizontal).
|
|
||||||
//
|
|
||||||
// TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint"
|
|
||||||
// action in the IDE, or press "p" in the console), to see the
|
|
||||||
// wireframe for each widget.
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
const Text(
|
const Text(
|
||||||
@ -119,7 +62,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
onPressed: _incrementCounter,
|
onPressed: _incrementCounter,
|
||||||
tooltip: 'Increment',
|
tooltip: 'Increment',
|
||||||
child: const Icon(Icons.add),
|
child: const Icon(Icons.add),
|
||||||
), // This trailing comma makes auto-formatting nicer for build methods.
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,13 +18,30 @@ import 'model/wk_card_content.dart';
|
|||||||
|
|
||||||
class WKIM {
|
class WKIM {
|
||||||
WKIM._privateConstructor();
|
WKIM._privateConstructor();
|
||||||
int deviceFlagApp = 0;
|
|
||||||
static final WKIM _instance = WKIM._privateConstructor();
|
static final WKIM _instance = WKIM._privateConstructor();
|
||||||
|
|
||||||
static WKIM get shared => _instance;
|
static WKIM get shared => _instance;
|
||||||
|
|
||||||
|
/// 设备标志应用程序
|
||||||
|
int deviceFlagApp = 0;
|
||||||
|
|
||||||
|
/// 使用选项设备标志
|
||||||
|
@Deprecated('Use Options deviceFlag')
|
||||||
|
void setDeviceFlag(int deviceFlag) {
|
||||||
|
deviceFlagApp = deviceFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 运行模式
|
||||||
Model runMode = Model.app;
|
Model runMode = Model.app;
|
||||||
|
|
||||||
|
/// 运行模式 - 是否是APP
|
||||||
|
bool isApp() {
|
||||||
|
return runMode == Model.app;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 配置
|
||||||
Options options = Options();
|
Options options = Options();
|
||||||
|
|
||||||
|
/// 设置配置
|
||||||
Future<bool> setup(Options opts) async {
|
Future<bool> setup(Options opts) async {
|
||||||
options = opts;
|
options = opts;
|
||||||
deviceFlagApp = opts.deviceFlag;
|
deviceFlagApp = opts.deviceFlag;
|
||||||
@ -39,6 +56,7 @@ class WKIM {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 初始化正常消息内容
|
||||||
_initNormalMsgContent() {
|
_initNormalMsgContent() {
|
||||||
messageManager.registerMsgContent(WkMessageContentType.text,
|
messageManager.registerMsgContent(WkMessageContentType.text,
|
||||||
(dynamic data) {
|
(dynamic data) {
|
||||||
@ -62,20 +80,24 @@ class WKIM {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Use Options deviceFlag')
|
/// 连接管理器
|
||||||
void setDeviceFlag(int deviceFlag) {
|
|
||||||
deviceFlagApp = deviceFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isApp() {
|
|
||||||
return runMode == Model.app;
|
|
||||||
}
|
|
||||||
|
|
||||||
WKWebConnectionManager connectionManager = WKWebConnectionManager.shared;
|
WKWebConnectionManager connectionManager = WKWebConnectionManager.shared;
|
||||||
|
|
||||||
|
/// 消息管理器
|
||||||
WKMessageManager messageManager = WKMessageManager.shared;
|
WKMessageManager messageManager = WKMessageManager.shared;
|
||||||
|
|
||||||
|
/// 会话管理器
|
||||||
WKConversationManager conversationManager = WKConversationManager.shared;
|
WKConversationManager conversationManager = WKConversationManager.shared;
|
||||||
|
|
||||||
|
/// 渠道经理
|
||||||
WKChannelManager channelManager = WKChannelManager.shared;
|
WKChannelManager channelManager = WKChannelManager.shared;
|
||||||
|
|
||||||
|
/// 渠道成员经理
|
||||||
WKChannelMemberManager channelMemberManager = WKChannelMemberManager.shared;
|
WKChannelMemberManager channelMemberManager = WKChannelMemberManager.shared;
|
||||||
|
|
||||||
|
/// 提醒管理器
|
||||||
WKReminderManager reminderManager = WKReminderManager.shared;
|
WKReminderManager reminderManager = WKReminderManager.shared;
|
||||||
|
|
||||||
|
/// 命令管理器
|
||||||
WKCMDManager cmdManager = WKCMDManager.shared;
|
WKCMDManager cmdManager = WKCMDManager.shared;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user