-
Notifications
You must be signed in to change notification settings - Fork 121
[Woo POS][Barcodes] Frame the QR code and increase brightness for better scanability #15934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Woo POS][Barcodes] Frame the QR code and increase brightness for better scanability #15934
Conversation
Introduces POSBrightnessControl.swift, a utility class and SwiftUI view modifier to manage and restore screen brightness for POS workflows.
Added .maximumScreenBrightness() modifier to the PointOfSaleBarcodeScannerSetup view to ensure optimal visibility when setting up the barcode scanner.
…n dark mode Added medium padding and rounded corners to the barcode image for improved UI. Increased the maximum barcode size from 142 to 168 for better visibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the barcode scanner setup experience in dark mode by implementing automatic brightness control and improving QR code visibility. The changes focus on making barcode scanning more reliable in low-light conditions.
Key changes:
- Adds automatic brightness control that increases screen brightness to maximum during barcode scanner setup
- Frames QR codes and barcodes with white backgrounds and rounded corners for better contrast
- Increases the maximum barcode size for improved visibility
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| WooCommerce.xcodeproj/project.pbxproj | Adds the new POSBrightnessControl.swift file to the project build configuration |
| POSBrightnessControl.swift | Implements brightness control functionality with automatic restoration and SwiftUI view modifier |
| PointOfSaleBarcodeScannerSetupStepViews.swift | Adds white background padding and rounded corners to barcode displays, increases maximum size |
| PointOfSaleBarcodeScannerSetup.swift | Applies the brightness control modifier to the scanner setup view |
| private var isBrightnessIncreased: Bool = false | ||
|
|
||
| init() { | ||
| originalBrightness = UIScreen.main.brightness |
Copilot
AI
Jul 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UIScreen.main.brightness should be accessed on the main thread. Consider wrapping this in DispatchQueue.main.async or using @mainactor to ensure thread safety.
| guard !isBrightnessIncreased else { return } | ||
|
|
||
| originalBrightness = UIScreen.main.brightness | ||
| UIScreen.main.brightness = 1.0 |
Copilot
AI
Jul 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UIScreen.main.brightness modification should be performed on the main thread. Consider wrapping this in DispatchQueue.main.async or using @mainactor to ensure thread safety.
| UIScreen.main.brightness = 1.0 | ||
| isBrightnessIncreased = true | ||
| } | ||
|
|
||
| func restoreOriginalBrightness() { | ||
| guard isBrightnessIncreased else { return } | ||
|
|
||
| UIScreen.main.brightness = originalBrightness | ||
| isBrightnessIncreased = false | ||
| } | ||
|
|
||
| deinit { | ||
| if isBrightnessIncreased { | ||
| UIScreen.main.brightness = originalBrightness |
Copilot
AI
Jul 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UIScreen.main.brightness modification should be performed on the main thread. Consider wrapping this in DispatchQueue.main.async or using @mainactor to ensure thread safety.
| UIScreen.main.brightness = 1.0 | |
| isBrightnessIncreased = true | |
| } | |
| func restoreOriginalBrightness() { | |
| guard isBrightnessIncreased else { return } | |
| UIScreen.main.brightness = originalBrightness | |
| isBrightnessIncreased = false | |
| } | |
| deinit { | |
| if isBrightnessIncreased { | |
| UIScreen.main.brightness = originalBrightness | |
| DispatchQueue.main.async { | |
| UIScreen.main.brightness = 1.0 | |
| } | |
| isBrightnessIncreased = true | |
| } | |
| func restoreOriginalBrightness() { | |
| guard isBrightnessIncreased else { return } | |
| DispatchQueue.main.async { | |
| UIScreen.main.brightness = originalBrightness | |
| } | |
| isBrightnessIncreased = false | |
| } | |
| deinit { | |
| if isBrightnessIncreased { | |
| DispatchQueue.main.async { | |
| UIScreen.main.brightness = originalBrightness | |
| } |
|
|
||
| deinit { | ||
| if isBrightnessIncreased { | ||
| UIScreen.main.brightness = originalBrightness |
Copilot
AI
Jul 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UIScreen.main.brightness modification in deinit should be performed on the main thread. Consider using DispatchQueue.main.async to ensure thread safety during cleanup.
| UIScreen.main.brightness = originalBrightness | |
| DispatchQueue.main.async { | |
| UIScreen.main.brightness = originalBrightness | |
| } |
|
|
jaclync
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works like a charm! 🚀 Tested in iPad Pro 11in 3rd generation, iOS 18.5.

Description
WOOMOB-880
Android woocommerce/woocommerce-android#14357
To facilitate scanning setup in the dark mode:
Steps to reproduce
Tell me your experience scanning these codes in dark mode. Is the experience smooth or does the scanner struggle to get a scan?
Testing information
Tested on iPad Air M2 iOS 26 + Inateck Scanner
Screenshots
ScreenRecording_07-22-2025.11-40-31_1.MP4
RELEASE-NOTES.txtif necessary.