Component and other handler deregisterations

This commit is contained in:
Mo Bitar
2020-03-24 12:12:07 -05:00
parent ee7cb1fce6
commit 7aa38cbdb8
11 changed files with 476 additions and 310 deletions

View File

@@ -31,6 +31,8 @@ class FooterCtrl extends PureCtrl {
deinit() {
this.rooms.length = 0;
this.themesWithIcons.length = 0;
this.unregisterComponent();
this.unregisterComponent = null;
this.rootScopeListener1();
this.rootScopeListener2();
this.rootScopeListener1 = null;
@@ -65,11 +67,7 @@ class FooterCtrl extends PureCtrl {
onAppLaunch() {
super.onAppLaunch();
const hasPasscode = this.application.hasPasscode();
this.setState({
hasPasscode: hasPasscode
});
this.reloadPasscodeStatus();
this.reloadUpgradeStatus();
this.user = this.application.getUser();
this.updateOfflineStatus();
@@ -78,6 +76,13 @@ class FooterCtrl extends PureCtrl {
this.registerComponentHandler();
}
async reloadPasscodeStatus() {
const hasPasscode = this.application.hasPasscode();
this.setState({
hasPasscode: hasPasscode
});
}
addRootScopeListeners() {
this.rootScopeListener1 = this.$rootScope.$on("reload-ext-data", () => {
this.reloadExtendedData();
@@ -118,6 +123,13 @@ class FooterCtrl extends PureCtrl {
}
}
/** @override */
async onAppKeyChange() {
super.onAppKeyChange();
this.reloadPasscodeStatus();
}
/** @override */
onAppEvent(eventName) {
if (eventName === ApplicationEvents.KeyStatusChanged) {
@@ -183,7 +195,7 @@ class FooterCtrl extends PureCtrl {
}
registerComponentHandler() {
this.application.componentManager.registerHandler({
this.unregisterComponent = this.application.componentManager.registerHandler({
identifier: "roomBar",
areas: ["rooms", "modal"],
activationHandler: (component) => { },