From 92b223d35a282578e819148195eacf0a743efb43 Mon Sep 17 00:00:00 2001 From: Baptiste Grob <60621355+baptiste-grob@users.noreply.github.com> Date: Mon, 28 Sep 2020 12:07:13 +0200 Subject: [PATCH] fix: activate themes on desktop --- app/assets/javascripts/services/desktopManager.ts | 4 ---- app/assets/javascripts/services/themeManager.ts | 9 +-------- app/assets/javascripts/ui_models/app_state.ts | 10 ---------- .../javascripts/views/application/application_view.ts | 6 +++--- 4 files changed, 4 insertions(+), 25 deletions(-) diff --git a/app/assets/javascripts/services/desktopManager.ts b/app/assets/javascripts/services/desktopManager.ts index c3894d843..fb8962565 100644 --- a/app/assets/javascripts/services/desktopManager.ts +++ b/app/assets/javascripts/services/desktopManager.ts @@ -187,10 +187,6 @@ export class DesktopManager extends ApplicationService { }); } - onExtensionsReady() { - this.webApplication.getAppState().desktopExtensionsReady(); - } - desktop_requestBackupFile() { return this.application!.createBackupFile( undefined, diff --git a/app/assets/javascripts/services/themeManager.ts b/app/assets/javascripts/services/themeManager.ts index 9f97bb5db..1fb707c9f 100644 --- a/app/assets/javascripts/services/themeManager.ts +++ b/app/assets/javascripts/services/themeManager.ts @@ -24,8 +24,8 @@ export class ThemeManager extends ApplicationService { if (event === ApplicationEvent.SignedOut) { this.deactivateAllThemes(); } else if (event === ApplicationEvent.StorageReady) { + await this.activateCachedThemes(); if (!this.webApplication.getDesktopService().isDesktop) { - await this.activateCachedThemes(); } } } @@ -50,13 +50,6 @@ export class ThemeManager extends ApplicationService { async onAppStart() { super.onAppStart(); this.registerObservers(); - this.unsubState = this.webApplication.getAppState().addObserver( - async (eventName) => { - if (eventName === AppStateEvent.DesktopExtsReady) { - this.activateCachedThemes(); - } - } - ); } private async activateCachedThemes() { diff --git a/app/assets/javascripts/ui_models/app_state.ts b/app/assets/javascripts/ui_models/app_state.ts index e55bd8d1d..88e8a4965 100644 --- a/app/assets/javascripts/ui_models/app_state.ts +++ b/app/assets/javascripts/ui_models/app_state.ts @@ -21,7 +21,6 @@ export enum AppStateEvent { EditorFocused = 5, BeganBackupDownload = 6, EndedBackupDownload = 7, - DesktopExtsReady = 8, WindowDidFocus = 9, WindowDidBlur = 10, }; @@ -309,13 +308,4 @@ export class AppState { { success: success } ); } - - /** - * When the desktop appplication extension server is ready. - */ - desktopExtensionsReady() { - this.notifyEvent( - AppStateEvent.DesktopExtsReady - ); - } } diff --git a/app/assets/javascripts/views/application/application_view.ts b/app/assets/javascripts/views/application/application_view.ts index 135b09404..a60986dac 100644 --- a/app/assets/javascripts/views/application/application_view.ts +++ b/app/assets/javascripts/views/application/application_view.ts @@ -57,6 +57,9 @@ class ApplicationViewCtrl extends PureViewCtrl { } async loadApplication() { + this.application!.componentManager!.setDesktopManager( + this.application!.getDesktopService() + ); await this.application!.prepareForLaunch({ receiveChallenge: async (challenge) => { this.application!.promptForChallenge(challenge); @@ -67,9 +70,6 @@ class ApplicationViewCtrl extends PureViewCtrl { async onAppStart() { super.onAppStart(); - this.application!.componentManager!.setDesktopManager( - this.application!.getDesktopService() - ); this.setState({ ready: true, needsUnlock: this.application!.hasPasscode()