Repository navigation
Commit 0a86880
committed
fix(scanner): fall back to any camera when there is no back camera
The scanner required LENS_FACING_BACK. An Infinix X688B exposes one camera
to CameraX and reports it as front facing, so every bind threw
IllegalArgumentException("No available camera can be found"), was retried
three times a second apart, and left a blank preview (Bugsnag
6aca4823396a2e952015e21d, 9 events on 2026.10.2).
Prefer the back camera and otherwise bind the first camera the device
exposes. Stop retrying IllegalArgumentException, which doesn't change
between attempts. A device with no camera now fails with
NoCamerasAvailableException, which shows the unavailable state and is no
longer reported as an error.1 parent 141e59c commit 0a86880
4 files changed
Lines changed: 90 additions & 13 deletions
File tree
- apps/flipcash/features/scanner/src/main/kotlin/com/flipcash/app/scanner/internal
- ui/scanner
- src
- main/kotlin/com/getcode/ui/scanner
- test/kotlin/com/getcode/ui/scanner
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| 290 | + | |
| 291 | + | |
290 | 292 | | |
291 | 293 | | |
| 294 | + | |
| 295 | + | |
292 | 296 | | |
293 | | - | |
294 | 297 | | |
295 | 298 | | |
296 | 299 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
33 | 36 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | 92 | | |
100 | 93 | | |
101 | 94 | | |
| |||
150 | 143 | | |
151 | 144 | | |
152 | 145 | | |
153 | | - | |
154 | 146 | | |
155 | 147 | | |
156 | 148 | | |
| |||
187 | 179 | | |
188 | 180 | | |
189 | 181 | | |
190 | | - | |
191 | 182 | | |
192 | 183 | | |
193 | 184 | | |
| |||
289 | 280 | | |
290 | 281 | | |
291 | 282 | | |
292 | | - | |
293 | 283 | | |
294 | 284 | | |
295 | 285 | | |
296 | 286 | | |
297 | 287 | | |
298 | 288 | | |
299 | | - | |
| 289 | + | |
300 | 290 | | |
301 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
302 | 299 | | |
303 | 300 | | |
304 | 301 | | |
| |||
319 | 316 | | |
320 | 317 | | |
321 | 318 | | |
322 | | - | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
329 | 338 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
0 commit comments