goBiometricAuth method

dynamic goBiometricAuth()

Implementation

goBiometricAuth() async {
  BootpayPrint("goBiometricAuth call: ${_supportState}");
  final LocalAuthentication localAuth = LocalAuthentication();
  // bool canCheckBiometrics = await localAuth.canCheckBiometrics;
  if(_supportState != _SupportState.supported) {
    Fluttertoast.showToast(
        msg: "생체인식이 지원되지 않는 기기입니다. 비밀번호 결제로 진행합니다.",
        toastLength: Toast.LENGTH_SHORT,
        gravity: ToastGravity.BOTTOM,
        timeInSecForIosWeb: 1,
        backgroundColor: Colors.black54,
        textColor: Colors.white,
        fontSize: 16.0
    );
    return;
  }
  // await  localAuth.

  // if(!await localAuth.canCheckBiometrics) {
  //   Fluttertoast.showToast(
  //       msg: "생체인식이 여러번 실패하여 비밀번호 결제로 진행됩니다.",
  //       toastLength: Toast.LENGTH_SHORT,
  //       gravity: ToastGravity.BOTTOM,
  //       timeInSecForIosWeb: 1,
  //       backgroundColor: Colors.black54,
  //       textColor: Colors.white,
  //       fontSize: 16.0
  //   );
  //   requestPasswordForPay();
  //   return;
  // }

  try {
    BootpayPrint("goBiometricAuth authenticate call: ${_supportState}");
    bool authenticated = await localAuth.authenticate(
        localizedReason:
        '인증 후 결제가 진행됩니다',
        androidAuthStrings: AndroidAuthMessages(
          signInTitle: '생체 인증',
          biometricHint: ''
        ),
        iOSAuthStrings: IOSAuthMessages(
          localizedFallbackTitle: "비밀번호를 입력해주세요"
        ),
        // stickyAuth: true,
        useErrorDialogs: true);
    if(authenticated) {
      onAuthenticationSucceeded();
    }
  } on PlatformException catch (e) {
    if(widget.onError != null) { widget.onError!(e.toString()); }
    if(widget.onClose != null) { widget.onClose!(); }
    print(e);
    BootpayPrint(e);
    // Widget.on
  }
}