ui fixed 2 - send max

This commit is contained in:
Gabriel Masclef 2017-12-29 17:47:09 -03:00
parent f39d7a4c21
commit bb6b681453
No known key found for this signature in database
GPG Key ID: DD6D7EAADE12280D
6 changed files with 28 additions and 7 deletions

View File

@ -77,12 +77,12 @@
<ion-footer *ngIf="fromWallet && toWallet && totalAmountStr"> <ion-footer *ngIf="fromWallet && toWallet && totalAmountStr">
<button ion-button block class="button-footer" (click)="confirmTx()" [disabled]="!fromWallet || !totalAmountStr" translate> <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> </button>
</ion-footer> </ion-footer>
<ion-footer *ngIf="sendStatus === 'success'"> <ion-footer *ngIf="sendStatus === 'success'">
<button ion-button block class="button-footer" (click)="goBackHome()" [disabled]="!(wallet && totalAmountStr)" translate> <button ion-button block class="button-footer" (click)="goBackHome()" [disabled]="!(wallet && totalAmountStr)" translate>
Transaction sent Transaction Sent
</button> </button>
</ion-footer> </ion-footer>

View File

@ -35,6 +35,7 @@ export class ShapeshiftConfirmPage {
private configWallet: any; private configWallet: any;
private bitcore: any; private bitcore: any;
private bitcoreCash: any; private bitcoreCash: any;
private useSendMax: boolean;
public currencyIsoCode: string; public currencyIsoCode: string;
public isCordova: boolean; public isCordova: boolean;
@ -72,11 +73,13 @@ export class ShapeshiftConfirmPage {
private walletProvider: WalletProvider private walletProvider: WalletProvider
) { ) {
this.configWallet = this.configProvider.get().wallet; this.configWallet = this.configProvider.get().wallet;
this.currencyIsoCode = this.configWallet.settings.alternativeIsoCode; this.currencyIsoCode = 'USD'; // Only USD
this.isCordova = this.platformProvider.isCordova; this.isCordova = this.platformProvider.isCordova;
this.bitcore = this.bwcProvider.getBitcore(); this.bitcore = this.bwcProvider.getBitcore();
this.bitcoreCash = this.bwcProvider.getBitcoreCash(); this.bitcoreCash = this.bwcProvider.getBitcoreCash();
this.useSendMax = this.navParams.data.useSendMax ? true : false;
this.amount = this.navParams.data.amount / 1e8; this.amount = this.navParams.data.amount / 1e8;
this.currency = this.navParams.data.currency; this.currency = this.navParams.data.currency;
this.fromWalletId = this.navParams.data.walletId; this.fromWalletId = this.navParams.data.walletId;
@ -94,6 +97,9 @@ export class ShapeshiftConfirmPage {
this.shapeshiftProvider.getLimit(this.getCoinPair(), (err: any, lim: any) => { this.shapeshiftProvider.getLimit(this.getCoinPair(), (err: any, lim: any) => {
let min = Number(lim.min); let min = Number(lim.min);
let max = Number(lim.limit); let max = Number(lim.limit);
if (this.useSendMax) this.amount = max;
let amountNumber = Number(this.amount); let amountNumber = Number(this.amount);
if (amountNumber < min) { if (amountNumber < min) {

View File

@ -27,7 +27,7 @@ export class ShapeshiftShiftPage {
public fromWallet: any; public fromWallet: any;
public toWallet: any; public toWallet: any;
public rate: number; public rate: number;
public limit: number; public limit: any;
public network: string; public network: string;
public fromWalletSelectorTitle: string; public fromWalletSelectorTitle: string;
public toWalletSelectorTitle: string; public toWalletSelectorTitle: string;
@ -94,7 +94,7 @@ export class ShapeshiftShiftPage {
this.shapeshiftProvider.getRate(pair, (err: any, rate: number) => { this.shapeshiftProvider.getRate(pair, (err: any, rate: number) => {
this.rate = rate; this.rate = rate;
}); });
this.shapeshiftProvider.getLimit(pair, (err: any, limit: number) => { this.shapeshiftProvider.getLimit(pair, (err: any, limit: any) => {
this.limit = limit; this.limit = limit;
}); });
} }
@ -115,7 +115,9 @@ export class ShapeshiftShiftPage {
coin: this.fromWallet.coin, coin: this.fromWallet.coin,
walletId: this.fromWallet.id, walletId: this.fromWallet.id,
toWalletId: this.toWallet.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()
}); });
} }

View File

@ -1,6 +1,6 @@
<ion-header> <ion-header>
<ion-navbar transparent> <ion-navbar transparent>
<ion-title>shapeshift</ion-title> <ion-title>shapeShift</ion-title>
</ion-navbar> </ion-navbar>
</ion-header> </ion-header>

View File

@ -44,6 +44,11 @@
<span translate>Amount</span> <span translate>Amount</span>
</div> </div>
<div *ngIf="shiftMin && shiftMax">
<div>Min: {{shiftMin}}</div>
<div>Max: {{shiftMax}}</div>
</div>
<div class="amount-content"> <div class="amount-content">
<div class="expression">{{expression || '0.00'}} <div class="expression">{{expression || '0.00'}}
<a class="unit-button" (click)="updateUnit()">{{unit}}</a> <a class="unit-button" (click)="updateUnit()">{{unit}}</a>

View File

@ -34,6 +34,9 @@ export class AmountPage {
public expression: any; public expression: any;
public amount: any; public amount: any;
public showExpressionResult: boolean; public showExpressionResult: boolean;
public shiftMax: number;
public shiftMin: number;
public showSendMax: boolean;
public allowSend: boolean; public allowSend: boolean;
public recipientType: string; public recipientType: string;
@ -60,6 +63,7 @@ export class AmountPage {
private configProvider: ConfigProvider, private configProvider: ConfigProvider,
private rateProvider: RateProvider, private rateProvider: RateProvider,
) { ) {
this.showSendMax = false;
this.config = this.configProvider.get(); this.config = this.configProvider.get();
this.recipientType = this.navParams.data.recipientType; this.recipientType = this.navParams.data.recipientType;
this.showRecipient = true; this.showRecipient = true;
@ -84,6 +88,8 @@ export class AmountPage {
// Use only with ShapeShift // Use only with ShapeShift
this.toWalletId = this.navParams.data.toWalletId; 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; let unit = this.navParams.data.currency ? this.navParams.data.currency : this.config.wallet.settings.alternativeIsoCode;
this.availableUnits.push(this.coin.toUpperCase()); this.availableUnits.push(this.coin.toUpperCase());
@ -142,10 +148,12 @@ export class AmountPage {
nextPage = BuyMercadoLibrePage; nextPage = BuyMercadoLibrePage;
break; break;
case 'ShapeshiftConfirmPage': case 'ShapeshiftConfirmPage':
this.showSendMax = true;
this.showRecipient = false; this.showRecipient = false;
nextPage = ShapeshiftConfirmPage; nextPage = ShapeshiftConfirmPage;
break; break;
default: default:
this.showSendMax = true;
nextPage = ConfirmPage; nextPage = ConfirmPage;
} }
return nextPage; return nextPage;