perf(startupService): remove timers, control splashscreen and statusbar from startupService
This commit is contained in:
parent
8035846faf
commit
4de3cad712
6 changed files with 46 additions and 8 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -84,6 +84,9 @@ Session.vim
|
||||||
.netrwhist
|
.netrwhist
|
||||||
*~
|
*~
|
||||||
|
|
||||||
|
.tags
|
||||||
|
.tags1
|
||||||
|
|
||||||
# SASS
|
# SASS
|
||||||
src/sass/*.css
|
src/sass/*.css
|
||||||
.sass-cache
|
.sass-cache
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
'use strict';
|
'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.init = function() {
|
||||||
$scope.lang = uxLanguage.currentLanguage;
|
$scope.lang = uxLanguage.currentLanguage;
|
||||||
$scope.terms = {};
|
$scope.terms = {};
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,13 @@
|
||||||
'use strict';
|
'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);
|
$ionicConfig.views.swipeBackEnabled(false);
|
||||||
|
|
||||||
|
$scope.$parent.$on("$ionicView.afterEnter", function() {
|
||||||
|
startupService.ready();
|
||||||
|
});
|
||||||
|
|
||||||
$scope.goImport = function(code) {
|
$scope.goImport = function(code) {
|
||||||
$state.go('onboarding.import', {
|
$state.go('onboarding.import', {
|
||||||
fromOnboarding: true,
|
fromOnboarding: true,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('tabHomeController',
|
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 wallet;
|
||||||
var listeners = [];
|
var listeners = [];
|
||||||
var notifications = [];
|
var notifications = [];
|
||||||
|
|
@ -13,6 +13,10 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
||||||
$scope.homeTip = $stateParams.fromOnboarding;
|
$scope.homeTip = $stateParams.fromOnboarding;
|
||||||
$scope.isCordova = platformInfo.isCordova;
|
$scope.isCordova = platformInfo.isCordova;
|
||||||
|
|
||||||
|
$scope.$on("$ionicView.afterEnter", function() {
|
||||||
|
startupService.ready();
|
||||||
|
});
|
||||||
|
|
||||||
if (!$scope.homeTip) {
|
if (!$scope.homeTip) {
|
||||||
storageService.getHomeTipAccepted(function(error, value) {
|
storageService.getHomeTipAccepted(function(error, value) {
|
||||||
$scope.homeTip = (value == 'false') ? false : true;
|
$scope.homeTip = (value == 'false') ? false : true;
|
||||||
|
|
|
||||||
|
|
@ -947,16 +947,12 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
});
|
});
|
||||||
|
|
||||||
$ionicPlatform.on('resume', function() {
|
$ionicPlatform.on('resume', function() {
|
||||||
// Nothing tot do
|
// Nothing to do
|
||||||
});
|
});
|
||||||
|
|
||||||
$ionicPlatform.on('menubutton', function() {
|
$ionicPlatform.on('menubutton', function() {
|
||||||
window.location = '#/preferences';
|
window.location = '#/preferences';
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(function() {
|
|
||||||
navigator.splashscreen.hide();
|
|
||||||
}, 500);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
26
src/js/services/startupService.js
Normal file
26
src/js/services/startupService.js
Normal 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();
|
||||||
|
};
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue