提交 03326323 authored 作者: 张国庆's avatar 张国庆

feat:增加是否保存认证录像

上级 cef19e6d
package com.aliyun.face.aliyun_face_plugin;
import androidx.annotation.NonNull;
import java.util.HashMap;
import java.util.Map;
import android.content.Context;
......@@ -48,13 +50,20 @@ public class AliyunFacePlugin implements FlutterPlugin, MethodCallHandler {
Log.d(TAG, "enter verify.");
Map<String, String> params = call.arguments();
String certifyId = params.get("certifyId");
String useVideo = params.get("ext_params_key_use_video");
Map<String, String> extParams=new HashMap<>();
if (useVideo.equals("1")){
extParams.put("ext_params_key_use_video","true");
}
if (certifyId == null || certifyId.isEmpty()) {
Log.e(TAG, "certifyId is null");
return;
}
ZIMFacade zimFacade = ZIMFacadeBuilder.create(mContext);
zimFacade.verify(certifyId, false, new ZIMCallback() {
zimFacade.verify(certifyId, false,extParams, new ZIMCallback() {
@Override
public boolean response(ZIMResponse response) {
if (null != response && 1000 == response.code) {
......
......@@ -11,8 +11,8 @@ class AliyunFacePlugin {
}
// SDK认证接口
Future<String?> verify(String key, String value) {
return AliyunFacePluginPlatform.instance.verify(key, value);
Future<String?> verify(Map<String, String> params) {
return AliyunFacePluginPlatform.instance.verify(params);
}
// 获取客户端的metainfos,用于服务器端接口获取认证id,即CertifyId
......
......@@ -29,8 +29,7 @@ class MethodChannelAliyunFacePlugin extends AliyunFacePluginPlatform {
}
@override
Future<String?> verify(String key, String value) async {
Map<String, String> params = {key: value};
Future<String?> verify(Map<String, String> params) async {
final code = await methodChannel.invokeMethod<String>('verify', params);
return code;
}
......
......@@ -30,7 +30,7 @@ abstract class AliyunFacePluginPlatform extends PlatformInterface {
throw UnimplementedError('init() has not been implemented.');
}
Future<String?> verify(String key, String value) {
Future<String?> verify(Map<String, String> params) {
throw UnimplementedError('verify() has not been implemented.');
}
......
......@@ -34,12 +34,20 @@ class FaceAuthUtils {
}
/// 开始认证
Future<String?> startVerify({required String certifyId}) async {
/// useVideo 是否返回活体认证视频 0不返 1返回
Future<String?> startVerify(
{required String certifyId, int useVideo = 0}) async {
String? verifyResult;
Map<String, String> params = {
"certifyId": certifyId,
"ext_params_key_use_video": useVideo.toString()
};
try {
// 调用认证接口,CertifyId需要调用服务器端接口获取。
// 每个CertifyId只能使用一次,否则会返回code: "2002(iOS), 1001(Android)"。
verifyResult = await _faceAuthPlugin.verify("certifyId", certifyId);
verifyResult = await _faceAuthPlugin.verify(params);
debugPrint("FaceAuthUtils startVerify: $verifyResult");
} on PlatformException {
debugPrint("FaceAuthUtils startVerify: PlatformException");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论