From c7de58d12500519f69b3c75b68108d330f95b8b2 Mon Sep 17 00:00:00 2001 From: Tor Hveem Date: Mon, 2 Mar 2015 22:08:45 +0100 Subject: [PATCH 1/2] save defaults to $store --- js/settings.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/settings.js b/js/settings.js index 8c312fc..b153d1a 100644 --- a/js/settings.js +++ b/js/settings.js @@ -57,6 +57,9 @@ weechat.factory('settings', ['$store', '$rootScope', function($store, $rootScope for (var key in defaults) { // null means the key isn't set if ($store.get(key) === null) { + // Define property so it will get saved to store + defineProperty(key); + // Save to settings module AND to store this[key] = defaults[key]; } } From a8dcd738cfa9da32afa778fa72e984ee16177016 Mon Sep 17 00:00:00 2001 From: Tor Hveem Date: Mon, 2 Mar 2015 22:19:53 +0100 Subject: [PATCH 2/2] fix problem with activating saving of password --- js/glowingbear.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/js/glowingbear.js b/js/glowingbear.js index 0bf07b7..edd0724 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -281,6 +281,15 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', settings.password = ''; } + // Check if user decides to save password, and copy it over + settings.addCallback('savepassword', function(newvalue) { + if (settings.savepassword) { + // Init value in settings module + settings.setDefaults({'password': $scope.password}); + settings.password = $scope.password; + } + }); + $rootScope.wasMobileUi = false; if (utils.isMobileUi()) { $rootScope.wasMobileUi = true;