fixes SHARED Wallet status, and refresh until it changes

This commit is contained in:
Matias Alejo Garcia 2016-03-09 11:53:47 -03:00
commit 3b5387fb70
7 changed files with 103 additions and 35 deletions

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('disclaimerController',
function($scope, $timeout, $log, profileService, isCordova, storageService, applicationService, gettextCatalog, uxLanguage, go) {
function($scope, $timeout, $log, profileService, isCordova, applicationService, gettextCatalog, uxLanguage, go) {
var self = this;
self.tries = 0;
$scope.creatingProfile = true;
@ -34,14 +34,20 @@ angular.module('copayApp.controllers').controller('disclaimerController',
this.init = function() {
self.lang = uxLanguage.currentLanguage;
storageService.getProfile(function(err, profile) {
if (!profile) create(false);
else $scope.creatingProfile = false;
//compatible
profileService.isDisclaimerAccepted(function(val) {
if (val) go.walletHome();
});
profileService.getProfile(function(err, profile) {
if (!profile) {
create(false);
} else {
$log.debug('There is a profile already');
$scope.creatingProfile = false;
profileService.bindProfile(profile, function(err) {
if (!err || !err.message || !err.message.match('NONAGREEDDISCLAIMER')) {
$log.debug('Disclaimer already accepted at #disclaimer. Redirect to Wallet Home.')
go.walletHome();
}
});
}
});
};
@ -51,4 +57,4 @@ angular.module('copayApp.controllers').controller('disclaimerController',
else go.walletHome();
});
};
});
});