Implement changes for #6

This commit is contained in:
Rene Vergara 2022-05-26 08:54:39 -05:00
parent e9682c1871
commit bd37b370c8
Signed by: pitmutt
GPG Key ID: 65122AD495A7F5B2
2 changed files with 43 additions and 1 deletions

View File

@ -23,5 +23,10 @@
</td>
</tr>
</table>
<p class="small text">Can't scan? Use this <a [href]="zcashUrl">wallet link</a>.
</mat-dialog-actions>
<div align="center">
<p class="small text">Can't scan? Use this <a [href]="zcashUrl">wallet link</a>, or</p>
<button class="small text" (click)="copyAddress()">Copy Address</button>
<button class="small text" (click)="copyAmount()">Copy Amount</button>
<button class="small text" (click)="copyMemo()">Copy Memo</button>
</div>

View File

@ -53,4 +53,41 @@ export class ScanComponent implements OnInit{
close() {
this.dialogRef.close(false);
}
copyAddress() {
if (!navigator.clipboard) {
alert("Copy functionality not supported");
}
try {
navigator.clipboard.writeText(this.address);
} catch (err) {
console.error("Error", err);
}
}
copyAmount() {
if (!navigator.clipboard) {
alert("Copy functionality not supported");
}
try {
navigator.clipboard.writeText(this.total.toString());
} catch (err) {
console.error("Error", err);
}
}
copyMemo() {
if (!navigator.clipboard) {
alert("Copy functionality not supported");
}
try {
if (this.pay) {
navigator.clipboard.writeText("ZGOp::" + this.session);
} else {
navigator.clipboard.writeText("ZGO::" + this.session + " Reply-To:<your z-addr>");
}
} catch (err) {
console.error("Error", err);
}
}
}