Skip to content

Commit bdc2562

Browse files
committed
update card reader modals when several found to new API
1 parent fed183d commit bdc2562

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

WooCommerce/Classes/ViewRelated/CardPresentPayments/SeveralReadersFoundViewController.swift

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,18 @@ final class SeveralReadersFoundViewController: UIViewController, UITableViewDele
3636
configureTable()
3737
updateViewMargins()
3838
updateViewAppearances()
39+
observeTraitChanges()
3940
}
4041

41-
/// Update constraints that vary by size class
42-
///
43-
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
44-
super.traitCollectionDidChange(previousTraitCollection)
45-
46-
/// Handle size class and orientation
47-
///
48-
updateViewMargins()
49-
50-
/// Handle changes to Light / Dark Appearance
51-
///
52-
if let previousTraits = previousTraitCollection, previousTraits.hasDifferentColorAppearance(comparedTo: traitCollection) {
53-
updateViewAppearances()
42+
private func observeTraitChanges() {
43+
let traits: [UITrait] = [
44+
UITraitVerticalSizeClass.self,
45+
UITraitHorizontalSizeClass.self,
46+
UITraitUserInterfaceStyle.self
47+
]
48+
registerForTraitChanges(traits) { (self: Self, _) in
49+
self.updateViewMargins()
50+
self.updateViewAppearances()
5451
}
5552
}
5653

0 commit comments

Comments
 (0)