save remote for new clients
This commit is contained in:
parent
c65b2d7c07
commit
7f65822790
4 changed files with 28 additions and 14 deletions
|
|
@ -172,6 +172,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
var prefs = opts.preferences || {};
|
||||
var fc = profileService.focusedClient;
|
||||
|
||||
// Update this JIC.
|
||||
var config = configService.getSync().wallet.settings;
|
||||
self.unitName = config.unitName;
|
||||
|
||||
//prefs.email (may come from arguments)
|
||||
prefs.language = self.defaultLanguageIsoCode;
|
||||
prefs.unit = self.unitName;
|
||||
|
|
@ -188,6 +192,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
self.handleError(err);
|
||||
return cb(err);
|
||||
}
|
||||
if (!fc) return cb();
|
||||
|
||||
fc.getPreferences(function(err, preferences) {
|
||||
if (err) {
|
||||
|
|
@ -651,6 +656,17 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
});
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/ProfileBound', function() {
|
||||
storageService.getRemotePrefsStoredFlag(function(err, val) {
|
||||
if (err || val) return;
|
||||
self.updateRemotePreferences({
|
||||
saveAll: true
|
||||
}, function() {
|
||||
$log.debug('Remote preferences saved')
|
||||
storageService.setRemotePrefsStoredFlag(function() {});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/NewFocusedWallet', function() {
|
||||
self.setUxLanguage();
|
||||
|
|
@ -666,11 +682,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
});
|
||||
|
||||
$rootScope.$on('Local/UnitSettingUpdated', function(event) {
|
||||
// This need to be done first, to update unitName
|
||||
// updateAll do it, but async, later.
|
||||
var config = configService.getSync().wallet.settings;
|
||||
self.unitName = config.unitName;
|
||||
|
||||
self.updateAll();
|
||||
self.updateTxHistory();
|
||||
self.updateRemotePreferences({
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ angular
|
|||
'main': {
|
||||
templateUrl: 'views/splash.html',
|
||||
controller: function($scope, $timeout, $log, profileService, storageService, go) {
|
||||
storageService.getCopayDisclaimer(function(err, val) {
|
||||
storageService.getCopayDisclaimerFlag(function(err, val) {
|
||||
if (!val) go.path('disclaimer');
|
||||
|
||||
if (profileService.profile) {
|
||||
|
|
@ -109,7 +109,7 @@ angular
|
|||
'main': {
|
||||
templateUrl: 'views/disclaimer.html',
|
||||
controller: function($scope, $timeout, storageService, applicationService, go) {
|
||||
storageService.getCopayDisclaimer(function(err, val) {
|
||||
storageService.getCopayDisclaimerFlag(function(err, val) {
|
||||
$scope.agreed = val;
|
||||
$timeout(function(){
|
||||
$scope.$digest();
|
||||
|
|
@ -117,7 +117,7 @@ angular
|
|||
});
|
||||
|
||||
$scope.agree = function() {
|
||||
storageService.setCopayDisclaimer(function(err) {
|
||||
storageService.setCopayDisclaimerFlag(function(err) {
|
||||
$timeout(function(){
|
||||
applicationService.restart();
|
||||
}, 1000);
|
||||
|
|
|
|||
|
|
@ -128,13 +128,16 @@ angular.module('copayApp.services')
|
|||
root.setWalletClients();
|
||||
storageService.getFocusedWalletId(function(err, focusedWalletId) {
|
||||
if (err) return cb(err);
|
||||
root._setFocus(focusedWalletId, cb);
|
||||
root._setFocus(focusedWalletId, function() {
|
||||
$rootScope.$emit('Local/ProfileBound');
|
||||
return cb();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
root.loadAndBindProfile = function(cb) {
|
||||
storageService.getCopayDisclaimer(function(err, val) {
|
||||
storageService.getCopayDisclaimerFlag(function(err, val) {
|
||||
if (!val) {
|
||||
return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -176,19 +176,19 @@ angular.module('copayApp.services')
|
|||
storage.remove('config', cb);
|
||||
};
|
||||
|
||||
root.setCopayDisclaimer = function(cb) {
|
||||
root.setCopayDisclaimerFlag = function(cb) {
|
||||
storage.set('agreeDisclaimer', true, cb);
|
||||
};
|
||||
|
||||
root.getCopayDisclaimer = function(cb) {
|
||||
root.getCopayDisclaimerFlag = function(cb) {
|
||||
storage.get('agreeDisclaimer', cb);
|
||||
};
|
||||
|
||||
root.setRemotePreferencesStored = function(cb) {
|
||||
root.setRemotePrefsStoredFlag = function(cb) {
|
||||
storage.set('remotePrefStored', true, cb);
|
||||
};
|
||||
|
||||
root.getRemovePreferencesStored = function(cb) {
|
||||
root.getRemotePrefsStoredFlag = function(cb) {
|
||||
storage.get('remotePrefStored', cb);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue