From bf16391085194beb44d8f365c483d260095424a5 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Sat, 11 Jun 2016 22:29:17 -0300 Subject: [PATCH] rm importLegacy --- public/views/import.html | 10 +---- public/views/importLegacy.html | 68 ------------------------------ src/js/controllers/importLegacy.js | 63 --------------------------- src/js/services/openURL.js | 11 ++++- src/js/services/profileService.js | 3 ++ 5 files changed, 14 insertions(+), 141 deletions(-) delete mode 100644 public/views/importLegacy.html delete mode 100644 src/js/controllers/importLegacy.js diff --git a/public/views/import.html b/public/views/import.html index 990f0a7a6..6ab456c69 100644 --- a/public/views/import.html +++ b/public/views/import.html @@ -21,7 +21,7 @@
File/Text Backup @@ -161,14 +161,6 @@ Import backup - -
-

Have a Backup from Copay v0.9?

- -
-
diff --git a/public/views/importLegacy.html b/public/views/importLegacy.html deleted file mode 100644 index 0c969e898..000000000 --- a/public/views/importLegacy.html +++ /dev/null @@ -1,68 +0,0 @@ -
-
- -
-
-
-
-

Importing...

-
    -
  • - {{m.message|translate}} -
-
- -
- - {{importLegacy.error|translate}} - -
- -
-
- - - - - - - - - - -
- - - -
-
-
-
diff --git a/src/js/controllers/importLegacy.js b/src/js/controllers/importLegacy.js deleted file mode 100644 index 0a1258876..000000000 --- a/src/js/controllers/importLegacy.js +++ /dev/null @@ -1,63 +0,0 @@ -'use strict'; - -angular.module('copayApp.controllers').controller('importLegacyController', - function($rootScope, $scope, $log, $timeout, notification, legacyImportService, profileService, go, lodash, bitcore, gettext, gettextCatalog) { - - var self = this; - self.messages = []; - self.fromCloud = true; - self.server = "https://insight.bitpay.com:443/api/email"; - - - $rootScope.$on('Local/ImportStatusUpdate', function(event, status) { - $timeout(function() { - $log.debug(status); - - self.messages.unshift({ - message: status, - }); - - var op = 1; - lodash.each(self.messages, function(m) { - if (op < 0.1) op = 0.1; - m.opacity = op; - op = op - 0.15; - }); - }, 100); - }); - - self.scan = function(ids) { - $log.debug('### Scanning: ' + ids) - var i = 0; - lodash.each(ids, function(id) { - $rootScope.$emit('Local/WalletImported', id); - if (++i == ids.length) { - go.walletHome(); - }; - }); - }; - - - self.import = function(form) { - var username = form.username.$modelValue; - var password = form.password.$modelValue; - var serverURL = form.server.$modelValue; - var fromCloud = form.fromCloud.$modelValue; - - self.error = null; - self.importing = true; - $timeout(function() { - legacyImportService.import(username, password, serverURL, fromCloud, function(err, ids, toScanIds) { - if (err || !ids || !ids.length) { - self.importing = false; - self.error = err || gettext('Failed to import wallets'); - return; - } - - notification.success( gettextCatalog.getString('{{len}} wallets imported. Funds scanning in progress. Hold on to see updated balance', {len: ids.length})); - self.scan(toScanIds); - }); - }, 100); - }; - // TODO destroy event... - }); diff --git a/src/js/services/openURL.js b/src/js/services/openURL.js index 07cd8935d..31f0c72b8 100644 --- a/src/js/services/openURL.js +++ b/src/js/services/openURL.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.services').factory('openURLService', function($ionicHistory, $document, $log, $state, go, platformInfo, lodash) { +angular.module('copayApp.services').factory('openURLService', function($rootScope, $ionicHistory, $document, $log, $state, go, platformInfo, lodash, profileService) { var root = {}; root.registeredUriHandlers = [{ @@ -21,6 +21,15 @@ angular.module('copayApp.services').factory('openURLService', function($ionicHis var handleOpenURL = function(args) { $log.info('Handling Open URL: ' + JSON.stringify(args)); + if (!profileService.isBound) { + $log.warn('Profile not bound yet. Waiting'); + + return $rootScope.$on('Local/ProfileBound', function(){ + $log.warn('Profile ready, retrying...'); + handleOpenURL(args); + }); + }; + // Stop it from caching the first view as one to return when the app opens $ionicHistory.nextViewOptions({ historyRoot: true, diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index 5e69bb8c4..a3352c869 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -169,6 +169,9 @@ angular.module('copayApp.services') if (!val) { return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer')); } + + root.isBound = true; + $root.$emit('Local/ProfileBound'); return cb(); }); });