From 199f0070b7bfe9f41439e98997ee4b02a3699e18 Mon Sep 17 00:00:00 2001 From: Jon Petersson Date: Mon, 13 May 2024 16:43:14 +0200 Subject: [PATCH] Change checkboxes in location cells to the correct ones --- .../SelectLocation/LocationCell.swift | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/ios/MullvadVPN/View controllers/SelectLocation/LocationCell.swift b/ios/MullvadVPN/View controllers/SelectLocation/LocationCell.swift index 68c70b04cc30..4f2f5ab62ce8 100644 --- a/ios/MullvadVPN/View controllers/SelectLocation/LocationCell.swift +++ b/ios/MullvadVPN/View controllers/SelectLocation/LocationCell.swift @@ -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 }() @@ -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