From 04e989ce44398e6fde162f0d38c63ac6b71c3a32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Tue, 17 Nov 2015 12:39:51 -0300 Subject: [PATCH] error handling --- public/views/disclaimer.html | 2 +- src/js/controllers/disclaimer.js | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/public/views/disclaimer.html b/public/views/disclaimer.html index aed44567e..b6f97f477 100644 --- a/public/views/disclaimer.html +++ b/public/views/disclaimer.html @@ -58,7 +58,7 @@
-
diff --git a/src/js/controllers/disclaimer.js b/src/js/controllers/disclaimer.js index 0ad075bca..8e038aee4 100644 --- a/src/js/controllers/disclaimer.js +++ b/src/js/controllers/disclaimer.js @@ -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; } }); });