-
Notifications
You must be signed in to change notification settings - Fork 349
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
1 parent
72b4281
commit 80eb27b
Showing
16 changed files
with
282 additions
and
74 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
73 changes: 73 additions & 0 deletions
73
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,73 @@ | ||
// | ||
// 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 buttonAction: (() -> Void)? | ||
|
||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
super.init(style: .subtitle, reuseIdentifier: reuseIdentifier) | ||
|
||
let actionButton = IncreasedHitButton(type: .system) | ||
var actionButtonConfiguration = actionButton.configuration ?? .plain() | ||
actionButtonConfiguration.image = UIImage(systemName: "ellipsis")? | ||
.withRenderingMode(.alwaysOriginal) | ||
.withTintColor(.white) | ||
actionButton.configuration = actionButtonConfiguration | ||
|
||
actionButton.addTarget( | ||
self, | ||
action: #selector(didPressActionButton), | ||
for: .touchUpInside | ||
) | ||
|
||
let separatorView = UIView() | ||
separatorView.backgroundColor = .secondaryColor | ||
|
||
viewContainer.addConstrainedSubviews([separatorView, actionButton]) { | ||
separatorView.leadingAnchor.constraint(equalTo: viewContainer.leadingAnchor, constant: 16) | ||
separatorView.centerYAnchor.constraint(equalTo: viewContainer.centerYAnchor) | ||
separatorView.heightAnchor.constraint(equalToConstant: UIMetrics.SettingsCell.verticalDividerHeight) | ||
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() { | ||
buttonAction?() | ||
} | ||
} |
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.