error handling

This commit is contained in:
Gabriel Bazán 2015-11-17 12:39:51 -03:00
commit 04e989ce44
2 changed files with 11 additions and 12 deletions

View file

@ -58,7 +58,7 @@
</div> </div>
<div class="row" ng-show="!creatingProfile"> <div class="row" ng-show="!creatingProfile">
<div class="start-button columns"> <div class="start-button columns">
<button ng-click="create()" class="button black expand round size-12 text-spacing" translate> <button ng-disabled="noProfile" ng-click="create()" class="button black expand round size-12 text-spacing" translate>
GET STARTED GET STARTED
</button> </button>
</div> </div>

View file

@ -2,19 +2,11 @@
angular.module('copayApp.controllers').controller('disclaimerController', angular.module('copayApp.controllers').controller('disclaimerController',
function($scope, $timeout, $log, profileService, isCordova, storageService, gettextCatalog, applicationService, uxLanguage, go) { function($scope, $timeout, $log, profileService, isCordova, storageService, gettextCatalog, applicationService, uxLanguage, go) {
self = this;
$scope.noProfile = true;
$scope.create = function() { $scope.create = function() {
$scope.creatingProfile = true;
if (isCordova) {
window.plugins.spinnerDialog.show(null, gettextCatalog.getString('Loading...'), true);
}
$scope.loading = true;
storageService.setCopayDisclaimerFlag(function(err) { storageService.setCopayDisclaimerFlag(function(err) {
$scope.creatingProfile = false;
if (isCordova) {
window.plugins.spinnerDialog.hide();
}
applicationService.restart(); applicationService.restart();
}); });
}; };
@ -27,10 +19,17 @@ angular.module('copayApp.controllers').controller('disclaimerController',
profileService.create({ profileService.create({
noWallet: noWallet noWallet: noWallet
}, function(err) { }, function(err) {
if (err) { if (err && !'EEXIST') {
$log.warn(err); $log.warn(err);
$scope.error = err; $scope.error = err;
$scope.$apply(); $scope.$apply();
$scope.noProfile = true;
$timeout(function() {
$scope.init();
}, 3000);
} else {
$scope.error = "";
$scope.noProfile = false;
} }
}); });
}); });