aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiab Neiroukh <officiallazerl0rd@gmail.com>2019-10-14 22:43:56 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2019-10-15 00:01:17 +0200
commit3dbfd6aabf4740aa31c54f740bdca53ec3bb5887 (patch)
tree4c6e2dbf2ec20a37197f910c4c2500d4f8ec8c60
parentVersion bump (diff)
downloadwireguard-apple-3dbfd6aabf4740aa31c54f740bdca53ec3bb5887.tar.xz
wireguard-apple-3dbfd6aabf4740aa31c54f740bdca53ec3bb5887.zip
UI: iOS: adjust colors for iOS 13
To be compatible with Dark Mode, we need to change some of our color references to be "dynamic". Signed-off-by: Diab Neiroukh <officiallazerl0rd@gmail.com>
-rw-r--r--WireGuard/WireGuard/UI/iOS/View/ButtonCell.swift4
-rw-r--r--WireGuard/WireGuard/UI/iOS/View/KeyValueCell.swift26
-rw-r--r--WireGuard/WireGuard/UI/iOS/View/SwitchCell.swift6
-rw-r--r--WireGuard/WireGuard/UI/iOS/View/TextCell.swift6
-rw-r--r--WireGuard/WireGuard/UI/iOS/View/TunnelEditKeyValueCell.swift6
-rw-r--r--WireGuard/WireGuard/UI/iOS/View/TunnelListCell.swift12
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/LogViewController.swift12
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/SSIDOptionEditTableViewController.swift6
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift12
9 files changed, 70 insertions, 20 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/View/ButtonCell.swift b/WireGuard/WireGuard/UI/iOS/View/ButtonCell.swift
index 62333152..90601c5d 100644
--- a/WireGuard/WireGuard/UI/iOS/View/ButtonCell.swift
+++ b/WireGuard/WireGuard/UI/iOS/View/ButtonCell.swift
@@ -9,8 +9,8 @@ class ButtonCell: UITableViewCell {
set(value) { button.setTitle(value, for: .normal) }
}
var hasDestructiveAction: Bool {
- get { return button.tintColor == .red }
- set(value) { button.tintColor = value ? .red : buttonStandardTintColor }
+ get { return button.tintColor == .systemRed }
+ set(value) { button.tintColor = value ? .systemRed : buttonStandardTintColor }
}
var onTapped: (() -> Void)?
diff --git a/WireGuard/WireGuard/UI/iOS/View/KeyValueCell.swift b/WireGuard/WireGuard/UI/iOS/View/KeyValueCell.swift
index df86752f..9b1d13b9 100644
--- a/WireGuard/WireGuard/UI/iOS/View/KeyValueCell.swift
+++ b/WireGuard/WireGuard/UI/iOS/View/KeyValueCell.swift
@@ -9,7 +9,11 @@ class KeyValueCell: UITableViewCell {
let keyLabel = UILabel()
keyLabel.font = UIFont.preferredFont(forTextStyle: .body)
keyLabel.adjustsFontForContentSizeCategory = true
- keyLabel.textColor = .black
+ if #available(iOS 13.0, *) {
+ keyLabel.textColor = .label
+ } else {
+ keyLabel.textColor = .black
+ }
keyLabel.textAlignment = .left
return keyLabel
}()
@@ -31,7 +35,11 @@ class KeyValueCell: UITableViewCell {
valueTextField.autocapitalizationType = .none
valueTextField.autocorrectionType = .no
valueTextField.spellCheckingType = .no
- valueTextField.textColor = .gray
+ if #available(iOS 13.0, *) {
+ valueTextField.textColor = .secondaryLabel
+ } else {
+ valueTextField.textColor = .gray
+ }
return valueTextField
}()
@@ -56,10 +64,18 @@ class KeyValueCell: UITableViewCell {
var isValueValid = true {
didSet {
- if isValueValid {
- keyLabel.textColor = .black
+ if #available(iOS 13.0, *) {
+ if isValueValid {
+ keyLabel.textColor = .label
+ } else {
+ keyLabel.textColor = .systemRed
+ }
} else {
- keyLabel.textColor = .red
+ if isValueValid {
+ keyLabel.textColor = .black
+ } else {
+ keyLabel.textColor = .red
+ }
}
}
}
diff --git a/WireGuard/WireGuard/UI/iOS/View/SwitchCell.swift b/WireGuard/WireGuard/UI/iOS/View/SwitchCell.swift
index 61695930..0d6e4dea 100644
--- a/WireGuard/WireGuard/UI/iOS/View/SwitchCell.swift
+++ b/WireGuard/WireGuard/UI/iOS/View/SwitchCell.swift
@@ -16,7 +16,11 @@ class SwitchCell: UITableViewCell {
get { return switchView.isEnabled }
set(value) {
switchView.isEnabled = value
- textLabel?.textColor = value ? .black : .gray
+ if #available(iOS 13.0, *) {
+ textLabel?.textColor = value ? .label : .secondaryLabel
+ } else {
+ textLabel?.textColor = value ? .black : .gray
+ }
}
}
diff --git a/WireGuard/WireGuard/UI/iOS/View/TextCell.swift b/WireGuard/WireGuard/UI/iOS/View/TextCell.swift
index ba9b37f8..7df9444f 100644
--- a/WireGuard/WireGuard/UI/iOS/View/TextCell.swift
+++ b/WireGuard/WireGuard/UI/iOS/View/TextCell.swift
@@ -28,7 +28,11 @@ class TextCell: UITableViewCell {
override func prepareForReuse() {
super.prepareForReuse()
message = ""
- setTextColor(.black)
+ if #available(iOS 13.0, *) {
+ setTextColor(.label)
+ } else {
+ setTextColor(.black)
+ }
setTextAlignment(.left)
}
}
diff --git a/WireGuard/WireGuard/UI/iOS/View/TunnelEditKeyValueCell.swift b/WireGuard/WireGuard/UI/iOS/View/TunnelEditKeyValueCell.swift
index 7c69a474..c139566b 100644
--- a/WireGuard/WireGuard/UI/iOS/View/TunnelEditKeyValueCell.swift
+++ b/WireGuard/WireGuard/UI/iOS/View/TunnelEditKeyValueCell.swift
@@ -30,7 +30,11 @@ class TunnelEditEditableKeyValueCell: TunnelEditKeyValueCell {
super.init(style: style, reuseIdentifier: reuseIdentifier)
copyableGesture = false
- valueTextField.textColor = .black
+ if #available(iOS 13.0, *) {
+ valueTextField.textColor = .label
+ } else {
+ valueTextField.textColor = .black
+ }
valueTextField.isEnabled = true
valueLabelScrollView.isScrollEnabled = false
valueTextField.widthAnchor.constraint(equalTo: valueLabelScrollView.widthAnchor).isActive = true
diff --git a/WireGuard/WireGuard/UI/iOS/View/TunnelListCell.swift b/WireGuard/WireGuard/UI/iOS/View/TunnelListCell.swift
index 914acc25..b2e0ba9f 100644
--- a/WireGuard/WireGuard/UI/iOS/View/TunnelListCell.swift
+++ b/WireGuard/WireGuard/UI/iOS/View/TunnelListCell.swift
@@ -29,9 +29,15 @@ class TunnelListCell: UITableViewCell {
}()
let busyIndicator: UIActivityIndicatorView = {
- let busyIndicator = UIActivityIndicatorView(style: .gray)
- busyIndicator.hidesWhenStopped = true
- return busyIndicator
+ if #available(iOS 13.0, *) {
+ let busyIndicator = UIActivityIndicatorView(style: .medium)
+ busyIndicator.hidesWhenStopped = true
+ return busyIndicator
+ } else {
+ let busyIndicator = UIActivityIndicatorView(style: .gray)
+ busyIndicator.hidesWhenStopped = true
+ return busyIndicator
+ }
}()
let statusSwitch = UISwitch()
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/LogViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/LogViewController.swift
index 4e4412d6..25c16b07 100644
--- a/WireGuard/WireGuard/UI/iOS/ViewController/LogViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/ViewController/LogViewController.swift
@@ -15,9 +15,15 @@ class LogViewController: UIViewController {
}()
let busyIndicator: UIActivityIndicatorView = {
- let busyIndicator = UIActivityIndicatorView(style: .gray)
- busyIndicator.hidesWhenStopped = true
- return busyIndicator
+ if #available(iOS 13.0, *) {
+ let busyIndicator = UIActivityIndicatorView(style: .medium)
+ busyIndicator.hidesWhenStopped = true
+ return busyIndicator
+ } else {
+ let busyIndicator = UIActivityIndicatorView(style: .gray)
+ busyIndicator.hidesWhenStopped = true
+ return busyIndicator
+ }
}()
let paragraphStyle: NSParagraphStyle = {
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/SSIDOptionEditTableViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/SSIDOptionEditTableViewController.swift
index 8740f06d..a9822583 100644
--- a/WireGuard/WireGuard/UI/iOS/ViewController/SSIDOptionEditTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/ViewController/SSIDOptionEditTableViewController.swift
@@ -176,7 +176,11 @@ extension SSIDOptionEditTableViewController {
private func noSSIDsCell(for tableView: UITableView, at indexPath: IndexPath) -> UITableViewCell {
let cell: TextCell = tableView.dequeueReusableCell(for: indexPath)
cell.message = tr("tunnelOnDemandNoSSIDs")
- cell.setTextColor(.gray)
+ if #available(iOS 13.0, *) {
+ cell.setTextColor(.secondaryLabel)
+ } else {
+ cell.setTextColor(.gray)
+ }
cell.setTextAlignment(.center)
return cell
}
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift
index 372a8e39..d58b2680 100644
--- a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift
@@ -32,9 +32,15 @@ class TunnelsListTableViewController: UIViewController {
}()
let busyIndicator: UIActivityIndicatorView = {
- let busyIndicator = UIActivityIndicatorView(style: .gray)
- busyIndicator.hidesWhenStopped = true
- return busyIndicator
+ if #available(iOS 13.0, *) {
+ let busyIndicator = UIActivityIndicatorView(style: .medium)
+ busyIndicator.hidesWhenStopped = true
+ return busyIndicator
+ } else {
+ let busyIndicator = UIActivityIndicatorView(style: .gray)
+ busyIndicator.hidesWhenStopped = true
+ return busyIndicator
+ }
}()
var detailDisplayedTunnel: TunnelContainer?