Fix: backbutton for fingerprint and pin modals

This commit is contained in:
Gabriel Masclef 2018-01-15 10:09:54 -03:00
parent 17b87ec1ec
commit cfbfadb48f
No known key found for this signature in database
GPG Key ID: DD6D7EAADE12280D
2 changed files with 20 additions and 5 deletions

View File

@ -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);
});

View File

@ -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 = '';