This commit is contained in:
Mo Bitar
2020-02-09 12:07:18 -06:00
parent 046f6ca5b9
commit 1a87df0db8
18 changed files with 1151 additions and 1130 deletions

View File

@@ -1,21 +1,19 @@
import template from '%/lock-screen.pug';
import { AppStateEvents } from '@/state';
import { PureCtrl } from './abstract/pure_ctrl';
const ELEMENT_ID_PASSCODE_INPUT = 'passcode-input';
class LockScreenCtrl {
class LockScreenCtrl extends PureCtrl {
/* @ngInject */
constructor(
$scope,
$timeout,
application,
appState
) {
this.$scope = $scope;
this.application = application;
this.appState = appState;
super($scope, $timeout, application, appState);
this.formData = {};
this.addVisibilityObserver();
this.addDestroyHandler();
}
$onInit() {
@@ -30,25 +28,18 @@ class LockScreenCtrl {
);
}
addDestroyHandler() {
this.$scope.$on('$destroy', () => {
this.unregisterObserver();
});
}
addVisibilityObserver() {
this.unregisterObserver = this.appState.addObserver((eventName, data) => {
if (eventName === AppStateEvents.WindowDidFocus) {
const input = this.passcodeInput;
if(input) {
input.focus();
}
/** @override */
async onAppStateEvent(eventName, data) {
if (eventName === AppStateEvents.WindowDidFocus) {
const input = this.passcodeInput;
if (input) {
input.focus();
}
});
}
}
async submitPasscodeForm($event) {
if(
if (
!this.formData.passcode ||
this.formData.passcode.length === 0
) {