From d8d1ee30229c8223910744d6a1771d1062dcc467 Mon Sep 17 00:00:00 2001 From: Chad Scharf <3904944+cscharf@users.noreply.github.com> Date: Thu, 29 Oct 2020 16:35:09 -0400 Subject: [PATCH] Handle main window hide --- jslib | 2 +- src/app/accounts/lock.component.ts | 7 +++++-- src/app/accounts/login.component.ts | 7 +++++-- src/app/accounts/register.component.ts | 7 +++++-- src/app/accounts/set-password.component.ts | 6 ++++-- src/app/vault/add-edit.component.ts | 7 +++++-- src/app/vault/export.component.ts | 7 +++++-- src/main.ts | 3 +++ 8 files changed, 33 insertions(+), 13 deletions(-) diff --git a/jslib b/jslib index d84d6da7f7..4258077179 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit d84d6da7f77ec89ba69299b1ff982f083fd77203 +Subproject commit 4258077179afa09f57712d2c9d05a9dff0b2f583 diff --git a/src/app/accounts/lock.component.ts b/src/app/accounts/lock.component.ts index 33b6d5ae80..657c0110ce 100644 --- a/src/app/accounts/lock.component.ts +++ b/src/app/accounts/lock.component.ts @@ -17,6 +17,8 @@ import { VaultTimeoutService } from 'jslib/abstractions/vaultTimeout.service'; import { LockComponent as BaseLockComponent } from 'jslib/angular/components/lock.component'; +import { BroadcasterService } from 'jslib/angular/services/broadcaster.service'; + @Component({ selector: 'app-lock', templateUrl: 'lock.component.html', @@ -27,9 +29,10 @@ export class LockComponent extends BaseLockComponent { userService: UserService, cryptoService: CryptoService, storageService: StorageService, vaultTimeoutService: VaultTimeoutService, environmentService: EnvironmentService, stateService: StateService, - apiService: ApiService, private route: ActivatedRoute) { + apiService: ApiService, broadcasterService: BroadcasterService, + private route: ActivatedRoute) { super(router, i18nService, platformUtilsService, messagingService, userService, cryptoService, - storageService, vaultTimeoutService, environmentService, stateService, apiService); + storageService, vaultTimeoutService, environmentService, stateService, apiService, broadcasterService); } async ngOnInit() { diff --git a/src/app/accounts/login.component.ts b/src/app/accounts/login.component.ts index 1b06d85b5b..8fb75c7afe 100644 --- a/src/app/accounts/login.component.ts +++ b/src/app/accounts/login.component.ts @@ -22,6 +22,8 @@ import { SyncService } from 'jslib/abstractions/sync.service'; import { LoginComponent as BaseLoginComponent } from 'jslib/angular/components/login.component'; import { ModalComponent } from 'jslib/angular/components/modal.component'; +import { BroadcasterService } from 'jslib/angular/services/broadcaster.service'; + @Component({ selector: 'app-login', templateUrl: 'login.component.html', @@ -35,9 +37,10 @@ export class LoginComponent extends BaseLoginComponent { syncService: SyncService, private componentFactoryResolver: ComponentFactoryResolver, platformUtilsService: PlatformUtilsService, stateService: StateService, environmentService: EnvironmentService, passwordGenerationService: PasswordGenerationService, - cryptoFunctionService: CryptoFunctionService, storageService: StorageService) { + cryptoFunctionService: CryptoFunctionService, storageService: StorageService, + broadcasterService: BroadcasterService) { super(authService, router, platformUtilsService, i18nService, stateService, environmentService, - passwordGenerationService, cryptoFunctionService, storageService); + passwordGenerationService, cryptoFunctionService, broadcasterService, storageService); super.onSuccessfulLogin = () => { return syncService.fullSync(true); }; diff --git a/src/app/accounts/register.component.ts b/src/app/accounts/register.component.ts index 19fa0c1962..c6910fe1a7 100644 --- a/src/app/accounts/register.component.ts +++ b/src/app/accounts/register.component.ts @@ -9,6 +9,8 @@ import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { StateService } from 'jslib/abstractions/state.service'; +import { BroadcasterService } from 'jslib/angular/services/broadcaster.service'; + import { RegisterComponent as BaseRegisterComponent } from 'jslib/angular/components/register.component'; @Component({ @@ -19,8 +21,9 @@ export class RegisterComponent extends BaseRegisterComponent { constructor(authService: AuthService, router: Router, i18nService: I18nService, cryptoService: CryptoService, apiService: ApiService, stateService: StateService, - platformUtilsService: PlatformUtilsService, passwordGenerationService: PasswordGenerationService) { + platformUtilsService: PlatformUtilsService, passwordGenerationService: PasswordGenerationService, + broadcasterService: BroadcasterService) { super(authService, router, i18nService, cryptoService, apiService, stateService, platformUtilsService, - passwordGenerationService); + passwordGenerationService, broadcasterService); } } diff --git a/src/app/accounts/set-password.component.ts b/src/app/accounts/set-password.component.ts index 295ded430f..0e9a9b3e03 100644 --- a/src/app/accounts/set-password.component.ts +++ b/src/app/accounts/set-password.component.ts @@ -15,6 +15,8 @@ import { PolicyService } from 'jslib/abstractions/policy.service'; import { SyncService } from 'jslib/abstractions/sync.service'; import { UserService } from 'jslib/abstractions/user.service'; +import { BroadcasterService } from 'jslib/angular/services/broadcaster.service'; + import { SetPasswordComponent as BaseSetPasswordComponent, } from 'jslib/angular/components/set-password.component'; @@ -28,9 +30,9 @@ export class SetPasswordComponent extends BaseSetPasswordComponent { cryptoService: CryptoService, messagingService: MessagingService, userService: UserService, passwordGenerationService: PasswordGenerationService, platformUtilsService: PlatformUtilsService, policyService: PolicyService, router: Router, - syncService: SyncService, route: ActivatedRoute) { + syncService: SyncService, route: ActivatedRoute, broadcasterService: BroadcasterService) { super(i18nService, cryptoService, messagingService, userService, passwordGenerationService, - platformUtilsService, policyService, router, apiService, syncService, route); + platformUtilsService, policyService, router, apiService, syncService, route, broadcasterService); } get masterPasswordScoreWidth() { diff --git a/src/app/vault/add-edit.component.ts b/src/app/vault/add-edit.component.ts index ed0d529d84..937dfbfdaa 100644 --- a/src/app/vault/add-edit.component.ts +++ b/src/app/vault/add-edit.component.ts @@ -16,6 +16,8 @@ import { UserService } from 'jslib/abstractions/user.service'; import { AddEditComponent as BaseAddEditComponent } from 'jslib/angular/components/add-edit.component'; +import { BroadcasterService } from 'jslib/angular/services/broadcaster.service'; + @Component({ selector: 'app-vault-add-edit', templateUrl: 'add-edit.component.html', @@ -25,9 +27,10 @@ export class AddEditComponent extends BaseAddEditComponent implements OnChanges i18nService: I18nService, platformUtilsService: PlatformUtilsService, auditService: AuditService, stateService: StateService, userService: UserService, collectionService: CollectionService, - messagingService: MessagingService, eventService: EventService) { + messagingService: MessagingService, eventService: EventService, + broadcasterService: BroadcasterService) { super(cipherService, folderService, i18nService, platformUtilsService, auditService, stateService, - userService, collectionService, messagingService, eventService); + userService, collectionService, messagingService, eventService, broadcasterService); } async ngOnInit() { diff --git a/src/app/vault/export.component.ts b/src/app/vault/export.component.ts index eac41c806e..1fb5d0c70a 100644 --- a/src/app/vault/export.component.ts +++ b/src/app/vault/export.component.ts @@ -8,6 +8,8 @@ import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { ExportComponent as BaseExportComponent } from 'jslib/angular/components/export.component'; +import { BroadcasterService } from 'jslib/angular/services/broadcaster.service'; + @Component({ selector: 'app-export', templateUrl: 'export.component.html', @@ -15,7 +17,8 @@ import { ExportComponent as BaseExportComponent } from 'jslib/angular/components export class ExportComponent extends BaseExportComponent { constructor(cryptoService: CryptoService, i18nService: I18nService, platformUtilsService: PlatformUtilsService, exportService: ExportService, - eventService: EventService) { - super(cryptoService, i18nService, platformUtilsService, exportService, eventService, window); + eventService: EventService, broadcasterService: BroadcasterService) { + super(cryptoService, i18nService, platformUtilsService, exportService, eventService, window, + broadcasterService); } } diff --git a/src/main.ts b/src/main.ts index e582c4cffc..49317e077f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -149,6 +149,9 @@ export class Main { event.preventDefault(); this.processDeepLink([url]); }); + + // Handle visibility event(s) + this.windowMain.win.on('hide', () => this.messagingService.send('hideMain')); }, (e: any) => { // tslint:disable-next-line console.error(e);