From cb8e31e9611df96d65c0dcc4f457a2ad734790ce Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Wed, 6 Jul 2022 10:15:20 +0600 Subject: [PATCH] move wallet address QR code to deposit page --- .../wallets/transfer/transfer.module.ts | 3 +- .../wallets/transfer/transfer.page.html | 277 ++++++++++-------- .../wallets/transfer/transfer.page.scss | 18 ++ .../wallets/transfer/transfer.page.ts | 15 +- src/app/features/wallets/wallets.page.html | 16 - 5 files changed, 196 insertions(+), 133 deletions(-) diff --git a/src/app/features/wallets/transfer/transfer.module.ts b/src/app/features/wallets/transfer/transfer.module.ts index 04f64b327..fba808bf1 100644 --- a/src/app/features/wallets/transfer/transfer.module.ts +++ b/src/app/features/wallets/transfer/transfer.module.ts @@ -1,4 +1,5 @@ import { NgModule } from '@angular/core'; +import { NgxQRCodeModule } from '@techiediaries/ngx-qrcode'; import { SharedModule } from '../../../shared/shared.module'; import { TransferLoadingComponent } from './transfer-loading/transfer-loading.component'; import { TransferRequestSentComponent } from './transfer-request-sent/transfer-request-sent.component'; @@ -6,7 +7,7 @@ import { TransferPageRoutingModule } from './transfer-routing.module'; import { TransferPage } from './transfer.page'; @NgModule({ - imports: [SharedModule, TransferPageRoutingModule], + imports: [SharedModule, TransferPageRoutingModule, NgxQRCodeModule], declarations: [ TransferPage, TransferLoadingComponent, diff --git a/src/app/features/wallets/transfer/transfer.page.html b/src/app/features/wallets/transfer/transfer.page.html index ddaf9a7d5..3d4c80fc8 100644 --- a/src/app/features/wallets/transfer/transfer.page.html +++ b/src/app/features/wallets/transfer/transfer.page.html @@ -6,119 +6,166 @@ - - - - - - - -
{{ t('wallets.inAppTransfer') }}
-

{{ t('wallets.moveNumBetweenAssetWallet') }}

-

{{ t('wallets.andIntegrityWallet') }}

-
- - - -
- - -

- {{ - mode === 'withdraw' - ? t('wallets.assetWallet') - : t('wallets.integrityWallet') - }} -

-
- -
BEP20
-
- {{ - (mode === 'withdraw' - ? assetWalletBscNumBalance$ - : integrityWalletBscNumBalance$ - ) - | ngrxPush - | currency - }} -
-
-
- - -
-
- - -

- {{ - mode === 'withdraw' - ? t('wallets.integrityWallet') - : t('wallets.assetWallet') - }} -

-
- -
BEP20
-
- {{ - (mode === 'withdraw' - ? integrityWalletBscNumBalance$ - : assetWalletBscNumBalance$ - ) - | ngrxPush - | currency - }} -
-
-
- - - -
-
- - - - - - - -
- {{ t('wallets.gasFee') }}: - {{ gasFee > 0 ? (gasFee | number: '1.2-2') : t('wallets.pending') }} -
-

- {{ t('wallets.total') }} {{ totalCost$ | ngrxPush | currency }} -

-
- - {{ t('wallets.calculateGasFee') }} - {{ t('wallets.' + mode) }} - -
-
-
+
+
+
+ {{ t('wallets.myAssetWalletQRCode') }} +
+ {{ t('wallets.myAssetWalletQRCodeInfo') }} +
+
+ + +
+ + + + +
+ {{ t('wallets.myAssetWallet') }} + +
+
{{ assetWalletAddr$ | ngrxPush }}
+ +
+
+
+ +
+ + + + + + + +
{{ t('wallets.inAppTransfer') }}
+

{{ t('wallets.moveNumBetweenAssetWallet') }}

+

{{ t('wallets.andIntegrityWallet') }}

+
+ + + +
+ + +

+ {{ + mode === 'withdraw' + ? t('wallets.assetWallet') + : t('wallets.integrityWallet') + }} +

+
+ +
BEP20
+
+ {{ + (mode === 'withdraw' + ? assetWalletBscNumBalance$ + : integrityWalletBscNumBalance$ + ) + | ngrxPush + | currency + }} +
+
+
+ + +
+
+ + +

+ {{ + mode === 'withdraw' + ? t('wallets.integrityWallet') + : t('wallets.assetWallet') + }} +

+
+ +
BEP20
+
+ {{ + (mode === 'withdraw' + ? integrityWalletBscNumBalance$ + : assetWalletBscNumBalance$ + ) + | ngrxPush + | currency + }} +
+
+
+ + + +
+
+ + + + + + + +
+ {{ t('wallets.gasFee') }}: + {{ + gasFee > 0 ? (gasFee | number: '1.2-2') : t('wallets.pending') + }} +
+

+ {{ t('wallets.total') }} {{ totalCost$ | ngrxPush | currency }} +

+
+ + {{ t('wallets.calculateGasFee') }} + {{ t('wallets.' + mode) }} + +
+
+
+
diff --git a/src/app/features/wallets/transfer/transfer.page.scss b/src/app/features/wallets/transfer/transfer.page.scss index 79fa13796..bec8d93aa 100644 --- a/src/app/features/wallets/transfer/transfer.page.scss +++ b/src/app/features/wallets/transfer/transfer.page.scss @@ -175,3 +175,21 @@ ion-card { border-radius: 5px; } } + +.asset-wallet-qr-code-container { + max-width: 300px; + margin: 0 auto; + display: flex; + flex-direction: column; + align-items: center; +} + +.qr-code-info { + text-align: center; + opacity: 0.6; + font-size: 12px; +} + +.vertical-pacing-12 { + height: 12px; +} diff --git a/src/app/features/wallets/transfer/transfer.page.ts b/src/app/features/wallets/transfer/transfer.page.ts index b0bf57079..b556d3f00 100644 --- a/src/app/features/wallets/transfer/transfer.page.ts +++ b/src/app/features/wallets/transfer/transfer.page.ts @@ -1,10 +1,13 @@ import { HttpErrorResponse } from '@angular/common/http'; import { Component } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; +import { MatSnackBar } from '@angular/material/snack-bar'; import { ActivatedRoute } from '@angular/router'; +import { Clipboard } from '@capacitor/clipboard'; import { NavController, Platform } from '@ionic/angular'; import { TranslocoService } from '@ngneat/transloco'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; +import { NgxQrcodeElementTypes } from '@techiediaries/ngx-qrcode'; import { BehaviorSubject, merge, ObservableInput } from 'rxjs'; import { catchError, finalize, mapTo, startWith, tap } from 'rxjs/operators'; import { BlockingActionService } from '../../../shared/blocking-action/blocking-action.service'; @@ -22,7 +25,9 @@ import { TransferRequestSentComponent } from './transfer-request-sent/transfer-r }) export class TransferPage { mode = ''; + elementType = NgxQrcodeElementTypes.URL; + readonly assetWalletAddr$ = this.diaBackendWalletService.assetWalletAddr$; readonly assetWalletBscNumBalance$ = this.diaBackendWalletService.assetWalletBscNumBalance$; readonly integrityWalletBscNumBalance$ = @@ -53,7 +58,8 @@ export class TransferPage { private readonly navCtrl: NavController, private readonly errorService: ErrorService, private readonly translocoService: TranslocoService, - private readonly platform: Platform + private readonly platform: Platform, + private readonly snackBar: MatSnackBar ) { this.activeRoute.paramMap.subscribe(paramMap => { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion @@ -188,4 +194,11 @@ export class TransferPage { .toPromise() .then(() => this.navCtrl.navigateBack('/wallets')); } + + async copyToClipboard(value: string) { + await Clipboard.write({ string: value }); + this.snackBar.open( + this.translocoService.translate('message.copiedToClipboard') + ); + } } diff --git a/src/app/features/wallets/wallets.page.html b/src/app/features/wallets/wallets.page.html index 78d3ee073..822d520dd 100644 --- a/src/app/features/wallets/wallets.page.html +++ b/src/app/features/wallets/wallets.page.html @@ -76,22 +76,6 @@

NUM

-
- {{ t('wallets.myAssetWalletQRCode') }} -
- {{ t('wallets.myAssetWalletQRCodeInfo') }} -
-
- - -
-