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',
|
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) {
|
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 reader = new FileReader();
|
||||||
var defaults = configService.getDefaults();
|
var defaults = configService.getDefaults();
|
||||||
var errors = bwcService.getErrors();
|
var errors = bwcService.getErrors();
|
||||||
|
|
||||||
$scope.init = function() {
|
$scope.init = function() {
|
||||||
$scope.isDevel = platformInfo.isDevel;
|
$scope.supportsLedger = platformInfo.supportsLedger;
|
||||||
$scope.isChromeApp = platformInfo.isChromeApp;
|
$scope.supportsTrezor = platformInfo.supportsTrezor;
|
||||||
$scope.isCordova = platformInfo.isCordova;
|
$scope.isCordova = platformInfo.isCordova;
|
||||||
$scope.formData = {};
|
$scope.formData = {};
|
||||||
$scope.formData.bwsurl = defaults.bws.url;
|
$scope.formData.bwsurl = defaults.bws.url;
|
||||||
|
@ -25,14 +23,14 @@ angular.module('copayApp.controllers').controller('importController',
|
||||||
|
|
||||||
$scope.seedOptions = [];
|
$scope.seedOptions = [];
|
||||||
|
|
||||||
if ($scope.isChromeApp) {
|
if ($scope.supportsLedger) {
|
||||||
$scope.seedOptions.push({
|
$scope.seedOptions.push({
|
||||||
id: walletService.externalSource.ledger.id,
|
id: walletService.externalSource.ledger.id,
|
||||||
label: walletService.externalSource.ledger.longName,
|
label: walletService.externalSource.ledger.longName,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($scope.isChromeApp || $scope.isDevel) {
|
if ($scope.supportsTrezor) {
|
||||||
$scope.seedOptions.push({
|
$scope.seedOptions.push({
|
||||||
id: walletService.externalSource.trezor.id,
|
id: walletService.externalSource.trezor.id,
|
||||||
label: walletService.externalSource.trezor.longName,
|
label: walletService.externalSource.trezor.longName,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('joinController',
|
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 self = this;
|
||||||
var defaults = configService.getDefaults();
|
var defaults = configService.getDefaults();
|
||||||
|
@ -64,14 +64,21 @@ angular.module('copayApp.controllers').controller('joinController',
|
||||||
if (walletService.externalSource.ledger.supported) {
|
if (walletService.externalSource.ledger.supported) {
|
||||||
self.seedOptions.push({
|
self.seedOptions.push({
|
||||||
id: walletService.externalSource.ledger.id,
|
id: walletService.externalSource.ledger.id,
|
||||||
label: walletService.externalSource.ledger.longName,
|
label: walletService.externalSource.ledger.longName
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (walletService.externalSource.trezor.supported) {
|
if (walletService.externalSource.trezor.supported) {
|
||||||
self.seedOptions.push({
|
self.seedOptions.push({
|
||||||
id: walletService.externalSource.trezor.id,
|
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 = {
|
var opts = {
|
||||||
secret: form.secret.$modelValue,
|
secret: form.secret.$modelValue,
|
||||||
myName: form.myName.$modelValue,
|
myName: form.myName.$modelValue,
|
||||||
bwsurl: $scope.bwsurl,
|
bwsurl: $scope.bwsurl
|
||||||
}
|
}
|
||||||
|
|
||||||
var setSeed = self.seedSourceId == 'set';
|
var setSeed = self.seedSourceId == 'set';
|
||||||
|
@ -127,21 +134,37 @@ angular.module('copayApp.controllers').controller('joinController',
|
||||||
return;
|
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;
|
var account = $scope.account;
|
||||||
if (!account || account < 1) {
|
if (!account || account < 1) {
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid account number'));
|
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid account number'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.seedSourceId == walletService.externalSource.trezor.id)
|
if (self.seedSourceId == walletService.externalSource.trezor.id || self.seedSourceId == walletService.externalSource.intelTEE.id)
|
||||||
account = account - 1;
|
account = account - 1;
|
||||||
|
|
||||||
opts.account = account;
|
opts.account = account;
|
||||||
opts.isMultisig = true;
|
opts.isMultisig = true;
|
||||||
ongoingProcess.set('connecting' + self.seedSourceId, 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) {
|
src.getInfoForNewWallet(true, account, 'livenet', function(err, lopts) {
|
||||||
ongoingProcess.set('connecting' + self.seedSourceId, false);
|
ongoingProcess.set('connecting' + self.seedSourceId, false);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('preferencesExternalController', function($scope, $stateParams, lodash, gettextCatalog, popupService, profileService, walletService) {
|
angular.module('copayApp.controllers').controller('preferencesExternalController', function($scope, $stateParams, lodash, gettextCatalog, popupService, profileService, walletService) {
|
||||||
var wallet = profileService.getWallet($stateParams.walletId);
|
var wallet = profileService.getWallet($stateParams.walletId);
|
||||||
$scope.wallet = wallet;
|
|
||||||
|
|
||||||
$scope.externalSource = lodash.find(walletService.externalSource, function(source) {
|
$scope.externalSource = lodash.find(walletService.externalSource, function(source) {
|
||||||
return source.id == wallet.getPrivKeyExternalSourceName();
|
return source.id == wallet.getPrivKeyExternalSourceName();
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<span translate>File/Text</span>
|
<span translate>File/Text</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col" ng-click="hardware = true; phrase = file = false" ng-style="hardware &&
|
<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>
|
<span translate>Hardware wallet</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<span class="toggle-label" translate>Hide Balance</span>
|
<span class="toggle-label" translate>Hide Balance</span>
|
||||||
</ion-toggle>
|
</ion-toggle>
|
||||||
|
|
||||||
<div class="item item-divider" translate>
|
<div class="item item-divider" ng-hide="wallet.isPrivKeyExternal() || !wallet.canSign()" translate>
|
||||||
Security
|
Security
|
||||||
</div>
|
</div>
|
||||||
<a class="item item-icon-right" ui-sref="tabs.preferences.backupWarning({from: 'tabs.preferences'})" ng-hide="wallet.isPrivKeyExternal()">
|
<a class="item item-icon-right" ui-sref="tabs.preferences.backupWarning({from: 'tabs.preferences'})" ng-hide="wallet.isPrivKeyExternal()">
|
||||||
|
|
|
@ -43,7 +43,13 @@
|
||||||
{{derivationStrategy}}
|
{{derivationStrategy}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</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 translate>Hardware Wallet</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{externalSource}}
|
{{externalSource}}
|
||||||
|
|
Loading…
Reference in New Issue