diff --git a/src/pages/fingerprint/fingerprint.ts b/src/pages/fingerprint/fingerprint.ts index 33b655aa1..e553c5757 100644 --- a/src/pages/fingerprint/fingerprint.ts +++ b/src/pages/fingerprint/fingerprint.ts @@ -1,5 +1,5 @@ import { Component } from '@angular/core'; -import { ViewController } from 'ionic-angular'; +import { Platform, ViewController } from 'ionic-angular'; import { TouchIdProvider } from '../../providers/touchid/touchid'; @Component({ @@ -8,16 +8,21 @@ import { TouchIdProvider } from '../../providers/touchid/touchid'; }) export class FingerprintModalPage { + public unregister: any; + constructor( private touchid: TouchIdProvider, - private viewCtrl: ViewController + private viewCtrl: ViewController, + private platform: Platform ) { + this.unregister = this.platform.registerBackButtonAction(() => { }); this.checkFingerprint(); } public checkFingerprint(): void { this.touchid.check().then(() => { setTimeout(() => { + this.unregister(); this.viewCtrl.dismiss(); }, 300); }); diff --git a/src/pages/pin/pin.ts b/src/pages/pin/pin.ts index 08abe832d..ce4670108 100644 --- a/src/pages/pin/pin.ts +++ b/src/pages/pin/pin.ts @@ -1,5 +1,5 @@ import { Component } from '@angular/core'; -import { NavParams, ViewController } from 'ionic-angular'; +import { NavParams, ViewController, Platform } from 'ionic-angular'; import { ConfigProvider } from '../../providers/config/config'; import { Logger } from '@nsalaun/ng-logger'; @@ -19,14 +19,18 @@ export class PinModalPage { public disableButtons: boolean = false; public expires: string = ''; public incorrect: boolean; + public unregister: any; constructor( private navParams: NavParams, private configProvider: ConfigProvider, private logger: Logger, - private viewCtrl: ViewController + private viewCtrl: ViewController, + private platform: Platform ) { + this.unregister = this.platform.registerBackButtonAction(() => { }); + switch (this.navParams.get('action')) { case 'checkPin': this.action = 'checkPin'; @@ -52,6 +56,7 @@ export class PinModalPage { } public close(): void { + this.unregister(); this.viewCtrl.dismiss(); } @@ -127,6 +132,7 @@ export class PinModalPage { public save(): void { let lock = { method: 'PIN', value: this.currentPin, bannedUntil: null }; this.configProvider.set({ lock }); + this.unregister(); this.viewCtrl.dismiss(); } @@ -137,9 +143,13 @@ export class PinModalPage { if (this.action === 'removeLock') { let lock = { method: 'Disabled', value: null, bannedUntil: null }; this.configProvider.set({ lock }); + this.unregister(); + this.viewCtrl.dismiss(); + } + if (this.action === 'checkPin') { + this.unregister(); this.viewCtrl.dismiss(); } - if (this.action === 'checkPin') this.viewCtrl.dismiss(); } else { this.currentPin = '';