Fix: memo, message and addressbook contacts fixed in txDetails and wallet history

This commit is contained in:
Gabriel Masclef 2018-02-07 15:29:45 -03:00
parent 4b80ed37b1
commit bba58e96d9
No known key found for this signature in database
GPG Key ID: DD6D7EAADE12280D
5 changed files with 95 additions and 63 deletions

View File

@ -325,7 +325,7 @@ export class BuyMercadoLibrePage {
invoice['buyerPaidBtcMinerFee'] = invoice.buyerPaidBtcMinerFee || 0;
let invoiceFeeSat = parseInt((invoice.buyerPaidBtcMinerFee * 100000000).toFixed());
this.message = this.amountUnitStr + " for Mercado Livre Brazil Gift Car"; // TODO: translate
this.message = this.amountUnitStr + " for Mercado Livre Brazil Gift Card"; // TODO: translate
this.createTx(wallet, invoice, this.message).then((ctxp: any) => {
this.onGoingProcessProvider.set('loadingTxInfo', false);

View File

@ -43,8 +43,8 @@
<span class="payment-proposal-to">
<img class="icon-bitcoin" *ngIf="!cardId" src="assets/img/icon-bitcoin-small.svg">
<img class="icon-bitcoin" *ngIf="cardId" src="assets/img/icon-card.svg" width="34">
<div copy-to-clipboard="{{ btx.addressTo }}">
<span class="contact" *ngIf="!toName">{{ btx.addressTo }}"</span>
<div copy-to-clipboard="{{ btx.outputs[0].address }}">
<span class="contact" *ngIf="!toName">{{ btx.outputs[0].address }}"</span>
<span *ngIf="toName">{{ toName }}</span>
</div>
</span>
@ -80,8 +80,9 @@
<button ion-item (click)="showCommentPopup()">
<ion-label>{{'Memo' | translate}}</ion-label>
<ion-note item-end *ngIf="btx.note">
{{btx.note.body || btx.message}}
<ion-note item-end>
<span *ngIf="btx.note && btx.note.body">{{btx.note.body}}</span>
<span *ngIf="(!btx.note || !btx.note.body) && btx.message">{{btx.message}}</span>
</ion-note>
</button>
@ -159,4 +160,4 @@
</ion-list>
</ion-content>
</ion-content>

View File

@ -101,8 +101,8 @@ export class TxDetailsPage {
}
private updateMemo(): void {
this.walletProvider.getTxNote(this.wallet, this.btx.txid).then((note: string) => {
if (!note) return;
this.walletProvider.getTxNote(this.wallet, this.btx.txid).then((note: any) => {
if (!note || note.body == "") return;
this.btx.note = note;
}).catch((err: any) => {
this.logger.warn('Could not fetch transaction note: ' + err);
@ -194,7 +194,7 @@ export class TxDetailsPage {
if (this.btx.note && this.btx.note.body) opts.defaultText = this.btx.note.body;
this.popupProvider.ionicPrompt(this.wallet.name, this.translate.instant('Memo'), opts).then((text: string) => {
if (typeof text == "undefined") return;
if (text == null) return;
this.btx.note = {
body: text

View File

@ -7,64 +7,63 @@
<ion-content no-bounce>
<div class="balance-card" [ngStyle]="{'background': wallet.color}">
<div class="balance-header">
<div (longPress)="toggleBalance()">
<div
(tap)="updateAll(true)"
*ngIf="!updateStatusError && !wallet.balanceHidden && !wallet.scanning && wallet.status">
<div class="balance-str">{{wallet.status.totalBalanceStr}}</div>
<div class="balance-alt-str" *ngIf="wallet.network != 'testnet'">
{{wallet.status.totalBalanceAlternative}} {{wallet.status.alternativeIsoCode}}
</div>
</div>
<div class="balance-hidden" *ngIf="!updateStatusError && wallet.balanceHidden && !wallet.scanning">
<strong translate>[Balance Hidden]</strong>
<div class="amount-alternative" translate>
Tap and hold to show
</div>
<div class="balance-header">
<div (longPress)="toggleBalance()">
<div (tap)="updateAll(true)" *ngIf="!updateStatusError && !wallet.balanceHidden && !wallet.scanning && wallet.status">
<div class="balance-str">{{wallet.status.totalBalanceStr}}</div>
<div class="balance-alt-str" *ngIf="wallet.network != 'testnet'">
{{wallet.status.totalBalanceAlternative}} {{wallet.status.alternativeIsoCode}}
</div>
</div>
<div class="balance-scanning" *ngIf="!updateStatusError && wallet.scanning">
<strong translate>[Scanning Funds]</strong>
</div>
<div class="balance-spendable" *ngIf="!wallet.balanceHidden && !wallet.scanning && showBalanceButton && wallet.status">
<div translate>Spendable</div>
<strong>
{{wallet.status.spendableBalanceStr}}
</strong>
&nbsp;
<span>
({{wallet.status.spendableBalanceAlternative}} {{wallet.status.alternativeIsoCode}})
</span>
</div>
<div class="balance-error" *ngIf="updateStatusError" (tap)="updateAll(true)">
<span>{{updateStatusError}}.</span> <strong>Tap to retry</strong>
</div>
<div class="balance-error" *ngIf="walletNotRegistered" (tap)="recreate()">
<span translate>This wallet is not registered at the given Bitcore Wallet Service (BWS). You can recreate it
from the local information.</span> <strong>Tap to recreate</strong>
<div class="balance-hidden" *ngIf="!updateStatusError && wallet.balanceHidden && !wallet.scanning">
<strong translate>[Balance Hidden]</strong>
<div class="amount-alternative" translate>
Tap and hold to show
</div>
</div>
</div>
<div class="wallet-info" *ngIf="wallet">
<ion-spinner *ngIf="(updatingStatus || updatingTxHistory) && !walletNotRegistered && !updateStatusError && !updateTxHistoryError"></ion-spinner>
<div class="balance-scanning" *ngIf="!updateStatusError && wallet.scanning">
<strong translate>[Scanning Funds]</strong>
</div>
<img class="testnet" *ngIf="wallet.network == 'testnet'" src="assets/img/icon-wallet-testnet.svg">
<img class="testnet-text" *ngIf="wallet.network == 'testnet'" src="assets/img/icon-text-testnet.svg">
<img class="read-only" *ngIf="!wallet.canSign()" src="assets/img/icon-read-only.svg">
<img class="read-only-text" *ngIf="!wallet.canSign()" src="assets/img/icon-text-read-only.svg">
<img class="auditable-text" *ngIf="wallet.status && wallet.status.wallet.singleAddress" src="assets/img/icon-text-auditable.svg">
<img class="custom-bws" *ngIf="wallet.usingCustomBWS" src="assets/img/icon-bws-white.svg">
<span class="wallet-type" *ngIf="wallet.credentials.n > 1">
<span translate>{{wallet.m}}-of-{{wallet.n}}</span>
<div class="balance-spendable" *ngIf="!wallet.balanceHidden && !wallet.scanning && showBalanceButton && wallet.status">
<div translate>Spendable</div>
<strong>
{{wallet.status.spendableBalanceStr}}
</strong>
&nbsp;
<span>
({{wallet.status.spendableBalanceAlternative}} {{wallet.status.alternativeIsoCode}})
</span>
</div>
<div class="balance-error" *ngIf="updateStatusError" (tap)="updateAll(true)">
<span>{{updateStatusError}}.</span>
<strong>Tap to retry</strong>
</div>
<div class="balance-error" *ngIf="walletNotRegistered" (tap)="recreate()">
<span translate>This wallet is not registered at the given Bitcore Wallet Service (BWS). You can recreate it from the local information.</span>
<strong>Tap to recreate</strong>
</div>
</div>
<div class="wallet-info" *ngIf="wallet">
<ion-spinner *ngIf="(updatingStatus || updatingTxHistory) && !walletNotRegistered && !updateStatusError && !updateTxHistoryError"></ion-spinner>
<img class="testnet" *ngIf="wallet.network == 'testnet'" src="assets/img/icon-wallet-testnet.svg">
<img class="testnet-text" *ngIf="wallet.network == 'testnet'" src="assets/img/icon-text-testnet.svg">
<img class="read-only" *ngIf="!wallet.canSign()" src="assets/img/icon-read-only.svg">
<img class="read-only-text" *ngIf="!wallet.canSign()" src="assets/img/icon-text-read-only.svg">
<img class="auditable-text" *ngIf="wallet.status && wallet.status.wallet.singleAddress" src="assets/img/icon-text-auditable.svg">
<img class="custom-bws" *ngIf="wallet.usingCustomBWS" src="assets/img/icon-bws-white.svg">
<span class="wallet-type" *ngIf="wallet.credentials.n > 1">
<span translate>{{wallet.m}}-of-{{wallet.n}}</span>
</span>
</div>
</div>
<div *ngIf="wallet.needsBackup" class="box-notification no-margin warn">
@ -143,12 +142,40 @@
<img src="assets/img/tx-action/icon-moved.svg" *ngIf="tx.action == 'moved'" width="40">
</div>
</ion-icon>
<div class="action" *ngIf="tx.confirmations == 0 && (tx.action == 'sent' || tx.action == 'moved')">{{'Sending' | translate}}</div>
<div class="action" *ngIf="tx.confirmations == 0 && tx.action == 'received'">{{'Receiving' | translate}}</div>
<div class="action" *ngIf="tx.confirmations > 0">{{tx.action}}</div>
<div class="action" *ngIf="tx.confirmations == 0">
<span *ngIf="(tx.action == 'sent' || tx.action == 'moved') && !(addressbook && addressbook[tx.outputs[0].address])">{{'Sending' | translate}}</span>
<span *ngIf="(tx.action == 'sent' || tx.action == 'moved') && (addressbook && addressbook[tx.outputs[0].address])">{{addressbook[tx.outputs[0].address].name || addressbook[tx.outputs[0].address]}}</span>
<span *ngIf="tx.action == 'received'">{{'Receiving' | translate}}</span>
</div>
<div class="action" *ngIf="tx.confirmations > 0 && tx.action == 'received'">
<span *ngIf="(!tx.note || (tx.note && tx.note.body == ''))">{{'Received' | translate}}</span>
<span *ngIf="tx.note && tx.note.body != ''">{{tx.note.body}}</span>
</div>
<div class="action" *ngIf="tx.confirmations > 0 && tx.action == 'sent'">
<span *ngIf="!tx.message && (!tx.note || (tx.note && tx.note.body == '')) && (!addressbook || !addressbook[tx.outputs[0].address])">{{'Sent' | translate}}</span>
<span *ngIf="tx.message">{{tx.message}}</span>
<span *ngIf="!tx.message && tx.note && tx.note.body != ''">{{tx.note.body}}</span>
<span *ngIf="!tx.message && addressbook && addressbook[tx.outputs[0].address]">
{{addressbook[tx.outputs[0].address].name || addressbook[tx.outputs[0].address]}}
</span>
</div>
<div class="action" *ngIf="tx.confirmations > 0 && tx.action == 'moved'">
<span *ngIf="(!tx.note || (tx.note && tx.note.body == ''))">{{'Moved' | translate}}</span>
<span *ngIf="tx.note && tx.note.body != ''">{{tx.note.body}}</span>
</div>
<div class="action" *ngIf="tx.confirmations > 0 && tx.action == 'invalid'">
<span class="assertive" *ngIf="!tx.message && !tx.note">{{'Invalid' | translate}}</span>
</div>
<ion-note item-end>
<div class="amount">
<span [ngClass]="{'received': tx.action == 'received'}">{{tx.amount | satToUnit: wallet.coin}}</span>
<span [ngClass]="{'received': tx.action == 'received'}" *ngIf="tx.action != 'invalid'">{{tx.amount | satToUnit: wallet.coin}}</span>
<span class="double-spend" *ngIf="tx.action == 'invalid'" translate>(possible double spend)</span>
</div>
<div class="date">
<span *ngIf="tx.time && createdWithinPastDay(tx.time * 1000)">{{tx.time * 1000 | amTimeAgo}}</span>
@ -162,4 +189,4 @@
<ion-infinite-scroll (ionInfinite)="loadHistory($event)">
<ion-infinite-scroll-content></ion-infinite-scroll-content>
</ion-infinite-scroll>
</ion-content>
</ion-content>

View File

@ -43,6 +43,10 @@ page-wallet-details {
width: 35px;
}
.action {
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
ion-note {
text-align: end;
@ -121,7 +125,7 @@ page-wallet-details {
.total-locked-amount {
color: color($colors, dark);
}
.total-alt-locked-amount {
.total-alt-locked-amount, .double-spend {
font-size: 12.5px;
}
}