From 5a252f8ae8091a231a083a2a808c327fd75551d6 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Fri, 12 Dec 2014 19:17:50 -0300 Subject: [PATCH] import profile/wallet on android --- js/controllers/import.js | 7 +++++++ js/controllers/importProfile.js | 7 +++++++ js/controllers/join.js | 6 +++--- js/controllers/send.js | 6 +++--- js/init.js | 2 +- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/js/controllers/import.js b/js/controllers/import.js index c8481f078..f0013f886 100644 --- a/js/controllers/import.js +++ b/js/controllers/import.js @@ -9,6 +9,13 @@ angular.module('copayApp.controllers').controller('ImportController', $scope.is_iOS = isMobile.iOS(); $scope.importOpts = {}; + window.ignoreMobilePause = true; + $scope.$on('$destroy', function() { + $timeout(function(){ + window.ignoreMobilePause = false; + }, 100); + }); + Compatibility.check($scope); var reader = new FileReader(); diff --git a/js/controllers/importProfile.js b/js/controllers/importProfile.js index 28c69fbe3..ceb83bead 100644 --- a/js/controllers/importProfile.js +++ b/js/controllers/importProfile.js @@ -7,6 +7,13 @@ angular.module('copayApp.controllers').controller('ImportProfileController', $scope.hideAdv = true; $scope.is_iOS = isMobile.iOS(); + window.ignoreMobilePause = true; + $scope.$on('$destroy', function() { + $timeout(function(){ + window.ignoreMobilePause = false; + }, 100); + }); + var reader = new FileReader(); var updateStatus = function(status) { diff --git a/js/controllers/join.js b/js/controllers/join.js index 3fb59605b..402c427e3 100644 --- a/js/controllers/join.js +++ b/js/controllers/join.js @@ -99,11 +99,11 @@ angular.module('copayApp.controllers').controller('JoinController', }; $scope.scannerIntent = function() { - window.usingCamera = true; + window.ignoreMobilePause = true; cordova.plugins.barcodeScanner.scan( function onSuccess(result) { $timeout(function(){ - window.usingCamera = false; + window.ignoreMobilePause = false; }, 100); if (result.cancelled) return; @@ -112,7 +112,7 @@ angular.module('copayApp.controllers').controller('JoinController', }, function onError(error) { $timeout(function(){ - window.usingCamera = false; + window.ignoreMobilePause = false; }, 100); alert('Scanning error'); }); diff --git a/js/controllers/send.js b/js/controllers/send.js index 99576f8ae..3f21a5bfb 100644 --- a/js/controllers/send.js +++ b/js/controllers/send.js @@ -285,11 +285,11 @@ angular.module('copayApp.controllers').controller('SendController', }; $scope.scannerIntent = function() { - window.usingCamera = true; + window.ignoreMobilePause = true; cordova.plugins.barcodeScanner.scan( function onSuccess(result) { $timeout(function(){ - window.usingCamera = false; + window.ignoreMobilePause = false; }, 100); if (result.cancelled) return; @@ -303,7 +303,7 @@ angular.module('copayApp.controllers').controller('SendController', }, function onError(error) { $timeout(function(){ - window.usingCamera = false; + window.ignoreMobilePause = false; }, 100); alert('Scanning error'); }); diff --git a/js/init.js b/js/init.js index 991586ad1..2a07527aa 100644 --- a/js/init.js +++ b/js/init.js @@ -10,7 +10,7 @@ angular.element(document).ready(function() { document.addEventListener('deviceready', function() { document.addEventListener('pause', function() { - if (!window.usingCamera) { + if (!window.ignoreMobilePause) { window.location = '#!'; } });