This commit is contained in:
Gabriel Bazán 2015-11-30 13:32:54 -03:00
commit 9aeb1ea4fd
3 changed files with 22 additions and 19 deletions

View file

@ -1,5 +1,4 @@
<div class="splash content text-center" <div class="splash content text-center"
ng-init="init()"
ng-controller="disclaimerController"> ng-controller="disclaimerController">
<div> <div>
<div class="row"> <div class="row">

View file

@ -6,11 +6,13 @@ angular.module('copayApp.controllers').controller('disclaimerController',
$scope.lang = uxLanguage.currentLanguage; $scope.lang = uxLanguage.currentLanguage;
$scope.goHome = function() { $scope.goHome = function() {
storageService.getProfile(function(err, profile) { $scope.error = "";
profile.agreeDisclaimer = true; profileService.storeDisclaimer(function(err) {
storageService.storeProfile(profile, function() { if (err) {
go.walletHome(); $scope.error = err;
}); $log.warn(err);
$scope.$apply();
} else go.walletHome();
}); });
}; };
@ -20,19 +22,12 @@ angular.module('copayApp.controllers').controller('disclaimerController',
if (err) { if (err) {
$log.warn(err); $log.warn(err);
if (err == 'EEXISTS') { $scope.error = err;
$scope.$apply();
if (profileService.profile.agreeDisclaimer) return go.walletHome(); $timeout(function() {
$scope.creatingProfile = false; $log.warn('Retrying to create profile......');
create();
} else { }, 3000);
$scope.error = err;
$scope.$apply();
$timeout(function() {
$log.warn('Retrying to create profile......');
create();
}, 3000);
}
} else { } else {
$scope.error = ""; $scope.error = "";
$scope.creatingProfile = false; $scope.creatingProfile = false;

View file

@ -516,6 +516,15 @@ angular.module('copayApp.services')
}); });
}; };
root.storeDisclaimer = function(cb) {
storageService.getProfile(function(err, profile) {
profile.agreeDisclaimer = true;
storageService.storeProfile(profile, function() {
return cb(err);
});
});
}
root.importLegacyWallet = function(username, password, blob, cb) { root.importLegacyWallet = function(username, password, blob, cb) {
var walletClient = bwcService.getClient(); var walletClient = bwcService.getClient();