error handling

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

View File

@ -58,7 +58,7 @@
</div>
<div class="row" ng-show="!creatingProfile">
<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
</button>
</div>

View File

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