deleting agree disclaimer flag in storage and adding to the storage profile

This commit is contained in:
Gabriel Bazán 2015-11-30 12:58:52 -03:00
commit 3f7485ca8d
7 changed files with 62 additions and 58 deletions

View file

@ -4,9 +4,13 @@ angular.module('copayApp.controllers').controller('disclaimerController',
function($scope, $timeout, $log, profileService, isCordova, storageService, applicationService, gettextCatalog, uxLanguage, go) {
self = this;
$scope.lang = uxLanguage.currentLanguage;
$scope.goHome = function() {
storageService.setCopayDisclaimerFlag(function(err) {
go.walletHome();
storageService.getProfile(function(err, profile) {
profile.agreeDisclaimer = true;
storageService.storeProfile(profile, function() {
go.walletHome();
});
});
};
@ -17,10 +21,10 @@ angular.module('copayApp.controllers').controller('disclaimerController',
if (err) {
$log.warn(err);
if (err == 'EEXISTS') {
storageService.getCopayDisclaimerFlag(function(err, val) {
if (val) return go.walletHome();
$scope.creatingProfile = false;
});
if (profileService.profile.agreeDisclaimer) return go.walletHome();
$scope.creatingProfile = false;
} else {
$scope.error = err;
$scope.$apply();
@ -36,8 +40,10 @@ angular.module('copayApp.controllers').controller('disclaimerController',
});
};
if (!profileService.profile)
create();
else
applicationService.restart();
storageService.getProfile(function(err, profile) {
if (!profile) create();
else $scope.creatingProfile = false;
});
});

View file

@ -135,8 +135,8 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.openWallet();
});
}
storageService.getCopayDisclaimerFlag(function(err, val) {
self.agreeDisclaimer = val;
storageService.getProfile(function(err, profile) {
self.agreeDisclaimer = profile.agreeDisclaimer;
});
});
};
@ -732,7 +732,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
_creator = '';
if (it.actions && it.actions.length > 1) {
for (var i = 0; i < it.actions.length; i++) {
for (var i = 0; i < it.actions.length; i++) {
_copayers += it.actions[i].copayerName + ':' + it.actions[i].type + ' - ';
}
_creator = (it.creatorName && it.creatorName != 'undefined') ? it.creatorName : '';
@ -1328,8 +1328,8 @@ angular.module('copayApp.controllers').controller('indexController', function($r
$rootScope.$on('Local/NewFocusedWallet', function() {
self.setFocusedWallet();
self.updateTxHistory();
storageService.getCopayDisclaimerFlag(function(err, val) {
if (val) go.walletHome();
storageService.getProfile(function(err, val) {
if (val.agreeDisclaimer) go.walletHome();
storageService.getCleanAndScanAddresses(function(err, walletId) {
if (walletId && profileService.walletClients[walletId]) {
$log.debug('Clear last address cache and Scan ', walletId);