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 prefs = opts.preferences || {};
|
||||||
var fc = profileService.focusedClient;
|
var fc = profileService.focusedClient;
|
||||||
|
|
||||||
|
// Update this JIC.
|
||||||
|
var config = configService.getSync().wallet.settings;
|
||||||
|
self.unitName = config.unitName;
|
||||||
|
|
||||||
//prefs.email (may come from arguments)
|
//prefs.email (may come from arguments)
|
||||||
prefs.language = self.defaultLanguageIsoCode;
|
prefs.language = self.defaultLanguageIsoCode;
|
||||||
prefs.unit = self.unitName;
|
prefs.unit = self.unitName;
|
||||||
|
|
@ -188,6 +192,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
self.handleError(err);
|
self.handleError(err);
|
||||||
return cb(err);
|
return cb(err);
|
||||||
}
|
}
|
||||||
|
if (!fc) return cb();
|
||||||
|
|
||||||
fc.getPreferences(function(err, preferences) {
|
fc.getPreferences(function(err, preferences) {
|
||||||
if (err) {
|
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() {
|
$rootScope.$on('Local/NewFocusedWallet', function() {
|
||||||
self.setUxLanguage();
|
self.setUxLanguage();
|
||||||
|
|
@ -666,11 +682,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
});
|
});
|
||||||
|
|
||||||
$rootScope.$on('Local/UnitSettingUpdated', function(event) {
|
$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.updateAll();
|
||||||
self.updateTxHistory();
|
self.updateTxHistory();
|
||||||
self.updateRemotePreferences({
|
self.updateRemotePreferences({
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ angular
|
||||||
'main': {
|
'main': {
|
||||||
templateUrl: 'views/splash.html',
|
templateUrl: 'views/splash.html',
|
||||||
controller: function($scope, $timeout, $log, profileService, storageService, go) {
|
controller: function($scope, $timeout, $log, profileService, storageService, go) {
|
||||||
storageService.getCopayDisclaimer(function(err, val) {
|
storageService.getCopayDisclaimerFlag(function(err, val) {
|
||||||
if (!val) go.path('disclaimer');
|
if (!val) go.path('disclaimer');
|
||||||
|
|
||||||
if (profileService.profile) {
|
if (profileService.profile) {
|
||||||
|
|
@ -109,7 +109,7 @@ angular
|
||||||
'main': {
|
'main': {
|
||||||
templateUrl: 'views/disclaimer.html',
|
templateUrl: 'views/disclaimer.html',
|
||||||
controller: function($scope, $timeout, storageService, applicationService, go) {
|
controller: function($scope, $timeout, storageService, applicationService, go) {
|
||||||
storageService.getCopayDisclaimer(function(err, val) {
|
storageService.getCopayDisclaimerFlag(function(err, val) {
|
||||||
$scope.agreed = val;
|
$scope.agreed = val;
|
||||||
$timeout(function(){
|
$timeout(function(){
|
||||||
$scope.$digest();
|
$scope.$digest();
|
||||||
|
|
@ -117,7 +117,7 @@ angular
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.agree = function() {
|
$scope.agree = function() {
|
||||||
storageService.setCopayDisclaimer(function(err) {
|
storageService.setCopayDisclaimerFlag(function(err) {
|
||||||
$timeout(function(){
|
$timeout(function(){
|
||||||
applicationService.restart();
|
applicationService.restart();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
|
||||||
|
|
@ -128,13 +128,16 @@ angular.module('copayApp.services')
|
||||||
root.setWalletClients();
|
root.setWalletClients();
|
||||||
storageService.getFocusedWalletId(function(err, focusedWalletId) {
|
storageService.getFocusedWalletId(function(err, focusedWalletId) {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
root._setFocus(focusedWalletId, cb);
|
root._setFocus(focusedWalletId, function() {
|
||||||
|
$rootScope.$emit('Local/ProfileBound');
|
||||||
|
return cb();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
root.loadAndBindProfile = function(cb) {
|
root.loadAndBindProfile = function(cb) {
|
||||||
storageService.getCopayDisclaimer(function(err, val) {
|
storageService.getCopayDisclaimerFlag(function(err, val) {
|
||||||
if (!val) {
|
if (!val) {
|
||||||
return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
|
return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -176,19 +176,19 @@ angular.module('copayApp.services')
|
||||||
storage.remove('config', cb);
|
storage.remove('config', cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
root.setCopayDisclaimer = function(cb) {
|
root.setCopayDisclaimerFlag = function(cb) {
|
||||||
storage.set('agreeDisclaimer', true, cb);
|
storage.set('agreeDisclaimer', true, cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
root.getCopayDisclaimer = function(cb) {
|
root.getCopayDisclaimerFlag = function(cb) {
|
||||||
storage.get('agreeDisclaimer', cb);
|
storage.get('agreeDisclaimer', cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
root.setRemotePreferencesStored = function(cb) {
|
root.setRemotePrefsStoredFlag = function(cb) {
|
||||||
storage.set('remotePrefStored', true, cb);
|
storage.set('remotePrefStored', true, cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
root.getRemovePreferencesStored = function(cb) {
|
root.getRemotePrefsStoredFlag = function(cb) {
|
||||||
storage.get('remotePrefStored', cb);
|
storage.get('remotePrefStored', cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue