From d4a4fe049841ecd34634b0fe60d54fed2937ad75 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Thu, 11 Dec 2014 18:13:13 -0300 Subject: [PATCH] fix delay of submit after enter the PIN --- js/controllers/createProfile.js | 14 +++++--------- js/controllers/home.js | 30 ++++++++++++++---------------- views/createProfile.html | 15 +++++++-------- views/home.html | 11 +++++------ views/import.html | 2 +- views/importProfile.html | 2 +- views/join.html | 2 +- 7 files changed, 34 insertions(+), 42 deletions(-) diff --git a/js/controllers/createProfile.js b/js/controllers/createProfile.js index aec2acdbd..07205603f 100644 --- a/js/controllers/createProfile.js +++ b/js/controllers/createProfile.js @@ -43,7 +43,7 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun preconditions.checkArgument(pin); preconditions.checkState($rootScope.iden); preconditions.checkState(_credentials && _credentials.email); - $scope.loading = true; + $rootScope.starting = true; $timeout(function() { $rootScope.$digest(); @@ -53,10 +53,10 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun _credentials = null; $scope.askForPin = 0; $rootScope.hasPin = true; - $scope.loading = null; + $rootScope.starting = null; $scope.createDefaultWallet(); }); - }, 1); + }, 100); }; @@ -91,13 +91,10 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun }, 1); }; - - $scope.createDefaultWallet = function() { $rootScope.hideNavigation = false; identityService.createDefaultWallet(function(err) { $scope.askForPin = 0; - $scope.loading = false; if (err) { var msg = err.toString(); @@ -106,16 +103,15 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun }); }; - $scope._doCreateProfile = function(emailOrUsername, password, cb) { preconditions.checkArgument(_.isString(emailOrUsername)); preconditions.checkArgument(_.isString(password)); $rootScope.hideNavigation = false; - $scope.loading = true; + $rootScope.starting = true; identityService.create(emailOrUsername, password, function(err) { - $scope.loading = null; + $rootScope.starting = null; $scope.error = null; if (err) { var msg = err.toString(); diff --git a/js/controllers/home.js b/js/controllers/home.js index 4f2ec5522..7639a43e8 100644 --- a/js/controllers/home.js +++ b/js/controllers/home.js @@ -62,22 +62,19 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc return; } $rootScope.starting = true; - + $timeout(function() { - $rootScope.$digest(); var credentials = pinService.get(pin, function(err, credentials) { if (err || !credentials) { - $rootScope.starting = false; - $scope.loading = null; + $rootScope.starting = null; $scope.error = 'Wrong PIN'; return; } $scope.open(credentials.email, credentials.password); }); - },1); + },100); }; - $scope.openWallets = function() { preconditions.checkState($rootScope.iden); var iden = $rootScope.iden; @@ -90,16 +87,18 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc preconditions.checkArgument(pin); preconditions.checkState($rootScope.iden); preconditions.checkState(_credentials && _credentials.email); - $scope.loading = true; + $rootScope.starting = true; - pinService.save(pin, _credentials.email, _credentials.password, function(err) { - _credentials.password = ''; - _credentials = null; - $scope.askForPin = 0; - $rootScope.hasPin = true; - $scope.loading = null; - $scope.openWallets(); - }); + $timeout(function() { + pinService.save(pin, _credentials.email, _credentials.password, function(err) { + _credentials.password = ''; + _credentials = null; + $scope.askForPin = 0; + $rootScope.hasPin = true; + $rootScope.starting = null; + $scope.openWallets(); + }); + },100); }; $scope.openWithCredentials = function(form) { @@ -144,7 +143,6 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc $scope.error = 'Unknown error'; } $rootScope.starting = false; - $scope.loading = null; $timeout(function(){ $rootScope.$digest(); },1) diff --git a/views/createProfile.html b/views/createProfile.html index f563527ee..7503a48e9 100644 --- a/views/createProfile.html +++ b/views/createProfile.html @@ -1,9 +1,9 @@
-
+
-
+
Copay
@@ -167,7 +167,7 @@
- @@ -184,7 +184,7 @@
-
+
clipo
@@ -198,7 +198,7 @@
-
+
@@ -215,9 +215,8 @@
-
diff --git a/views/home.html b/views/home.html index c7e0a355a..1c16d5c98 100644 --- a/views/home.html +++ b/views/home.html @@ -36,7 +36,7 @@
- +
@@ -53,9 +53,8 @@
-
@@ -92,7 +91,7 @@
- @@ -145,7 +144,7 @@
- diff --git a/views/import.html b/views/import.html index 85809d680..9f1bfe474 100644 --- a/views/import.html +++ b/views/import.html @@ -1,5 +1,5 @@
-
+
diff --git a/views/importProfile.html b/views/importProfile.html index 703e413fa..f301a3709 100644 --- a/views/importProfile.html +++ b/views/importProfile.html @@ -1,6 +1,6 @@
-
+
diff --git a/views/join.html b/views/join.html index 6f620efd6..e92cc6762 100644 --- a/views/join.html +++ b/views/join.html @@ -1,5 +1,5 @@
-
+