Add invoice and bond payout: Scan QR offers a detour where there is no camera
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
Research direction
Read add_lightning_invoice_screen.dart and bond_payout_invoice_screen.dart, then trace how canScanQr() and qrScanUnavailable are used in the NWC wallet and Cashu Receive. Add widget tests for disabled Scan actions on Linux and enabled actions on Android, and run the affected tests. Done when both screens follow that behavior; regenerate the goldens if they change.
Written by the indexing model from the issue text.
Description
What happens
On web, Linux, Windows and macOS the app has no camera scanner: since #657, PlatformAwareQrScanner shows a paste form there (qrInputFor), and canScanQr() is false.
Two screens still offer Scan QR as if it worked:
- Add Lightning invoice (
lib/features/order/screens/add_lightning_invoice_screen.dart): the field's Scan action (InvoiceInputField,AutomationIds.invoiceScan). - Bond payout claim (
lib/features/order/screens/bond_payout_invoice_screen.dart): the Scan icon next to Paste (InvoiceIconAction).
On those platforms, tapping it opens a page titled "Scan QR Code" that is a second paste field with Submit, over a screen that already has a field and a Paste button. It works (before #657 it was a blank page), but it is a detour with nothing to scan.
The NWC wallet and Cashu Receive already handle this (#657): Scan QR stays visible, disabled, with the tooltip "Not available on this device" (qrScanUnavailable).
Proposal
Apply the same rule to both screens:
- Where
canScanQr()is false, the Scan action is disabled and shows theqrScanUnavailabletooltip (hover, long press, screen readers). Where it is true, nothing changes. - Add invoice:
_FieldAction.onPressedis non-nullable today, andInvoiceInputField.onScanis required. Make them nullable, so that null draws the disabled state in the palette's faint ink with the tooltip.AutomationIds.invoiceScanstays on the action. - Bond payout:
InvoiceIconAction.onPressedis already nullable, so pass null and switch the tooltip toqrScanUnavailable. - No new l10n key:
qrScanUnavailableexists in all six locales.
Tests
- Widget tests on both screens: on Linux, the Scan action is disabled with the reason; on Android it is enabled.
- The add-invoice and bond goldens may change (disabled ink), regenerated in CI.
Out of scope
- Enabling the camera on macOS (entitlement and
NSCameraUsageDescription). That needs a Mac and is a separate issue.
Follow-up of #657 (noted in specs/004-mostro-p2p-client/tasks.md, T121).
- Dominant language
- Dart
- Stars
- 11
- Forks
- 9
- Avg merge
- 17h 18m
- Merged PRs (30d)
- 195
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from MostroP2P/app
-
feat(reputation): show the source of an attestation before importing itPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
MostroP2P/app#881 · 1 comment ·
Maintainers usually reply within 1 day
-
area: rust-core bug priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
area: ui
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
fable-compiler/Fable#5157 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bannzai/medicalarm#430 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
fossasia/badgemagic-app#2016 ·
Maintainers usually reply within 1 day
-
area-vm
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
dart-lang/sdk#64727 · 1 comment ·
Maintainers usually reply within 4 days
-
bug P3 ux
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
QueryaHub/Querya-Desktop#1837 ·
Maintainers usually reply within 1 day