Merge branch 'master' of https://github.com/bitpay/copay into v3.5.0

This commit is contained in:
magmahindenburg 2017-06-16 11:20:33 +09:00
commit 19824e8fde
73 changed files with 200 additions and 94 deletions

View file

@ -1,7 +1,7 @@
'use strict';
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, hwWallet) {
var reader = new FileReader();
var defaults = configService.getDefaults();
@ -17,6 +17,7 @@ angular.module('copayApp.controllers').controller('importController',
$scope.formData.account = 1;
$scope.importErr = false;
$scope.isCopay = appConfigService.name == 'copay';
$scope.fromHardwareWallet = { value: false };
if ($stateParams.code)
$scope.processWalletInfo($stateParams.code);
@ -38,6 +39,21 @@ angular.module('copayApp.controllers').controller('importController',
$scope.formData.seedSource = $scope.seedOptions[0];
}
$scope.seedOptionsAll = [];
$scope.seedOptionsAll.push({
id: walletService.externalSource.ledger.id,
label: walletService.externalSource.ledger.longName,
});
$scope.seedOptionsAll.push({
id: walletService.externalSource.trezor.id,
label: walletService.externalSource.trezor.longName,
});
$scope.formData.seedSourceAll = $scope.seedOptionsAll[0];
$timeout(function() {
$scope.$apply();
});
@ -159,6 +175,7 @@ angular.module('copayApp.controllers').controller('importController',
$timeout(function() {
profileService.importMnemonic(words, opts, function(err, client) {
ongoingProcess.set('importingWallet', false);
if (err) {
@ -177,7 +194,7 @@ angular.module('copayApp.controllers').controller('importController',
};
$scope.setDerivationPath = function() {
$scope.formData.derivationPath = $scope.formData.testnetEnabled ? derivationPathHelper.defaultTestnet : derivationPathHelper.default;
$scope.formData.testnetEnabled ? derivationPathHelper.defaultTestnet : derivationPathHelper.default;
};
$scope.getFile = function() {
@ -256,6 +273,17 @@ angular.module('copayApp.controllers').controller('importController',
}
opts.passphrase = $scope.formData.passphrase || null;
if ($scope.fromHardwareWallet.value) {
$log.debug('Importing seed from hardware wallet');
$log.warn('This wont work for Intel TEE wallets');
var id = $scope.formData.seedSourceAll.id;
var isMultisig = opts.derivationStrategy =='BIP48';
var account = opts.account;
opts.entropySourcePath = 'm/' + hwWallet.getEntropyPath(id, isMultisig, account);
}
_importMnemonic(words, opts);
};
@ -269,6 +297,7 @@ angular.module('copayApp.controllers').controller('importController',
lopts.externalSource = walletService.externalSource.trezor.id;
lopts.bwsurl = $scope.formData.bwsurl;
lopts.account = account;
ongoingProcess.set('importingWallet', true);
$log.debug('Import opts', lopts);
@ -325,6 +354,7 @@ angular.module('copayApp.controllers').controller('importController',
lopts.externalSource = lopts.externalSource = walletService.externalSource.ledger.id;
lopts.bwsurl = $scope.formData.bwsurl;
lopts.account = account;
ongoingProcess.set('importingWallet', true);
$log.debug('Import opts', lopts);

View file

@ -36,7 +36,7 @@ angular.module('copayApp.controllers').controller('lockSetupController', functio
function getSavedMethod() {
var config = configService.getSync();
if (config.lock) return config.lock.method;
if (config.lock && config.lock.method) return config.lock.method;
return 'none';
};

View file

@ -128,6 +128,16 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
updateWalletsList();
};
$scope.searchInFocus = function() {
$scope.searchFocus = true;
};
$scope.searchBlurred = function() {
if ($scope.formData.search == null) {
$scope.searchFocus = false;
}
};
$scope.findContact = function(search) {
if (incomingData.redir(search)) {

View file

@ -50,19 +50,15 @@ angular.module('copayApp.services')
});
scope.openModal = function() {
scope.fingerprintCheckModal.show();
checkFingerprint();
scope.checkFingerprint();
};
scope.hideModal = function() {
root.isModalOpen = false;
scope.fingerprintCheckModal.hide();
};
function checkFingerprint() {
scope.checkFingerprint = function() {
fingerprintService.check('unlockingApp', function(err) {
if (err) {
checkFingerprint();
return;
}
if (err) return;
scope.hideModal();
});
}

View file

@ -208,9 +208,9 @@ angular.module('copayApp.services')
};
var shouldSkipValidation = function(walletId) {
return root.profile.isChecked(platformInfo.ua, walletId) || isIOS || isWP;
}
// Used when reading wallets from the profile
return root.profile.isChecked(platformInfo.ua, walletId) || isIOS || isWP;
}
// Used when reading wallets from the profile
root.bindWallet = function(credentials, cb) {
if (!credentials.walletId || !credentials.m)
return cb('bindWallet should receive credentials JSON');
@ -618,6 +618,8 @@ angular.module('copayApp.services')
walletClient.importFromMnemonic(words, {
network: opts.networkName,
passphrase: opts.passphrase,
entropySourcePath: opts.entropySourcePath,
derivationStrategy: opts.derivationStrategy || 'BIP44',
account: opts.account || 0,
}, function(err) {
if (err) {

View file

@ -93,7 +93,6 @@ angular.module('copayApp.services')
outputs = [];
var tmpOutputs = [];
if (txp.type && txp.type != 'simple') {
return callback('Only TXPs type SIMPLE are supported in TREZOR');
} else if (txp.outputs) {
@ -170,7 +169,6 @@ angular.module('copayApp.services')
return '';
});
inputs = lodash.map(txp.inputs, function(i) {
$log.debug("Trezor TX input path:", i.path);
var pathArr = i.path.split('/');
@ -180,12 +178,12 @@ angular.module('copayApp.services')
inAmount += i.satoshis;
var orderedPubKeys = root._orderPubKeys(xPubKeys, np);
var pubkeys = lodash(orderedPubKeys.map(function(v) {
var pubkeys = orderedPubKeys.map(function(v) {
return {
node: v,
address_n: np,
};
}));
});
return {
address_n: n,
@ -208,12 +206,12 @@ angular.module('copayApp.services')
var np = n.slice(3);
var orderedPubKeys = root._orderPubKeys(xPubKeys, np);
var pubkeys = lodash(orderedPubKeys.map(function(v) {
var pubkeys = orderedPubKeys.map(function(v) {
return {
node: v,
address_n: np,
};
}));
});
tmpOutputs.push({
address_n: n,

View file

@ -101,6 +101,7 @@
height: 40px;
border-radius: 40px;
border: 1px solid;
color: #9b9bab;
&.no-border {
border: none;
.svg {

View file

@ -1,5 +1,9 @@
#pin {
background-color: #FAFAFA;
width: 100%;
height: 100%;
top: 0;
left: 0;
.content {
text-align: center;
position: fixed;

View file

@ -35,7 +35,50 @@
.send-heading {
font-size: 14px;
font-weight: bold;
padding-bottom: 0;
padding: 0 0 16px 0;
border: none;
}
.send-header-wrapper {
padding: 10px;
background-color: white;
box-shadow: 0px 5px 10px 0px #cccccc;
}
.search-wrapper {
background-color: #f2f2f2;
border-radius: 3px;
border: none;
.svg#Bitcoin_Symbol {
width: 14px;
.st0 {
fill: #cccccc;
}
}
&.focus {
background: none;
.svg#Bitcoin_Symbol {
display: none;
}
.search-input {
padding-left: 0;
&:focus::-webkit-input-placeholder {
opacity: 0;
}
}
}
}
.abs-v-center {
position: absolute;
top: 50%;
transform: translateY(-50%);
}
.search-input {
background-color: transparent;
padding-left: 30px;
}
.separator-left {
border-left: 1px solid #d9d9df;
padding-left: 10px;
height: 70%;
}
.bitcoin-address {
border-top: none;