master
jack ning 3 years ago
parent 52ebb87b9e
commit 4adda0eceb

@ -1,5 +1,9 @@
# Upgrade Log
## 1.2.6
* optimize user experience
## 1.2.5
* optimize user experience

@ -8,7 +8,7 @@ bytedesk flutter helpdesk sdk
- [Website](https://www.bytedesk.com)
- [Download Gitee Demo](https://git.oschina.net/270580156/bytedesk-flutter)
- [Download Github Demo](https://github.com/Bytedesk/bytedesk-flutter)
- [Download ApkDemo](https://bytedesk.oss-cn-shenzhen.aliyuncs.com/apk/bytedesk-android-sdk-demo.apk)
<!-- - [Download ApkDemo](https://bytedesk.oss-cn-shenzhen.aliyuncs.com/apk/bytedesk-android-sdk-demo.apk) -->
## Features

@ -43,6 +43,10 @@ class MyApp extends StatefulWidget {
}
class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
// appkey->->Flutter->->appkey
String _appKey = '81f427ea-4467-4c7c-b0cd-5c0e4b51456f';
// subDomain->->->
String _subDomain = "vip";
//
String _title = '萝卜丝客服Demo(连接中...)';
// AudioCache audioCache = AudioCache();
@ -140,6 +144,17 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
// BytedeskKefu.logout();
// },
// ),
// ListTile(
// title: Text('重新初始化'),
// onTap: () {
// BytedeskKefu.initWithUsernameAndNicknameAndAvatar(
// 'myflutterusername2',
// '我是帅哥',
// 'https://bytedesk.oss-cn-shenzhen.aliyuncs.com/avatars/boy.png',
// _appKey,
// _subDomain);
// },
// ),
ListTile(
title: Text('技术支持: QQ-3群: 825257535'),
)

@ -30,13 +30,14 @@ class BytedeskUserHttpApi extends BytedeskBaseHttpApi {
};
final oauthResponse =
await this.httpClient.post(oauthUrl, headers: headers, body: bodyMap);
print('oauth result: $oauthResponse');
// print('oauth result: $oauthResponse');
// check the status code for the result
int statusCode = oauthResponse.statusCode;
// print("statusCode $statusCode");
print("statusCode $statusCode");
// 200:
final oauthJson = jsonDecode(oauthResponse.body);
// print('oauthJson:' + oauthJson);
print('oauth:');
print(oauthJson);
SpUtil.putBool(BytedeskConstants.isLogin, true);
SpUtil.putString(BytedeskConstants.accessToken, oauthJson['access_token']);
//
@ -66,7 +67,8 @@ class BytedeskUserHttpApi extends BytedeskBaseHttpApi {
int statusCode = oauthResponse.statusCode;
// 200:
final oauthJson = jsonDecode(oauthResponse.body);
print("oauthJson $oauthJson");
print('smsOAuth:');
print(oauthJson);
if (statusCode == 200) {
SpUtil.putBool(BytedeskConstants.isLogin, true);
SpUtil.putBool(BytedeskConstants.isAuthenticated, true);
@ -100,7 +102,8 @@ class BytedeskUserHttpApi extends BytedeskBaseHttpApi {
// print("statusCode $statusCode");
// 200:
final oauthJson = jsonDecode(oauthResponse.body);
print("oauthJson $oauthJson");
print('unionIdOAuth:');
print(oauthJson);
if (statusCode == 200) {
SpUtil.putBool(BytedeskConstants.isLogin, true);
SpUtil.putBool(BytedeskConstants.isAuthenticated, true);
@ -134,8 +137,8 @@ class BytedeskUserHttpApi extends BytedeskBaseHttpApi {
//string json
final responseJson =
json.decode(utf8decoder.convert(initResponse.bodyBytes));
// final responseJson = json.decode(initResponse.body);
// print("responseJson $responseJson");
// print("register:");
// print(responseJson);
return JsonResult.fromJson(responseJson);
}
@ -154,7 +157,8 @@ class BytedeskUserHttpApi extends BytedeskBaseHttpApi {
//string json
final responseJson =
json.decode(utf8decoder.convert(initResponse.bodyBytes));
// print("responseJson $responseJson");
// print("registerAnonymous:");
// print(responseJson);
//
User user = User.fromJson(responseJson['data']);
//
@ -192,8 +196,9 @@ class BytedeskUserHttpApi extends BytedeskBaseHttpApi {
//string json
final responseJson =
json.decode(utf8decoder.convert(initResponse.bodyBytes));
print("responseJson $responseJson");
//
print("registerUser:");
print(responseJson);
//
int statusCode = responseJson['status_code'];
if (statusCode == 200) {
User user = User.fromJson(responseJson['data']);
@ -210,7 +215,8 @@ class BytedeskUserHttpApi extends BytedeskBaseHttpApi {
} else {
//
SpUtil.putString(BytedeskConstants.uid, responseJson['data']);
SpUtil.putString(BytedeskConstants.username, username! + '@' + subDomain!);
SpUtil.putString(
BytedeskConstants.username, username! + '@' + subDomain!);
SpUtil.putString(BytedeskConstants.password, password!);
SpUtil.putString(BytedeskConstants.nickname, nickname!);
SpUtil.putString(BytedeskConstants.avatar, avatar!);
@ -227,7 +233,6 @@ class BytedeskUserHttpApi extends BytedeskBaseHttpApi {
var body =
json.encode({"mobile": mobile, "password": password, "client": client});
// final initUrl = '$baseUrl/visitors/api/v1/change';
final initUrl = Uri.http(BytedeskConstants.host, '/visitors/api/v1/change');
final initResponse =
await this.httpClient.post(initUrl, headers: headers, body: body);
@ -238,7 +243,8 @@ class BytedeskUserHttpApi extends BytedeskBaseHttpApi {
final responseJson =
json.decode(utf8decoder.convert(initResponse.bodyBytes));
// final responseJson = json.decode(initResponse.body);
print("responseJson $responseJson");
// print("changePassword");
// print(responseJson);
return JsonResult.fromJson(responseJson);
}
@ -255,7 +261,8 @@ class BytedeskUserHttpApi extends BytedeskBaseHttpApi {
//string json
final responseJson =
json.decode(utf8decoder.convert(initResponse.bodyBytes));
print("responseJson $responseJson");
// print("requestCode:");
// print(responseJson);
SpUtil.putBool(BytedeskConstants.exist, responseJson['data']['exist']);
SpUtil.putString(BytedeskConstants.code, responseJson['data']['code']);
@ -299,7 +306,8 @@ class BytedeskUserHttpApi extends BytedeskBaseHttpApi {
//string json
final responseJson =
json.decode(utf8decoder.convert(initResponse.bodyBytes));
print("responseJson $responseJson");
// print("getProfile:");
// print(responseJson);
//
User user = User.fromJson(responseJson['data']);
//
@ -762,8 +770,8 @@ class BytedeskUserHttpApi extends BytedeskBaseHttpApi {
//string json
final responseJson =
json.decode(utf8decoder.convert(initResponse.bodyBytes));
print("responseJson $responseJson");
//
// print("unfollow:");
// print(responseJson);
return JsonResult.fromJson(responseJson);
}
@ -777,10 +785,14 @@ class BytedeskUserHttpApi extends BytedeskBaseHttpApi {
{'access_token': accessToken});
final initResponse =
await this.httpClient.post(initUrl, headers: headers, body: body);
final responseJson = json.decode(initResponse.body);
print("responseJson $responseJson");
//
//json
Utf8Decoder utf8decoder = Utf8Decoder(); // fix
//string json
final responseJson =
json.decode(utf8decoder.convert(initResponse.bodyBytes));
print("logout:");
print(responseJson);
BytedeskUtils.clearUserCache();
}
}

@ -67,7 +67,7 @@ class MessageProvider {
version: 9,
);
// database path:/Users/ningjinpeng/Library/Developer/CoreSimulator/Devices/715CBA02-A602-4DE1-8C57-75A64B53BF03/data/Containers/Data/Application/8F46273D-9492-4C42-A618-4DF3815562BA/Documents/bytedesk-message-v9.db
print('database path:' + database!.path);
// print('database path:' + database!.path);
}
Future<int> insert(Message message) async {

@ -45,16 +45,9 @@ class BytedeskMqtt {
factory BytedeskMqtt() {
return _singleton;
}
BytedeskMqtt._internal() {
// _connect();
reconnect();
}
//
// void _connect() async {
// reconnect();
// }
BytedeskMqtt._internal() {}
void reconnect() async {
void connect() async {
// eventbus广...
bytedeskEventBus
.fire(ConnectionEventBus(BytedeskConstants.USER_STATUS_CONNECTING));

@ -121,7 +121,7 @@ class BytedeskUtils {
static bool mqttConnect() {
var isLogin = SpUtil.getBool(BytedeskConstants.isLogin);
if (isLogin!) {
new BytedeskMqtt();
new BytedeskMqtt().connect();
return true;
}
return false;
@ -130,7 +130,7 @@ class BytedeskUtils {
static bool mqttReConnect() {
bool isConnected = new BytedeskMqtt().isConnected();
if (!isConnected) {
new BytedeskMqtt().reconnect();
new BytedeskMqtt().connect();
return true;
}
return false;

@ -1,6 +1,6 @@
name: bytedesk_kefu
description: the best app chat sdk in china, you can chat with the agent freely at anytime. the agent can chat with the visitor by web/pc/mac/ios/android client.
version: 1.2.5
version: 1.2.6
homepage: https://www.weikefu.net
environment:
@ -49,7 +49,7 @@ dependencies:
# https://pub.dev/packages/flutter_easyloading
flutter_easyloading: ^3.0.3
# H5-webchat https://pub.dev/packages/webview_flutter
webview_flutter: ^2.8.0
webview_flutter: ^3.0.2
# https://pub.dev/packages/device_info
device_info: ^2.0.3
# 查看大图 https://pub.dev/packages/photo_view
@ -77,7 +77,7 @@ dependencies:
# audioplayers: ^0.16.1
# https://pub.dev/packages/flutter_html
# https://github.com/Sub6Resources/flutter_html
flutter_html: ^2.2.1
flutter_html: ^3.0.0-alpha.3
# https://pub.dev/packages/flutter_cache_manager
flutter_cache_manager: ^3.3.0
# 保存图片到相册
@ -99,7 +99,7 @@ dependencies:
css_colors: ^1.1.1
# Plugins for rendering the <video> tag.
video_player: ^2.4.0
# chewie: ^1.2.2 # 与 flutter_html: ^2.2.1 不兼容
# chewie: ^1.2.2 # 与 flutter_html: ^3.0.0-alpha.3 不兼容
# chewie:
# git:
# url: https://github.com/brianegan/chewie.git
@ -111,7 +111,7 @@ dependencies:
# Plugins for rendering the <audio> tag.
# chewie_audio: ^1.0.0+1
# Plugins for rendering the <svg> tag.
flutter_svg: ^0.22.0
flutter_svg: ^1.0.3
flutter_web_plugins:
sdk: flutter

Loading…
Cancel
Save