From 3210c87ec19292db9a37bdf8734cefdcbbfd7e8e Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Thu, 11 Dec 2014 23:45:44 -0300 Subject: [PATCH] add timeout to fix settings saving --- js/controllers/createProfile.js | 1 + js/services/configService.js | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/js/controllers/createProfile.js b/js/controllers/createProfile.js index 509cf6b13..8e6719c8e 100644 --- a/js/controllers/createProfile.js +++ b/js/controllers/createProfile.js @@ -160,6 +160,7 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun $scope.error = 'Please enter the required fields'; return; } + $scope.saveSettings(function(err) { preconditions.checkState(!err, err); diff --git a/js/services/configService.js b/js/services/configService.js index f34013165..ed4c517d8 100644 --- a/js/services/configService.js +++ b/js/services/configService.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.services').factory('configService', function(localstorageService, gettextCatalog) { +angular.module('copayApp.services').factory('configService', function($timeout, localstorageService, gettextCatalog) { var root = {}; root.set = function(opts, cb) { @@ -22,10 +22,12 @@ angular.module('copayApp.services').factory('configService', function(localstora var newOpts = {}; _.extend(newOpts, copay.defaultConfig, oldOpts, opts); - // TODO remove this gloval variable. + // TODO remove this global variable. config = newOpts; - localstorageService.setItem('config', JSON.stringify(newOpts), cb); + localstorageService.setItem('config', JSON.stringify(newOpts), function() { + $timeout(cb, 1); + }); }); };