Merge pull request #394 from bitjson/feature/launch-so-fast-and-so-clean

launch so fast and so clean
This commit is contained in:
Matias Alejo Garcia 2016-10-12 15:05:03 -03:00 committed by GitHub
commit 43aeaae7a2
10 changed files with 71 additions and 74 deletions

View file

@ -1,6 +1,11 @@
'use strict';
angular.module('copayApp.controllers').controller('disclaimerController', function($scope, $timeout, $state, $log, $ionicModal, profileService, uxLanguage, externalLinkService, storageService, $stateParams) {
angular.module('copayApp.controllers').controller('disclaimerController', function($scope, $timeout, $state, $log, $ionicModal, profileService, uxLanguage, externalLinkService, storageService, $stateParams, startupService) {
$scope.$on("$ionicView.afterEnter", function() {
startupService.ready();
});
$scope.init = function() {
$scope.lang = uxLanguage.currentLanguage;
$scope.terms = {};

View file

@ -1,9 +1,13 @@
'use strict';
angular.module('copayApp.controllers').controller('welcomeController', function($scope, $state, $timeout, $ionicConfig, $log, profileService) {
angular.module('copayApp.controllers').controller('welcomeController', function($scope, $state, $timeout, $ionicConfig, $log, profileService, startupService) {
$ionicConfig.views.swipeBackEnabled(false);
$scope.$parent.$on("$ionicView.afterEnter", function() {
startupService.ready();
});
$scope.goImport = function(code) {
$state.go('onboarding.import', {
fromOnboarding: true,

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('tabHomeController',
function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, gettextCatalog, lodash, popupService, ongoingProcess, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, $window, bitpayCardService) {
function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, gettextCatalog, lodash, popupService, ongoingProcess, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, $window, bitpayCardService, startupService) {
var wallet;
var listeners = [];
var notifications = [];
@ -13,6 +13,10 @@ angular.module('copayApp.controllers').controller('tabHomeController',
$scope.homeTip = $stateParams.fromOnboarding;
$scope.isCordova = platformInfo.isCordova;
$scope.$on("$ionicView.afterEnter", function() {
startupService.ready();
});
if (!$scope.homeTip) {
storageService.getHomeTipAccepted(function(error, value) {
$scope.homeTip = (value == 'false') ? false : true;

View file

@ -947,22 +947,21 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
});
$ionicPlatform.on('resume', function() {
// Nothing tot do
// Nothing to do
});
$ionicPlatform.on('menubutton', function() {
window.location = '#/preferences';
});
setTimeout(function() {
navigator.splashscreen.hide();
}, 500);
}
$log.info('Init profile...');
// Try to open local profile
profileService.loadAndBindProfile(function(err) {
$ionicHistory.nextViewOptions({
disableAnimate: true
});
if (err) {
if (err.message && err.message.match('NOPROFILE')) {
$log.debug('No profile... redirecting');

View file

@ -0,0 +1,28 @@
'use strict';
angular.module('copayApp.services').service('startupService', function($log, $timeout) {
var splashscreenVisible = true;
var statusBarVisible = false;
function _hideSplash(){
if(typeof navigator.splashscreen !== "undefined" && splashscreenVisible){
$log.debug('startupService is hiding the splashscreen...');
$timeout(function(){
navigator.splashscreen.hide();
}, 20);
splashscreenVisible = false;
}
}
function _showStatusBar(){
if(typeof StatusBar !== "undefined" && !statusBarVisible){
$log.debug('startupService is showing the StatusBar...');
StatusBar.show();
statusBarVisible = true;
}
}
this.ready = function() {
_showStatusBar();
_hideSplash();
};
});