diff --git a/bytedesk_demo/android/app/src/main/AndroidManifest.xml b/bytedesk_demo/android/app/src/main/AndroidManifest.xml index 3c3164d..165d4de 100644 --- a/bytedesk_demo/android/app/src/main/AndroidManifest.xml +++ b/bytedesk_demo/android/app/src/main/AndroidManifest.xml @@ -23,7 +23,7 @@ FlutterApplication and put your custom class here. --> 2.7.2) + - FMDB (>= 2.7.5) + - SwiftyGif (5.4.0) - Toast (4.0.0) + - vibration (1.7.2): + - Flutter - video_player (0.0.1): - Flutter - wakelock (0.0.1): @@ -36,34 +76,44 @@ PODS: - Flutter DEPENDENCIES: + - audioplayers (from `.symlinks/plugins/audioplayers/ios`) - bytedesk_kefu (from `.symlinks/plugins/bytedesk_kefu/ios`) - device_info (from `.symlinks/plugins/device_info/ios`) - devicelocale (from `.symlinks/plugins/devicelocale/ios`) + - file_picker (from `.symlinks/plugins/file_picker/ios`) - Flutter (from `Flutter`) - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) - image_picker (from `.symlinks/plugins/image_picker/ios`) - package_info (from `.symlinks/plugins/package_info/ios`) - path_provider (from `.symlinks/plugins/path_provider/ios`) - permission_handler (from `.symlinks/plugins/permission_handler/ios`) - - screen (from `.symlinks/plugins/screen/ios`) - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) - sqflite (from `.symlinks/plugins/sqflite/ios`) + - vibration (from `.symlinks/plugins/vibration/ios`) - video_player (from `.symlinks/plugins/video_player/ios`) - wakelock (from `.symlinks/plugins/wakelock/ios`) - webview_flutter (from `.symlinks/plugins/webview_flutter/ios`) SPEC REPOS: trunk: + - DKImagePickerController + - DKPhotoGallery - FMDB + - SDWebImage + - SwiftyGif - Toast EXTERNAL SOURCES: + audioplayers: + :path: ".symlinks/plugins/audioplayers/ios" bytedesk_kefu: :path: ".symlinks/plugins/bytedesk_kefu/ios" device_info: :path: ".symlinks/plugins/device_info/ios" devicelocale: :path: ".symlinks/plugins/devicelocale/ios" + file_picker: + :path: ".symlinks/plugins/file_picker/ios" Flutter: :path: Flutter fluttertoast: @@ -76,12 +126,12 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/path_provider/ios" permission_handler: :path: ".symlinks/plugins/permission_handler/ios" - screen: - :path: ".symlinks/plugins/screen/ios" shared_preferences: :path: ".symlinks/plugins/shared_preferences/ios" sqflite: :path: ".symlinks/plugins/sqflite/ios" + vibration: + :path: ".symlinks/plugins/vibration/ios" video_player: :path: ".symlinks/plugins/video_player/ios" wakelock: @@ -90,24 +140,30 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/webview_flutter/ios" SPEC CHECKSUMS: + audioplayers: 455322b54050b30ea4b1af7cd9e9d105f74efa8c bytedesk_kefu: ca69f7b243932a665dc7001be5a8e04fe7f30c57 device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 devicelocale: feebbe5e7a30adb8c4f83185de1b50ff19b44f00 + DKImagePickerController: b5eb7f7a388e4643264105d648d01f727110fc3d + DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 + file_picker: 3e6c3790de664ccf9b882732d9db5eaf6b8d4eb1 Flutter: 0e3d915762c693b495b44d77113d4970485de6ec fluttertoast: 6122fa75143e992b1d3470f61000f591a798cc58 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a image_picker: 9c3312491f862b28d21ecd8fdf0ee14e601b3f09 package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62 path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c - permission_handler: eac8e15b4a1a3fba55b761d19f3f4e6b005d15b6 - screen: abd91ca7bf3426e1cc3646d27e9b2358d6bf07b0 + permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 + SDWebImage: c666b97e1fa9c64b4909816a903322018f0a9c84 shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d - sqflite: 4001a31ff81d210346b500c55b17f4d6c7589dd0 + sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 + SwiftyGif: 5d4af95df24caf1c570dbbcb32a3b8a0763bc6d7 Toast: 91b396c56ee72a5790816f40d3a94dd357abc196 + vibration: 528f5ef88e90d4a8fd1ef04afbf0ed3ac7c9801d video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e - wakelock: 0d4a70faf8950410735e3f61fb15d517c8a6efc4 + wakelock: bfc7955c418d0db797614075aabbc58a39ab5107 webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96 -PODFILE CHECKSUM: 8e679eca47255a8ca8067c4c67aab20e64cb974d +PODFILE CHECKSUM: dca2b29e21cb3d11e071f660f55810735db709ac -COCOAPODS: 1.9.3 +COCOAPODS: 1.10.0 diff --git a/bytedesk_demo/ios/Runner.xcodeproj/project.pbxproj b/bytedesk_demo/ios/Runner.xcodeproj/project.pbxproj index cded5e9..15a83d9 100644 --- a/bytedesk_demo/ios/Runner.xcodeproj/project.pbxproj +++ b/bytedesk_demo/ios/Runner.xcodeproj/project.pbxproj @@ -9,12 +9,12 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 76C21F7050A2CD2DEF6939A7 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F592C57DD0344E5C9FD3DBCA /* libPods-Runner.a */; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + F23039A69C0D9E90D8124FBF /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FC492F43EA1F2B9AE0E98B42 /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -48,7 +48,7 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - F592C57DD0344E5C9FD3DBCA /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + FC492F43EA1F2B9AE0E98B42 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -56,7 +56,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 76C21F7050A2CD2DEF6939A7 /* libPods-Runner.a in Frameworks */, + F23039A69C0D9E90D8124FBF /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -130,7 +130,7 @@ F87F847604EB996C0990C6B8 /* Frameworks */ = { isa = PBXGroup; children = ( - F592C57DD0344E5C9FD3DBCA /* libPods-Runner.a */, + FC492F43EA1F2B9AE0E98B42 /* Pods_Runner.framework */, ); name = Frameworks; sourceTree = ""; diff --git a/bytedesk_demo/ios/Runner/Info.plist b/bytedesk_demo/ios/Runner/Info.plist index 6d027ba..0c30147 100644 --- a/bytedesk_demo/ios/Runner/Info.plist +++ b/bytedesk_demo/ios/Runner/Info.plist @@ -5,7 +5,7 @@ CFBundleDevelopmentRegion zh_CN CFBundleDisplayName - 萝卜丝客服Demo + 萝卜丝Demo CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier diff --git a/bytedesk_demo/lib/main.dart b/bytedesk_demo/lib/main.dart index 2a9e54c..c840c7b 100644 --- a/bytedesk_demo/lib/main.dart +++ b/bytedesk_demo/lib/main.dart @@ -24,12 +24,12 @@ void main() { // 参考文档:https://github.com/Bytedesk/bytedesk-flutter // 管理后台:https://www.bytedesk.com/antv/user/login // appkey和subDomain请替换为真实值 - // 获取appkey,登录后台->客服管理->渠道管理->添加应用->appkey - String _appKey = "45c513b8-0331-414c-8412-7e2cdfb3eb9f"; + // 获取appkey,登录后台->渠道管理->Flutter->添加应用->获取appkey + String _appKey = '81f427ea-4467-4c7c-b0cd-5c0e4b51456f'; // 获取subDomain,也即企业号:登录后台->客服管理->客服账号->企业号 String _subDomain = "vip"; - // 第一步:匿名登录 - BytedeskKefu.anonymousLogin(_appKey, _subDomain); + // 第一步:初始化 + BytedeskKefu.init(_appKey, _subDomain); } class MyApp extends StatefulWidget { @@ -119,7 +119,7 @@ class _MyAppState extends State with WidgetsBindingObserver { // }, // ), ListTile( - title: Text('消息设置'), + title: Text('消息提示'), trailing: Icon(Icons.keyboard_arrow_right), onTap: () { Navigator.of(context) @@ -157,7 +157,8 @@ class _MyAppState extends State with WidgetsBindingObserver { // print('receive message:' + event.message.content); // 1. 首先将example/assets/audio文件夹中文件拷贝到自己项目;2.在自己项目pubspec.yaml中添加assets // 播放发送消息提示音 - if (BytedeskKefu.getPlayAudioOnSendMessage() && event.message.isSend == 1) { + if (BytedeskKefu.getPlayAudioOnSendMessage() && + event.message.isSend == 1) { print('play send audio'); // 修改为自己项目中语音文件路径 audioCache.play('audio/bytedesk_dingdong.wav'); @@ -167,12 +168,14 @@ class _MyAppState extends State with WidgetsBindingObserver { return; } // 接收消息播放提示音 - if (BytedeskKefu.getPlayAudioOnReceiveMessage() && event.message.isSend == 0) { + if (BytedeskKefu.getPlayAudioOnReceiveMessage() && + event.message.isSend == 0) { print('play receive audio'); audioCache.play('audio/bytedesk_dingdong.wav'); } // 振动 - if (BytedeskKefu.getVibrateOnReceiveMessage() && event.message.isSend == 0) { + if (BytedeskKefu.getVibrateOnReceiveMessage() && + event.message.isSend == 0) { print('should vibrate'); vibrate(); } @@ -190,7 +193,8 @@ class _MyAppState extends State with WidgetsBindingObserver { // OverlaySupportEntry.of(context).dismiss(); // 进入客服页面,支持自定义页面标题 - BytedeskKefu.startChatThread(context, event.message.thread, title: '客服会话'); + BytedeskKefu.startChatThread(context, event.message.thread, + title: '客服会话'); }, ); }, duration: Duration(milliseconds: 4000)); diff --git a/bytedesk_demo/lib/page/chat_type_page.dart b/bytedesk_demo/lib/page/chat_type_page.dart index 836f5e9..85e8688 100644 --- a/bytedesk_demo/lib/page/chat_type_page.dart +++ b/bytedesk_demo/lib/page/chat_type_page.dart @@ -16,7 +16,7 @@ class _ChatTypePageState extends State { // 第二步:到 客服管理->技能组-有一列 ‘唯一ID(wId)’, 默认设置工作组wid // 说明:一个技能组可以分配多个客服,访客会按照一定的规则分配给组内的各个客服账号 String _workGroupWid = "201807171659201"; // 默认人工 - String _workGroupWidRobot = "201809061716221"; // 默认机器人 + String _workGroupWidRobot = "201809061716221"; // 默认机器人, 在管理后台开启或关闭机器人 // 说明:直接发送给此一个客服账号,一对一会话 String _agentUid = "201808221551193"; // diff --git a/bytedesk_demo/lib/page/online_status_page.dart b/bytedesk_demo/lib/page/online_status_page.dart index b58450b..3bf8af8 100644 --- a/bytedesk_demo/lib/page/online_status_page.dart +++ b/bytedesk_demo/lib/page/online_status_page.dart @@ -15,12 +15,14 @@ class _OnlineStatusPageState extends State { // 到 客服管理->客服账号-有一列 ‘唯一ID(uId)’ String _agentUid = "201808221551193"; // - String _workGroupStatus = ''; - String _agentStatus = ''; + String _workGroupStatus = ''; // 注:online 代表在线,offline 代表离线 + String _agentStatus = ''; // 注:online 代表在线,offline 代表离线 // @override void initState() { + // 获取技能组在线状态 _getWorkGroupStatus(); + // 获取指定客服在线状态 _getAgentStatus(); super.initState(); } @@ -57,6 +59,7 @@ class _OnlineStatusPageState extends State { } void _getWorkGroupStatus() { + // 获取技能组在线状态:当技能组中至少有一个客服在线时,显示在线 BytedeskKefu.getWorkGroupStatus(_workGroupWid).then((status) => { print(status), setState(() { @@ -66,6 +69,7 @@ class _OnlineStatusPageState extends State { } void _getAgentStatus() { + // 获取指定客服在线状态 BytedeskKefu.getAgentStatus(_agentUid).then((status) => { print(status), setState(() { diff --git a/bytedesk_demo/lib/page/user_info_page.dart b/bytedesk_demo/lib/page/user_info_page.dart index d808349..d5fed3c 100644 --- a/bytedesk_demo/lib/page/user_info_page.dart +++ b/bytedesk_demo/lib/page/user_info_page.dart @@ -58,6 +58,7 @@ class _UserInfoPageState extends State { } void _getProfile() { + // 查询当前用户信息:昵称、头像 BytedeskKefu.getProfile().then((user) => { setState(() { _nickname = user.nickname; @@ -67,7 +68,8 @@ class _UserInfoPageState extends State { } void _setNickname() { - String mynickname = 'APP昵称123'; + // 可自定义用户昵称-客服端可见 + String mynickname = '自定义APP昵称flutter'; BytedeskKefu.updateNickname(mynickname).then((user) => { setState(() { _nickname = mynickname; @@ -77,11 +79,12 @@ class _UserInfoPageState extends State { } void _setAvatar() { + // 可自定义用户头像url-客服端可见 String myavatarurl = 'https://chainsnow.oss-cn-shenzhen.aliyuncs.com/avatars/visitor_default_avatar.png'; // 头像网址url BytedeskKefu.updateAvatar(myavatarurl).then((user) => { setState(() { - _avatar = myavatarurl; - }), + _avatar = myavatarurl; + }), Fluttertoast.showToast(msg: "设置头像成功") }); } diff --git a/bytedesk_demo/pubspec.yaml b/bytedesk_demo/pubspec.yaml index 2a00d8f..a6956a6 100644 --- a/bytedesk_demo/pubspec.yaml +++ b/bytedesk_demo/pubspec.yaml @@ -39,14 +39,17 @@ dependencies: # 针对报错fatal error: 'vibration/vibration-Swift.h' file not found #import , ld: library not found for -lvibration # 请在ios/Podfile中添加:use_frameworks! vibration: ^1.7.2 - # https://pub.dev/packages/bytedesk_kefu - bytedesk_kefu: ^0.4.0 - + # 在线客服 https://pub.dev/packages/bytedesk_kefu + bytedesk_kefu: ^0.5.0 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.0 +#注意:pull_to_refresh: 1.6.4不兼容,故强制依赖1.6.3 +dependency_overrides: + pull_to_refresh: 1.6.3 + dev_dependencies: flutter_test: sdk: flutter