Resizable panels and user prefs

This commit is contained in:
Mo Bitar
2017-12-27 12:17:29 -06:00
parent 38f2e345d9
commit 8c15438d00
16 changed files with 603 additions and 163 deletions

View File

@@ -298,6 +298,7 @@ angular.module('app.frontend')
singletonManager.registerSingleton({content_type: prefsContentType}, (resolvedSingleton) => {
console.log("AuthManager received resolved UserPreferences", resolvedSingleton);
this.userPreferences = resolvedSingleton;
this.userPreferencesDidChange();
}, () => {
// Safe to create. Create and return object.
var prefs = new Item({content_type: prefsContentType});
@@ -308,5 +309,28 @@ angular.module('app.frontend')
return prefs;
});
this.userPreferencesDidChange = function() {
$rootScope.$broadcast("user-preferences-changed");
}
this.syncUserPreferences = function() {
this.userPreferences.setDirty(true);
$rootScope.sync();
}
this.getUserPrefValue = function(key, defaultValue) {
if(!this.userPreferences) { return; }
var value = this.userPreferences.getAppDataItem(key);
return (value !== undefined && value != null) ? value : defaultValue;
}
this.setUserPrefValue = function(key, value, sync) {
if(!this.userPreferences) { console.log("Prefs are null, not setting value", key); return; }
this.userPreferences.setAppDataItem(key, value);
if(sync) {
this.syncUserPreferences();
}
}
}
});