summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2021-05-03 16:37:40 +0200
committerAndrej Mihajlov <and@mullvad.net>2021-05-03 16:37:40 +0200
commitd53728ed4083b7002bae8970b73de6a1549d32f7 (patch)
tree977ee395afe993d89eaea39959a3930d418a9ea8
parent0634cecc40ee43828947146221c8aa26636a36c7 (diff)
parentc6f685773de6505e5ed5e4e29c1e6b1da099b6c8 (diff)
downloadmullvadvpn-d53728ed4083b7002bae8970b73de6a1549d32f7.tar.xz
mullvadvpn-d53728ed4083b7002bae8970b73de6a1549d32f7.zip
Merge branch 'app-button-fixes'
-rw-r--r--ios/MullvadVPN/AppButton.swift19
-rw-r--r--ios/MullvadVPN/ConnectMainContentView.swift2
-rw-r--r--ios/MullvadVPN/DisconnectSplitButton.swift1
3 files changed, 9 insertions, 13 deletions
diff --git a/ios/MullvadVPN/AppButton.swift b/ios/MullvadVPN/AppButton.swift
index 8636c667ee..799c4b933f 100644
--- a/ios/MullvadVPN/AppButton.swift
+++ b/ios/MullvadVPN/AppButton.swift
@@ -62,23 +62,22 @@ private extension UIControl.State {
commonInit()
}
- override func setTitle(_ title: String?, for state: UIControl.State) {
- if let title = title {
- setAttributedTitle(makeAttributedTitle(title, for: state), for: state)
- } else {
- setAttributedTitle(nil, for: state)
+ var titleString: String? {
+ didSet {
+ updateAttributedTitle(string: titleString)
}
}
private func commonInit() {
imageAlignment = .trailing
+ contentHorizontalAlignment = .leading
+ }
+ private func updateAttributedTitle(string: String?) {
let states: [UIControl.State] = [.normal, .highlighted, .disabled]
states.forEach { (state) in
- if let title = self.title(for: state) {
- let attributedTitle = makeAttributedTitle(title, for: state)
- self.setAttributedTitle(attributedTitle, for: state)
- }
+ let attributedTitle = string.flatMap { makeAttributedTitle($0, for: state) }
+ self.setAttributedTitle(attributedTitle, for: state)
}
}
@@ -197,7 +196,7 @@ private extension UIControl.State {
contentEdgeInsets = contentInsets
imageAlignment = .trailingFixed
- titleLabel?.font = UIFont.systemFont(ofSize: 17, weight: .semibold)
+ titleLabel?.font = UIFont.systemFont(ofSize: 18, weight: .semibold)
let states: [UIControl.State] = [.normal, .highlighted, .disabled]
states.forEach { (state) in
diff --git a/ios/MullvadVPN/ConnectMainContentView.swift b/ios/MullvadVPN/ConnectMainContentView.swift
index a92d18fdda..57fbf13a2d 100644
--- a/ios/MullvadVPN/ConnectMainContentView.swift
+++ b/ios/MullvadVPN/ConnectMainContentView.swift
@@ -36,7 +36,6 @@ class ConnectMainContentView: UIView {
lazy var connectButton: AppButton = {
let button = AppButton(style: .success)
button.translatesAutoresizingMaskIntoConstraints = false
- button.titleLabel?.font = UIFont.systemFont(ofSize: 18, weight: .semibold)
return button
}()
@@ -44,7 +43,6 @@ class ConnectMainContentView: UIView {
let button = AppButton(style: .translucentNeutral)
button.accessibilityIdentifier = "SelectLocationButton"
button.translatesAutoresizingMaskIntoConstraints = false
- button.titleLabel?.font = UIFont.systemFont(ofSize: 18, weight: .semibold)
return button
}()
diff --git a/ios/MullvadVPN/DisconnectSplitButton.swift b/ios/MullvadVPN/DisconnectSplitButton.swift
index be3340d3ce..b3eaa5bcfc 100644
--- a/ios/MullvadVPN/DisconnectSplitButton.swift
+++ b/ios/MullvadVPN/DisconnectSplitButton.swift
@@ -39,7 +39,6 @@ class DisconnectSplitButton: UIView {
stackView.alignment = .fill
stackView.spacing = 1
- primaryButton.titleLabel?.font = UIFont.systemFont(ofSize: 18, weight: .semibold)
secondaryButton.setImage(UIImage(named: "IconReload"), for: .normal)
primaryButton.overrideContentEdgeInsets = true