From 48082eeaef608779f91880c71c338ce3830eb373 Mon Sep 17 00:00:00 2001 From: Ralph Date: Tue, 19 Nov 2019 03:34:04 -0500 Subject: [PATCH] feat(cordova-plugin-fingerprint-aio): change interface to support v3.0.0 release of plugin update index.ts (#3227) --- .../plugins/fingerprint-aio/index.ts | 114 +++++++++++++++--- 1 file changed, 99 insertions(+), 15 deletions(-) diff --git a/src/@ionic-native/plugins/fingerprint-aio/index.ts b/src/@ionic-native/plugins/fingerprint-aio/index.ts index 00d65ee941..6e8426fa89 100644 --- a/src/@ionic-native/plugins/fingerprint-aio/index.ts +++ b/src/@ionic-native/plugins/fingerprint-aio/index.ts @@ -3,29 +3,41 @@ import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; export interface FingerprintOptions { /** - * Key for platform keychain + * Title in biometric prompt (android only) + * @default {APP_NAME} Biometric Sign On */ - clientId: string; + title?: string; /** - * Secret password. Only for android + * Subtitle in biometric Prompt (android only) + * @default null */ - clientSecret?: string; + subtitle?: string; /** - * Disable 'use backup' option. Only for android (optional) + * Description in biometric Prompt + * @default null */ - disableBackup?: boolean; + description?: string; /** - * Title of fallback button. Only for iOS + * Title of fallback button. + * @default "Use Pin" */ - localizedFallbackTitle?: string; + fallbackButtonTitle?: string; /** - * Description in authentication dialogue. Only for iOS + * Title for cancel button on Android + * @default "Cancel" */ - localizedReason?: string; + cancelButtonTitle?: string; + + /** + * Disable 'use backup' option. + * @default false + */ + disableBackup?: boolean; + } /** @@ -42,12 +54,17 @@ export interface FingerprintOptions { * * ... * + * this.faio.show().then((result: any) => console.log(result)).catch((error: any) => console.log(error)); + * + * OR with options... + * * this.faio.show({ - * clientId: 'Fingerprint-Demo', //Android: Used for encryption. iOS: used for dialogue if no `localizedReason` is given. - * clientSecret: 'o7aoOMYUbyxaD23oFAnJ' //Necessary for Android encrpytion of keys. Use random secret key. - * disableBackup:true, //Only for Android(optional) - * localizedFallbackTitle: 'Use Pin', //Only for iOS - * localizedReason: 'Please authenticate' //Only for iOS + * title: 'Biometric Authentication', // (Android Only) | optional | Default: " Biometric Sign On" + * subtitle: 'Coolest Plugin ever' // (Android Only) | optional | Default: null + * description: 'Please authenticate' // optional | Default: null + * fallbackButtonTitle: 'Use Backup', // optional | When disableBackup is false defaults to "Use Pin". + * // When disableBackup is true defaults to "Cancel" + * disableBackup:true, // optional | default: false * }) * .then((result: any) => console.log(result)) * .catch((error: any) => console.log(error)); @@ -65,6 +82,73 @@ export interface FingerprintOptions { }) @Injectable() export class FingerprintAIO extends IonicNativePlugin { + + /** + * Convenience constant + * @type {number} + */ + BIOMETRIC_UNKNOWN_ERROR = -100; + /** + * Convenience constant + * @type {number} + */ + BIOMETRIC_UNAVAILABLE = -101; + /** + * Convenience constant + * @type {number} + */ + BIOMETRIC_AUTHENTICATION_FAILED = -102; + /** + * Convenience constant + * @type {number} + */ + BIOMETRIC_SDK_NOT_SUPPORTED = -103; + /** + * Convenience constant + * @type {number} + */ + BIOMETRIC_HARDWARE_NOT_SUPPORTED = -104; + /** + * Convenience constant + * @type {number} + */ + BIOMETRIC_PERMISSION_NOT_GRANTED = -105; + /** + * Convenience constant + * @type {number} + */ + BIOMETRIC_NOT_ENROLLED = -106; + /** + * Convenience constant + * @type {number} + */ + BIOMETRIC_INTERNAL_PLUGIN_ERROR = -107; + /** + * Convenience constant + * @type {number} + */ + BIOMETRIC_DISMISSED = -108; + /** + * Convenience constant + * @type {number} + */ + BIOMETRIC_PIN_OR_PATTERN_DISMISSED = -109; + /** + * Convenience constant + * @type {number} + */ + BIOMETRIC_SCREEN_GUARD_UNSECURED = -110; + /** + * Convenience constant + * @type {number} + */ + BIOMETRIC_LOCKED_OUT = -111; + /** + * Convenience constant + * @type {number} + */ + BIOMETRIC_LOCKED_OUT_PERMANENT = -112; + /** * Check if fingerprint authentication is available * @return {Promise} Returns a promise with result