1.0.1 • Published 6 years ago

@anli/lock v1.0.1

Weekly downloads
2
License
MIT
Repository
-
Last release
6 years ago

Ionic Module Lock

Installation

npm install @anli/lock --save
// https://ionicframework.com/docs/native/fingerprint-aio/
ionic cordova plugin add cordova-plugin-fingerprint-aio
npm install --save @ionic-native/fingerprint-aio

Update .gitignore:

src/environments/environment.ts

Update src\environments\environment.ts:

export const environment = {
  faio: {
    clientId: 'FingerPrintLockScreen',
    clientSecret: '123456',   //Only necessary for Android
    disableBackup: true,              //Only for Android(optional)
    localizedFallbackTitle: 'Use Pin',      //Only for iOS
    localizedReason: 'Please authenticate' //Only for iOS
  }
}

Update src/app/app.module.ts:

import { LockModule } from '@anli/lock';

@NgModule({
  imports: [
    EffectsModule.forRoot([]),
    StoreModule.forRoot({ }),
    StoreDevtoolsModule.instrument({ maxAge: 25 }),
    LockModule.forRoot({
      lockScreenPage: 'LockScreenPage',
      faio: environment.faio,
    }),

Usage

Update app.component.ts:

this.platform.ready().then(() => {
  this.platform.pause.subscribe(() => {
    this.store.dispatch(new Lock())
  });

  this.platform.resume.subscribe(() => {
    this.store.dispatch(new Unlock())
  });
});