Activate cached themes on desktop set of application path

This commit is contained in:
Mo Bitar
2019-10-28 12:29:16 -05:00
parent b3ce96dd20
commit 6b9f630737
5 changed files with 22 additions and 14 deletions

View File

@@ -13,7 +13,8 @@ module.exports = function(grunt) {
js: { js: {
files: ['app/assets/javascripts/**/*.js'], files: ['app/assets/javascripts/**/*.js'],
tasks: [ 'concat:app', 'babel', 'browserify', 'concat:dist', 'clean'], tasks: ['haml', 'ngtemplates', 'sass', 'concat:app', 'babel', 'browserify',
'concat:lib', 'concat:dist', 'concat:css', 'uglify', 'ngconstant:build', 'clean'],
options: { options: {
spawn: false, spawn: false,
}, },

View File

@@ -154,6 +154,7 @@ class DesktopManager {
/* Used to resolve "sn://" */ /* Used to resolve "sn://" */
desktop_setApplicationDataPath(path) { desktop_setApplicationDataPath(path) {
this.applicationDataPath = path; this.applicationDataPath = path;
this.$rootScope.$broadcast("desktop-did-set-application-path");
} }
desktop_setComponentInstallationSyncHandler(handler) { desktop_setComponentInstallationSyncHandler(handler) {

View File

@@ -1,6 +1,6 @@
class ThemeManager { class ThemeManager {
constructor(componentManager, desktopManager, storageManager, passcodeManager) { constructor(componentManager, desktopManager, storageManager, passcodeManager, $rootScope) {
this.componentManager = componentManager; this.componentManager = componentManager;
this.storageManager = storageManager; this.storageManager = storageManager;
this.desktopManager = desktopManager; this.desktopManager = desktopManager;
@@ -17,11 +17,13 @@ class ThemeManager {
this.cacheThemes(); this.cacheThemes();
}) })
// The desktop application won't have its applicationDataPath until the angular document is ready, if(desktopManager.isDesktop) {
// so it wont be able to resolve local theme urls until thats ready $rootScope.$on("desktop-did-set-application-path", () => {
angular.element(document).ready(() => { this.activateCachedThemes();
})
} else {
this.activateCachedThemes(); this.activateCachedThemes();
}); }
} }
activateCachedThemes() { activateCachedThemes() {

View File

@@ -58896,6 +58896,7 @@ function () {
key: "desktop_setApplicationDataPath", key: "desktop_setApplicationDataPath",
value: function desktop_setApplicationDataPath(path) { value: function desktop_setApplicationDataPath(path) {
this.applicationDataPath = path; this.applicationDataPath = path;
this.$rootScope.$broadcast("desktop-did-set-application-path");
} }
}, { }, {
key: "desktop_setComponentInstallationSyncHandler", key: "desktop_setComponentInstallationSyncHandler",
@@ -61723,9 +61724,9 @@ angular.module('app').service('syncManager', SyncManager);
var ThemeManager = var ThemeManager =
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
ThemeManager.$inject = ["componentManager", "desktopManager", "storageManager", "passcodeManager"]; ThemeManager.$inject = ["componentManager", "desktopManager", "storageManager", "passcodeManager", "$rootScope"];
function ThemeManager(componentManager, desktopManager, storageManager, passcodeManager) { function ThemeManager(componentManager, desktopManager, storageManager, passcodeManager, $rootScope) {
var _this89 = this; var _this89 = this;
(0, _classCallCheck3["default"])(this, ThemeManager); (0, _classCallCheck3["default"])(this, ThemeManager);
@@ -61740,12 +61741,15 @@ function () {
passcodeManager.addPasscodeChangeObserver(function () { passcodeManager.addPasscodeChangeObserver(function () {
_this89.cacheThemes(); _this89.cacheThemes();
}); // The desktop application won't have its applicationDataPath until the angular document is ready,
// so it wont be able to resolve local theme urls until thats ready
angular.element(document).ready(function () {
_this89.activateCachedThemes();
}); });
if (desktopManager.isDesktop) {
$rootScope.$on("desktop-did-set-application-path", function () {
_this89.activateCachedThemes();
});
} else {
this.activateCachedThemes();
}
} }
(0, _createClass3["default"])(ThemeManager, [{ (0, _createClass3["default"])(ThemeManager, [{

File diff suppressed because one or more lines are too long