Compare commits

...
Author SHA1 Message Date
Jason A. Donenfeld 547eabb4ae Version bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-10-15 14:53:34 +02:00
Jason A. Donenfeld bb16d3ebc8 iOS: UI: Make edit views full screen modal
This might be worse on the iPad. Oh well.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-10-15 14:51:04 +02:00
Jason A. Donenfeld 1b6170cbc9 NetworkExtension: don't use exit(0) hack on Catalina
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-10-15 11:44:13 +02:00
Diab NeiroukhandJason A. Donenfeld 4c37a4b7a7 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>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-10-15 00:01:17 +02:00
12 changed files with 78 additions and 25 deletions
+2 -2
View File
@@ -1,2 +1,2 @@
VERSION_NAME = 0.0.20191012 VERSION_NAME = 0.0.20191015
VERSION_ID = 14 VERSION_ID = 15
@@ -9,8 +9,8 @@ class ButtonCell: UITableViewCell {
set(value) { button.setTitle(value, for: .normal) } set(value) { button.setTitle(value, for: .normal) }
} }
var hasDestructiveAction: Bool { var hasDestructiveAction: Bool {
get { return button.tintColor == .red } get { return button.tintColor == .systemRed }
set(value) { button.tintColor = value ? .red : buttonStandardTintColor } set(value) { button.tintColor = value ? .systemRed : buttonStandardTintColor }
} }
var onTapped: (() -> Void)? var onTapped: (() -> Void)?
@@ -9,7 +9,11 @@ class KeyValueCell: UITableViewCell {
let keyLabel = UILabel() let keyLabel = UILabel()
keyLabel.font = UIFont.preferredFont(forTextStyle: .body) keyLabel.font = UIFont.preferredFont(forTextStyle: .body)
keyLabel.adjustsFontForContentSizeCategory = true keyLabel.adjustsFontForContentSizeCategory = true
keyLabel.textColor = .black if #available(iOS 13.0, *) {
keyLabel.textColor = .label
} else {
keyLabel.textColor = .black
}
keyLabel.textAlignment = .left keyLabel.textAlignment = .left
return keyLabel return keyLabel
}() }()
@@ -31,7 +35,11 @@ class KeyValueCell: UITableViewCell {
valueTextField.autocapitalizationType = .none valueTextField.autocapitalizationType = .none
valueTextField.autocorrectionType = .no valueTextField.autocorrectionType = .no
valueTextField.spellCheckingType = .no valueTextField.spellCheckingType = .no
valueTextField.textColor = .gray if #available(iOS 13.0, *) {
valueTextField.textColor = .secondaryLabel
} else {
valueTextField.textColor = .gray
}
return valueTextField return valueTextField
}() }()
@@ -56,10 +64,18 @@ class KeyValueCell: UITableViewCell {
var isValueValid = true { var isValueValid = true {
didSet { didSet {
if isValueValid { if #available(iOS 13.0, *) {
keyLabel.textColor = .black if isValueValid {
keyLabel.textColor = .label
} else {
keyLabel.textColor = .systemRed
}
} else { } else {
keyLabel.textColor = .red if isValueValid {
keyLabel.textColor = .black
} else {
keyLabel.textColor = .red
}
} }
} }
} }
@@ -16,7 +16,11 @@ class SwitchCell: UITableViewCell {
get { return switchView.isEnabled } get { return switchView.isEnabled }
set(value) { set(value) {
switchView.isEnabled = 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
}
} }
} }
@@ -28,7 +28,11 @@ class TextCell: UITableViewCell {
override func prepareForReuse() { override func prepareForReuse() {
super.prepareForReuse() super.prepareForReuse()
message = "" message = ""
setTextColor(.black) if #available(iOS 13.0, *) {
setTextColor(.label)
} else {
setTextColor(.black)
}
setTextAlignment(.left) setTextAlignment(.left)
} }
} }
@@ -30,7 +30,11 @@ class TunnelEditEditableKeyValueCell: TunnelEditKeyValueCell {
super.init(style: style, reuseIdentifier: reuseIdentifier) super.init(style: style, reuseIdentifier: reuseIdentifier)
copyableGesture = false copyableGesture = false
valueTextField.textColor = .black if #available(iOS 13.0, *) {
valueTextField.textColor = .label
} else {
valueTextField.textColor = .black
}
valueTextField.isEnabled = true valueTextField.isEnabled = true
valueLabelScrollView.isScrollEnabled = false valueLabelScrollView.isScrollEnabled = false
valueTextField.widthAnchor.constraint(equalTo: valueLabelScrollView.widthAnchor).isActive = true valueTextField.widthAnchor.constraint(equalTo: valueLabelScrollView.widthAnchor).isActive = true
@@ -29,9 +29,15 @@ class TunnelListCell: UITableViewCell {
}() }()
let busyIndicator: UIActivityIndicatorView = { let busyIndicator: UIActivityIndicatorView = {
let busyIndicator = UIActivityIndicatorView(style: .gray) if #available(iOS 13.0, *) {
busyIndicator.hidesWhenStopped = true let busyIndicator = UIActivityIndicatorView(style: .medium)
return busyIndicator busyIndicator.hidesWhenStopped = true
return busyIndicator
} else {
let busyIndicator = UIActivityIndicatorView(style: .gray)
busyIndicator.hidesWhenStopped = true
return busyIndicator
}
}() }()
let statusSwitch = UISwitch() let statusSwitch = UISwitch()
@@ -15,9 +15,15 @@ class LogViewController: UIViewController {
}() }()
let busyIndicator: UIActivityIndicatorView = { let busyIndicator: UIActivityIndicatorView = {
let busyIndicator = UIActivityIndicatorView(style: .gray) if #available(iOS 13.0, *) {
busyIndicator.hidesWhenStopped = true let busyIndicator = UIActivityIndicatorView(style: .medium)
return busyIndicator busyIndicator.hidesWhenStopped = true
return busyIndicator
} else {
let busyIndicator = UIActivityIndicatorView(style: .gray)
busyIndicator.hidesWhenStopped = true
return busyIndicator
}
}() }()
let paragraphStyle: NSParagraphStyle = { let paragraphStyle: NSParagraphStyle = {
@@ -176,7 +176,11 @@ extension SSIDOptionEditTableViewController {
private func noSSIDsCell(for tableView: UITableView, at indexPath: IndexPath) -> UITableViewCell { private func noSSIDsCell(for tableView: UITableView, at indexPath: IndexPath) -> UITableViewCell {
let cell: TextCell = tableView.dequeueReusableCell(for: indexPath) let cell: TextCell = tableView.dequeueReusableCell(for: indexPath)
cell.message = tr("tunnelOnDemandNoSSIDs") cell.message = tr("tunnelOnDemandNoSSIDs")
cell.setTextColor(.gray) if #available(iOS 13.0, *) {
cell.setTextColor(.secondaryLabel)
} else {
cell.setTextColor(.gray)
}
cell.setTextAlignment(.center) cell.setTextAlignment(.center)
return cell return cell
} }
@@ -120,7 +120,7 @@ class TunnelDetailTableViewController: UITableViewController {
let editVC = TunnelEditTableViewController(tunnelsManager: self.tunnelsManager, tunnel: self.tunnel) let editVC = TunnelEditTableViewController(tunnelsManager: self.tunnelsManager, tunnel: self.tunnel)
editVC.delegate = self editVC.delegate = self
let editNC = UINavigationController(rootViewController: editVC) let editNC = UINavigationController(rootViewController: editVC)
editNC.modalPresentationStyle = .formSheet editNC.modalPresentationStyle = .fullScreen
self.present(editNC, animated: true) self.present(editNC, animated: true)
} }
} }
@@ -32,9 +32,15 @@ class TunnelsListTableViewController: UIViewController {
}() }()
let busyIndicator: UIActivityIndicatorView = { let busyIndicator: UIActivityIndicatorView = {
let busyIndicator = UIActivityIndicatorView(style: .gray) if #available(iOS 13.0, *) {
busyIndicator.hidesWhenStopped = true let busyIndicator = UIActivityIndicatorView(style: .medium)
return busyIndicator busyIndicator.hidesWhenStopped = true
return busyIndicator
} else {
let busyIndicator = UIActivityIndicatorView(style: .gray)
busyIndicator.hidesWhenStopped = true
return busyIndicator
}
}() }()
var detailDisplayedTunnel: TunnelContainer? var detailDisplayedTunnel: TunnelContainer?
@@ -178,7 +184,7 @@ class TunnelsListTableViewController: UIViewController {
func presentViewControllerForTunnelCreation(tunnelsManager: TunnelsManager) { func presentViewControllerForTunnelCreation(tunnelsManager: TunnelsManager) {
let editVC = TunnelEditTableViewController(tunnelsManager: tunnelsManager) let editVC = TunnelEditTableViewController(tunnelsManager: tunnelsManager)
let editNC = UINavigationController(rootViewController: editVC) let editNC = UINavigationController(rootViewController: editVC)
editNC.modalPresentationStyle = .formSheet editNC.modalPresentationStyle = .fullScreen
present(editNC, animated: true) present(editNC, animated: true)
} }
@@ -99,7 +99,10 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
// HACK: This is a filthy hack to work around Apple bug 32073323 (dup'd by us as 47526107). // HACK: This is a filthy hack to work around Apple bug 32073323 (dup'd by us as 47526107).
// Remove it when they finally fix this upstream and the fix has been rolled out to // Remove it when they finally fix this upstream and the fix has been rolled out to
// sufficient quantities of users. // sufficient quantities of users.
exit(0) let osVersion = ProcessInfo.processInfo.operatingSystemVersion
if osVersion.majorVersion <= 10 && osVersion.minorVersion <= 14 {
exit(0)
}
#endif #endif
} }