2020-11-04 18:09:21 +01:00
|
|
|
import {
|
|
|
|
Component,
|
|
|
|
NgZone,
|
|
|
|
} from '@angular/core';
|
2020-07-23 23:24:35 +02:00
|
|
|
import {
|
|
|
|
ActivatedRoute,
|
|
|
|
Router,
|
|
|
|
} from '@angular/router';
|
2018-02-10 04:47:53 +01:00
|
|
|
|
2020-07-23 19:32:36 +02:00
|
|
|
import { ApiService } from 'jslib/abstractions/api.service';
|
2018-02-10 04:47:53 +01:00
|
|
|
import { CryptoService } from 'jslib/abstractions/crypto.service';
|
2019-06-04 06:03:20 +02:00
|
|
|
import { EnvironmentService } from 'jslib/abstractions/environment.service';
|
2018-02-10 04:47:53 +01:00
|
|
|
import { I18nService } from 'jslib/abstractions/i18n.service';
|
|
|
|
import { MessagingService } from 'jslib/abstractions/messaging.service';
|
|
|
|
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
2019-07-02 14:18:42 +02:00
|
|
|
import { StateService } from 'jslib/abstractions/state.service';
|
2018-12-26 17:02:02 +01:00
|
|
|
import { StorageService } from 'jslib/abstractions/storage.service';
|
2018-02-10 04:47:53 +01:00
|
|
|
import { UserService } from 'jslib/abstractions/user.service';
|
2020-04-01 17:18:36 +02:00
|
|
|
import { VaultTimeoutService } from 'jslib/abstractions/vaultTimeout.service';
|
2018-02-10 04:47:53 +01:00
|
|
|
|
2020-11-04 18:09:21 +01:00
|
|
|
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
|
|
|
|
|
2018-04-05 05:01:40 +02:00
|
|
|
import { LockComponent as BaseLockComponent } from 'jslib/angular/components/lock.component';
|
|
|
|
|
2020-11-04 18:09:21 +01:00
|
|
|
const BroadcasterSubscriptionId = 'LockComponent';
|
|
|
|
|
2018-02-10 04:47:53 +01:00
|
|
|
@Component({
|
|
|
|
selector: 'app-lock',
|
2018-04-06 18:25:22 +02:00
|
|
|
templateUrl: 'lock.component.html',
|
2018-02-10 04:47:53 +01:00
|
|
|
})
|
2019-02-25 21:07:44 +01:00
|
|
|
export class LockComponent extends BaseLockComponent {
|
2018-10-03 15:42:11 +02:00
|
|
|
constructor(router: Router, i18nService: I18nService,
|
2018-04-05 05:01:40 +02:00
|
|
|
platformUtilsService: PlatformUtilsService, messagingService: MessagingService,
|
2018-12-26 17:02:02 +01:00
|
|
|
userService: UserService, cryptoService: CryptoService,
|
2020-04-01 17:18:36 +02:00
|
|
|
storageService: StorageService, vaultTimeoutService: VaultTimeoutService,
|
2020-07-23 23:24:35 +02:00
|
|
|
environmentService: EnvironmentService, stateService: StateService,
|
2020-11-04 18:09:21 +01:00
|
|
|
apiService: ApiService, private route: ActivatedRoute,
|
|
|
|
private broadcasterService: BroadcasterService, private ngZone: NgZone) {
|
2019-02-13 16:06:58 +01:00
|
|
|
super(router, i18nService, platformUtilsService, messagingService, userService, cryptoService,
|
2020-11-02 23:11:56 +01:00
|
|
|
storageService, vaultTimeoutService, environmentService, stateService, apiService);
|
2018-02-24 19:48:55 +01:00
|
|
|
}
|
2020-07-23 23:24:35 +02:00
|
|
|
|
|
|
|
async ngOnInit() {
|
|
|
|
await super.ngOnInit();
|
|
|
|
this.route.queryParams.subscribe((params) => {
|
|
|
|
if (this.supportsBiometric && params.promptBiometric) {
|
|
|
|
setTimeout(() => this.unlockBiometric(), 1000);
|
|
|
|
}
|
|
|
|
});
|
2020-11-04 18:09:21 +01:00
|
|
|
this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => {
|
|
|
|
this.ngZone.run(() => {
|
|
|
|
switch (message.command) {
|
|
|
|
case 'windowHidden':
|
|
|
|
this.onWindowHidden();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
onWindowHidden() {
|
|
|
|
this.showPassword = false;
|
2020-07-23 23:24:35 +02:00
|
|
|
}
|
2018-02-10 04:47:53 +01:00
|
|
|
}
|