Skip to content

Commit

Permalink
Merge pull request #2133 from cmgustavo/bug/android-import
Browse files Browse the repository at this point in the history
import profile/wallet on android
  • Loading branch information
matiaspando committed Dec 12, 2014
2 parents 3ef5643 + 9727c70 commit 97bcd37
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 9 deletions.
9 changes: 8 additions & 1 deletion js/controllers/import.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
'use strict';

angular.module('copayApp.controllers').controller('ImportController',
function($scope, $rootScope, $location, identityService, notification, isMobile, Compatibility) {
function($scope, $rootScope, $location, $timeout, identityService, notification, isMobile, Compatibility) {

$rootScope.title = 'Import wallet';
$scope.importStatus = 'Importing wallet - Reading backup...';
$scope.hideAdv = true;
$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();
Expand Down
9 changes: 8 additions & 1 deletion js/controllers/importProfile.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
'use strict';

angular.module('copayApp.controllers').controller('ImportProfileController',
function($scope, $rootScope, $location, notification, isMobile, identityService) {
function($scope, $rootScope, $location, $timeout, notification, isMobile, identityService) {
$scope.title = 'Import a backup';
$scope.importStatus = 'Importing wallet - Reading backup...';
$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) {
Expand Down
6 changes: 3 additions & 3 deletions js/controllers/join.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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');
});
Expand Down
6 changes: 3 additions & 3 deletions js/controllers/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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');
});
Expand Down
2 changes: 1 addition & 1 deletion js/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '#!';
}
});
Expand Down

0 comments on commit 97bcd37

Please sign in to comment.