perf(startupService): remove timers, control splashscreen and statusbar from startupService

This commit is contained in:
Jason Dreyzehner 2016-10-11 22:46:07 -04:00
parent 8035846faf
commit 4de3cad712
6 changed files with 46 additions and 8 deletions

3
.gitignore vendored
View File

@ -84,6 +84,9 @@ Session.vim
.netrwhist
*~
.tags
.tags1
# SASS
src/sass/*.css
.sass-cache

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,16 +947,12 @@ 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);
}

View File

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