WIP
This commit is contained in:
@@ -15,8 +15,9 @@ export class NativeExtManager {
|
||||
this.resolveExtensionsManager();
|
||||
this.resolveBatchManager();
|
||||
|
||||
application.onReady(() => {
|
||||
this.initialize();
|
||||
application.onUnlock(() => {
|
||||
this.resolveExtensionsManager();
|
||||
this.resolveBatchManager();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -24,11 +25,6 @@ export class NativeExtManager {
|
||||
return this.systemExtensions.includes(extension.uuid);
|
||||
}
|
||||
|
||||
async initialize() {
|
||||
this.resolveExtensionsManager();
|
||||
this.resolveBatchManager();
|
||||
}
|
||||
|
||||
extensionsManagerTemplatePayload() {
|
||||
const url = window._extensions_manager_location;
|
||||
if (!url) {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { SFPredicate, CreateMaxPayloadFromAnyObject } from 'snjs';
|
||||
import { AppStateEvents } from '../state';
|
||||
|
||||
export const PrefKeys = {
|
||||
TagsPanelWidth: 'tagsPanelWidth',
|
||||
@@ -26,16 +25,12 @@ export class PreferencesManager {
|
||||
) {
|
||||
this.application = application;
|
||||
this.appState = appState;
|
||||
application.onReady(() => {
|
||||
this.initialize();
|
||||
application.onUnlock(() => {
|
||||
this.streamPreferences();
|
||||
this.loadSingleton();
|
||||
});
|
||||
}
|
||||
|
||||
async initialize() {
|
||||
this.streamPreferences();
|
||||
await this.loadSingleton();
|
||||
}
|
||||
|
||||
streamPreferences() {
|
||||
this.application.streamItems({
|
||||
contentType: 'SN|UserPreferences',
|
||||
|
||||
@@ -1,33 +1,40 @@
|
||||
import _ from 'lodash';
|
||||
import { ContentTypes, StorageValueModes, EncryptionIntents } from 'snjs';
|
||||
import { ContentTypes, StorageValueModes, EncryptionIntents, PureService } from 'snjs';
|
||||
import { AppStateEvents } from '@/state';
|
||||
|
||||
const CACHED_THEMES_KEY = 'cachedThemes';
|
||||
|
||||
export class ThemeManager {
|
||||
export class ThemeManager extends PureService {
|
||||
/* @ngInject */
|
||||
constructor(
|
||||
application,
|
||||
appState,
|
||||
desktopManager,
|
||||
) {
|
||||
super();
|
||||
this.application = application;
|
||||
this.appState = appState;
|
||||
this.desktopManager = desktopManager;
|
||||
this.activeThemes = [];
|
||||
this.registerObservers();
|
||||
application.onReady(() => {
|
||||
application.onStart(() => {
|
||||
if (!desktopManager.isDesktop) {
|
||||
this.activateCachedThemes();
|
||||
}
|
||||
});
|
||||
appState.addObserver((eventName, data) => {
|
||||
this.unsubState = appState.addObserver((eventName, data) => {
|
||||
if (eventName === AppStateEvents.DesktopExtsReady) {
|
||||
this.activateCachedThemes();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async deinit() {
|
||||
super.deinit();
|
||||
this.unsubState();
|
||||
}
|
||||
|
||||
async activateCachedThemes() {
|
||||
const cachedThemes = await this.getCachedThemes();
|
||||
const writeToCache = false;
|
||||
|
||||
Reference in New Issue
Block a user