Skip to content

Commit 0bd238a

Browse files
authored
Merge pull request #9807 from woocommerce/issue/9806-scan-to-pay-screen-brightness
Increase screen brightness when showing the QR code
2 parents d6fc78c + 8cfa1c3 commit 0bd238a

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- [*] Orders: Fixes a bug where the Orders list would not load if an order had a non-integer gift card amount applied to the order (with the Gift Cards extension). [https://github.com/woocommerce/woocommerce-ios/pull/9795]
1111

1212
- [*] My Store: A new button to share the current store is added on the top right of the screen. [https://github.com/woocommerce/woocommerce-ios/pull/9796]
13+
- [*] Mobile Payments: The screen brightness is increased when showing the Scan to Pay view so the QR code can be scanned more easily [https://github.com/woocommerce/woocommerce-ios/pull/9807]
1314

1415
13.7
1516
-----

WooCommerce/Classes/ViewRelated/Orders/ScanToPay/ScanToPayView.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import SwiftUI
33
struct ScanToPayView: View {
44
let viewModel: ScanToPayViewModel
55
let onSuccess: (() -> Void)
6+
/// We keep this value to reset the screen brightness after increasing it for better QR readability. Only works on phsycal device.
7+
///
8+
let screenBrightnessAtViewCreation = UIScreen.main.brightness
69

710
@Environment(\.dismiss) var dismiss
811

@@ -43,6 +46,12 @@ struct ScanToPayView: View {
4346
.padding(Layout.scanToPayBoxOutterPadding)
4447
.frame(maxWidth: .infinity, alignment: .center)
4548
}
49+
.onAppear {
50+
UIScreen.main.brightness = 1.0
51+
}
52+
.onDisappear {
53+
UIScreen.main.brightness = screenBrightnessAtViewCreation
54+
}
4655
}
4756

4857
private struct DoneButton: View {

0 commit comments

Comments
 (0)