Skip to content

Commit

Permalink
Change checkboxes in location cells to the correct ones
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Petersson authored and buggmagnet committed May 16, 2024
1 parent 5ae06f2 commit 199f007
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions ios/MullvadVPN/View controllers/SelectLocation/LocationCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ class LocationCell: UITableViewCell {

private let checkboxButton: UIButton = {
let button = UIButton()
button.setImage(UIImage(systemName: "checkmark.square.fill"), for: .selected)
button.setImage(UIImage(systemName: "square"), for: .normal)
button.tintColor = .white
let checkboxView = CheckboxView()

checkboxView.isUserInteractionEnabled = false
button.addConstrainedSubviews([checkboxView]) {
checkboxView.pinEdgesToSuperviewMargins(PinnableEdges([.top(8), .bottom(8), .leading(16), .trailing(16)]))
}

return button
}()

Expand Down Expand Up @@ -310,10 +314,13 @@ extension LocationCell {
locationLabel.text = item.node.name
showsCollapseControl = !item.node.children.isEmpty
isExpanded = item.node.showsChildren
checkboxButton.accessibilityIdentifier = .customListLocationCheckmarkButton
checkboxButton.isSelected = item.isSelected
checkboxButton.tintColor = item.isSelected ? .successColor : .white
accessibilityValue = item.node.code
checkboxButton.accessibilityIdentifier = .customListLocationCheckmarkButton

for view in checkboxButton.subviews where view is CheckboxView {
let checkboxView = view as? CheckboxView
checkboxView?.isChecked = item.isSelected
}

if item.node is CustomListLocationNode {
accessibilityIdentifier = .customListLocationCell
Expand Down

0 comments on commit 199f007

Please sign in to comment.