Skip to content

Commit 91ef804

Browse files
committed
feat(dev): debug UR codes
1 parent a6494a0 commit 91ef804

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

lib/src/screens/ur/animated_ur_page.dart

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ import 'package:cake_wallet/src/screens/base_page.dart';
77
import 'package:cake_wallet/src/screens/receive/widgets/qr_image.dart';
88
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
99
import 'package:cake_wallet/src/widgets/primary_button.dart';
10+
import 'package:cake_wallet/utils/clipboard_util.dart';
11+
import 'package:cake_wallet/utils/feature_flag.dart';
1012
import 'package:cake_wallet/utils/show_pop_up.dart';
1113
import 'package:cake_wallet/view_model/animated_ur_model.dart';
1214
import 'package:flutter/material.dart';
15+
import 'package:flutter/services.dart';
1316

1417
// ur:xmr-txunsigned - unsigned transaction
1518
// should show a scanner afterwards.
@@ -46,8 +49,8 @@ class AnimatedURPage extends BasePage {
4649
frames: urQr.trim().split("\n"),
4750
),
4851
),
52+
if (urQrType == "ur:xmr-txunsigned" || urQrType == "ur:xmr-output") ...{
4953
SizedBox(height: 32),
50-
if (urQrType == "ur:xmr-txunsigned" || urQrType == "ur:xmr-output")
5154
Padding(
5255
padding: const EdgeInsets.symmetric(horizontal: 16.0),
5356
child: SizedBox(
@@ -60,8 +63,10 @@ class AnimatedURPage extends BasePage {
6063
),
6164
),
6265
),
63-
SizedBox(height: 32),
64-
if (urQrType == "ur:xmr-output" && !isAll) Padding(
66+
},
67+
if (urQrType == "ur:xmr-output" && !isAll) ...{
68+
SizedBox(height: 32),
69+
Padding(
6570
padding: const EdgeInsets.symmetric(horizontal: 16.0),
6671
child: SizedBox(
6772
width: double.maxFinite,
@@ -73,6 +78,7 @@ class AnimatedURPage extends BasePage {
7378
),
7479
),
7580
),
81+
},
7682
],
7783
);
7884
}
@@ -168,10 +174,21 @@ class _URQRState extends State<URQR> {
168174
children: [
169175
Center(
170176
child: QrImage(
171-
data: widget.frames[frame % widget.frames.length], version: -1,
177+
data: widget.frames[frame % widget.frames.length],
178+
version: -1,
172179
size: 400,
173180
),
174181
),
182+
if (FeatureFlag.hasDevOptions) ...{
183+
TextButton(
184+
onPressed: () {
185+
Clipboard.setData(ClipboardData(text: """Current frame (${frame % widget.frames.length}): ${widget.frames[frame % widget.frames.length]},
186+
All frames:
187+
- ${widget.frames.join("\n - ")}"""));
188+
},
189+
child: Text(widget.frames[frame % widget.frames.length]),
190+
),
191+
}
175192
],
176193
);
177194
}

0 commit comments

Comments
 (0)