update to 0.0.8

master
jackning 4 years ago
parent 670f2ae683
commit 9cc56d659d

@ -13,7 +13,7 @@
### 第二步:匿名登录 ### 第二步:匿名登录
- BytedeskKefu.anonymousLogin(appKey, subDomain); - BytedeskKefu.anonymousLogin(_androidKey, _iOSKey, _subDomain);
### 第三步:联系客服 ### 第三步:联系客服

@ -13,7 +13,7 @@
### 第二步:匿名登录 ### 第二步:匿名登录
- BytedeskKefu.anonymousLogin(appKey, subDomain); - BytedeskKefu.anonymousLogin(_androidKey, _iOSKey, _subDomain);
### 第三步:联系客服 ### 第三步:联系客服

@ -1,6 +1,6 @@
import 'package:bytedesk_kefu/bytedesk_kefu.dart'; import 'package:bytedesk_kefu/bytedesk_kefu.dart';
import 'package:bytedesk_kefu/util/constants.dart'; import 'package:bytedesk_kefu/util/bytedesk_constants.dart';
import 'package:bytedesk_kefu/util/events.dart'; import 'package:bytedesk_kefu/util/bytedesk_events.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
void main() { void main() {
@ -14,11 +14,12 @@ void main() {
// https://github.com/pengjinning/bytedesk-android // https://github.com/pengjinning/bytedesk-android
// appkeysubDomain // appkeysubDomain
// appkey->->->->appkey // appkey->->->->appkey
String _appKey = "201809171553112"; String _androidKey = "66390193-b2c1-4edb-aa5f-50b1541059e8";
String _iOSKey = "201809171553112";
// subDomain->->-> // subDomain->->->
String _subDomain = "vip"; String _subDomain = "vip";
// //
BytedeskKefu.anonymousLogin(_appKey, _subDomain); BytedeskKefu.anonymousLogin(_androidKey, _iOSKey, _subDomain);
} }
class MyApp extends StatefulWidget { class MyApp extends StatefulWidget {
@ -64,28 +65,28 @@ class _MyAppState extends State<MyApp> {
// //
_listener() { _listener() {
// //
eventBus.on<ConnectionEventBus>().listen((event) { bytedeskEventBus.on<ConnectionEventBus>().listen((event) {
print('长连接状态:' + event.content); print('长连接状态:' + event.content);
if (event.content == BDConstants.USER_STATUS_CONNECTING) { if (event.content == BytedeskConstants.USER_STATUS_CONNECTING) {
setState(() { setState(() {
_title = "萝卜丝客服Demo(连接中...)"; _title = "萝卜丝客服Demo(连接中...)";
}); });
} else if (event.content == BDConstants.USER_STATUS_CONNECTED) { } else if (event.content == BytedeskConstants.USER_STATUS_CONNECTED) {
setState(() { setState(() {
_title = "萝卜丝客服Demo(连接成功)"; _title = "萝卜丝客服Demo(连接成功)";
}); });
} else if (event.content == BDConstants.USER_STATUS_DISCONNECTED) { } else if (event.content == BytedeskConstants.USER_STATUS_DISCONNECTED) {
setState(() { setState(() {
_title = "萝卜丝客服Demo(连接断开)"; _title = "萝卜丝客服Demo(连接断开)";
}); });
} }
}); });
// //
eventBus.on<ReceiveMessageEventBus>().listen((event) { bytedeskEventBus.on<ReceiveMessageEventBus>().listen((event) {
// print('receive message:' + event.message.content); // print('receive message:' + event.message.content);
if (event.message.type == BDConstants.MESSAGE_TYPE_TEXT) { if (event.message.type == BytedeskConstants.MESSAGE_TYPE_TEXT) {
print('文字消息: ' + event.message.content); print('文字消息: ' + event.message.content);
} else if (event.message.type == BDConstants.MESSAGE_TYPE_IMAGE) { } else if (event.message.type == BytedeskConstants.MESSAGE_TYPE_IMAGE) {
print('图片消息:' + event.message.imageUrl); print('图片消息:' + event.message.imageUrl);
} else { } else {
print('其他类型消息'); print('其他类型消息');

@ -25,7 +25,7 @@ dependencies:
sdk: flutter sdk: flutter
# https://pub.dev/packages/bytedesk_kefu # https://pub.dev/packages/bytedesk_kefu
bytedesk_kefu: ^0.0.2 bytedesk_kefu: ^0.0.8
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.

Loading…
Cancel
Save