-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update cell layout and behavior for obfuscation methods
- Loading branch information
Showing
12 changed files
with
212 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
ios/MullvadVPN/View controllers/Settings/SelectableSettingsDetailsCell.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// | ||
// SelectableSettingsDetailsCell.swift | ||
// MullvadVPN | ||
// | ||
// Created by Jon Petersson on 2024-10-14. | ||
// Copyright © 2024 Mullvad VPN AB. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class SelectableSettingsDetailsCell: SelectableSettingsCell { | ||
var action: (() -> Void)? | ||
|
||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
super.init(style: .subtitle, reuseIdentifier: reuseIdentifier) | ||
|
||
let actionButton = IncreasedHitButton(type: .system) | ||
actionButton.setImage(UIImage(systemName: "ellipsis"), for: .normal) | ||
actionButton.tintColor = .white | ||
|
||
let separatorView = UIView() | ||
separatorView.backgroundColor = .white | ||
|
||
let viewContainer = UIView() | ||
viewContainer.addConstrainedSubviews([separatorView, actionButton]) { | ||
separatorView.leadingAnchor.constraint(equalTo: viewContainer.leadingAnchor, constant: 16) | ||
separatorView.centerYAnchor.constraint(equalTo: viewContainer.centerYAnchor) | ||
separatorView.heightAnchor.constraint(equalToConstant: UIMetrics.SettingsCell.buttonSeparatorHeight) | ||
separatorView.widthAnchor.constraint(equalToConstant: 1) | ||
|
||
actionButton.pinEdgesToSuperview(.all().excluding(.leading)) | ||
actionButton.leadingAnchor.constraint(equalTo: separatorView.trailingAnchor) | ||
actionButton.widthAnchor.constraint(equalToConstant: UIMetrics.SettingsCell.detailsButtonSize) | ||
} | ||
|
||
setTrailingView { superview in | ||
superview.addConstrainedSubviews([viewContainer]) { | ||
viewContainer.pinEdgesToSuperview() | ||
} | ||
} | ||
|
||
actionButton.addTarget( | ||
self, | ||
action: #selector(didPressActionButton), | ||
for: .valueChanged | ||
) | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
// MARK: - Actions | ||
|
||
@objc private func didPressActionButton() { | ||
action?() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.