Commit 10470ce9 by zeven

修复设备微信支付宝刷脸硬件判断

parent 241e6e21
{
"name": "zm-face-counter",
"version": "1.0.6",
"version": "1.0.7",
"private": true,
"scripts": {
"android": "react-native run-android",
......
......@@ -40,7 +40,7 @@ class FacePage extends Component {
let storeName = await AsyncStorage.getItem('NAME');
this.setState({contact, storeName});
if (!this.init) {
this.init = await WxFacepay.init();
this.init = await WxFacepay.initialize(3000);
if (!this.init) {
// 微信刷脸失败,启动支付宝刷脸
this.init = true;
......
......@@ -44,7 +44,7 @@ class VerticalPage extends Component {
this.setState({contact});
this.storeKey = await AsyncStorage.getItem('KEY');
if (!this.init) {
this.init = await WxFacepay.init();
this.init = await WxFacepay.initialize(3000);
if (!this.init) {
// 微信刷脸失败,启动支付宝刷脸
this.init = true;
......
import {NativeModules} from 'react-native';
const timeout = ms =>
new Promise(resolve => {
setTimeout(() => resolve(false), ms);
});
const init = new Promise(resolve => {
NativeModules.WxFacepay.init().then(resolve);
});
NativeModules.WxFacepay.initialize = ms => {
return Promise.race([init, timeout(ms)]);
};
export default NativeModules.WxFacepay;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment