mirror of https://github.com/BTCPrivate/copay.git
ui fixed 2 - send max
This commit is contained in:
parent
f39d7a4c21
commit
bb6b681453
|
@ -77,12 +77,12 @@
|
|||
|
||||
<ion-footer *ngIf="fromWallet && toWallet && totalAmountStr">
|
||||
<button ion-button block class="button-footer" (click)="confirmTx()" [disabled]="!fromWallet || !totalAmountStr" translate>
|
||||
{{'Shift ' + (fromWallet.coin | uppercase) + ' to ' + (toWallet.coin | uppercase)}}
|
||||
Click to shift
|
||||
</button>
|
||||
</ion-footer>
|
||||
|
||||
<ion-footer *ngIf="sendStatus === 'success'">
|
||||
<button ion-button block class="button-footer" (click)="goBackHome()" [disabled]="!(wallet && totalAmountStr)" translate>
|
||||
Transaction sent
|
||||
Transaction Sent
|
||||
</button>
|
||||
</ion-footer>
|
|
@ -35,6 +35,7 @@ export class ShapeshiftConfirmPage {
|
|||
private configWallet: any;
|
||||
private bitcore: any;
|
||||
private bitcoreCash: any;
|
||||
private useSendMax: boolean;
|
||||
|
||||
public currencyIsoCode: string;
|
||||
public isCordova: boolean;
|
||||
|
@ -72,11 +73,13 @@ export class ShapeshiftConfirmPage {
|
|||
private walletProvider: WalletProvider
|
||||
) {
|
||||
this.configWallet = this.configProvider.get().wallet;
|
||||
this.currencyIsoCode = this.configWallet.settings.alternativeIsoCode;
|
||||
this.currencyIsoCode = 'USD'; // Only USD
|
||||
this.isCordova = this.platformProvider.isCordova;
|
||||
this.bitcore = this.bwcProvider.getBitcore();
|
||||
this.bitcoreCash = this.bwcProvider.getBitcoreCash();
|
||||
|
||||
this.useSendMax = this.navParams.data.useSendMax ? true : false;
|
||||
|
||||
this.amount = this.navParams.data.amount / 1e8;
|
||||
this.currency = this.navParams.data.currency;
|
||||
this.fromWalletId = this.navParams.data.walletId;
|
||||
|
@ -94,6 +97,9 @@ export class ShapeshiftConfirmPage {
|
|||
this.shapeshiftProvider.getLimit(this.getCoinPair(), (err: any, lim: any) => {
|
||||
let min = Number(lim.min);
|
||||
let max = Number(lim.limit);
|
||||
|
||||
if (this.useSendMax) this.amount = max;
|
||||
|
||||
let amountNumber = Number(this.amount);
|
||||
|
||||
if (amountNumber < min) {
|
||||
|
|
|
@ -27,7 +27,7 @@ export class ShapeshiftShiftPage {
|
|||
public fromWallet: any;
|
||||
public toWallet: any;
|
||||
public rate: number;
|
||||
public limit: number;
|
||||
public limit: any;
|
||||
public network: string;
|
||||
public fromWalletSelectorTitle: string;
|
||||
public toWalletSelectorTitle: string;
|
||||
|
@ -94,7 +94,7 @@ export class ShapeshiftShiftPage {
|
|||
this.shapeshiftProvider.getRate(pair, (err: any, rate: number) => {
|
||||
this.rate = rate;
|
||||
});
|
||||
this.shapeshiftProvider.getLimit(pair, (err: any, limit: number) => {
|
||||
this.shapeshiftProvider.getLimit(pair, (err: any, limit: any) => {
|
||||
this.limit = limit;
|
||||
});
|
||||
}
|
||||
|
@ -115,7 +115,9 @@ export class ShapeshiftShiftPage {
|
|||
coin: this.fromWallet.coin,
|
||||
walletId: this.fromWallet.id,
|
||||
toWalletId: this.toWallet.id,
|
||||
currency: this.fromWallet.coin.toUpperCase()
|
||||
currency: this.fromWallet.coin.toUpperCase(),
|
||||
shiftMax: this.limit.limit + ' ' + this.fromWallet.coin.toUpperCase(),
|
||||
shiftMin: this.limit.min + ' ' + this.fromWallet.coin.toUpperCase()
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<ion-header>
|
||||
<ion-navbar transparent>
|
||||
<ion-title>shapeshift</ion-title>
|
||||
<ion-title>shapeShift</ion-title>
|
||||
</ion-navbar>
|
||||
</ion-header>
|
||||
|
||||
|
|
|
@ -44,6 +44,11 @@
|
|||
<span translate>Amount</span>
|
||||
</div>
|
||||
|
||||
<div *ngIf="shiftMin && shiftMax">
|
||||
<div>Min: {{shiftMin}}</div>
|
||||
<div>Max: {{shiftMax}}</div>
|
||||
</div>
|
||||
|
||||
<div class="amount-content">
|
||||
<div class="expression">{{expression || '0.00'}}
|
||||
<a class="unit-button" (click)="updateUnit()">{{unit}}</a>
|
||||
|
|
|
@ -34,6 +34,9 @@ export class AmountPage {
|
|||
public expression: any;
|
||||
public amount: any;
|
||||
public showExpressionResult: boolean;
|
||||
public shiftMax: number;
|
||||
public shiftMin: number;
|
||||
public showSendMax: boolean;
|
||||
|
||||
public allowSend: boolean;
|
||||
public recipientType: string;
|
||||
|
@ -60,6 +63,7 @@ export class AmountPage {
|
|||
private configProvider: ConfigProvider,
|
||||
private rateProvider: RateProvider,
|
||||
) {
|
||||
this.showSendMax = false;
|
||||
this.config = this.configProvider.get();
|
||||
this.recipientType = this.navParams.data.recipientType;
|
||||
this.showRecipient = true;
|
||||
|
@ -84,6 +88,8 @@ export class AmountPage {
|
|||
|
||||
// Use only with ShapeShift
|
||||
this.toWalletId = this.navParams.data.toWalletId;
|
||||
this.shiftMax = this.navParams.data.shiftMax;
|
||||
this.shiftMin = this.navParams.data.shiftMin;
|
||||
|
||||
let unit = this.navParams.data.currency ? this.navParams.data.currency : this.config.wallet.settings.alternativeIsoCode;
|
||||
this.availableUnits.push(this.coin.toUpperCase());
|
||||
|
@ -142,10 +148,12 @@ export class AmountPage {
|
|||
nextPage = BuyMercadoLibrePage;
|
||||
break;
|
||||
case 'ShapeshiftConfirmPage':
|
||||
this.showSendMax = true;
|
||||
this.showRecipient = false;
|
||||
nextPage = ShapeshiftConfirmPage;
|
||||
break;
|
||||
default:
|
||||
this.showSendMax = true;
|
||||
nextPage = ConfirmPage;
|
||||
}
|
||||
return nextPage;
|
||||
|
|
Loading…
Reference in New Issue