Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
aliyun_face_plugin
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
aliyun_face_plugin
Commits
b768f8ee
提交
b768f8ee
authored
5月 18, 2023
作者:
shixiaochen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1、增加FaceAuthUtils
上级
084ffc88
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
54 行增加
和
83 行删除
+54
-83
plugin_integration_test.dart
example/integration_test/plugin_integration_test.dart
+0
-25
main.dart
example/lib/main.dart
+1
-1
aliyun_face_plugin.dart
lib/core/aliyun_face_plugin.dart
+0
-0
aliyun_face_plugin_method_channel.dart
lib/core/aliyun_face_plugin_method_channel.dart
+0
-0
aliyun_face_plugin_platform_interface.dart
lib/core/aliyun_face_plugin_platform_interface.dart
+0
-1
face_auth_plugins.dart
lib/face_auth_plugins.dart
+4
-0
face_auth_utils.dart
lib/utils/face_auth_utils.dart
+49
-0
aliyun_face_plugin_method_channel_test.dart
test/aliyun_face_plugin_method_channel_test.dart
+0
-27
aliyun_face_plugin_test.dart
test/aliyun_face_plugin_test.dart
+0
-29
没有找到文件。
example/integration_test/plugin_integration_test.dart
deleted
100644 → 0
浏览文件 @
084ffc88
// This is a basic Flutter integration test.
//
// Since integration tests run in a full Flutter application, they can interact
// with the host side of a plugin implementation, unlike Dart unit tests.
//
// For more information about Flutter integration tests, please see
// https://docs.flutter.dev/cookbook/testing/integration/introduction
import
'package:flutter_test/flutter_test.dart'
;
import
'package:integration_test/integration_test.dart'
;
import
'package:aliyun_face_plugin/aliyun_face_plugin.dart'
;
void
main
(
)
{
IntegrationTestWidgetsFlutterBinding
.
ensureInitialized
();
testWidgets
(
'getPlatformVersion test'
,
(
WidgetTester
tester
)
async
{
final
AliyunFacePlugin
plugin
=
AliyunFacePlugin
();
final
String
?
version
=
await
plugin
.
getPlatformVersion
();
// The version string depends on the host platform running the test, so
// just assert that some non-empty string is returned.
expect
(
version
?.
isNotEmpty
,
true
);
});
}
example/lib/main.dart
浏览文件 @
b768f8ee
...
...
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import
'dart:async'
;
import
'package:flutter/services.dart'
;
import
'package:aliyun_face_plugin/
aliyun_face_plugin
.dart'
;
import
'package:aliyun_face_plugin/
face_auth_plugins
.dart'
;
void
main
(
)
{
runApp
(
const
MyApp
());
...
...
lib/aliyun_face_plugin.dart
→
lib/
core/
aliyun_face_plugin.dart
浏览文件 @
b768f8ee
File moved
lib/aliyun_face_plugin_method_channel.dart
→
lib/
core/
aliyun_face_plugin_method_channel.dart
浏览文件 @
b768f8ee
File moved
lib/aliyun_face_plugin_platform_interface.dart
→
lib/
core/
aliyun_face_plugin_platform_interface.dart
浏览文件 @
b768f8ee
import
'package:plugin_platform_interface/plugin_platform_interface.dart'
;
import
'aliyun_face_plugin_method_channel.dart'
;
abstract
class
AliyunFacePluginPlatform
extends
PlatformInterface
{
...
...
lib/face_auth_plugins.dart
0 → 100644
浏览文件 @
b768f8ee
library
face_auth_plugins
;
export
'package:aliyun_face_plugin/core/aliyun_face_plugin.dart'
;
\ No newline at end of file
lib/utils/face_auth_utils.dart
0 → 100644
浏览文件 @
b768f8ee
import
'package:aliyun_face_plugin/face_auth_plugins.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/services.dart'
;
class
FaceAuthUtils
{
factory
FaceAuthUtils
()
=>
_singleton
;
static
final
FaceAuthUtils
_singleton
=
FaceAuthUtils
.
_
();
FaceAuthUtils
.
_
()
{
_faceAuthPlugin
=
AliyunFacePlugin
();
}
static
FaceAuthUtils
get
instance
=>
_singleton
;
static
late
AliyunFacePlugin
_faceAuthPlugin
;
/// 初始化刷脸认证
void
initFaceAuth
()
{
_faceAuthPlugin
.
init
();
}
/// 获取metaInfo
Future
<
String
?>
getMetaInfo
()
async
{
String
?
metaInfo
;
try
{
// 获取客户端metaInfo,将信息发送到服务器端,调用服务器端相关接口获取认证ID,即CertifyId。
metaInfo
=
await
_faceAuthPlugin
.
getMetaInfos
();
debugPrint
(
"FaceAuthUtils getMetaInfo:
$metaInfo
"
);
}
on
PlatformException
{
debugPrint
(
"FaceAuthUtils getMetaInfo: PlatformException"
);
}
return
metaInfo
;
}
/// 开始认证
Future
<
String
?>
startVerify
({
required
String
certifyId
})
async
{
String
?
verifyResult
;
try
{
// 调用认证接口,CertifyId需要调用服务器端接口获取。
// 每个CertifyId只能使用一次,否则会返回code: "2002(iOS), 1001(Android)"。
verifyResult
=
await
_faceAuthPlugin
.
verify
(
"certifyId"
,
certifyId
);
debugPrint
(
"FaceAuthUtils startVerify:
$verifyResult
"
);
}
on
PlatformException
{
debugPrint
(
"FaceAuthUtils startVerify: PlatformException"
);
}
return
verifyResult
;
}
}
test/aliyun_face_plugin_method_channel_test.dart
deleted
100644 → 0
浏览文件 @
084ffc88
import
'package:flutter/services.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:aliyun_face_plugin/aliyun_face_plugin_method_channel.dart'
;
void
main
(
)
{
TestWidgetsFlutterBinding
.
ensureInitialized
();
MethodChannelAliyunFacePlugin
platform
=
MethodChannelAliyunFacePlugin
();
const
MethodChannel
channel
=
MethodChannel
(
'aliyun_face_plugin'
);
setUp
(()
{
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
channel
,
(
MethodCall
methodCall
)
async
{
return
'42'
;
},
);
});
tearDown
(()
{
TestDefaultBinaryMessengerBinding
.
instance
.
defaultBinaryMessenger
.
setMockMethodCallHandler
(
channel
,
null
);
});
test
(
'getPlatformVersion'
,
()
async
{
expect
(
await
platform
.
getPlatformVersion
(),
'42'
);
});
}
test/aliyun_face_plugin_test.dart
deleted
100644 → 0
浏览文件 @
084ffc88
import
'package:flutter_test/flutter_test.dart'
;
import
'package:aliyun_face_plugin/aliyun_face_plugin.dart'
;
import
'package:aliyun_face_plugin/aliyun_face_plugin_platform_interface.dart'
;
import
'package:aliyun_face_plugin/aliyun_face_plugin_method_channel.dart'
;
import
'package:plugin_platform_interface/plugin_platform_interface.dart'
;
class
MockAliyunFacePluginPlatform
with
MockPlatformInterfaceMixin
implements
AliyunFacePluginPlatform
{
@override
Future
<
String
?>
getPlatformVersion
()
=>
Future
.
value
(
'42'
);
}
void
main
(
)
{
final
AliyunFacePluginPlatform
initialPlatform
=
AliyunFacePluginPlatform
.
instance
;
test
(
'
$MethodChannelAliyunFacePlugin
is the default instance'
,
()
{
expect
(
initialPlatform
,
isInstanceOf
<
MethodChannelAliyunFacePlugin
>());
});
test
(
'getPlatformVersion'
,
()
async
{
AliyunFacePlugin
aliyunFacePlugin
=
AliyunFacePlugin
();
MockAliyunFacePluginPlatform
fakePlatform
=
MockAliyunFacePluginPlatform
();
AliyunFacePluginPlatform
.
instance
=
fakePlatform
;
expect
(
await
aliyunFacePlugin
.
getPlatformVersion
(),
'42'
);
});
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论