From 3901d2d72ed0d060117f6227719fc9d7a3d6a6e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Mon, 14 Dec 2015 14:02:27 -0300 Subject: [PATCH 1/4] fix no conecction bug in disclaimer --- src/js/controllers/disclaimer.js | 17 +++++++++++++---- src/js/controllers/index.js | 20 +++++++++++++------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/js/controllers/disclaimer.js b/src/js/controllers/disclaimer.js index 853b496be..ec9b6ba65 100644 --- a/src/js/controllers/disclaimer.js +++ b/src/js/controllers/disclaimer.js @@ -3,10 +3,13 @@ angular.module('copayApp.controllers').controller('disclaimerController', function($scope, $timeout, $log, profileService, isCordova, storageService, applicationService, gettextCatalog, uxLanguage, go) { self = this; + self.tries = 0; - var create = function() { + var create = function(noWallet) { $scope.creatingProfile = true; - profileService.create({}, function(err) { + profileService.create({ + noWallet: noWallet + }, function(err) { if (err) { $log.warn(err); @@ -14,7 +17,13 @@ angular.module('copayApp.controllers').controller('disclaimerController', $scope.$apply(); $timeout(function() { $log.warn('Retrying to create profile......'); - create(); + if (self.tries == 3) { + self.tries == 0; + create(true); + } else { + self.tries += 1; + create(false); + } }, 3000); } else { $scope.error = ""; @@ -26,7 +35,7 @@ angular.module('copayApp.controllers').controller('disclaimerController', this.init = function() { self.lang = uxLanguage.currentLanguage; storageService.getProfile(function(err, profile) { - if (!profile) create(); + if (!profile) create(false); else $scope.creatingProfile = false; //compatible diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index 669f4d67c..ad17c45bd 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -154,7 +154,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r self.disclaimerAccepted = true; profileService.setDisclaimerAccepted(function(err) { if (err) $log.error(err); - go.walletHome(); + if (lodash.isEmpty(profileService.focusedClient)) { + $rootScope.$emit('Local/NoWallets'); + } else go.walletHome(); }); }; @@ -1357,12 +1359,16 @@ angular.module('copayApp.controllers').controller('indexController', function($r }); $rootScope.$on('Local/NoWallets', function(event) { - $timeout(function() { - self.hasProfile = true; - self.noFocusedWallet = true; - self.isComplete = null; - self.walletName = null; - go.path('import'); + profileService.isDisclaimerAccepted(function(v) { + if (v) { + $timeout(function() { + self.hasProfile = true; + self.noFocusedWallet = true; + self.isComplete = null; + self.walletName = null; + go.path('import'); + }); + } }); }); From 0ce69590b85296f56e6459af5c0759816b0933ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Mon, 14 Dec 2015 15:18:26 -0300 Subject: [PATCH 2/4] refactor --- src/js/controllers/index.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index ad17c45bd..6fae1ade5 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -154,9 +154,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r self.disclaimerAccepted = true; profileService.setDisclaimerAccepted(function(err) { if (err) $log.error(err); - if (lodash.isEmpty(profileService.focusedClient)) { - $rootScope.$emit('Local/NoWallets'); - } else go.walletHome(); + go.walletHome(); }); }; @@ -1359,16 +1357,17 @@ angular.module('copayApp.controllers').controller('indexController', function($r }); $rootScope.$on('Local/NoWallets', function(event) { - profileService.isDisclaimerAccepted(function(v) { - if (v) { - $timeout(function() { - self.hasProfile = true; - self.noFocusedWallet = true; - self.isComplete = null; - self.walletName = null; + + $timeout(function() { + self.hasProfile = true; + self.noFocusedWallet = true; + self.isComplete = null; + self.walletName = null; + profileService.isDisclaimerAccepted(function(v) { + if (v) { go.path('import'); - }); - } + } + }); }); }); From 06346ade79b55df763165528ef51d4d48e4ecd28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Mon, 14 Dec 2015 16:01:45 -0300 Subject: [PATCH 3/4] hide top bar --- public/views/walletHome.html | 1 + 1 file changed, 1 insertion(+) diff --git a/public/views/walletHome.html b/public/views/walletHome.html index ba4cfe192..e5e30416a 100644 --- a/public/views/walletHome.html +++ b/public/views/walletHome.html @@ -1,6 +1,7 @@
From 43b63564c653d76baf494fee6ce4c0f8992097cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Mon, 14 Dec 2015 16:13:53 -0300 Subject: [PATCH 4/4] refactor --- public/views/includes/topbar.html | 2 +- public/views/walletHome.html | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/public/views/includes/topbar.html b/public/views/includes/topbar.html index 134057836..bbda0916c 100644 --- a/public/views/includes/topbar.html +++ b/public/views/includes/topbar.html @@ -16,7 +16,7 @@ -
+
diff --git a/public/views/walletHome.html b/public/views/walletHome.html index e5e30416a..ba4cfe192 100644 --- a/public/views/walletHome.html +++ b/public/views/walletHome.html @@ -1,7 +1,6 @@