Skip to content

Conversation

@staskus
Copy link
Contributor

@staskus staskus commented Jul 22, 2025

Description

WOOMOB-880
Android woocommerce/woocommerce-android#14357

To facilitate scanning setup in the dark mode:

  • Frame QR code in a white clip shape background with padding
  • Increase the screen brightness to maximum while the setup is open

Steps to reproduce

  1. Open POS on the iPad device
  2. Set the device to lower background brightness
  3. Select ... -> Barcode Scanning
  4. Confirm the brightness increases
  5. Confirm that closing the modal decreases the brightness to a previous brightness level
  6. Open and continue the flow
  7. Confirm that barcodes (and QR codes) are framed

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

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

staskus added 3 commits July 22, 2025 11:59
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.
@staskus staskus added this to the 22.9 milestone Jul 22, 2025
@staskus staskus requested review from Copilot and jaclync July 22, 2025 09:04
@staskus staskus added type: task An internally driven task. feature: POS labels Jul 22, 2025
Copy link
Contributor

Copilot AI left a 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
Copy link

Copilot AI Jul 22, 2025

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.

Copilot uses AI. Check for mistakes.
guard !isBrightnessIncreased else { return }

originalBrightness = UIScreen.main.brightness
UIScreen.main.brightness = 1.0
Copy link

Copilot AI Jul 22, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +31
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
Copy link

Copilot AI Jul 22, 2025

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.

Suggested change
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
}

Copilot uses AI. Check for mistakes.

deinit {
if isBrightnessIncreased {
UIScreen.main.brightness = originalBrightness
Copy link

Copilot AI Jul 22, 2025

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.

Suggested change
UIScreen.main.brightness = originalBrightness
DispatchQueue.main.async {
UIScreen.main.brightness = originalBrightness
}

Copilot uses AI. Check for mistakes.
@staskus staskus changed the title [Woo POS][Barcodes] Frame the QR code and increase brightness for better scalability [Woo POS][Barcodes] Frame the QR code and increase brightness for better scanability Jul 22, 2025
@wpmobilebot
Copy link
Collaborator

App Icon📲 You can test the changes from this Pull Request in WooCommerce iOS Prototype by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS Prototype
Build Numberpr15934-80faa66
Version22.8
Bundle IDcom.automattic.alpha.woocommerce
Commit80faa66
Installation URL7tmma9egvc0i8
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

Copy link
Contributor

@jaclync jaclync left a 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.

@staskus staskus merged commit 1443830 into trunk Jul 23, 2025
20 of 23 checks passed
@staskus staskus deleted the woomob-880-woo-posbarcodes-frame-the-qr-code-for-better-scalability branch July 23, 2025 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: POS type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants