增加查询未读消息接口

master
jack ning 3 years ago
parent ebdcc713cc
commit 01d8b06e7b

@ -18,6 +18,7 @@
- 消息撤回
- 输入状态(对方正在输入)
- 发送/播放视频
- 查询未读消息数
<!-- - 提交工单 -->
<!-- - 意见反馈 -->

@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
//
class ChatTypePage extends StatefulWidget {
ChatTypePage({Key? key}) : super(key: key);
const ChatTypePage({Key? key}) : super(key: key);
@override
_ChatTypePageState createState() => _ChatTypePageState();
@ -15,39 +15,57 @@ class ChatTypePage extends StatefulWidget {
class _ChatTypePageState extends State<ChatTypePage> {
// ->- IDwId, wid
// 访
String _workGroupWid = "201807171659201"; //
String _workGroupWidRobot = "201809061716221"; // ,
final String _workGroupWid = "201807171659201"; //
final String _workGroupWidRobot = "201809061716221"; // ,
//
String _agentUid = "201808221551193";
final String _agentUid = "201808221551193";
//
String _unreadMessageCount = "0";
//
@override
void initState() {
//
_getUnreadCountVisitor();
//
super.initState();
}
//
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('对话类型'),
title: const Text('对话类型'),
elevation: 0,
),
body: ListView(
children: ListTile.divideTiles(context: context, tiles: [
ListTile(
title: Text('技能组客服'),
trailing: Icon(Icons.keyboard_arrow_right),
title: Text('未读消息数目:' + _unreadMessageCount),
trailing: const Icon(Icons.keyboard_arrow_right),
onTap: () {
//
_getUnreadCountVisitor();
},
),
ListTile(
title: const Text('技能组客服'),
trailing: const Icon(Icons.keyboard_arrow_right),
onTap: () {
BytedeskKefu.startWorkGroupChat(
context, _workGroupWid, "技能组客服-默认人工");
},
),
ListTile(
title: Text('技能组客服-机器人'),
trailing: Icon(Icons.keyboard_arrow_right),
title: const Text('技能组客服-机器人'),
trailing: const Icon(Icons.keyboard_arrow_right),
onTap: () {
BytedeskKefu.startWorkGroupChat(
context, _workGroupWidRobot, "技能组客服-默认机器人");
},
),
ListTile(
title: Text('技能组客服-电商'),
trailing: Icon(Icons.keyboard_arrow_right),
title: const Text('技能组客服-电商'),
trailing: const Icon(Icons.keyboard_arrow_right),
onTap: () {
// type/title/content/price/url/imageUrl/id/categoryCode
// 500
@ -69,8 +87,8 @@ class _ChatTypePageState extends State<ChatTypePage> {
},
),
ListTile(
title: Text('技能组客服-电商-回调'),
trailing: Icon(Icons.keyboard_arrow_right),
title: const Text('技能组客服-电商-回调'),
trailing: const Icon(Icons.keyboard_arrow_right),
onTap: () {
// type/title/content/price/url/imageUrl/id/categoryCode
// 500
@ -99,8 +117,8 @@ class _ChatTypePageState extends State<ChatTypePage> {
},
),
ListTile(
title: Text('技能组客服-附言'),
trailing: Icon(Icons.keyboard_arrow_right),
title: const Text('技能组客服-附言'),
trailing: const Icon(Icons.keyboard_arrow_right),
onTap: () {
BytedeskKefu.startWorkGroupChatPostscript(
context, _workGroupWid, "技能组客服-附言", "随便说点什么吧,我会自动发送给客服");
@ -110,15 +128,15 @@ class _ChatTypePageState extends State<ChatTypePage> {
height: 20,
),
ListTile(
title: Text('指定一对一客服'),
trailing: Icon(Icons.keyboard_arrow_right),
title: const Text('指定一对一客服'),
trailing: const Icon(Icons.keyboard_arrow_right),
onTap: () {
BytedeskKefu.startAppointedChat(context, _agentUid, "指定一对一客服");
},
),
ListTile(
title: Text('指定一对一客服-电商'),
trailing: Icon(Icons.keyboard_arrow_right),
title: const Text('指定一对一客服-电商'),
trailing: const Icon(Icons.keyboard_arrow_right),
onTap: () {
// type/title/content/price/url/imageUrl/id/categoryCode
// 500
@ -139,8 +157,8 @@ class _ChatTypePageState extends State<ChatTypePage> {
},
),
ListTile(
title: Text('指定一对一客服-电商-回调'),
trailing: Icon(Icons.keyboard_arrow_right),
title: const Text('指定一对一客服-电商-回调'),
trailing: const Icon(Icons.keyboard_arrow_right),
onTap: () {
// type/title/content/price/url/imageUrl/id/categoryCode
// 500
@ -168,8 +186,8 @@ class _ChatTypePageState extends State<ChatTypePage> {
},
),
ListTile(
title: Text('指定一对一客服-附言'),
trailing: Icon(Icons.keyboard_arrow_right),
title: const Text('指定一对一客服-附言'),
trailing: const Icon(Icons.keyboard_arrow_right),
onTap: () {
BytedeskKefu.startAppointedChatPostscript(
context, _agentUid, "指定一对一客服-附言", "随便说点什么吧,我会自动发送给客服");
@ -179,13 +197,13 @@ class _ChatTypePageState extends State<ChatTypePage> {
height: 20,
),
ListTile(
title: Text('H5网页会话'),
trailing: Icon(Icons.keyboard_arrow_right),
title: const Text('H5网页会话'),
trailing: const Icon(Icons.keyboard_arrow_right),
onTap: () {
print('h5 chat');
// : ->->()-> URL
String url =
"http://www.bytedesk.com/chat?sub=vip&uid=201808221551193&wid=201807171659201&type=workGroup&aid=&hidenav=1&ph=ph";
"https://h1.kefux.cn/chat/h5/index.html?sub=vip&uid=201808221551193&wid=201807171659201&type=workGroup&aid=&hidenav=1&ph=ph";
String title = 'H5在线客服演示';
BytedeskKefu.startH5Chat(context, url, title);
},
@ -194,4 +212,14 @@ class _ChatTypePageState extends State<ChatTypePage> {
),
);
}
void _getUnreadCountVisitor() {
// 线
BytedeskKefu.getUnreadCountVisitor().then((count) => {
print('unreadcount:' + count),
setState(() {
_unreadMessageCount = count;
})
});
}
}

@ -46,7 +46,7 @@ dependencies:
# 请在ios/Podfile中添加use_frameworks!
vibration: ^1.7.3
# 在线客服 https://pub.dev/packages/bytedesk_kefu
bytedesk_kefu: ^1.2.1
bytedesk_kefu: ^1.2.2
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.

Loading…
Cancel
Save