diff --git a/src/js/routes.js b/src/js/routes.js index da09f3a7b..ce7f5485d 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -1213,6 +1213,14 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr goTo(defaultView); } + if (onResume) { + var now = Math.floor(Date.now() / 1000); + if (now < openURLService.unlockUntil) { + $log.debug('Skip startup locking'); + return; + } + } + function goTo(nextView) { nextView = nextView || defaultView; $state.transitionTo(nextView).then(function() { @@ -1293,7 +1301,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr // After everything have been loaded, initialize handler URL $timeout(function() { openURLService.init(); - }, 1000); + }); }); }); diff --git a/src/js/services/openURL.js b/src/js/services/openURL.js index 7c1af7417..8e6a768cf 100644 --- a/src/js/services/openURL.js +++ b/src/js/services/openURL.js @@ -1,9 +1,15 @@ 'use strict'; angular.module('copayApp.services').factory('openURLService', function($rootScope, $ionicHistory, $document, $log, $state, platformInfo, lodash, profileService, incomingData, appConfigService) { + var DELAY_UNLOCK_TIME = 2 * 60; var root = {}; + root.unlockUntil = null; + var handleOpenURL = function(args) { + root.unlockUntil = Math.floor(Date.now() / 1000) + DELAY_UNLOCK_TIME; + $log.debug('Set unlock time until: ' + root.unlockUntil); + $log.info('Handling Open URL: ' + JSON.stringify(args)); // Stop it from caching the first view as one to return when the app opens $ionicHistory.nextViewOptions({ @@ -103,5 +109,5 @@ angular.module('copayApp.services').factory('openURLService', function($rootScop }); }; -return root; + return root; });