From ab2a3d61c1bc7fab24e957d3d07e09db146e006f Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Mon, 30 Mar 2015 17:20:13 -0300 Subject: [PATCH 1/2] Updates ng-idle module --- js/controllers/head.js | 11 ++++++----- js/routes.js | 14 +++++++------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/js/controllers/head.js b/js/controllers/head.js index 9fbfb6bf1..6ca050314 100644 --- a/js/controllers/head.js +++ b/js/controllers/head.js @@ -45,22 +45,23 @@ angular.module('copayApp.controllers').controller('HeadController', function($sc $scope.init = function() { if (!$rootScope.wallet) return; - $scope.$on('$idleStart', function() {}); - $scope.$on('$idleWarn', function(a, countdown) { + $scope.$on('IdleStart', function() {}); + $scope.$on('IdleWarn', function(a, countdown) { $rootScope.countdown = countdown; $rootScope.sessionExpired = true; + $rootScope.$apply(); }); - $scope.$on('$idleEnd', function() { + $scope.$on('IdleEnd', function() { $timeout(function() { $rootScope.sessionExpired = null; }, 500); }); - $scope.$on('$idleTimeout', function() { + $scope.$on('IdleTimeout', function() { $rootScope.sessionExpired = null; $scope.signout(); notification.warning('Session closed', 'Session closed because a long time of inactivity'); }); - $scope.$on('$keepalive', function() { + $scope.$on('Keepalive', function() { if ($rootScope.wallet) { $rootScope.wallet.keepAlive(); } diff --git a/js/routes.js b/js/routes.js index 56d74dfa0..93ebdc797 100644 --- a/js/routes.js +++ b/js/routes.js @@ -129,17 +129,17 @@ angular //Setting HTML5 Location Mode angular .module('copayApp') - .config(function($locationProvider, $idleProvider, $keepaliveProvider) { + .config(function($locationProvider, IdleProvider, KeepaliveProvider) { $locationProvider .html5Mode(false) .hashPrefix('!'); // IDLE timeout var timeout = config.wallet.idleDurationMin * 60 || 300; - $idleProvider.idleDuration(timeout); // in seconds - $idleProvider.warningDuration(40); // in seconds - $keepaliveProvider.interval(30); // in seconds + IdleProvider.idle(timeout); // in seconds + IdleProvider.timeout(40); // in seconds + KeepaliveProvider.interval(30); // in seconds }) - .run(function($rootScope, $location, $idle, gettextCatalog, uriHandler, isCordova, amMoment) { + .run(function($rootScope, $location, Idle, gettextCatalog, uriHandler, isCordova, amMoment) { var userLang, androidLang; @@ -156,7 +156,7 @@ angular // Register URI handler, not for mobileApp if (!isCordova) { - $idle.watch(); + Idle.watch(); uriHandler.register(); } @@ -167,7 +167,7 @@ angular } if (!$rootScope.iden && next.logged) { - $idle.unwatch(); + Idle.unwatch(); $location.path('/'); } if ($rootScope.wallet && !$rootScope.wallet.isComplete() && next.walletShouldBeComplete) { From 8d9f3d2879225fa95c1ffb986c50888f9df43d87 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Mon, 30 Mar 2015 17:23:01 -0300 Subject: [PATCH 2/2] Force to update ng-idle module --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index 152bf929a..31ac3bc02 100644 --- a/bower.json +++ b/bower.json @@ -19,7 +19,7 @@ "qrcode-decoder-js": "*", "angular-moment": "~0.7.1", "socket.io-client": ">=1.0.0", - "ng-idle": "*", + "ng-idle": "~1.0.2", "inherits": "~0.0.1", "lodash": "~2.4.1", "angular-gravatar": "*",