Skip to content

Commit

Permalink
Merge pull request #10760 from cmgustavo/bug/coinbase-04
Browse files Browse the repository at this point in the history
fix(coinbase): finish view on iOS. Select crypto as default on amount…
  • Loading branch information
gabrielbazan7 authored Mar 31, 2020
2 parents c5c198f + f1fee49 commit c0bb33c
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export class CoinbaseAccountPage {
}
this.onGoingProcessProvider.clear();
this.navCtrl.push(AmountPage, {
currency: this.nativeCurrency,
alternativeCurrency: this.nativeCurrency,
coin,
walletId: fromWallet.id,
fromWalletDetails: true,
Expand Down Expand Up @@ -217,7 +217,7 @@ export class CoinbaseAccountPage {
this.navCtrl.push(AmountPage, {
id: this.id,
toWalletId: toWallet.id,
currency: this.nativeCurrency,
alternativeCurrency: this.nativeCurrency,
coin,
nextPage: 'CoinbaseWithdrawPage',
description:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class CoinbaseWithdrawPage {

private accountId: string;

public hideSlideButton: boolean;
public data: object = {};
public amount: string;
public currency: string;
Expand Down Expand Up @@ -53,6 +54,7 @@ export class CoinbaseWithdrawPage {
private walletProvider: WalletProvider
) {
this.isCordova = this.platformProvider.isCordova;
this.hideSlideButton = false;

this.amount = this.navParams.data.amount;
this.currency = this.navParams.data.currency;
Expand All @@ -72,6 +74,16 @@ export class CoinbaseWithdrawPage {

ionViewDidLoad() {
this.logger.info('Loaded: CoinbaseWithdrawPage');
this.navCtrl.swipeBackEnabled = false;
if (this.isCordova) {
window.addEventListener('keyboardWillShow', () => {
this.hideSlideButton = true;
});

window.addEventListener('keyboardWillHide', () => {
this.hideSlideButton = false;
});
}
}

ionViewWillLeave() {
Expand Down Expand Up @@ -154,23 +166,27 @@ export class CoinbaseWithdrawPage {
});
}

private openFinishModal(): void {
let finishText = this.translate.instant('Withdraw success');
let finishComment = this.translate.instant(
public openFinishModal() {
const finishText = this.translate.instant('Withdraw success');
const finishComment = this.translate.instant(
'It could take a while to confirm transaction'
);
let modal = this.modalCtrl.create(
const modal = this.modalCtrl.create(
FinishModalPage,
{ finishText, finishComment },
{ showBackdrop: true, enableBackdropDismiss: false }
);
modal.present();
modal.onDidDismiss(_ => {
this.navCtrl.popToRoot().then(_ => {
this.navCtrl.popToRoot({ animate: false }).then(_ => {
this.navCtrl.parent.select(1);
this.navCtrl.push(CoinbaseAccountPage, {
id: this.accountId
});
this.navCtrl.push(
CoinbaseAccountPage,
{
id: this.accountId
},
{ animate: false }
);
});
});
}
Expand Down
7 changes: 6 additions & 1 deletion src/pages/send/amount/amount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export class AmountPage {
public cardConfig: CardConfig;

private fromCoinbase;
private alternativeCurrency;

@ViewChild(Navbar) navBar: Navbar;

Expand Down Expand Up @@ -132,6 +133,7 @@ export class AmountPage {
? this.navParams.data.onlyIntegers
: false;
this.fromCoinbase = this.navParams.data.fromCoinbase;
this.alternativeCurrency = this.navParams.data.alternativeCurrency;

this.showSendMax = false;
this.useSendMax = false;
Expand Down Expand Up @@ -270,7 +272,10 @@ export class AmountPage {
this.altUnitIndex = this.unitIndex;
this.unitIndex = this.availableUnits.length;
} else {
this.fiatCode = this.config.wallet.settings.alternativeIsoCode || 'USD';
this.fiatCode =
this.alternativeCurrency ||
this.config.wallet.settings.alternativeIsoCode ||
'USD';
fiatName = this.config.wallet.settings.alternativeName || this.fiatCode;
this.altUnitIndex = this.availableUnits.length;
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/wallets/wallets.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
<div *ngIf="!coinbaseData.accounts" translate>Loading accounts...</div>
<div *ngFor="let ac of coinbaseData.accounts">
<ion-list no-lines class="bp-list" [hidden]="collapsedAccounts">
<button ion-item (click)="goToCoinbaseAccount(ac.id)">
<button ion-item detail-none (click)="goToCoinbaseAccount(ac.id)">
<coin-icon [coin]="ac.currency.code.toLowerCase()" [network]="livenet" item-left></coin-icon>
<ion-label>
{{ac.name}}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/wallets/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class WalletsPage {
);
this.coinbaseLinked = this.coinbaseProvider.isLinked();
if (this.coinbaseLinked && this.showCoinbase) {
if (force || !this.coinbaseData['accounts']) {
if (force || !this.coinbaseData) {
this.coinbaseProvider.updateExchangeRates();
this.coinbaseProvider.preFetchAllData(this.coinbaseData);
} else this.coinbaseData = this.coinbaseProvider.coinbaseData;
Expand Down
1 change: 1 addition & 0 deletions src/providers/coinbase/coinbase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,7 @@ export class CoinbaseProvider {
this.coinbaseData['token']['access_token'],
this.coinbaseData['token']['refresh_token']
);
this.updateExchangeRates();
}

this.homeIntegrationsProvider.register({
Expand Down

0 comments on commit c0bb33c

Please sign in to comment.