Commit 62e4fd80 authored by Jose Blaya's avatar Jose Blaya
Browse files

Update to Swift5

parent 1e916028
This diff is collapsed.
......@@ -28,7 +28,7 @@ class AboutNoticeCell: UITableViewCell, Restylable {
labelCopyright.text = component.copyright
labelNotice.text = component.notice
buttonName.accessibilityTraits = UIAccessibilityTraitNone
buttonName.accessibilityTraits = UIAccessibilityTraits.none
buttonName.accessibilityLabel = component.name
}
......@@ -110,7 +110,7 @@ class AboutLicenseCell: UITableViewCell, Restylable {
}
buttonMore.setImage(moreImage, for: .normal)
buttonName.accessibilityTraits = UIAccessibilityTraitNone
buttonName.accessibilityTraits = UIAccessibilityTraits.none
buttonName.accessibilityLabel = component.name
buttonName.accessibilityHint = L10n.About.Accessibility.Component.expand
}
......
......@@ -41,7 +41,7 @@ class AboutViewController: AutolayoutViewController {
tableView.scrollsToTop = true
let nc = NotificationCenter.default
nc.addObserver(self, selector: #selector(viewHasRotated), name: .UIDeviceOrientationDidChange, object: nil)
nc.addObserver(self, selector: #selector(viewHasRotated), name: UIDevice.orientationDidChangeNotification, object: nil)
}
......@@ -62,7 +62,7 @@ class AboutViewController: AutolayoutViewController {
guard let headerView = tableView.tableHeaderView else {
return
}
let height = headerView.systemLayoutSizeFitting(UILayoutFittingCompressedSize).height
let height = headerView.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).height
var frame = headerView.frame
frame.size.height = height
headerView.frame = frame
......@@ -106,7 +106,7 @@ class AboutViewController: AutolayoutViewController {
override func viewShouldRestyle() {
super.viewShouldRestyle()
tableView.separatorInset = UIEdgeInsetsMake(0, 30, 0, 0)
tableView.separatorInset = UIEdgeInsets(top: 0, left: 30, bottom: 0, right: 0)
Theme.current.applyDividerToSeparator(tableView)
styleNavigationBarWithTitle(L10n.Menu.Item.about)
// XXX: for some reason, UITableView is not affected by appearance updates
......
......@@ -85,7 +85,7 @@ class AccountViewController: AutolayoutViewController {
let nc = NotificationCenter.default
nc.addObserver(self, selector: #selector(redisplayAccount), name: .PIAAccountDidRefresh, object: nil)
nc.addObserver(self, selector: #selector(viewHasRotated), name: .UIDeviceOrientationDidChange, object: nil)
nc.addObserver(self, selector: #selector(viewHasRotated), name: UIDevice.orientationDidChangeNotification, object: nil)
Client.providers.accountProvider.retrieveAccount()
}
......
......@@ -32,7 +32,7 @@ class AppDelegate: NSObject, UIApplicationDelegate {
NotificationCenter.default.removeObserver(self)
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
Bootstrapper.shared.bootstrap()
application.shortcutItems = []
......@@ -62,7 +62,7 @@ class AppDelegate: NSObject, UIApplicationDelegate {
L10n.Notifications.Disabled.message
)
alert.addActionWithTitle(L10n.Notifications.Disabled.settings) {
application.openURL(URL(string: UIApplicationOpenSettingsURLString)!)
application.openURL(URL(string: UIApplication.openSettingsURLString)!)
}
alert.addCancelAction(L10n.Global.ok)
window?.rootViewController?.present(alert, animated: true, completion: nil)
......@@ -74,7 +74,7 @@ class AppDelegate: NSObject, UIApplicationDelegate {
application.applicationIconBadgeNumber = 0
}
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
log.debug("Opened app from URL: \(url)")
guard let host = url.host else {
return false
......
......@@ -62,9 +62,9 @@ class DashboardViewController: AutolayoutViewController {
let nc = NotificationCenter.default
nc.addObserver(self, selector: #selector(accountDidLogout(notification:)), name: .PIAAccountDidLogout, object: nil)
nc.addObserver(self, selector: #selector(vpnDidInstall(notification:)), name: .PIAVPNDidInstall, object: nil)
nc.addObserver(self, selector: #selector(applicationDidBecomeActive(notification:)), name: .UIApplicationDidBecomeActive, object: nil)
nc.addObserver(self, selector: #selector(applicationDidBecomeActive(notification:)), name: UIApplication.didBecomeActiveNotification, object: nil)
nc.addObserver(self, selector: #selector(vpnStatusDidChange(notification:)), name: .PIADaemonsDidUpdateVPNStatus, object: nil)
nc.addObserver(self, selector: #selector(viewHasRotated), name: .UIDeviceOrientationDidChange, object: nil)
nc.addObserver(self, selector: #selector(viewHasRotated), name: UIDevice.orientationDidChangeNotification, object: nil)
nc.addObserver(self, selector: #selector(updateCurrentStatus), name: .PIAThemeDidChange, object: nil)
nc.addObserver(self, selector: #selector(updateTiles), name: .PIATilesDidChange, object: nil)
nc.addObserver(self, selector: #selector(vpnShouldReconnect), name: .PIASettingsHaveChanged, object: nil)
......
......@@ -105,7 +105,7 @@ class MenuViewController: AutolayoutViewController {
imvAvatar.image = Asset.imageRobot.image
labelVersion.text = Macros.localizedVersionFullString()
tableView.rowHeight = UITableViewAutomaticDimension
tableView.rowHeight = UITableView.automaticDimension
tableView.estimatedRowHeight = 50
let nc = NotificationCenter.default
......
......@@ -124,7 +124,7 @@ class PIAConnectionButton: UIButton, Restylable {
func startButtonAnimation() {
displayLink.add(to: .current, forMode: .commonModes)
displayLink.add(to: .current, forMode: RunLoop.Mode.common)
self.updateColors()
......@@ -136,7 +136,7 @@ class PIAConnectionButton: UIButton, Restylable {
end.beginTime = 0
end.duration = duration * 0.75
end.timingFunction = PIAConnectionButtonSettings.timingFunction
end.fillMode = kCAFillModeForwards
end.fillMode = CAMediaTimingFillMode.forwards
let begin = CABasicAnimation(keyPath: "strokeStart")
begin.fromValue = 0
......@@ -144,7 +144,7 @@ class PIAConnectionButton: UIButton, Restylable {
begin.beginTime = duration * 0.15
begin.duration = duration * 0.85
begin.timingFunction = PIAConnectionButtonSettings.timingFunction
begin.fillMode = kCAFillModeBackwards
begin.fillMode = CAMediaTimingFillMode.backwards
let opacity = CABasicAnimation(keyPath: "opacity")
opacity.fromValue = 0
......@@ -152,7 +152,7 @@ class PIAConnectionButton: UIButton, Restylable {
opacity.beginTime = 0
opacity.duration = duration * 0.75
opacity.timingFunction = PIAConnectionButtonSettings.timingFunction
opacity.fillMode = kCAFillModeForwards
opacity.fillMode = CAMediaTimingFillMode.forwards
let group = CAAnimationGroup()
group.animations = [end, begin, opacity]
......@@ -177,9 +177,9 @@ class PIAConnectionButton: UIButton, Restylable {
ending.fromValue = self.currenStrokeEnd
ending.toValue = 1
ending.duration = PIAConnectionButtonSettings.shapeEndAnimationDuration
ending.fillMode = kCAFillModeForwards
ending.fillMode = CAMediaTimingFillMode.forwards
self.circlePathLayer.add(ending, forKey: "move")
displayLink.remove(from: .current, forMode: .commonModes)
displayLink.remove(from: .current, forMode: RunLoop.Mode.common)
}
isAnimating = false
......
......@@ -46,7 +46,7 @@ class RegionsViewController: AutolayoutViewController {
selectedServer = Client.preferences.displayedServer
NotificationCenter.default.addObserver(self, selector: #selector(pingsDidComplete(notification:)), name: .PIADaemonsDidPingServers, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(viewHasRotated), name: .UIDeviceOrientationDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(viewHasRotated), name: UIDevice.orientationDidChangeNotification, object: nil)
setupSearchBarController()
Macros.stylePopupDialog()
......
......@@ -237,7 +237,7 @@ class SettingsViewController: AutolayoutViewController {
validateDNSList()
if #available(iOS 11, *) {
tableView.sectionFooterHeight = UITableViewAutomaticDimension
tableView.sectionFooterHeight = UITableView.automaticDimension
tableView.estimatedSectionFooterHeight = 1.0
}
switchPersistent.addTarget(self, action: #selector(togglePersistentConnection(_:)), for: .valueChanged)
......@@ -249,8 +249,8 @@ class SettingsViewController: AutolayoutViewController {
switchDisconnectSiriShortcuts.addTarget(self, action: #selector(toggleDisconnectSiriShortcuts(_:)), for: .valueChanged)
redisplaySettings()
NotificationCenter.default.addObserver(self, selector: #selector(refreshContentBlockerState), name: .UIApplicationDidBecomeActive, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(viewHasRotated), name: .UIDeviceOrientationDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(refreshContentBlockerState), name: UIApplication.didBecomeActiveNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(viewHasRotated), name: UIDevice.orientationDidChangeNotification, object: nil)
}
......@@ -752,7 +752,7 @@ extension SettingsViewController: UITableViewDataSource, UITableViewDelegate {
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return UITableViewAutomaticDimension
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
......@@ -1194,7 +1194,7 @@ extension SettingsViewController: OptionsViewControllerDelegate {
return Theme.current.palette.principalBackground
}
func tableStyleForOptionsController(_ controller: OptionsViewController) -> UITableViewStyle {
func tableStyleForOptionsController(_ controller: OptionsViewController) -> UITableView.Style {
return .grouped
}
......
......@@ -134,9 +134,9 @@ extension Theme {
}
//Cancel button
let attributes:[NSAttributedStringKey:Any] = [
NSAttributedStringKey.foregroundColor : TextStyle.textStyle8.color!,
NSAttributedStringKey.font : TextStyle.textStyle8.font!
let attributes:[NSAttributedString.Key:Any] = [
NSAttributedString.Key.foregroundColor : TextStyle.textStyle8.color!,
NSAttributedString.Key.font : TextStyle.textStyle8.font!
]
UIBarButtonItem.appearance(whenContainedInInstancesOf: [UISearchBar.self]).setTitleTextAttributes(attributes, for: .normal)
......
......@@ -71,7 +71,7 @@ private struct LightThemeStrategy: ThemeStrategy {
func autolayoutContainerMargins(for mask: UIInterfaceOrientationMask) -> UIEdgeInsets {
if ((mask == .landscape) && Macros.isDevicePad) {
return UIEdgeInsetsMake(0, AppConfiguration.UI.iPadLandscapeMargin, 0, AppConfiguration.UI.iPadLandscapeMargin)
return UIEdgeInsets(top: 0, left: AppConfiguration.UI.iPadLandscapeMargin, bottom: 0, right: AppConfiguration.UI.iPadLandscapeMargin)
}
return .zero
}
......@@ -97,7 +97,7 @@ private struct DarkThemeStrategy: ThemeStrategy {
func autolayoutContainerMargins(for mask: UIInterfaceOrientationMask) -> UIEdgeInsets {
if ((mask == .landscape) && Macros.isDevicePad) {
return UIEdgeInsetsMake(0, AppConfiguration.UI.iPadLandscapeMargin, 0, AppConfiguration.UI.iPadLandscapeMargin)
return UIEdgeInsets(top: 0, left: AppConfiguration.UI.iPadLandscapeMargin, bottom: 0, right: AppConfiguration.UI.iPadLandscapeMargin)
}
return .zero
}
......
......@@ -47,7 +47,7 @@ class TrustedNetworksViewController: AutolayoutViewController {
self.switchCellularData.addTarget(self, action: #selector(toggleCellularData(_:)), for: .valueChanged)
self.switchRules.addTarget(self, action: #selector(toggleRules(_:)), for: .valueChanged)
NotificationCenter.default.addObserver(self, selector: #selector(filterAvailableNetworks), name: .UIApplicationDidBecomeActive, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(filterAvailableNetworks), name: UIApplication.didBecomeActiveNotification, object: nil)
configureTableView()
}
......@@ -124,7 +124,7 @@ class TrustedNetworksViewController: AutolayoutViewController {
// MARK: Private Methods
private func configureTableView() {
if #available(iOS 11, *) {
tableView.sectionFooterHeight = UITableViewAutomaticDimension
tableView.sectionFooterHeight = UITableView.automaticDimension
tableView.estimatedSectionFooterHeight = 1.0
}
filterAvailableNetworks()
......@@ -313,7 +313,7 @@ extension TrustedNetworksViewController: UITableViewDelegate, UITableViewDataSou
}
}
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
let ssid = trustedNetworks[indexPath.row]
hotspotHelper.removeTrustedNetwork(ssid)
......
......@@ -10,7 +10,7 @@ import Foundation
import UIKit
extension UINavigationController {
open override var childViewControllerForStatusBarStyle: UIViewController? {
open override var childForStatusBarStyle: UIViewController? {
return topViewController
}
}
......@@ -2,6 +2,9 @@ source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
# ignore all warnings from all pods
inhibit_all_warnings!
# Libraries
$git_root = "https://github.com/pia-foss"
......@@ -53,7 +56,7 @@ end
def shared_main_pods
pod 'AlamofireImage'
#library_by_path('')
library_by_git('0033217')
library_by_git('7d09a9a')
#library_by_version('~> 1.1.3')
end
......@@ -69,7 +72,7 @@ end
def tunnel_pods
#tunnel_by_path('')
tunnel_by_git('bd53e0a')
tunnel_by_git('257296c')
#tunnel_by_version('~> 1.1.6')
end
......@@ -107,5 +110,10 @@ post_install do |installer|
config.build_settings['SWIFT_VERSION'] = '4.2'
end
end
if ['SwiftEntryKit', 'QuickLayout', 'SideMenu'].include? target.name
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.0'
end
end
end
end
......@@ -28,7 +28,7 @@ PODS:
- GoogleUtilities/Environment (~> 5.3)
- GoogleUtilities/UserDefaults (~> 5.3)
- FXPageControl (1.5)
- Gloss (2.0.1)
- Gloss (2.1.0)
- GoogleAppMeasurement (5.3.0):
- GoogleUtilities/AppDelegateSwizzler (~> 5.2)
- GoogleUtilities/MethodSwizzler (~> 5.2)
......@@ -57,7 +57,7 @@ PODS:
- HockeySDK/DefaultLib (= 5.1.4)
- HockeySDK/DefaultLib (5.1.4)
- iRate (1.12.2)
- lottie-ios (2.5.2)
- lottie-ios (3.0.3)
- nanopb (0.3.901):
- nanopb/decode (= 0.3.901)
- nanopb/encode (= 0.3.901)
......@@ -102,7 +102,7 @@ PODS:
- SideMenu (3.1.5)
- SwiftEntryKit (0.7.2):
- QuickLayout (= 2.0.2)
- SwiftyBeaver (1.6.1)
- SwiftyBeaver (1.7.0)
- TPKeyboardAvoiding (1.3.2)
DEPENDENCIES:
......@@ -114,11 +114,11 @@ DEPENDENCIES:
- FXPageControl
- HockeySDK
- iRate
- PIALibrary/Library (from `https://github.com/pia-foss/client-library-apple`, commit `0033217`)
- PIALibrary/Mock (from `https://github.com/pia-foss/client-library-apple`, commit `0033217`)
- PIALibrary/UI (from `https://github.com/pia-foss/client-library-apple`, commit `0033217`)
- PIALibrary/VPN (from `https://github.com/pia-foss/client-library-apple`, commit `0033217`)
- PIATunnel (from `https://github.com/pia-foss/tunnel-apple`, commit `bd53e0a`)
- PIALibrary/Library (from `https://github.com/pia-foss/client-library-apple`, commit `7d09a9a`)
- PIALibrary/Mock (from `https://github.com/pia-foss/client-library-apple`, commit `7d09a9a`)
- PIALibrary/UI (from `https://github.com/pia-foss/client-library-apple`, commit `7d09a9a`)
- PIALibrary/VPN (from `https://github.com/pia-foss/client-library-apple`, commit `7d09a9a`)
- PIATunnel (from `https://github.com/pia-foss/tunnel-apple`, commit `257296c`)
- PopupDialog
- SideMenu (= 3.1.5)
- TPKeyboardAvoiding
......@@ -154,18 +154,18 @@ SPEC REPOS:
EXTERNAL SOURCES:
PIALibrary:
:commit: '0033217'
:commit: 7d09a9a
:git: https://github.com/pia-foss/client-library-apple
PIATunnel:
:commit: bd53e0a
:commit: 257296c
:git: https://github.com/pia-foss/tunnel-apple
CHECKOUT OPTIONS:
PIALibrary:
:commit: '0033217'
:commit: 7d09a9a
:git: https://github.com/pia-foss/client-library-apple
PIATunnel:
:commit: bd53e0a
:commit: 257296c
:git: https://github.com/pia-foss/tunnel-apple
SPEC CHECKSUMS:
......@@ -180,12 +180,12 @@ SPEC CHECKSUMS:
FirebaseCore: d16552f06821489ce1affe2e5e3e5593402ddfe3
FirebaseInstanceID: e2fa4cb35ef5558c200f7f0ad8a53e212215f93e
FXPageControl: 97620412515365d10a3282ec0660f49f6401a8f0
Gloss: 1e8743f8de1fbe14a97f220ff901cba91ae5f8f8
Gloss: 13ab6b4b0ff4cb2448466edc957479b1bccea8ba
GoogleAppMeasurement: 5029d78f2b438bd30ffb44e6c558b57c21622727
GoogleUtilities: abb092d2c12e817fa3e0e7b274987dd72fb86ec3
HockeySDK: 15afe6bc0a5bfe3a531fd73dbf082095f37dac3b
iRate: 4fc69958788624545e5d050c8ffd20884013c3f1
lottie-ios: 3fef45d3fabe63e3c7c2eb603dd64ddfffc73062
lottie-ios: 06e0b54aab85ba128e332687d7f4ac4861a7a7ae
nanopb: 2901f78ea1b7b4015c860c2fdd1ea2fee1a18d48
OpenSSL-Apple: cd153d705ef350eb834ae7ff5f21f792b51ed208
PIALibrary: 49067d695fe3597be7ce9561a635bbd47f0e6b48
......@@ -195,9 +195,9 @@ SPEC CHECKSUMS:
ReachabilitySwift: 408477d1b6ed9779dba301953171e017c31241f3
SideMenu: 47dbf9e4d878062d8994aed43f6e4bf6c1fea30b
SwiftEntryKit: 83d312243af7397e38a222b17b7a744b9a7d2145
SwiftyBeaver: ccfcdf85a04d429f1633f668650b0ce8020bda3a
SwiftyBeaver: 4cc0080d2e23f980652e28978db11a5c9da39165
TPKeyboardAvoiding: cb69d5ddbe90ce0170e4bc2db1e5e41d4a3ad9a4
PODFILE CHECKSUM: b74692ef2c53a00a94204bd8c1f4311101f671f9
PODFILE CHECKSUM: a2746f6d6030e7ba16ce0996314b761685d4011b
COCOAPODS: 1.5.3
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment