From 06c80ceaaeb0c74ec9c837d704b30172d4c609eb Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Wed, 1 Jun 2016 16:07:25 -0300 Subject: [PATCH] fix import + walletHome + copayers --- src/js/controllers/copayers.js | 4 +++- src/js/controllers/export.js | 6 ++++-- src/js/controllers/index.js | 1 - src/js/controllers/walletHome.js | 2 +- src/js/services/platformInfo.js | 24 ++++++++---------------- 5 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/js/controllers/copayers.js b/src/js/controllers/copayers.js index 99825adc6..a4fcb5b91 100644 --- a/src/js/controllers/copayers.js +++ b/src/js/controllers/copayers.js @@ -4,6 +4,8 @@ angular.module('copayApp.controllers').controller('copayersController', function($scope, $rootScope, $timeout, $log, $modal, profileService, go, notification, platformInfo, gettext, gettextCatalog, animationService) { var self = this; var isCordova = platformInfo.isCordova; + var isWP = platformInfo.isWP; + var isAndroid = platformInfo.isAndroid; var delete_msg = gettextCatalog.getString('Are you sure you want to delete this wallet?'); var accept_msg = gettextCatalog.getString('Accept'); @@ -104,7 +106,7 @@ angular.module('copayApp.controllers').controller('copayersController', self.shareSecret = function(secret) { if (isCordova) { - if (isMobile.Android() || isMobile.Windows()) { + if (isAndroid || isWP) { window.ignoreMobilePause = true; } var message = gettextCatalog.getString('Join my Copay wallet. Here is the invitation code: {{secret}} You can download Copay for your phone or desktop at https://copay.io', {secret: secret}); diff --git a/src/js/controllers/export.js b/src/js/controllers/export.js index 79402d6e7..21fe8d8ac 100644 --- a/src/js/controllers/export.js +++ b/src/js/controllers/export.js @@ -1,8 +1,10 @@ 'use strict'; angular.module('copayApp.controllers').controller('exportController', - function($rootScope, $scope, $timeout, $log, backupService, storageService, profileService, isMobile, notification, go, gettext, gettextCatalog) { + function($rootScope, $scope, $timeout, $log, backupService, storageService, profileService, platformInfo, notification, go, gettext, gettextCatalog) { var self = this; + var isWP = platformInfo.isWP; + var isAndroid = platformInfo.isAndroid; self.error = null; self.success = null; @@ -125,7 +127,7 @@ angular.module('copayApp.controllers').controller('exportController', self.sendWalletBackup = function() { var fc = profileService.focusedClient; - if (isMobile.Android() || isMobile.Windows()) { + if (isAndroid || isWP) { window.ignoreMobilePause = true; } window.plugins.toast.showShortCenter(gettextCatalog.getString('Preparing backup...')); diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index 94f502c29..31db70abb 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -742,7 +742,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r $log.info('CSV generation not available in mobile'); return; } - var isNode = isNW; var fc = profileService.focusedClient; var c = fc.credentials; if (!fc.isComplete()) return; diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js index f94f926a6..213db5443 100644 --- a/src/js/controllers/walletHome.js +++ b/src/js/controllers/walletHome.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $interval, $timeout, $filter, $modal, $log, notification, txStatus, profileService, lodash, configService, rateService, storageService, bitcore, gettext, gettextCatalog, platformInfo, addressService, ledger, bwsError, confirmDialog, txFormatService, animationService, addressbookService, go, feeService, walletService, fingerprintService) { +angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $interval, $timeout, $filter, $modal, $log, notification, txStatus, profileService, lodash, configService, rateService, storageService, bitcore, gettext, gettextCatalog, platformInfo, addressService, ledger, bwsError, confirmDialog, txFormatService, animationService, addressbookService, go, feeService, walletService, fingerprintService, nodeWebkit) { var isCordova = platformInfo.isCordova; var isWP = platformInfo.isWP; diff --git a/src/js/services/platformInfo.js b/src/js/services/platformInfo.js index 51ac7eea8..2d9a3ae94 100644 --- a/src/js/services/platformInfo.js +++ b/src/js/services/platformInfo.js @@ -23,24 +23,16 @@ angular.module('copayApp.services').factory('platformInfo', function($window) { // Detect mobile devices var ret = { - isAndroid: function() { - return !!ua.match(/Android/i); - }, - isIOS: function() { - return /iPad|iPhone|iPod/.test(ua) && !$window.MSStream; - }, - isWP: function() { - return !!ua.match(/IEMobile/i); - }, - isSafari: function() { - return Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; - } + isAndroid: !!ua.match(/Android/i), + isIOS: /iPad|iPhone|iPod/.test(ua) && !$window.MSStream, + isWP: !!ua.match(/IEMobile/i), + isSafari: Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0, + ua: ua, + isCordova: !!$window.cordova, + isNW: isNodeWebkit(), }; - ret.ua = ua; - ret.isMobile = ret.isAndroid() || ret.isIOS() || ret.isWP(); - ret.isCordova = !!$window.cordova; - ret.isNW = isNodeWebkit(); + ret.isMobile = ret.isAndroid || ret.isIOS || ret.isWP; ret.isChromeApp = $window.chrome && chrome.runtime && chrome.runtime.id && !ret.isNW; ret.isDevel = !ret.isMobile && !ret.isChromeApp && !ret.isNW;