From a13e12ff07c14d25558b1d3b1064368e6d1656d8 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Wed, 19 Aug 2015 11:16:55 -0300 Subject: [PATCH] Smooth start on mobile --- public/views/disclaimer.html | 8 ++++-- src/js/routes.js | 54 +++++++++++++++++++++--------------- 2 files changed, 37 insertions(+), 25 deletions(-) diff --git a/public/views/disclaimer.html b/public/views/disclaimer.html index 879d04da0..8f1426196 100644 --- a/public/views/disclaimer.html +++ b/public/views/disclaimer.html @@ -19,11 +19,13 @@

I affirm that I have read, understood, and agree with these terms.

-
- +
diff --git a/src/js/routes.js b/src/js/routes.js index 2c56b361c..1bc276d58 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -89,25 +89,27 @@ angular $scope.create = function(noWallet) { $scope.creatingProfile = true; - profileService.create({ - noWallet: noWallet - }, function(err) { - if (err) { - $scope.creatingProfile = false; - $log.warn(err); - $scope.error = err; - $scope.$apply(); - $timeout(function() { - $scope.create(noWallet); - }, 3000); - } - }); + $timeout(function() { + profileService.create({ + noWallet: noWallet + }, function(err) { + if (err) { + $scope.creatingProfile = false; + $log.warn(err); + $scope.error = err; + $scope.$apply(); + $timeout(function() { + $scope.create(noWallet); + }, 3000); + } + }); + }, 100); }; } } } }); - + $stateProvider .state('translators', { url: '/translators', @@ -125,7 +127,7 @@ angular views: { 'main': { templateUrl: 'views/disclaimer.html', - controller: function($scope, $timeout, storageService, applicationService, go) { + controller: function($scope, $timeout, storageService, applicationService, go, gettextCatalog, isCordova) { storageService.getCopayDisclaimerFlag(function(err, val) { $scope.agreed = val; $timeout(function() { @@ -134,11 +136,20 @@ angular }); $scope.agree = function() { - storageService.setCopayDisclaimerFlag(function(err) { - $timeout(function() { - applicationService.restart(); - }, 1000); - }); + if (isCordova) { + window.plugins.spinnerDialog.show(null, gettextCatalog.getString('Loading...'), true); + } + $scope.loading = true; + $timeout(function() { + storageService.setCopayDisclaimerFlag(function(err) { + $timeout(function() { + if (isCordova) { + window.plugins.spinnerDialog.hide(); + } + applicationService.restart(); + }, 1000); + }); + }, 100); }; } } @@ -531,7 +542,7 @@ angular event.preventDefault(); } - /* + /* * -------------------- */ @@ -630,7 +641,6 @@ angular cachedBackPanel.getElementsByClassName('content')[0].scrollTop = sc; cachedTransitionState = desiredTransitionState; - //console.log('CACHing animation', cachedTransitionState); return false; } }