update 0.3.0

master
jackning 4 years ago
parent 5deaa06024
commit 92bcb5d64b

@ -12,10 +12,11 @@
- 对接APP用户信息(昵称/头像) - 对接APP用户信息(昵称/头像)
- 获取当前客服在线状态 - 获取当前客服在线状态
- 获取历史会话 - 获取历史会话
- 消息提示设置 - 消息提示音/振动设置
- 消息送达/已读 - 消息送达/已读
- 消息撤回 - 消息撤回
- 输入状态(对方正在输入) - 输入状态(对方正在输入)
- 发送/播放视频
<!-- - 提交工单 --> <!-- - 提交工单 -->
<!-- - 意见反馈 --> <!-- - 意见反馈 -->

@ -12,10 +12,11 @@
- 对接APP用户信息(昵称/头像) - 对接APP用户信息(昵称/头像)
- 获取当前客服在线状态 - 获取当前客服在线状态
- 获取历史会话 - 获取历史会话
- 消息提示设置 - 消息提示音/振动设置
- 消息送达/已读 - 消息送达/已读
- 消息撤回 - 消息撤回
- 输入状态(对方正在输入) - 输入状态(对方正在输入)
- 发送/播放视频
<!-- - 提交工单 --> <!-- - 提交工单 -->
<!-- - 意见反馈 --> <!-- - 意见反馈 -->
@ -29,7 +30,7 @@
- [注册账号](https://www.bytedesk.com/antv/user/login) - [注册账号](https://www.bytedesk.com/antv/user/login)
- 获取appkey登录后台->客服管理->渠道管理->添加应用->appkey - 获取appkey登录后台->客服管理->渠道管理->添加应用->appkey
- 获取subDomain也即企业号登录后台->客服管理->客服账号->企业号 - 获取subDomain也即企业号登录后台->客服管理->客服账号->企业号
- 获取技能组workGroupWid - 获取技能组workGroupWid, 登录后台->技能组->wid
### 第二步:匿名登录 ### 第二步:匿名登录

@ -25,7 +25,7 @@ apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android { android {
compileSdkVersion 28 compileSdkVersion 29
lintOptions { lintOptions {
disable 'InvalidPackage' disable 'InvalidPackage'

@ -1,21 +1,27 @@
buildscript { buildscript {
repositories { repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
// maven { url 'https://maven.aliyun.com/repository/jcenter' }
google() google()
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.5.0' classpath 'com.android.tools.build:gradle:4.1.0'
} }
} }
allprojects { allprojects {
repositories { repositories {
// mavenCentral()
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
// maven { url 'https://maven.aliyun.com/repository/jcenter' }
google() google()
jcenter() jcenter()
} }
} }
rootProject.buildDir = '../build' rootProject.buildDir = '../build'
subprojects { subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}" project.buildDir = "${rootProject.buildDir}/${project.name}"

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

@ -1,5 +1,7 @@
# Uncomment this line to define a global platform for your project # Uncomment this line to define a global platform for your project
# platform :ios, '9.0' platform :ios, '10.0'
# added by jackning, 20200929
use_frameworks!
# CocoaPods analytics sends network stats synchronously affecting flutter build latency. # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true' ENV['COCOAPODS_DISABLE_STATS'] = 'true'

@ -1,29 +1,25 @@
import 'package:bytedesk_kefu/bytedesk_kefu.dart'; import 'package:bytedesk_kefu/bytedesk_kefu.dart';
import 'package:bytedesk_kefu/util/bytedesk_constants.dart'; import 'package:bytedesk_kefu/util/bytedesk_constants.dart';
import 'package:bytedesk_kefu/util/bytedesk_events.dart'; import 'package:bytedesk_kefu/util/bytedesk_events.dart';
import 'package:bytedesk_kefu/util/bytedesk_utils.dart';
import 'package:bytedesk_demo/notification/custom_notification.dart';
import 'package:bytedesk_demo/page/chat_type_page.dart'; import 'package:bytedesk_demo/page/chat_type_page.dart';
import 'package:bytedesk_demo/page/history_thread_page.dart'; import 'package:bytedesk_demo/page/history_thread_page.dart';
import 'package:bytedesk_demo/page/online_status_page.dart'; import 'package:bytedesk_demo/page/online_status_page.dart';
// import 'package:bytedesk_demo/page/setting_page.dart'; import 'package:bytedesk_demo/page/setting_page.dart';
import 'package:bytedesk_demo/page/user_info_page.dart'; import 'package:bytedesk_demo/page/user_info_page.dart';
import 'package:bytedesk_kefu/util/bytedesk_utils.dart';
import 'package:overlay_support/overlay_support.dart'; import 'package:overlay_support/overlay_support.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:vibration/vibration.dart';
import 'notification/custom_notification.dart'; import 'package:audioplayers/audio_cache.dart';
void main() { void main() {
// runApp(MyApp()); // runApp(MyApp());
// runApp(MaterialApp(
// debugShowCheckedModeBanner: false, // debug
// home: MyApp(),
// ));
runApp(OverlaySupport( runApp(OverlaySupport(
child: MaterialApp( child: MaterialApp(
debugShowCheckedModeBanner: false, // debug debugShowCheckedModeBanner: false, // debug
home: MyApp(), home: MyApp(),
) )));
));
// https://github.com/Bytedesk/bytedesk-flutter // https://github.com/Bytedesk/bytedesk-flutter
// https://www.bytedesk.com/antv/user/login // https://www.bytedesk.com/antv/user/login
@ -45,8 +41,7 @@ class MyApp extends StatefulWidget {
class _MyAppState extends State<MyApp> with WidgetsBindingObserver { class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
// //
String _title = '萝卜丝客服Demo'; String _title = '萝卜丝客服Demo';
// ->- IDwId, wid AudioCache audioCache = AudioCache();
// String _workGroupWid = "201807171659201";
// //
@override @override
void initState() { void initState() {
@ -81,6 +76,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: () {
// anonymousLogin
Navigator.of(context) Navigator.of(context)
.push(new MaterialPageRoute(builder: (context) { .push(new MaterialPageRoute(builder: (context) {
return new UserInfoPage(); return new UserInfoPage();
@ -123,16 +119,16 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
// // TODO: // // TODO:
// }, // },
// ), // ),
// ListTile( ListTile(
// 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 SettingPage(); return new SettingPage();
// })); }));
// }, },
// ) )
], ],
).toList()), ).toList()),
); );
@ -157,9 +153,30 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
}); });
} }
}); });
// //
bytedeskEventBus.on<ReceiveMessageEventBus>().listen((event) { bytedeskEventBus.on<ReceiveMessageEventBus>().listen((event) {
// print('receive message:' + event.message.content); // print('receive message:' + event.message.content);
// 1. example/assets/audio2.pubspec.yamlassets
//
if (BytedeskKefu.getPlayAudioOnSendMessage() && event.message.isSend == 1) {
print('play send audio');
//
audioCache.play('audio/bytedesk_dingdong.wav');
}
if (event.message.isSend == 1) {
//
return;
}
//
if (BytedeskKefu.getPlayAudioOnReceiveMessage() && event.message.isSend == 0) {
print('play receive audio');
audioCache.play('audio/bytedesk_dingdong.wav');
}
//
if (BytedeskKefu.getVibrateOnReceiveMessage() && event.message.isSend == 0) {
print('should vibrate');
vibrate();
}
if (event.message.type == BytedeskConstants.MESSAGE_TYPE_TEXT) { if (event.message.type == BytedeskConstants.MESSAGE_TYPE_TEXT) {
print('文字消息: ' + event.message.content); print('文字消息: ' + event.message.content);
// //
@ -176,9 +193,10 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
); );
}, duration: Duration(milliseconds: 4000)); }, duration: Duration(milliseconds: 4000));
} }
} 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_VIDEO) {
print('视频消息:' + event.message.imageUrl);
} else { } else {
print('其他类型消息'); print('其他类型消息');
} }
@ -202,10 +220,15 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
// } // }
// } // }
void vibrate() async {
if (await Vibration.hasVibrator()) {
Vibration.vibrate();
}
}
@override @override
void dispose() { void dispose() {
WidgetsBinding.instance.removeObserver(this); WidgetsBinding.instance.removeObserver(this);
super.dispose(); super.dispose();
} }
} }

@ -13,8 +13,10 @@ class ChatTypePage extends StatefulWidget {
} }
class _ChatTypePageState extends State<ChatTypePage> { class _ChatTypePageState extends State<ChatTypePage> {
// ->- IDwId, wid
// 访 // 访
String _workGroupWid = "201807171659201"; String _workGroupWid = "201807171659201"; //
String _workGroupWidRobot = "201809061716221"; //
// //
String _agentUid = "201808221551193"; String _agentUid = "201808221551193";
// //
@ -33,7 +35,14 @@ class _ChatTypePageState extends State<ChatTypePage> {
title: Text('技能组客服'), title: Text('技能组客服'),
trailing: Icon(Icons.keyboard_arrow_right), trailing: Icon(Icons.keyboard_arrow_right),
onTap: () { onTap: () {
BytedeskKefu.startWorkGroupChat(context, _workGroupWid, "技能组客服"); BytedeskKefu.startWorkGroupChat(context, _workGroupWid, "技能组客服-默认人工");
},
),
ListTile(
title: Text('技能组客服-机器人'),
trailing: Icon(Icons.keyboard_arrow_right),
onTap: () {
BytedeskKefu.startWorkGroupChat(context, _workGroupWidRobot, "技能组客服-默认机器人");
}, },
), ),
ListTile( ListTile(
@ -52,14 +61,14 @@ class _ChatTypePageState extends State<ChatTypePage> {
"categoryCode": "100010003", "categoryCode": "100010003",
"client": "flutter" "client": "flutter"
}); });
BytedeskKefu.startWorkGroupChatShop(context, _workGroupWid, "技能组客服", custom); BytedeskKefu.startWorkGroupChatShop(context, _workGroupWid, "技能组客服-电商", custom);
}, },
), ),
ListTile( ListTile(
title: Text('技能组客服-附言'), title: Text('技能组客服-附言'),
trailing: Icon(Icons.keyboard_arrow_right), trailing: Icon(Icons.keyboard_arrow_right),
onTap: () { onTap: () {
BytedeskKefu.startWorkGroupChatPostscript(context, _workGroupWid, "技能组客服", "随便说点什么吧,我会自动发送给客服"); BytedeskKefu.startWorkGroupChatPostscript(context, _workGroupWid, "技能组客服-附言", "随便说点什么吧,我会自动发送给客服");
}, },
), ),
Container( Container(

@ -11,14 +11,14 @@ class SettingPage extends StatefulWidget {
} }
class _SettingPageState extends State<SettingPage> { class _SettingPageState extends State<SettingPage> {
// bool _playAudioOnSendMessage = false; bool _playAudioOnSendMessage = false;
// bool _playAudioOnReceiveMessage = false; bool _playAudioOnReceiveMessage = false;
bool _vibrateOnReceiveMessage = false; bool _vibrateOnReceiveMessage = false;
// //
@override @override
void initState() { void initState() {
// _playAudioOnSendMessage = BytedeskKefu.getPlayAudioOnSendMessage(); _playAudioOnSendMessage = BytedeskKefu.getPlayAudioOnSendMessage();
// _playAudioOnReceiveMessage = BytedeskKefu.getPlayAudioOnReceiveMessage(); _playAudioOnReceiveMessage = BytedeskKefu.getPlayAudioOnReceiveMessage();
_vibrateOnReceiveMessage = BytedeskKefu.getVibrateOnReceiveMessage(); _vibrateOnReceiveMessage = BytedeskKefu.getVibrateOnReceiveMessage();
super.initState(); super.initState();
} }
@ -34,26 +34,26 @@ class _SettingPageState extends State<SettingPage> {
children: ListTile.divideTiles( children: ListTile.divideTiles(
context: context, context: context,
tiles: [ tiles: [
// ListTileSwitch( ListTileSwitch(
// value: _playAudioOnSendMessage, value: _playAudioOnSendMessage,
// onChanged: (value) { onChanged: (value) {
// setState(() { setState(() {
// _playAudioOnSendMessage = value; _playAudioOnSendMessage = value;
// }); });
// BytedeskKefu.setPlayAudioOnSendMessage(value); BytedeskKefu.setPlayAudioOnSendMessage(value);
// }, },
// title: Text('TODO: 发送消息时播放声音'), title: Text('发送消息时播放声音'),
// ), ),
// ListTileSwitch( ListTileSwitch(
// value: _playAudioOnReceiveMessage, value: _playAudioOnReceiveMessage,
// onChanged: (value) { onChanged: (value) {
// setState(() { setState(() {
// _playAudioOnReceiveMessage = value; _playAudioOnReceiveMessage = value;
// }); });
// BytedeskKefu.setPlayAudioOnReceiveMessage(value); BytedeskKefu.setPlayAudioOnReceiveMessage(value);
// }, },
// title: Text('TODO: 收到消息时播放声音'), title: Text('收到消息时播放声音'),
// ), ),
ListTileSwitch( ListTileSwitch(
value: _vibrateOnReceiveMessage, value: _vibrateOnReceiveMessage,
onChanged: (value) { onChanged: (value) {

@ -1,7 +1,9 @@
import 'package:bytedesk_kefu/bytedesk_kefu.dart'; import 'package:bytedesk_kefu/bytedesk_kefu.dart';
import 'package:bytedesk_kefu/util/bytedesk_constants.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart'; import 'package:fluttertoast/fluttertoast.dart';
// anonymousLogin
// -APP // -APP
class UserInfoPage extends StatefulWidget { class UserInfoPage extends StatefulWidget {
UserInfoPage({Key key}) : super(key: key); UserInfoPage({Key key}) : super(key: key);
@ -12,8 +14,7 @@ class UserInfoPage extends StatefulWidget {
class _UserInfoPageState extends State<UserInfoPage> { class _UserInfoPageState extends State<UserInfoPage> {
String _nickname = ''; String _nickname = '';
String _avatar = String _avatar = BytedeskConstants.DEFAULT_AVATA;
'https://chainsnow.oss-cn-shenzhen.aliyuncs.com/avatars/chrome_default_avatar.png';
@override @override
void initState() { void initState() {
_getProfile(); _getProfile();
@ -41,7 +42,7 @@ class _UserInfoPageState extends State<UserInfoPage> {
), ),
ListTile( ListTile(
leading: Image.network( leading: Image.network(
_avatar ?? 'https://chainsnow.oss-cn-shenzhen.aliyuncs.com/avatars/chrome_default_avatar.png', _avatar ?? BytedeskConstants.DEFAULT_AVATA,
height: 30, height: 30,
width: 30, width: 30,
), ),

@ -33,13 +33,19 @@ dependencies:
list_tile_switch: ^0.0.2 list_tile_switch: ^0.0.2
# 应用内-顶部通知栏 https://pub.dev/packages/overlay_support/ # 应用内-顶部通知栏 https://pub.dev/packages/overlay_support/
overlay_support: ^1.0.5 overlay_support: ^1.0.5
# 播放提示音 https://pub.dev/packages/audioplayers
audioplayers: ^0.17.0
# 振动 https://pub.dev/packages/vibration
# 针对报错fatal error: 'vibration/vibration-Swift.h' file not found #import <vibration/vibration-Swift.h>, ld: library not found for -lvibration
# 请在ios/Podfile中添加use_frameworks!
vibration: ^1.7.2
# https://pub.dev/packages/bytedesk_kefu # https://pub.dev/packages/bytedesk_kefu
bytedesk_kefu: ^0.2.6 bytedesk_kefu: ^0.3.0
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3 cupertino_icons: ^1.0.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
@ -60,6 +66,9 @@ flutter:
# assets: # assets:
# - images/a_dot_burr.jpeg # - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg # - images/a_dot_ham.jpeg
assets:
- assets/audio/
- assets/images/feedback/
# An image asset can refer to one or more resolution-specific "variants", see # An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware. # https://flutter.dev/assets-and-images/#resolution-aware.

Loading…
Cancel
Save