mirror of https://github.com/BTCPrivate/copay.git
Review and test fixes.
This commit is contained in:
parent
36cb23015a
commit
a742e53814
|
@ -3,15 +3,13 @@
|
|||
angular.module('copayApp.controllers').controller('importController',
|
||||
function($scope, $timeout, $log, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, profileService, configService, sjcl, ledger, trezor, derivationPathHelper, platformInfo, bwcService, ongoingProcess, walletService, popupService, gettextCatalog, appConfigService) {
|
||||
|
||||
var isChromeApp = platformInfo.isChromeApp;
|
||||
var isDevel = platformInfo.isDevel;
|
||||
var reader = new FileReader();
|
||||
var defaults = configService.getDefaults();
|
||||
var errors = bwcService.getErrors();
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.isDevel = platformInfo.isDevel;
|
||||
$scope.isChromeApp = platformInfo.isChromeApp;
|
||||
$scope.supportsLedger = platformInfo.supportsLedger;
|
||||
$scope.supportsTrezor = platformInfo.supportsTrezor;
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
$scope.formData = {};
|
||||
$scope.formData.bwsurl = defaults.bws.url;
|
||||
|
@ -25,14 +23,14 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
|
||||
$scope.seedOptions = [];
|
||||
|
||||
if ($scope.isChromeApp) {
|
||||
if ($scope.supportsLedger) {
|
||||
$scope.seedOptions.push({
|
||||
id: walletService.externalSource.ledger.id,
|
||||
label: walletService.externalSource.ledger.longName,
|
||||
});
|
||||
}
|
||||
|
||||
if ($scope.isChromeApp || $scope.isDevel) {
|
||||
if ($scope.supportsTrezor) {
|
||||
$scope.seedOptions.push({
|
||||
id: walletService.externalSource.trezor.id,
|
||||
label: walletService.externalSource.trezor.longName,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('joinController',
|
||||
function($scope, $rootScope, $timeout, $state, $ionicHistory, $ionicScrollDelegate, profileService, configService, storageService, applicationService, gettextCatalog, lodash, ledger, trezor, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams, popupService, appConfigService) {
|
||||
function($scope, $rootScope, $timeout, $state, $ionicHistory, $ionicScrollDelegate, profileService, configService, storageService, applicationService, gettextCatalog, lodash, ledger, trezor, intelTEE, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams, popupService, appConfigService) {
|
||||
|
||||
var self = this;
|
||||
var defaults = configService.getDefaults();
|
||||
|
@ -64,14 +64,21 @@ angular.module('copayApp.controllers').controller('joinController',
|
|||
if (walletService.externalSource.ledger.supported) {
|
||||
self.seedOptions.push({
|
||||
id: walletService.externalSource.ledger.id,
|
||||
label: walletService.externalSource.ledger.longName,
|
||||
label: walletService.externalSource.ledger.longName
|
||||
});
|
||||
}
|
||||
|
||||
if (walletService.externalSource.trezor.supported) {
|
||||
self.seedOptions.push({
|
||||
id: walletService.externalSource.trezor.id,
|
||||
label: walletService.externalSource.trezor.longName,
|
||||
label: walletService.externalSource.trezor.longName
|
||||
});
|
||||
}
|
||||
|
||||
if (walletService.externalSource.intelTEE.supported) {
|
||||
seedOptions.push({
|
||||
id: walletService.externalSource.intelTEE.id,
|
||||
label: walletService.externalSource.intelTEE.longName
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +101,7 @@ angular.module('copayApp.controllers').controller('joinController',
|
|||
var opts = {
|
||||
secret: form.secret.$modelValue,
|
||||
myName: form.myName.$modelValue,
|
||||
bwsurl: $scope.bwsurl,
|
||||
bwsurl: $scope.bwsurl
|
||||
}
|
||||
|
||||
var setSeed = self.seedSourceId == 'set';
|
||||
|
@ -127,21 +134,37 @@ angular.module('copayApp.controllers').controller('joinController',
|
|||
return;
|
||||
}
|
||||
|
||||
if (self.seedSourceId == walletService.externalSource.ledger.id || self.seedSourceId == walletService.externalSource.trezor.id) {
|
||||
if (self.seedSourceId == walletService.externalSource.ledger.id || self.seedSourceId == walletService.externalSource.trezor.id || self.seedSourceId == walletService.externalSource.intelTEE.id) {
|
||||
var account = $scope.account;
|
||||
if (!account || account < 1) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid account number'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.seedSourceId == walletService.externalSource.trezor.id)
|
||||
if (self.seedSourceId == walletService.externalSource.trezor.id || self.seedSourceId == walletService.externalSource.intelTEE.id)
|
||||
account = account - 1;
|
||||
|
||||
opts.account = account;
|
||||
opts.isMultisig = true;
|
||||
ongoingProcess.set('connecting' + self.seedSourceId, true);
|
||||
var src = self.seedSourceId == walletService.externalSource.ledger.id ? ledger : trezor;
|
||||
|
||||
var src;
|
||||
switch (self.seedSourceId) {
|
||||
case walletService.externalSource.ledger.id:
|
||||
src = ledger;
|
||||
break;
|
||||
case walletService.externalSource.trezor.id:
|
||||
src = trezor;
|
||||
break;
|
||||
case walletService.externalSource.intelTEE.id:
|
||||
src = intelTEE;
|
||||
break;
|
||||
default:
|
||||
this.error = gettextCatalog.getString('Invalid seed source id: ' + self.seedSourceId);
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: cannot currently join an intelTEE testnet wallet (need to detect from the secret)
|
||||
src.getInfoForNewWallet(true, account, 'livenet', function(err, lopts) {
|
||||
ongoingProcess.set('connecting' + self.seedSourceId, false);
|
||||
if (err) {
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
angular.module('copayApp.controllers').controller('preferencesExternalController', function($scope, $stateParams, lodash, gettextCatalog, popupService, profileService, walletService) {
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
$scope.wallet = wallet;
|
||||
|
||||
$scope.externalSource = lodash.find(walletService.externalSource, function(source) {
|
||||
return source.id == wallet.getPrivKeyExternalSourceName();
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<span translate>File/Text</span>
|
||||
</div>
|
||||
<div class="col" ng-click="hardware = true; phrase = file = false" ng-style="hardware &&
|
||||
{'border-bottom-style': 'solid'}" ng-show="isCopay && (isChromeApp || isDevel)">
|
||||
{'border-bottom-style': 'solid'}" ng-show="isCopay && (supportsLedger || supportsTrezor)">
|
||||
<span translate>Hardware wallet</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<span class="toggle-label" translate>Hide Balance</span>
|
||||
</ion-toggle>
|
||||
|
||||
<div class="item item-divider" translate>
|
||||
<div class="item item-divider" ng-hide="wallet.isPrivKeyExternal() || !wallet.canSign()" translate>
|
||||
Security
|
||||
</div>
|
||||
<a class="item item-icon-right" ui-sref="tabs.preferences.backupWarning({from: 'tabs.preferences'})" ng-hide="wallet.isPrivKeyExternal()">
|
||||
|
|
|
@ -43,7 +43,13 @@
|
|||
{{derivationStrategy}}
|
||||
</span>
|
||||
</div>
|
||||
<a class="item item-icon-right" href ui-sref="tabs.preferences.preferencesExternal" ng-show="wallet.isPrivKeyExternal()">
|
||||
<div class="item" ng-show="wallet.isPrivKeyExternal() && !externalSource.isEmbeddedHardware">
|
||||
<span translate>Hardware Wallet</span>
|
||||
<span class="item-note">
|
||||
{{externalSource}}
|
||||
</span>
|
||||
</div>
|
||||
<a class="item item-icon-right" href ui-sref="tabs.preferences.preferencesExternal" ng-show="wallet.isPrivKeyExternal() && externalSource.isEmbeddedHardware">
|
||||
<span translate>Hardware Wallet</span>
|
||||
<span class="item-note">
|
||||
{{externalSource}}
|
||||
|
|
Loading…
Reference in New Issue