mirror of https://github.com/BTCPrivate/copay.git
perf(startupService): remove timers, control splashscreen and statusbar from startupService
This commit is contained in:
parent
8035846faf
commit
4de3cad712
|
@ -84,6 +84,9 @@ Session.vim
|
|||
.netrwhist
|
||||
*~
|
||||
|
||||
.tags
|
||||
.tags1
|
||||
|
||||
# SASS
|
||||
src/sass/*.css
|
||||
.sass-cache
|
||||
|
|
|
@ -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 = {};
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
});
|
Loading…
Reference in New Issue