-
Notifications
You must be signed in to change notification settings - Fork 339
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
261 additions
and
58 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
69 changes: 69 additions & 0 deletions
69
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,69 @@ | ||
// | ||
// SelectableSettingsDetailsCell.swift | ||
// MullvadVPN | ||
// | ||
// Created by Jon Petersson on 2024-10-14. | ||
// Copyright © 2024 Mullvad VPN AB. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class SelectableSettingsDetailsCell: SelectableSettingsCell { | ||
let viewContainer = UIView() | ||
|
||
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 | ||
actionButton.addTarget( | ||
self, | ||
action: #selector(didPressActionButton), | ||
for: .valueChanged | ||
) | ||
|
||
let separatorView = UIView() | ||
separatorView.backgroundColor = .primaryColor | ||
|
||
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) | ||
} | ||
|
||
setViewContainer() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
override func prepareForReuse() { | ||
super.prepareForReuse() | ||
setViewContainer() | ||
} | ||
|
||
private func setViewContainer() { | ||
#if DEBUG | ||
setTrailingView { superview in | ||
superview.addConstrainedSubviews([viewContainer]) { | ||
viewContainer.pinEdgesToSuperview() | ||
} | ||
} | ||
#endif | ||
} | ||
|
||
// 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
Oops, something went wrong.