From a78ef50bd5f72a0ffa9731d8dafd6913ed50dd28 Mon Sep 17 00:00:00 2001 From: keeri Date: Tue, 23 May 2023 14:24:52 +0000 Subject: [PATCH] receive page: add button which allows to copy payment uri nano:...?amount=... --- .../components/receive/receive.component.html | 65 ++++++++++++++----- .../components/receive/receive.component.ts | 23 ++++++- 2 files changed, 68 insertions(+), 20 deletions(-) diff --git a/src/app/components/receive/receive.component.html b/src/app/components/receive/receive.component.html index c56947d..5e21999 100644 --- a/src/app/components/receive/receive.component.html +++ b/src/app/components/receive/receive.component.html @@ -12,6 +12,40 @@ Merchant Mode + + + + + + + +

Receive Nano

@@ -50,6 +84,15 @@
+ +
+
+ +
+
+ +
+
@@ -73,25 +116,11 @@
-
-
- -
- -
+
+ + +
diff --git a/src/app/components/receive/receive.component.ts b/src/app/components/receive/receive.component.ts index 1606cb6..d8f7beb 100644 --- a/src/app/components/receive/receive.component.ts +++ b/src/app/components/receive/receive.component.ts @@ -36,10 +36,12 @@ export class ReceiveComponent implements OnInit, OnDestroy { pendingAccountModel = '0'; pendingBlocks = []; pendingBlocksForSelectedAccount = []; + qrCodeUri = null; qrCodeImage = null; qrAccount = ''; qrAmount: BigNumber = null; recentlyCopiedAccountAddress = false; + recentlyCopiedPaymentUri = false; walletAccount: WalletAccount = null; selAccountInit = false; loadingIncomingTxList = false; @@ -292,7 +294,8 @@ export class ReceiveComponent implements OnInit, OnDestroy { if (account.length > 1) { this.qrAccount = account; this.qrCodeImage = null; - qrCode = await QRCode.toDataURL(`nano:${account}${this.qrAmount ? `?amount=${this.qrAmount.toString(10)}` : ''}`, {scale: 7}); + this.qrCodeUri = `nano:${account}${this.qrAmount ? `?amount=${this.qrAmount.toString(10)}` : ''}`; + qrCode = await QRCode.toDataURL(this.qrCodeUri, {scale: 7}); } this.qrCodeImage = qrCode; } @@ -307,7 +310,8 @@ export class ReceiveComponent implements OnInit, OnDestroy { } if (this.qrAccount.length > 1) { this.qrCodeImage = null; - qrCode = await QRCode.toDataURL(`nano:${this.qrAccount}${this.qrAmount ? `?amount=${this.qrAmount.toString(10)}` : ''}`, {scale: 7}); + this.qrCodeUri = `nano:${this.qrAccount}${this.qrAmount ? `?amount=${this.qrAmount.toString(10)}` : ''}`; + qrCode = await QRCode.toDataURL(this.qrCodeUri, {scale: 7}); this.qrCodeImage = qrCode; } } @@ -381,6 +385,7 @@ export class ReceiveComponent implements OnInit, OnDestroy { clearTimeout(this.timeoutIdClearingRecentlyCopiedState); } this.recentlyCopiedAccountAddress = true; + this.recentlyCopiedPaymentUri = false; this.timeoutIdClearingRecentlyCopiedState = setTimeout( () => { this.recentlyCopiedAccountAddress = false; @@ -389,6 +394,20 @@ export class ReceiveComponent implements OnInit, OnDestroy { ); } + copiedPaymentUri() { + if (this.timeoutIdClearingRecentlyCopiedState != null) { + clearTimeout(this.timeoutIdClearingRecentlyCopiedState); + } + this.recentlyCopiedPaymentUri = true; + this.recentlyCopiedAccountAddress = false; + this.timeoutIdClearingRecentlyCopiedState = setTimeout( + () => { + this.recentlyCopiedPaymentUri = false; + }, + 2000 + ); + } + toBigNumber(value) { return new BigNumber(value); }