mirror of https://github.com/BTCPrivate/copay.git
refactor bws control on import
This commit is contained in:
parent
f7eebf51ca
commit
4042d04f1b
|
@ -23,14 +23,6 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
});
|
||||
};
|
||||
|
||||
var setBwsURL = function(walletId, cb) {
|
||||
var opts = {
|
||||
bws: {}
|
||||
};
|
||||
opts.bws[walletId] = $scope.bwsurl;
|
||||
configService.set(opts, cb);
|
||||
}
|
||||
|
||||
var _importBlob = function(str, opts) {
|
||||
var str2, err;
|
||||
try {
|
||||
|
@ -58,10 +50,8 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
if (err) {
|
||||
self.error = err;
|
||||
} else {
|
||||
setBwsURL(walletId, function() {
|
||||
$rootScope.$emit('Local/WalletImported', walletId);
|
||||
notification.success(gettext('Success'), gettext('Your wallet has been imported correctly'));
|
||||
});
|
||||
}
|
||||
});
|
||||
}, 100);
|
||||
|
@ -79,12 +69,9 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
$scope.$apply();
|
||||
});
|
||||
}
|
||||
|
||||
setBwsURL(walletId, function() {
|
||||
$rootScope.$emit('Local/WalletImported', walletId);
|
||||
notification.success(gettext('Success'), gettext('Your wallet has been imported correctly'));
|
||||
});
|
||||
});
|
||||
}, 100);
|
||||
};
|
||||
|
||||
|
@ -100,11 +87,9 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
$scope.$apply();
|
||||
});
|
||||
}
|
||||
setBwsURL(walletId, function() {
|
||||
$rootScope.$emit('Local/WalletImported', walletId);
|
||||
notification.success(gettext('Success'), gettext('Your wallet has been imported correctly'));
|
||||
});
|
||||
});
|
||||
}, 100);
|
||||
};
|
||||
|
||||
|
@ -211,9 +196,12 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
$scope.$apply();
|
||||
return;
|
||||
}
|
||||
|
||||
lopts.externalSource = 'trezor';
|
||||
lopts.bwsurl = $scope.bwsurl;
|
||||
self.loading = true;
|
||||
$log.debug('Import opts', lopts);
|
||||
|
||||
profileService.importExtendedPublicKey(lopts, function(err, walletId) {
|
||||
self.loading = false;
|
||||
if (err) {
|
||||
|
@ -222,12 +210,10 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
$scope.$apply();
|
||||
});
|
||||
}
|
||||
setBwsURL(walletId, function() {
|
||||
$rootScope.$emit('Local/WalletImported', walletId);
|
||||
notification.success(gettext('Success'), gettext('Your wallet has been imported correctly'));
|
||||
go.walletHome();
|
||||
});
|
||||
});
|
||||
}, 100);
|
||||
};
|
||||
|
||||
|
@ -249,9 +235,12 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
$scope.$apply();
|
||||
return;
|
||||
}
|
||||
|
||||
lopts.externalSource = 'ledger';
|
||||
lopts.bwsurl = $scope.bwsurl;
|
||||
self.loading = true;
|
||||
$log.debug('Import opts', lopts);
|
||||
|
||||
profileService.importExtendedPublicKey(lopts, function(err, walletId) {
|
||||
self.loading = false;
|
||||
if (err) {
|
||||
|
@ -260,11 +249,9 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
$scope.$apply();
|
||||
});
|
||||
}
|
||||
setBwsURL(walletId, function() {
|
||||
$rootScope.$emit('Local/WalletImported', walletId);
|
||||
notification.success(gettext('Success'), gettext('Your wallet has been imported correctly'));
|
||||
});
|
||||
});
|
||||
}, 100);
|
||||
};
|
||||
|
||||
|
|
|
@ -441,9 +441,6 @@ angular.module('copayApp.services')
|
|||
};
|
||||
|
||||
root.importLegacyWallet = function(username, password, blob, cb) {
|
||||
if (opts.bwsurl)
|
||||
bwcService.setBaseUrl(opts.bwsurl);
|
||||
|
||||
var walletClient = bwcService.getClient();
|
||||
|
||||
walletClient.createWalletFromOldCopay(username, password, blob, function(err, existed) {
|
||||
|
|
Loading…
Reference in New Issue