onDestroy needed for broadcast subscriptions
This commit is contained in:
parent
c9c6a11390
commit
97e982bf01
|
@ -1,5 +1,6 @@
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
|
OnDestroy,
|
||||||
NgZone,
|
NgZone,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import {
|
import {
|
||||||
|
@ -28,7 +29,7 @@ const BroadcasterSubscriptionId = 'LockComponent';
|
||||||
selector: 'app-lock',
|
selector: 'app-lock',
|
||||||
templateUrl: 'lock.component.html',
|
templateUrl: 'lock.component.html',
|
||||||
})
|
})
|
||||||
export class LockComponent extends BaseLockComponent {
|
export class LockComponent extends BaseLockComponent implements OnDestroy {
|
||||||
constructor(router: Router, i18nService: I18nService,
|
constructor(router: Router, i18nService: I18nService,
|
||||||
platformUtilsService: PlatformUtilsService, messagingService: MessagingService,
|
platformUtilsService: PlatformUtilsService, messagingService: MessagingService,
|
||||||
userService: UserService, cryptoService: CryptoService,
|
userService: UserService, cryptoService: CryptoService,
|
||||||
|
@ -59,6 +60,10 @@ export class LockComponent extends BaseLockComponent {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
this.broadcasterService.unsubscribe(BroadcasterSubscriptionId);
|
||||||
|
}
|
||||||
|
|
||||||
onWindowHidden() {
|
onWindowHidden() {
|
||||||
this.showPassword = false;
|
this.showPassword = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
ComponentFactoryResolver,
|
ComponentFactoryResolver,
|
||||||
|
OnDestroy,
|
||||||
NgZone,
|
NgZone,
|
||||||
ViewChild,
|
ViewChild,
|
||||||
ViewContainerRef,
|
ViewContainerRef,
|
||||||
|
@ -31,7 +32,7 @@ const BroadcasterSubscriptionId = 'LoginComponent';
|
||||||
selector: 'app-login',
|
selector: 'app-login',
|
||||||
templateUrl: 'login.component.html',
|
templateUrl: 'login.component.html',
|
||||||
})
|
})
|
||||||
export class LoginComponent extends BaseLoginComponent {
|
export class LoginComponent extends BaseLoginComponent implements OnDestroy {
|
||||||
@ViewChild('environment', { read: ViewContainerRef, static: true }) environmentModal: ViewContainerRef;
|
@ViewChild('environment', { read: ViewContainerRef, static: true }) environmentModal: ViewContainerRef;
|
||||||
|
|
||||||
showingModal = false;
|
showingModal = false;
|
||||||
|
@ -63,6 +64,10 @@ export class LoginComponent extends BaseLoginComponent {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
this.broadcasterService.unsubscribe(BroadcasterSubscriptionId);
|
||||||
|
}
|
||||||
|
|
||||||
settings() {
|
settings() {
|
||||||
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
const factory = this.componentFactoryResolver.resolveComponentFactory(ModalComponent);
|
||||||
const modal = this.environmentModal.createComponent(factory).instance;
|
const modal = this.environmentModal.createComponent(factory).instance;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
NgZone,
|
NgZone,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
@ -23,7 +24,7 @@ const BroadcasterSubscriptionId = 'RegisterComponent';
|
||||||
selector: 'app-register',
|
selector: 'app-register',
|
||||||
templateUrl: 'register.component.html',
|
templateUrl: 'register.component.html',
|
||||||
})
|
})
|
||||||
export class RegisterComponent extends BaseRegisterComponent implements OnInit {
|
export class RegisterComponent extends BaseRegisterComponent implements OnInit, OnDestroy {
|
||||||
constructor(authService: AuthService, router: Router,
|
constructor(authService: AuthService, router: Router,
|
||||||
i18nService: I18nService, cryptoService: CryptoService,
|
i18nService: I18nService, cryptoService: CryptoService,
|
||||||
apiService: ApiService, stateService: StateService,
|
apiService: ApiService, stateService: StateService,
|
||||||
|
@ -46,6 +47,10 @@ export class RegisterComponent extends BaseRegisterComponent implements OnInit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
this.broadcasterService.unsubscribe(BroadcasterSubscriptionId);
|
||||||
|
}
|
||||||
|
|
||||||
onWindowHidden() {
|
onWindowHidden() {
|
||||||
this.showPassword = false;
|
this.showPassword = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
|
OnDestroy,
|
||||||
NgZone,
|
NgZone,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
|
@ -30,7 +31,7 @@ import {
|
||||||
selector: 'app-set-password',
|
selector: 'app-set-password',
|
||||||
templateUrl: 'set-password.component.html',
|
templateUrl: 'set-password.component.html',
|
||||||
})
|
})
|
||||||
export class SetPasswordComponent extends BaseSetPasswordComponent {
|
export class SetPasswordComponent extends BaseSetPasswordComponent implements OnDestroy {
|
||||||
constructor(apiService: ApiService, i18nService: I18nService,
|
constructor(apiService: ApiService, i18nService: I18nService,
|
||||||
cryptoService: CryptoService, messagingService: MessagingService,
|
cryptoService: CryptoService, messagingService: MessagingService,
|
||||||
userService: UserService, passwordGenerationService: PasswordGenerationService,
|
userService: UserService, passwordGenerationService: PasswordGenerationService,
|
||||||
|
@ -85,6 +86,10 @@ export class SetPasswordComponent extends BaseSetPasswordComponent {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
this.broadcasterService.unsubscribe(BroadcasterSubscriptionId);
|
||||||
|
}
|
||||||
|
|
||||||
onWindowHidden() {
|
onWindowHidden() {
|
||||||
this.showPassword = false;
|
this.showPassword = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
OnChanges,
|
OnChanges,
|
||||||
|
OnDestroy,
|
||||||
NgZone,
|
NgZone,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
|
@ -25,7 +26,7 @@ const BroadcasterSubscriptionId = 'AddEditComponent';
|
||||||
selector: 'app-vault-add-edit',
|
selector: 'app-vault-add-edit',
|
||||||
templateUrl: 'add-edit.component.html',
|
templateUrl: 'add-edit.component.html',
|
||||||
})
|
})
|
||||||
export class AddEditComponent extends BaseAddEditComponent implements OnChanges {
|
export class AddEditComponent extends BaseAddEditComponent implements OnChanges, OnDestroy {
|
||||||
constructor(cipherService: CipherService, folderService: FolderService,
|
constructor(cipherService: CipherService, folderService: FolderService,
|
||||||
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
|
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
|
||||||
auditService: AuditService, stateService: StateService,
|
auditService: AuditService, stateService: StateService,
|
||||||
|
@ -55,6 +56,10 @@ export class AddEditComponent extends BaseAddEditComponent implements OnChanges
|
||||||
await this.load();
|
await this.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
this.broadcasterService.unsubscribe(BroadcasterSubscriptionId);
|
||||||
|
}
|
||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
if (document.querySelectorAll('app-vault-add-edit .ng-dirty').length === 0 ||
|
if (document.querySelectorAll('app-vault-add-edit .ng-dirty').length === 0 ||
|
||||||
(this.cipher != null && this.cipherId !== this.cipher.id)) {
|
(this.cipher != null && this.cipherId !== this.cipher.id)) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
NgZone,
|
NgZone,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
@ -41,6 +42,10 @@ export class ExportComponent extends BaseExportComponent implements OnInit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
this.broadcasterService.unsubscribe(BroadcasterSubscriptionId);
|
||||||
|
}
|
||||||
|
|
||||||
onWindowHidden() {
|
onWindowHidden() {
|
||||||
this.showPassword = false;
|
this.showPassword = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,11 @@ export class ViewComponent extends BaseViewComponent implements OnChanges {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
super.ngOnDestroy();
|
||||||
|
this.broadcasterService.unsubscribe(BroadcasterSubscriptionId);
|
||||||
|
}
|
||||||
|
|
||||||
async ngOnChanges() {
|
async ngOnChanges() {
|
||||||
await super.load();
|
await super.load();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue