update 0.3.8

master
jackning 4 years ago
parent b4f5717686
commit b425f89245

@ -20,6 +20,20 @@
<!-- - 提交工单 --> <!-- - 提交工单 -->
<!-- - 意见反馈 --> <!-- - 意见反馈 -->
## 注意
- 修改安卓 android/build.gradle
```bash
# Android
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:3.5.4'
}
}
```
## 集成步骤 ## 集成步骤
### 第一步 ### 第一步
@ -50,8 +64,10 @@
| image1 | image2 | image3 | | image1 | image2 | image3 |
| :----------: | :----------: | :----------: | | :----------: | :----------: | :----------: |
| <img src="./home.jpeg" width="250"> | <img src="./robot.jpeg" width="250"> | <img src="./notice.jpeg" width="250"> | | <img src="./home.jpeg" width="250"> | <img src="./robot.jpeg" width="250"> | <img src="./notice.jpeg" width="250"> |
| <img src="./chat.png" width="250"> | <img src="./status.jpeg" width="250"> |<img src="./userinfo.jpeg" width="250"> | | <img src="./chat.png" width="250"> | <img src="./shop.png" width="250"> |<img src="./postscript.png" width="250"> |
| <img src="./status.jpeg" width="250"> |<img src="./userinfo.jpeg" width="250"> ||
### 其他 ### 其他
- [下载 ApkDemo](https://bytedesk.oss-cn-shenzhen.aliyuncs.com/apk/bytedesk-android-sdk-demo.apk)
- 技术支持QQ 3群: 825257535 - 技术支持QQ 3群: 825257535

@ -65,7 +65,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
title: Text('联系客服'), title: Text('联系客服'),
trailing: Icon(Icons.keyboard_arrow_right), trailing: Icon(Icons.keyboard_arrow_right),
onTap: () { onTap: () {
// //
Navigator.of(context) Navigator.of(context)
.push(new MaterialPageRoute(builder: (context) { .push(new MaterialPageRoute(builder: (context) {
return new ChatTypePage(); return new ChatTypePage();
@ -188,6 +188,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
nickname: event.message.user.nickname, nickname: event.message.user.nickname,
content: event.message.content, content: event.message.content,
onReply: () { onReply: () {
//
OverlaySupportEntry.of(context).dismiss(); OverlaySupportEntry.of(context).dismiss();
// //
BytedeskKefu.startChatThread(context, event.message.thread, title: '客服会话'); BytedeskKefu.startChatThread(context, event.message.thread, title: '客服会话');
@ -197,8 +198,12 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
} }
} else if (event.message.type == BytedeskConstants.MESSAGE_TYPE_IMAGE) { } else if (event.message.type == BytedeskConstants.MESSAGE_TYPE_IMAGE) {
print('图片消息:' + event.message.imageUrl); print('图片消息:' + event.message.imageUrl);
} else if (event.message.type == BytedeskConstants.MESSAGE_TYPE_VOICE) {
print('语音消息:' + event.message.voiceUrl);
} else if (event.message.type == BytedeskConstants.MESSAGE_TYPE_VIDEO) { } else if (event.message.type == BytedeskConstants.MESSAGE_TYPE_VIDEO) {
print('视频消息:' + event.message.imageUrl); print('视频消息:' + event.message.videoUrl);
} else if (event.message.type == BytedeskConstants.MESSAGE_TYPE_FILE) {
print('文件消息:' + event.message.fileUrl);
} else { } else {
print('其他类型消息'); print('其他类型消息');
} }
@ -222,6 +227,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
// } // }
// } // }
//
void vibrate() async { void vibrate() async {
if (await Vibration.hasVibrator()) { if (await Vibration.hasVibrator()) {
Vibration.vibrate(); Vibration.vibrate();

@ -28,101 +28,169 @@ class _ChatTypePageState extends State<ChatTypePage> {
elevation: 0, elevation: 0,
), ),
body: ListView( body: ListView(
children: ListTile.divideTiles( children: ListTile.divideTiles(context: context, tiles: [
context: context, ListTile(
tiles: [ title: Text('技能组客服'),
ListTile( trailing: Icon(Icons.keyboard_arrow_right),
title: Text('技能组客服'), onTap: () {
trailing: Icon(Icons.keyboard_arrow_right), BytedeskKefu.startWorkGroupChat(
onTap: () { context, _workGroupWid, "技能组客服-默认人工");
BytedeskKefu.startWorkGroupChat(context, _workGroupWid, "技能组客服-默认人工"); },
}, ),
), ListTile(
ListTile( title: Text('技能组客服-机器人'),
title: Text('技能组客服-机器人'), trailing: Icon(Icons.keyboard_arrow_right),
trailing: Icon(Icons.keyboard_arrow_right), onTap: () {
onTap: () { BytedeskKefu.startWorkGroupChat(
BytedeskKefu.startWorkGroupChat(context, _workGroupWidRobot, "技能组客服-默认机器人"); context, _workGroupWidRobot, "技能组客服-默认机器人");
}, },
), ),
ListTile( ListTile(
title: Text('技能组客服-电商'), title: Text('技能组客服-电商'),
trailing: Icon(Icons.keyboard_arrow_right), trailing: Icon(Icons.keyboard_arrow_right),
onTap: () { onTap: () {
// type/title/content/price/url/imageUrl/id/categoryCode // type/title/content/price/url/imageUrl/id/categoryCode
var custom = json.encode({ // 500
"type": BytedeskConstants.MESSAGE_TYPE_COMMODITY, var custom = json.encode({
"title": "商品标题", "type": BytedeskConstants.MESSAGE_TYPE_COMMODITY, //
"content": "商品详情", "title": "商品标题", // ,
"price": "9.99", "content": "商品详情", // ,
"url": "https://item.m.jd.com/product/12172344.html", "price": "9.99", // ,
"imageUrl": "https://bytedesk.oss-cn-shenzhen.aliyuncs.com/images/123.webp", "url":
"id": 123, "https://item.m.jd.com/product/12172344.html", // url,
"categoryCode": "100010003", "imageUrl":
"client": "flutter" "https://bytedesk.oss-cn-shenzhen.aliyuncs.com/images/123.webp", //,
}); "id": 123, //
BytedeskKefu.startWorkGroupChatShop(context, _workGroupWid, "技能组客服-电商", custom); "categoryCode": "100010003", // ,
}, "client": "flutter" // ,
), });
ListTile( BytedeskKefu.startWorkGroupChatShop(
title: Text('技能组客服-附言'), context, _workGroupWid, "技能组客服-电商", custom);
trailing: Icon(Icons.keyboard_arrow_right), },
onTap: () { ),
BytedeskKefu.startWorkGroupChatPostscript(context, _workGroupWid, "技能组客服-附言", "随便说点什么吧,我会自动发送给客服"); ListTile(
}, title: Text('技能组客服-电商-回调'),
), trailing: Icon(Icons.keyboard_arrow_right),
Container( onTap: () {
height: 20, // type/title/content/price/url/imageUrl/id/categoryCode
), // 500
ListTile( var custom = json.encode({
title: Text('指定一对一客服'), "type": BytedeskConstants.MESSAGE_TYPE_COMMODITY, //
trailing: Icon(Icons.keyboard_arrow_right), "title": "商品标题", // ,
onTap: () { "content": "商品详情", // ,
BytedeskKefu.startAppointedChat(context, _agentUid, "指定客服"); "price": "9.99", // ,
}, "url":
), "https://item.m.jd.com/product/12172344.html", // url,
ListTile( "imageUrl":
title: Text('指定一对一客服-电商'), "https://bytedesk.oss-cn-shenzhen.aliyuncs.com/images/123.webp", //,
trailing: Icon(Icons.keyboard_arrow_right), "id": 123, //
onTap: () { "categoryCode": "100010003", // ,
// type/title/content/price/url/imageUrl/id/categoryCode "client": "flutter", // ,
var custom = json.encode({ // key:value,
"type": BytedeskConstants.MESSAGE_TYPE_COMMODITY, "other1": "", //
"title": "商品标题", "other2": "", //
"content": "商品详情", "other3": "", //
"price": "9.99", });
"url": "https://item.m.jd.com/product/12172344.html", BytedeskKefu.startWorkGroupChatShopCallback(
"imageUrl": "https://bytedesk.oss-cn-shenzhen.aliyuncs.com/images/123.webp", context, _workGroupWid, "技能组客服-电商-回调", custom, (value) {
"id": 123, print('value为custom参数原样返回 $value');
"categoryCode": "100010003", //
"client": "flutter" });
}); },
BytedeskKefu.startAppointedChatShop(context, _agentUid, "指定客服", custom); ),
}, ListTile(
), title: Text('技能组客服-附言'),
ListTile( trailing: Icon(Icons.keyboard_arrow_right),
title: Text('指定一对一客服-附言'), onTap: () {
trailing: Icon(Icons.keyboard_arrow_right), BytedeskKefu.startWorkGroupChatPostscript(
onTap: () { context, _workGroupWid, "技能组客服-附言", "随便说点什么吧,我会自动发送给客服");
BytedeskKefu.startAppointedChatPostscript(context, _agentUid, "指定客服", "随便说点什么吧,我会自动发送给客服"); },
}, ),
), Container(
Container( height: 20,
height: 20, ),
), ListTile(
ListTile( title: Text('指定一对一客服'),
title: Text('H5网页会话'), trailing: Icon(Icons.keyboard_arrow_right),
trailing: Icon(Icons.keyboard_arrow_right), onTap: () {
onTap: () { BytedeskKefu.startAppointedChat(context, _agentUid, "指定一对一客服");
print('h5 chat'); },
// : ->->()-> URL ),
String url = "http://www.bytedesk.com/chat?sub=vip&uid=201808221551193&wid=201807171659201&type=workGroup&aid=&hidenav=1&ph=ph"; ListTile(
String title = 'H5在线客服演示'; title: Text('指定一对一客服-电商'),
BytedeskKefu.startH5Chat(context, url, title); trailing: Icon(Icons.keyboard_arrow_right),
}, onTap: () {
), // type/title/content/price/url/imageUrl/id/categoryCode
] // 500
).toList(), var custom = json.encode({
"type": BytedeskConstants.MESSAGE_TYPE_COMMODITY,
"title": "商品标题",
"content": "商品详情",
"price": "9.99",
"url": "https://item.m.jd.com/product/12172344.html",
"imageUrl":
"https://bytedesk.oss-cn-shenzhen.aliyuncs.com/images/123.webp",
"id": 123,
"categoryCode": "100010003",
"client": "flutter"
});
BytedeskKefu.startAppointedChatShop(
context, _agentUid, "指定一对一客服-电商", custom);
},
),
ListTile(
title: Text('指定一对一客服-电商-回调'),
trailing: Icon(Icons.keyboard_arrow_right),
onTap: () {
// type/title/content/price/url/imageUrl/id/categoryCode
// 500
var custom = json.encode({
"type": BytedeskConstants.MESSAGE_TYPE_COMMODITY,
"title": "商品标题",
"content": "商品详情",
"price": "9.99",
"url": "https://item.m.jd.com/product/12172344.html",
"imageUrl":
"https://bytedesk.oss-cn-shenzhen.aliyuncs.com/images/123.webp",
"id": 123,
"categoryCode": "100010003",
"client": "flutter",
// key:value,
"other1": "", //
"other2": "", //
"other3": "", //
});
BytedeskKefu.startAppointedChatShopCallback(
context, _agentUid, "指定一对一客服-电商-回调", custom, (value) {
print('value为custom参数原样返回 $value');
//
});
},
),
ListTile(
title: Text('指定一对一客服-附言'),
trailing: Icon(Icons.keyboard_arrow_right),
onTap: () {
BytedeskKefu.startAppointedChatPostscript(
context, _agentUid, "指定一对一客服-附言", "随便说点什么吧,我会自动发送给客服");
},
),
Container(
height: 20,
),
ListTile(
title: Text('H5网页会话'),
trailing: 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";
String title = 'H5在线客服演示';
BytedeskKefu.startH5Chat(context, url, title);
},
),
]).toList(),
), ),
); );
} }

@ -10,7 +10,9 @@ class HistoryThreadPage extends StatefulWidget {
_HistoryThreadPageState createState() => _HistoryThreadPageState(); _HistoryThreadPageState createState() => _HistoryThreadPageState();
} }
// TODO: thread
class _HistoryThreadPageState extends State<HistoryThreadPage> { class _HistoryThreadPageState extends State<HistoryThreadPage> {
//
int _page = 0; int _page = 0;
int _size = 20; int _size = 20;
List<Thread> _historyThreadList = []; List<Thread> _historyThreadList = [];
@ -20,7 +22,6 @@ class _HistoryThreadPageState extends State<HistoryThreadPage> {
_getVisitorThreads(); _getVisitorThreads();
super.initState(); super.initState();
} }
// //
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -36,6 +37,10 @@ class _HistoryThreadPageState extends State<HistoryThreadPage> {
leading: Image.network(_historyThreadList[index].avatar), leading: Image.network(_historyThreadList[index].avatar),
title: Text('${_historyThreadList[index].nickname}, ${_historyThreadList[index].timestamp}'), title: Text('${_historyThreadList[index].nickname}, ${_historyThreadList[index].timestamp}'),
subtitle: Text('${_historyThreadList[index].content}'), subtitle: Text('${_historyThreadList[index].content}'),
onTap: () {
//
BytedeskKefu.startChatThread(context, _historyThreadList[index]);
},
), ),
itemCount: _historyThreadList.length, itemCount: _historyThreadList.length,
), ),
@ -52,7 +57,7 @@ class _HistoryThreadPageState extends State<HistoryThreadPage> {
} }
Future<void> _onRefresh() async { Future<void> _onRefresh() async {
_page++;
_getVisitorThreads(); _getVisitorThreads();
_page++;
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 KiB

@ -28,7 +28,7 @@ dependencies:
# https://pub.dev/packages/event_bus # https://pub.dev/packages/event_bus
event_bus: ^1.1.1 event_bus: ^1.1.1
# toast https://pub.dev/packages/fluttertoast # toast https://pub.dev/packages/fluttertoast
fluttertoast: ^7.1.1 fluttertoast: ^7.1.4
# 消息设置switch https://pub.dev/packages/list_tile_switch # 消息设置switch https://pub.dev/packages/list_tile_switch
list_tile_switch: ^0.0.2 list_tile_switch: ^0.0.2
# 应用内-顶部通知栏 https://pub.dev/packages/overlay_support/ # 应用内-顶部通知栏 https://pub.dev/packages/overlay_support/
@ -40,7 +40,7 @@ dependencies:
# 请在ios/Podfile中添加use_frameworks! # 请在ios/Podfile中添加use_frameworks!
vibration: ^1.7.2 vibration: ^1.7.2
# https://pub.dev/packages/bytedesk_kefu # https://pub.dev/packages/bytedesk_kefu
bytedesk_kefu: ^0.3.1 bytedesk_kefu: ^0.3.8
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

Loading…
Cancel
Save