rm importLegacy

This commit is contained in:
Matias Alejo Garcia 2016-06-11 22:29:17 -03:00
commit bf16391085
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
5 changed files with 14 additions and 141 deletions

View file

@ -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...
});

View file

@ -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,

View file

@ -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();
});
});