Merge branch 'wallet/sprint/20' of https://github.com/Bitcoin-com/Wallet into wallet/sprint/20

This commit is contained in:
Jean-Baptiste Dominguez 2018-08-18 00:51:24 +09:00
commit 3cef258912
14 changed files with 73 additions and 140 deletions

View file

@ -24,9 +24,9 @@
"windowsAppId": "804636ee-b017-4cad-8719-e58ac97ffa5c",
"pushSenderId": "1036948132229",
"description": "A Secure Bitcoin Wallet",
"version": "4.13.2",
"fullVersion": "4.13-rc3",
"androidVersion": "413200",
"version": "5.0.0",
"fullVersion": "5.0-rc1",
"androidVersion": "500000",
"_extraCSS": "",
"_enabledExtensions": {
"coinbase": false,

View file

@ -119,10 +119,10 @@
"run:android": "cordova run android --device",
"run:android-release": "cordova run android --device --release",
"log:android": "adb logcat | grep chromium",
"sign:android": "rm -f platforms/android/build/outputs/apk/android-release-signed-aligned.apk; jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../bitcoin-com-release-key.jks -signedjar platforms/android/build/outputs/apk/android-release-signed.apk platforms/android/build/outputs/apk/android-release-unsigned.apk bitcoin-com && $ANDROID_HOME/build-tools/27.0.1/zipalign -v 4 platforms/android/build/outputs/apk/android-release-signed.apk platforms/android/build/outputs/apk/android-release-signed-aligned.apk",
"sign:android": "rm -f platforms/android/build/outputs/apk/android-release-signed-aligned.apk; jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../bitcoin-com-release-key.jks -signedjar platforms/android/build/outputs/apk/android-release-signed.apk platforms/android/build/outputs/apk/android-release-unsigned.apk bitcoin-com && zipalign -v 4 platforms/android/build/outputs/apk/android-release-signed.apk platforms/android/build/outputs/apk/android-release-signed-aligned.apk",
"apply:copay": "npm i fs-extra && cd app-template && node apply.js copay && npm i && cordova prepare",
"apply:bitpay": "npm i fs-extra && cd app-template && node apply.js bitpay && npm i && cordova prepare",
"apply:bitcoincom": "npm i fs-extra && cd app-template && node apply.js bitcoincom && npm i && cordova prepare",
"apply:bitcoincom": "npm i fs-extra && cd app-template && node apply.js bitcoincom && npm i && cordova prepare && cd ../ && ./fix-asn1.sh",
"test": "karma start test/karma.conf.js --single-run",
"clean": "trash platforms && trash plugins && cordova prepare",
"unstage-package": "git reset package.json",

11
fix-asn1.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/bash
firstLine=`awk 'NR < 2 {print}' node_modules/asn1.js-rfc5280/index.js`
if [ "$firstLine" = "try {" ]; then
echo "var asn1 = require('asn1.js');" > node_modules/asn1.js-rfc5280/index.new.js
awk 'NR > 6 {print}' node_modules/asn1.js-rfc5280/index.js >> node_modules/asn1.js-rfc5280/index.new.js
rm node_modules/asn1.js-rfc5280/index.js
mv node_modules/asn1.js-rfc5280/index.new.js node_modules/asn1.js-rfc5280/index.js
echo "node_modules/asn1.js-rfc5280/index.js fixed"
fi

View file

@ -3160,7 +3160,7 @@ msgid "To start the process you need to add funds to your wallet."
msgstr ""
#: www/views/shapeshift.html:30
msgid "he process is fast and you will receive the exchanged amount in your wallet."
msgid "The process is fast and you will receive the exchanged amount in your wallet."
msgstr ""
#: www/views/shapeshift.html:34

View file

@ -1,21 +1,25 @@
ext {
ANDROID_SUPPORT_V4_VERSION = '26.1.0'
}
configurations.all {
resolutionStrategy {
force "com.android.support:support-v4:26.1.0"
force "com.google.android.gms:play-services-auth:11.8.0"
force "com.google.android.gms:play-services-identity:11.8.0"
force "com.google.android.gms:play-services-ads:11.8.0"
force "com.google.android.gms:play-services-base:11.8.0"
force "com.google.android.gms:play-services-gcm:11.8.0"
force "com.google.android.gms:play-services-analytics:11.8.0"
force "com.google.android.gms:play-services-location:11.8.0"
force "com.google.android.gms:play-services-basement:11.8.0"
force "com.google.android.gms:play-services-tagmanager:11.8.0"
force 'com.google.firebase:firebase-core:11.8.0'
force 'com.google.firebase:firebase-crash:11.8.0'
force 'com.google.firebase:firebase-auth:11.8.0'
force 'com.google.firebase:firebase-common:11.8.0'
force 'com.google.firebase:firebase-config:11.8.0'
force 'com.google.firebase:firebase-perf:11.8.0'
force 'com.google.firebase:firebase-messaging:11.8.0'
}
resolutionStrategy {
force "com.android.support:support-v4:26.1.0"
force "com.google.android.gms:play-services-auth:11.8.0"
force "com.google.android.gms:play-services-identity:11.8.0"
force "com.google.android.gms:play-services-ads:11.8.0"
force "com.google.android.gms:play-services-base:11.8.0"
force "com.google.android.gms:play-services-gcm:11.8.0"
force "com.google.android.gms:play-services-analytics:11.8.0"
force "com.google.android.gms:play-services-location:11.8.0"
force "com.google.android.gms:play-services-basement:11.8.0"
force "com.google.android.gms:play-services-tagmanager:11.8.0"
force 'com.google.firebase:firebase-core:11.8.0'
force 'com.google.firebase:firebase-crash:11.8.0'
force 'com.google.firebase:firebase-auth:11.8.0'
force 'com.google.firebase:firebase-common:11.8.0'
force 'com.google.firebase:firebase-config:11.8.0'
force 'com.google.firebase:firebase-perf:11.8.0'
force 'com.google.firebase:firebase-messaging:11.8.0'
}
}

View file

@ -456,6 +456,7 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
var confirmData = {
amount: useSendMax ? undefined : satoshis,
displayAddress: passthroughParams.displayAddress,
fromWalletId: passthroughParams.fromWalletId,
sendMax: useSendMax,
toAddress: passthroughParams.toAddress,

View file

@ -19,6 +19,7 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit
kind: '', // 'address', 'contact', 'wallet'
name: ''
};
vm.displayAddress = '';
vm.feeCrypto = '';
vm.feeFiat = '';
vm.fiatCurrency = '';
@ -56,10 +57,9 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit
var sendFlowData;
var config = null;
var countDown = null;
var defaults = {};
var coin = '';
var countDown = null;
var defaults = {};
var usingCustomFee = false;
var usingMerchantFee = false;
var destinationWalletId = '';
@ -85,7 +85,8 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit
satoshis = parseInt(sendFlowData.amount, 10);
toAddress = sendFlowData.toAddress;
destinationWalletId = sendFlowData.toWalletId;
vm.displayAddress = sendFlowData.displayAddress;
vm.originWallet = profileService.getWallet(originWalletId);
vm.origin.currency = vm.originWallet.coin.toUpperCase();
coin = vm.originWallet.coin;
@ -104,7 +105,7 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit
priceDisplayIsFiat = config.wallet.settings.priceDisplay === 'fiat';
vm.origin.currencyColor = (vm.originWallet.coin === 'btc' ? defaults.bitcoinWalletColor : defaults.bitcoinCashWalletColor);
console.log("coin", vm.originWallet.coin, vm.origin.currencyColor, config.bitcoinWalletColor, vm.originWallet.coin === 'btc');
unitFromSat = 1 / config.wallet.settings.unitToSatoshi;
unitFromSat = 1 / config.wallet.settings.unitToSatoshi;
}
updateSendAmounts();
getOriginWalletBalance(vm.originWallet);

View file

@ -4,6 +4,8 @@ angular.module('copayApp.controllers').controller('shapeshiftController', functi
var walletsBtc = [];
var walletsBch = [];
$scope.showMyAddress = showMyAddress;
function generateAddress(wallet, cb) {
if (!wallet) return;
walletService.getAddress(wallet, false, function(err, addr) {
@ -41,14 +43,6 @@ angular.module('copayApp.controllers').controller('shapeshiftController', functi
$ionicNavBarDelegate.showBar(true);
});
$scope.showFromWalletSelector = function() {
$scope.showFromWallets = true;
};
$scope.showToWalletSelector = function() {
$scope.showToWallets = true;
};
// This could probably be enhanced refactoring the routes abstract states
$scope.createWallet = function() {
$state.go('tabs.home').then(function() {
@ -81,4 +75,11 @@ angular.module('copayApp.controllers').controller('shapeshiftController', functi
});
});
}
function showMyAddress() {
$state.go('tabs.home').then(function() {
$state.go('tabs.receive');
});
}
});

View file

@ -138,7 +138,9 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
$scope.paymentReceivedAlternativeAmount = ''; // For when a subsequent payment is received.
txFormatService.formatAlternativeStr($scope.wallet.coin, data.x.out[i].value, function(alternativeStr){
if (alternativeStr) {
$scope.paymentReceivedAlternativeAmount = alternativeStr;
$scope.$apply(function () {
$scope.paymentReceivedAlternativeAmount = alternativeStr;
});
}
});
}

View file

@ -11,7 +11,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
root.redir = function(data, serviceId, serviceData) {
var originalAddress = null;
var noPrefixInAddress = 0;
if (data.toLowerCase().indexOf('bitcoin') < 0) {
noPrefixInAddress = 1;
}
@ -83,7 +83,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
// Timeout is required to enable the "Back" button
$timeout(function() {
var params = sendFlowService.getStateClone();
if (amount) {
params.amount = amount;
}
@ -390,6 +390,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
$timeout(function() {
var stateParams = {
toAddress: toAddress,
displayAddress: toAddress,
coin: coin,
noPrefix: 1
};

View file

@ -13,6 +13,7 @@ angular
// even other properties added that this service does not know about. (such as "coin")
state: {
amount: '',
displayAddress: null,
fromWalletId: '',
sendMax: false,
thirdParty: null,
@ -42,6 +43,7 @@ angular
console.log("sendFlow clearCurrent()");
service.state = {
amount: '',
displayAddress: null,
fromWalletId: '',
sendMax: false,
thirdParty: null,

View file

@ -9,8 +9,8 @@
text-overflow: ellipsis;
&.expanded {
white-space: pre-wrap;
word-break: break-all;
white-space: normal;
text-overflow: clip;
}
.prefix {

View file

@ -57,7 +57,12 @@
</div>
<div class="item-content item-content-compact" ng-init="addressExpanded = false" ng-if="vm.destination.kind === 'address' && !vm.thirdParty">
<div class="address-frame" ng-class="{ 'expanded': addressExpanded }" ng-click="addressExpanded = !addressExpanded">
<span class="prefix">{{vm.destination.address.substring(0,5)}}</span><span class="mid">{{vm.destination.address.substring(5,vm.destination.address.length-4)}}</span><span class="suffix">{{vm.destination.address.substring(vm.destination.address.length-4)}}</span>
<span ng-if="!vm.displayAddress">
<span class="prefix">{{vm.destination.address.substring(0,5)}}</span><span class="mid">{{vm.destination.address.substring(5,vm.destination.address.length-4)}}</span><span class="suffix">{{vm.destination.address.substring(vm.destination.address.length-4)}}</span>
</span>
<span ng-if="vm.displayAddress">
<span class="prefix">{{vm.displayAddress.substring(0,5)}}</span><span class="mid">{{vm.displayAddress.substring(5,vm.displayAddress.length-4)}}</span><span class="suffix">{{vm.displayAddress.substring(vm.displayAddress.length-4)}}</span>
</span>
</div>
</div>
</div>
@ -111,6 +116,7 @@
<slide-to-accept-success
slide-success-show="vm.sendStatus === 'success'"
slide-success-on-confirm="vm.onSuccessConfirm()"
slide-success-on-share="vm.onShareTransaction"
slide-success-hide-on-confirm="true">
<span ng-show="vm.originWallet.m == 1 && (vm.originWallet.canSign() || vm.originWallet.isPrivKeyExternal())" translate>Payment Sent</span>
<span ng-show="vm.originWallet.m > 1 && (vm.originWallet.canSign() || vm.originWallet.isPrivKeyExternal())" translate>Proposal Created</span>

View file

@ -23,107 +23,11 @@
<div ng-show="!hasWallets" translate>To get started, you'll need to create a bitcoin wallet and get some bitcoin.</div>
<div class="padding buttons">
<button class="button button-standard button-green" ng-click="buyBitcoin()" ng-show="!walletsWithFunds.length" translate>Buy Bitcoin now</button>
<button class="button button-standard button-white" ng-click="showMyAddress()" ng-show="!walletsWithFunds.length" translate>Show my address</button>
<button class="button button-standard button-green" ng-click="createWallet()" ng-show="!hasWallets" translate>Create bitcoin wallet</button>
<button class="button button-standard button-shapeshift track_shapeshift_start_click" ng-click="shapeshift()" ng-show="walletsWithFunds.length" translate>Start ShapeShift</button>
</div>
</div>
</div>
<div class="third-party-notice" translate>This service is provided by the third-party ShapeShift, who will charge a small fee for the service. The fee will be shown before you start the transaction.</div>
<shapeshift-coin-trader class="ng-hide" ng-show="fromWallets.length > 0 && toWallets.length > 0">
<div class="list card">
<div class="item item-heading">
<span translate><strong>From</strong></span>
</div>
<div class="item wallet-selector" ng-click="showFromWalletSelector()" ng-if="fromWallet">
<a ng-if="fromWallet" class="item item-sub item-icon-left item-big-icon-left item-icon-right">
<i class="icon big-icon-svg" ng-include="'views/includes/fromWalletIcon.html'"></i>
<span>
{{fromWallet.name || fromWallet.id}}
</span>
<p>
<span ng-if="!fromWallet.balanceHidden"> {{fromWallet.status.totalBalanceStr}} </span>
<span ng-if="fromWallet.balanceHidden" translate>[Balance Hidden]</span>
<span class="tab-home__wallet__multisig-number" ng-if="fromWallet.n > 1">
{{fromWallet.m}}-of-{{fromWallet.n}}
</span>
<span class="assertive" ng-if="fromWallet.error">{{fromWallet.error}}</span>
&nbsp;
</p>
<i ng-if="!singleFromWallet" class="icon bp-arrow-right"></i>
</a>
</div>
<div class="item item-heading">
<span translate><strong>To</strong></span>
</div>
<div class="item wallet-selector" ng-click="showToWalletSelector()" ng-if="toWallet">
<a ng-if="toWallet" class="item item-sub item-icon-left item-big-icon-left item-icon-right">
<i class="icon big-icon-svg" ng-include="'views/includes/toWalletIcon.html'"></i>
<span>
{{toWallet.name || toWallet.id}}
</span>
<p>
<span ng-if="!toWallet.balanceHidden"> {{toWallet.status.totalBalanceStr}} </span>
<span ng-if="toWallet.balanceHidden" translate>[Balance Hidden]</span>
<span class="tab-home__wallet__multisig-number" ng-if="toWallet.n > 1">
{{toWallet.m}}-of-{{toWallet.n}}
</span>
<span class="assertive" ng-if="toWallet.error">{{toWallet.error}}</span>
&nbsp;
</p>
<i ng-if="!singleToWallet" class="icon bp-arrow-right"></i>
</a>
</div>
<div class="item item-heading">
Rate: {{rateString}}
</div>
</div>
<shapeshift-coin-selector
coins="coins"
label="'Return Address'"
get-market-data="getMarketDataIn"
market-data="marketData"
selected-coin="fromWallet.coin"
coin-address="fromWalletAddress"
wallet-id="fromWallet.id"
amount="amount"
direction="'in'">
</shapeshift-coin-selector>
<br/>
<shapeshift-coin-selector
coins="coins"
label="'Withdrawal Address'"
get-market-data="getMarketDataOut"
selected-coin="toWallet.coin"
coin-address="toWalletAddress"
wallet-id="toWallet.id"
direction="'out'">
</shapeshift-coin-selector>
<shapeshift-coin-error ssError="ssError"></shapeshift-coin-error>
<!--<shapeshift-coin-deposit-info deposit-status="DepositStatus" deposit-info="depositInfo"></shapeshift-coin-deposit-info>-->
<shapeshift-coin-shift-button shift-it="shiftIt" shift-state="ShiftState"></shapeshift-coin-shift-button>
</shapeshift-coin-trader>
</ion-content>
<!--<wallet-selector-->
<!--wallet-selector-title="fromWalletSelectorTitle"-->
<!--wallet-selector-wallets="fromWallets"-->
<!--wallet-selector-selected-wallet="fromWallet"-->
<!--wallet-selector-show="showFromWallets"-->
<!--wallet-selector-on-select="onFromWalletSelect"-->
<!--wallet-selector-always-display-bitcoin-core="true">-->
<!--</wallet-selector>-->
<!--<wallet-selector-->
<!--wallet-selector-title="toWalletSelectorTitle"-->
<!--wallet-selector-wallets="toWallets"-->
<!--wallet-selector-selected-wallet="toWallet"-->
<!--wallet-selector-show="showToWallets"-->
<!--wallet-selector-on-select="onToWalletSelect"-->
<!--wallet-selector-always-display-bitcoin-core="true">-->
<!--</wallet-selector>-->
<!--</ion-view>-->