View Issue Details

IDProjectCategoryView StatusLast Update
0012333Talerwallet (iOS App)public2026-11-25 17:55
Reporterbot-cg [agent]  
PrioritynormalSeverityminor 
Status new 
Summary0012333: Scan QR code: a scanner failure is shown as "Unknown error -- The operation couldn't be completed. (CodeScanner.ScanError error 2.)"; a refused camera gets the same treatment (patch attached)
DescriptionWhen the QR scanner reports a failure, the wallet shows

    Unknown error
    The operation couldn’t be completed. (CodeScanner.ScanError error 2.)

with an OK button. Nothing in that tells the user what happened or what
to do.

How to see it (GNU Taler 1.6.19, master 16f6f629, iPhone 17 simulator,
iOS 27.2)
----------------------------------------------------------------------
1. Actions > Scan QR code.
2. In the simulator the scanner library offers "Select a custom image"
   in place of the camera. Choose any photo that has no QR code in it.
3. The sheet above comes up (picture attached,
   scanner-failure-before-after.jpg, left). Its OK closes the scanner
   as well.

Found by an automated walk on Taler Nightly (Polish locale, where the
text reads "Nieznany błąd / Nie można ukończyć tej operacji. (Błąd
CodeScanner.ScanError 2.)"), then repeated as a fixed scenario on the
regular build.

Why this matters on a phone
---------------------------
The picture chooser exists only in the simulator, but the code that
produces the message does not depend on it. TalerWallet1/Views/Sheets/
QRSheet.swift:71-75:

    case .failure(let error):
        // TODO: errorAlert
        scannedSomething = false
        model.setError(error)

The scanner library (twostraws/CodeScanner, as resolved by the project:
commit cb7a063) has four failures:

    public enum ScanError: Error {
        case badInput // the camera could not be accessed
        case badOutput // the camera could not scan the requested codes
        case initError(_ error: Error)
        case permissionDenied // the camera permission is denied
    }

ScanError has no description of its own, so model.setError() ends in the
`default:` branch of ErrorView.init(error:) (ErrorView.swift:256-257),
which shows "Unknown error" with Foundation's generic text and the case
number. The simulator run above is `badOutput` ("error 2").

On a phone the library reports `permissionDenied` when the user has
answered "Don't Allow" to the camera question, and again every time the
scanner is opened afterwards (ScannerViewController.swift:205 for a stored
refusal, :225 for the answer to the question itself). By the code above
that is shown the same way, as "... (CodeScanner.ScanError error 3.)" --
to exactly the user who needs to be told that the camera is switched off
for this app and where to switch it on.

NOT VERIFIED on a device: the simulator build of the library never asks
for the camera, so the permission case could not be produced here; it is
read from the two sources quoted.

Proposed fix (scanner-failure-readable-v16f6f629.diff, against 16f6f629)
----------------------------------------------------------------------
One file, QRSheet.swift: the sheet names the four cases itself and uses
the existing model.setMessage(title, message):

    permissionDenied "No access to the camera" / "To scan a QR code, allow
                      this app to use the camera in the Settings app. You
                      can also paste a payment link instead."
    badInput "Camera not available" / "The camera of this device
                      could not be used to scan a QR code."
    badOutput "No QR code found" / "No QR code could be read.
                      Please try again."
    initError(e) model.setError(e), i.e. the underlying error as before

The wording is a suggestion (eight new strings to translate). Built and
run in the simulator: the same steps then show "No QR code found / No QR
code could be read. Please try again." (picture, right). A button that opens the app's page in Settings
(UIApplication.openSettingsURLString) would be the next step for the
permission case; the patch does not add one.
TagsNo tags attached.
Attached Files
scanner-failure-readable-v16f6f629.diff (2,088 bytes)   
diff --git a/TalerWallet1/Views/Sheets/QRSheet.swift b/TalerWallet1/Views/Sheets/QRSheet.swift
index 956ecbf0..391ce795 100644
--- a/TalerWallet1/Views/Sheets/QRSheet.swift
+++ b/TalerWallet1/Views/Sheets/QRSheet.swift
@@ -69,9 +69,22 @@ struct QRSheet: View {
                             scannedCode = result.string
                             closingAnnouncement = String(localized: "QR code recognized", comment: "a11y")
                         case .failure(let error):
-                            // TODO: errorAlert
                             scannedSomething = false
-                            model.setError(error)
+                            // ScanError has no description of its own: shown as it is, the user reads
+                            // "The operation couldn’t be completed. (CodeScanner.ScanError error 3.)"
+                            switch error {
+                                case .permissionDenied:
+                                    model.setMessage(String(localized: "No access to the camera"),
+                                                     String(localized: "To scan a QR code, allow this app to use the camera in the Settings app. You can also paste a payment link instead."))
+                                case .badInput:
+                                    model.setMessage(String(localized: "Camera not available"),
+                                                     String(localized: "The camera of this device could not be used to scan a QR code."))
+                                case .badOutput:
+                                    model.setMessage(String(localized: "No QR code found"),
+                                                     String(localized: "No QR code could be read. Please try again."))
+                                case .initError(let initError):
+                                    model.setError(initError)
+                            }
                             closingAnnouncement = errorAnnouncement
                     }
                         announce(closingAnnouncement)

Required notifications

Address or linkRemarkAdded byNotifiedActions

Activities

Issue History

Date ModifiedUsernameFieldChange
2026-11-25 17:55bot-cgNew Issue
2026-11-25 17:55bot-cgImplementer => MarcS
2026-11-25 17:55bot-cgReviewer => vlada.svirsh
2026-11-25 17:55bot-cgRelease signed by => MarcS
2026-11-25 17:55bot-cgDeployed by => MarcS
2026-11-25 17:55bot-cgVerifier => MarcS
2026-11-25 17:55bot-cgCommunicator => CM_7
2026-11-25 17:55bot-cgFile Added: scanner-failure-readable-v16f6f629.diff
2026-11-25 17:55bot-cgFile Added: scanner-failure-before-after.jpg