1.Describe
1.封裝的環(huán)信客服的功能: 初始化、注冊阳掐、登錄冷蚂、進(jìn)入會話;
2.繪畫頁面easeUI里包含的同kefu-android-demo、kefu-ios-demo一樣的功能:
android: 選圖片艺骂、拍照片钳恕、選視頻、發(fā)文件忧额、發(fā)語音宙址、文字调卑、表情
ios: 選照片大咱、拍照片注益、拍視頻丑搔、發(fā)定位、發(fā)語音啤月、文字谎仲、表情
3.語音郑诺、視頻通話嘗試均不可用
2.Setup
// 環(huán)信自帶的ui
flutter_easemob_kefu: ${last_version}
or
flutter_easemob_kefu:
git:
url: https://github.com/qq326646683/flutter_easemob_kefu.git
// 自定義ui(根據(jù)自己的ui,去修改原生兩端的ui代碼)
flutter_easemob_kefu:
git:
url: https://github.com/qq326646683/flutter_easemob_kefu.git#custom-ui
For Ios:
相冊辙售、相機(jī)等權(quán)限配置到plist
3.Usages
/// 初始化
/// appKey: “管理員模式 > 渠道管理 > 手機(jī)APP”頁面的關(guān)聯(lián)的“AppKey”
/// tenantId: “管理員模式 > 設(shè)置 > 企業(yè)信息”頁面的“租戶ID”
static void init(String appKey, String tenantId) {
_channel.invokeMethod("init", <String, dynamic>{
"appKey": appKey,
"tenantId": tenantId,
});
}
/// 注冊
static Future<bool> register(String username, String password) async {
return _channel.invokeMethod("register", <String, dynamic>{
"username": username,
"password": password,
});
}
/// 登錄
static Future<bool> login(String username, String password) async {
return _channel.invokeMethod("login", <String, dynamic>{
"username": username,
"password": password,
});
}
/// 是否登錄
static Future<bool> get isLogin {
return _channel.invokeMethod("isLogin");
}
/// 注銷登錄
static Future<bool> logout() async {
return _channel.invokeMethod("logout");
}
/// 會話頁面:
/// imNumber: “管理員模式 > 渠道管理 > 手機(jī)APP”頁面的關(guān)聯(lián)的“IM服務(wù)號”
static void jumpToPage(String imNumber) {
_channel.invokeMethod("jumpToPage", <String, dynamic>{
"imNumber": imNumber,
});
}
4.Example
FlutterEasemobKefu.init("1439201009092337#kefuchannelapp86399", "86399");
bool isSuccess = await FlutterEasemobKefu.register("nell", "123456");
bool isSuccess = await FlutterEasemobKefu.login("nell", "123456");
bool isLogin = await FlutterEasemobKefu.isLogin;
if (isLogin) {
FlutterEasemobKefu.jumpToPage("kefuchannelimid_316626");
}