Migrate to Swift 5.0

This commit is contained in:
Danny Moesch 2019-05-01 17:49:27 +02:00
parent e06413b348
commit f9c19b3ca4
26 changed files with 143 additions and 152 deletions

View file

@ -917,6 +917,7 @@
A239F5942158C08B00576CBF = { A239F5942158C08B00576CBF = {
CreatedOnToolsVersion = 10.0; CreatedOnToolsVersion = 10.0;
DevelopmentTeam = 4WDM8E95VU; DevelopmentTeam = 4WDM8E95VU;
LastSwiftMigration = 1020;
ProvisioningStyle = Manual; ProvisioningStyle = Manual;
SystemCapabilities = { SystemCapabilities = {
com.apple.ApplicationGroups.iOS = { com.apple.ApplicationGroups.iOS = {
@ -929,19 +930,19 @@
}; };
A26075771EEC6F34005DB03E = { A26075771EEC6F34005DB03E = {
CreatedOnToolsVersion = 8.3.3; CreatedOnToolsVersion = 8.3.3;
LastSwiftMigration = 0900; LastSwiftMigration = 1020;
ProvisioningStyle = Manual; ProvisioningStyle = Manual;
}; };
A260757F1EEC6F34005DB03E = { A260757F1EEC6F34005DB03E = {
CreatedOnToolsVersion = 8.3.3; CreatedOnToolsVersion = 8.3.3;
LastSwiftMigration = 0900; LastSwiftMigration = 1020;
ProvisioningStyle = Automatic; ProvisioningStyle = Automatic;
TestTargetID = DC917BD21E2E8231000FDF54; TestTargetID = DC917BD21E2E8231000FDF54;
}; };
A26700231EEC466A00176B8A = { A26700231EEC466A00176B8A = {
CreatedOnToolsVersion = 8.3.3; CreatedOnToolsVersion = 8.3.3;
DevelopmentTeam = 4WDM8E95VU; DevelopmentTeam = 4WDM8E95VU;
LastSwiftMigration = 0900; LastSwiftMigration = 1020;
ProvisioningStyle = Manual; ProvisioningStyle = Manual;
SystemCapabilities = { SystemCapabilities = {
com.apple.ApplicationGroups.iOS = { com.apple.ApplicationGroups.iOS = {
@ -955,14 +956,14 @@
DC13B14D1E8640810097803F = { DC13B14D1E8640810097803F = {
CreatedOnToolsVersion = 8.3; CreatedOnToolsVersion = 8.3;
DevelopmentTeam = 4WDM8E95VU; DevelopmentTeam = 4WDM8E95VU;
LastSwiftMigration = 0900; LastSwiftMigration = 1020;
ProvisioningStyle = Automatic; ProvisioningStyle = Automatic;
TestTargetID = DC917BD21E2E8231000FDF54; TestTargetID = DC917BD21E2E8231000FDF54;
}; };
DC917BD21E2E8231000FDF54 = { DC917BD21E2E8231000FDF54 = {
CreatedOnToolsVersion = 8.2.1; CreatedOnToolsVersion = 8.2.1;
DevelopmentTeam = 4WDM8E95VU; DevelopmentTeam = 4WDM8E95VU;
LastSwiftMigration = 0900; LastSwiftMigration = 1020;
ProvisioningStyle = Manual; ProvisioningStyle = Manual;
SystemCapabilities = { SystemCapabilities = {
com.apple.ApplicationGroups.iOS = { com.apple.ApplicationGroups.iOS = {
@ -1454,7 +1455,7 @@
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "match Development me.mssun.passforios.auto-fill-credential-extension"; PROVISIONING_PROFILE_SPECIFIER = "match Development me.mssun.passforios.auto-fill-credential-extension";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2; SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
}; };
name = Debug; name = Debug;
@ -1480,7 +1481,7 @@
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "match AppStore me.mssun.passforios.auto-fill-credential-extension"; PROVISIONING_PROFILE_SPECIFIER = "match AppStore me.mssun.passforios.auto-fill-credential-extension";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2; SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
}; };
name = Release; name = Release;
@ -1517,8 +1518,7 @@
SWIFT_INCLUDE_PATHS = ""; SWIFT_INCLUDE_PATHS = "";
SWIFT_OBJC_BRIDGING_HEADER = ""; SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_VERSION = 5.0;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = ""; VERSION_INFO_PREFIX = "";
@ -1556,8 +1556,7 @@
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SWIFT_INCLUDE_PATHS = ""; SWIFT_INCLUDE_PATHS = "";
SWIFT_OBJC_BRIDGING_HEADER = ""; SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_VERSION = 5.0;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = ""; VERSION_INFO_PREFIX = "";
@ -1579,8 +1578,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER).passKitTests"; PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER).passKitTests";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_VERSION = 5.0;
SWIFT_VERSION = 4.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/pass.app/pass"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/pass.app/pass";
}; };
name = Debug; name = Debug;
@ -1600,8 +1598,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER).passKitTests"; PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER).passKitTests";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_VERSION = 5.0;
SWIFT_VERSION = 4.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/pass.app/pass"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/pass.app/pass";
}; };
name = Release; name = Release;
@ -1628,8 +1625,7 @@
PROVISIONING_PROFILE = "d25c9029-bca6-4b2d-b04e-4abc9d232740"; PROVISIONING_PROFILE = "d25c9029-bca6-4b2d-b04e-4abc9d232740";
PROVISIONING_PROFILE_SPECIFIER = "match Development me.mssun.passforios.find-login-action-extension"; PROVISIONING_PROFILE_SPECIFIER = "match Development me.mssun.passforios.find-login-action-extension";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_VERSION = 5.0;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
}; };
name = Debug; name = Debug;
@ -1656,8 +1652,7 @@
PROVISIONING_PROFILE = "cbd86628-6f3e-40f3-b518-20d2330db545"; PROVISIONING_PROFILE = "cbd86628-6f3e-40f3-b518-20d2330db545";
PROVISIONING_PROFILE_SPECIFIER = "match AppStore me.mssun.passforios.find-login-action-extension"; PROVISIONING_PROFILE_SPECIFIER = "match AppStore me.mssun.passforios.find-login-action-extension";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_VERSION = 5.0;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
}; };
name = Release; name = Release;
@ -1675,8 +1670,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER).passTests"; PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER).passTests";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_VERSION = 5.0;
SWIFT_VERSION = 4.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/pass.app/pass"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/pass.app/pass";
}; };
name = Debug; name = Debug;
@ -1694,8 +1688,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER).passTests"; PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER).passTests";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_VERSION = 5.0;
SWIFT_VERSION = 4.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/pass.app/pass"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/pass.app/pass";
}; };
name = Release; name = Release;
@ -1849,8 +1842,7 @@
PROVISIONING_PROFILE = "3c4f599a-ce77-4184-b4c4-edebf09cba3b"; PROVISIONING_PROFILE = "3c4f599a-ce77-4184-b4c4-edebf09cba3b";
PROVISIONING_PROFILE_SPECIFIER = "match Development me.mssun.passforios"; PROVISIONING_PROFILE_SPECIFIER = "match Development me.mssun.passforios";
SWIFT_OBJC_BRIDGING_HEADER = "pass/Helpers/Objective-CBridgingHeader.h"; SWIFT_OBJC_BRIDGING_HEADER = "pass/Helpers/Objective-CBridgingHeader.h";
SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_VERSION = 5.0;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };
@ -1882,8 +1874,7 @@
PROVISIONING_PROFILE = "ee6e841d-ef77-4f00-b534-d7f1fd25dc1d"; PROVISIONING_PROFILE = "ee6e841d-ef77-4f00-b534-d7f1fd25dc1d";
PROVISIONING_PROFILE_SPECIFIER = "match AppStore me.mssun.passforios"; PROVISIONING_PROFILE_SPECIFIER = "match AppStore me.mssun.passforios";
SWIFT_OBJC_BRIDGING_HEADER = "pass/Helpers/Objective-CBridgingHeader.h"; SWIFT_OBJC_BRIDGING_HEADER = "pass/Helpers/Objective-CBridgingHeader.h";
SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_VERSION = 5.0;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };

View file

@ -25,11 +25,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
return presenter return presenter
}() }()
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch. // Override point for customization after application launch.
SVProgressHUD.setMinimumSize(CGSize(width: 150, height: 100)) SVProgressHUD.setMinimumSize(CGSize(width: 150, height: 100))
passcodeLockPresenter.present(windowLevel: UIApplication.shared.windows.last?.windowLevel) passcodeLockPresenter.present(windowLevel: UIApplication.shared.windows.last?.windowLevel.rawValue)
if let shortcutItem = launchOptions?[UIApplicationLaunchOptionsKey.shortcutItem] as? UIApplicationShortcutItem { if let shortcutItem = launchOptions?[UIApplication.LaunchOptionsKey.shortcutItem] as? UIApplicationShortcutItem {
if shortcutItem.type == Globals.bundleIdentifier + ".search" { if shortcutItem.type == Globals.bundleIdentifier + ".search" {
self.perform(#selector(postSearchNotification), with: nil, afterDelay: 0.4) self.perform(#selector(postSearchNotification), with: nil, afterDelay: 0.4)
} }
@ -67,7 +67,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
// Display a blur effect view // Display a blur effect view
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.light) let blurEffect = UIBlurEffect(style: UIBlurEffect.Style.light)
let blurEffectView = UIVisualEffectView(effect: blurEffect) let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = (self.window?.frame)! blurEffectView.frame = (self.window?.frame)!
blurEffectView.tag = ViewTag.blur.rawValue blurEffectView.tag = ViewTag.blur.rawValue
@ -95,7 +95,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func applicationWillEnterForeground(_ application: UIApplication) { func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
passcodeLockPresenter.present(windowLevel: UIApplication.shared.windows.last?.windowLevel) passcodeLockPresenter.present(windowLevel: UIApplication.shared.windows.last?.windowLevel.rawValue)
} }
func applicationDidBecomeActive(_ application: UIApplication) { func applicationDidBecomeActive(_ application: UIApplication) {

View file

@ -15,7 +15,7 @@ class AboutRepositoryTableViewController: BasicStaticTableViewController {
private var needRefresh = false private var needRefresh = false
private var indicator: UIActivityIndicatorView = { private var indicator: UIActivityIndicatorView = {
let indicator = UIActivityIndicatorView(activityIndicatorStyle: .gray) let indicator = UIActivityIndicatorView(style: .gray)
return indicator return indicator
}() }()
private let passwordStore = PasswordStore.shared private let passwordStore = PasswordStore.shared
@ -59,7 +59,7 @@ class AboutRepositoryTableViewController: BasicStaticTableViewController {
guard let strongSelf = self else { guard let strongSelf = self else {
return return
} }
let type = UITableViewCellAccessoryType.none let type = UITableViewCell.AccessoryType.none
strongSelf.tableData = [ strongSelf.tableData = [
// section 0 // section 0
[[.style: CellDataStyle.value1, .accessoryType: type, .title: "Passwords".localize(), .detailText: passwords], [[.style: CellDataStyle.value1, .accessoryType: type, .title: "Passwords".localize(), .detailText: passwords],

View file

@ -22,7 +22,7 @@ class AdvancedSettingsTableViewController: UITableViewController {
let uiSwitch = UISwitch() let uiSwitch = UISwitch()
uiSwitch.onTintColor = Globals.blue uiSwitch.onTintColor = Globals.blue
uiSwitch.sizeToFit() uiSwitch.sizeToFit()
uiSwitch.addTarget(self, action: #selector(encryptInASCIIArmoredAction(_:)), for: UIControlEvents.valueChanged) uiSwitch.addTarget(self, action: #selector(encryptInASCIIArmoredAction(_:)), for: UIControl.Event.valueChanged)
return uiSwitch return uiSwitch
}() }()
@ -48,19 +48,19 @@ class AdvancedSettingsTableViewController: UITableViewController {
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true) tableView.deselectRow(at: indexPath, animated: true)
if tableView.cellForRow(at: indexPath) == eraseDataTableViewCell { if tableView.cellForRow(at: indexPath) == eraseDataTableViewCell {
let alert = UIAlertController(title: "ErasePasswordStoreData?".localize(), message: "EraseExplanation.".localize(), preferredStyle: UIAlertControllerStyle.alert) let alert = UIAlertController(title: "ErasePasswordStoreData?".localize(), message: "EraseExplanation.".localize(), preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "ErasePasswordStoreData".localize(), style: UIAlertActionStyle.destructive, handler: {[unowned self] (action) -> Void in alert.addAction(UIAlertAction(title: "ErasePasswordStoreData".localize(), style: UIAlertAction.Style.destructive, handler: {[unowned self] (action) -> Void in
SVProgressHUD.show(withStatus: "Erasing...".localize()) SVProgressHUD.show(withStatus: "Erasing...".localize())
self.passwordStore.erase() self.passwordStore.erase()
self.navigationController!.popViewController(animated: true) self.navigationController!.popViewController(animated: true)
SVProgressHUD.showSuccess(withStatus: "Done".localize()) SVProgressHUD.showSuccess(withStatus: "Done".localize())
SVProgressHUD.dismiss(withDelay: 1) SVProgressHUD.dismiss(withDelay: 1)
})) }))
alert.addAction(UIAlertAction(title: "Dismiss".localize(), style: UIAlertActionStyle.cancel, handler:nil)) alert.addAction(UIAlertAction(title: "Dismiss".localize(), style: UIAlertAction.Style.cancel, handler:nil))
self.present(alert, animated: true, completion: nil) self.present(alert, animated: true, completion: nil)
} else if tableView.cellForRow(at: indexPath) == discardChangesTableViewCell { } else if tableView.cellForRow(at: indexPath) == discardChangesTableViewCell {
let alert = UIAlertController(title: "DiscardAllLocalChanges?".localize(), message: "DiscardExplanation.".localize(), preferredStyle: UIAlertControllerStyle.alert) let alert = UIAlertController(title: "DiscardAllLocalChanges?".localize(), message: "DiscardExplanation.".localize(), preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "DiscardAllLocalChanges".localize(), style: UIAlertActionStyle.destructive, handler: {[unowned self] (action) -> Void in alert.addAction(UIAlertAction(title: "DiscardAllLocalChanges".localize(), style: UIAlertAction.Style.destructive, handler: {[unowned self] (action) -> Void in
SVProgressHUD.show(withStatus: "Resetting...".localize()) SVProgressHUD.show(withStatus: "Resetting...".localize())
do { do {
let numberDiscarded = try self.passwordStore.reset() let numberDiscarded = try self.passwordStore.reset()
@ -72,7 +72,7 @@ class AdvancedSettingsTableViewController: UITableViewController {
} }
})) }))
alert.addAction(UIAlertAction(title: "Dismiss".localize(), style: UIAlertActionStyle.cancel, handler:nil)) alert.addAction(UIAlertAction(title: "Dismiss".localize(), style: UIAlertAction.Style.cancel, handler:nil))
self.present(alert, animated: true, completion: nil) self.present(alert, animated: true, completion: nil)
} }
} }

View file

@ -65,7 +65,7 @@ class BasicStaticTableViewController: UITableViewController, MFMailComposeViewCo
if let detailText = cellData[CellDataKey.detailText] as? String { if let detailText = cellData[CellDataKey.detailText] as? String {
cell?.detailTextLabel?.text = detailText cell?.detailTextLabel?.text = detailText
} }
if let accessoryType = cellData[CellDataKey.accessoryType] as? UITableViewCellAccessoryType { if let accessoryType = cellData[CellDataKey.accessoryType] as? UITableViewCell.AccessoryType {
cell?.accessoryType = accessoryType cell?.accessoryType = accessoryType
} else { } else {
cell?.accessoryType = .disclosureIndicator cell?.accessoryType = .disclosureIndicator

View file

@ -19,7 +19,7 @@ class CommitLogsTableViewController: UITableViewController {
NotificationCenter.default.addObserver(self, selector: #selector(updateCommitLogs), name: .passwordStoreUpdated, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(updateCommitLogs), name: .passwordStoreUpdated, object: nil)
commits = getCommitLogs() commits = getCommitLogs()
self.tableView.estimatedRowHeight = 50 self.tableView.estimatedRowHeight = 50
self.tableView.rowHeight = UITableViewAutomaticDimension self.tableView.rowHeight = UITableView.automaticDimension
} }
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

View file

@ -16,7 +16,7 @@ class GeneralSettingsTableViewController: BasicStaticTableViewController {
let uiSwitch = UISwitch() let uiSwitch = UISwitch()
uiSwitch.onTintColor = Globals.blue uiSwitch.onTintColor = Globals.blue
uiSwitch.sizeToFit() uiSwitch.sizeToFit()
uiSwitch.addTarget(self, action: #selector(hideUnknownSwitchAction(_:)), for: UIControlEvents.valueChanged) uiSwitch.addTarget(self, action: #selector(hideUnknownSwitchAction(_:)), for: UIControl.Event.valueChanged)
return uiSwitch return uiSwitch
}() }()
@ -24,7 +24,7 @@ class GeneralSettingsTableViewController: BasicStaticTableViewController {
let uiSwitch = UISwitch() let uiSwitch = UISwitch()
uiSwitch.onTintColor = Globals.blue uiSwitch.onTintColor = Globals.blue
uiSwitch.sizeToFit() uiSwitch.sizeToFit()
uiSwitch.addTarget(self, action: #selector(hideOTPSwitchAction(_:)), for: UIControlEvents.valueChanged) uiSwitch.addTarget(self, action: #selector(hideOTPSwitchAction(_:)), for: UIControl.Event.valueChanged)
return uiSwitch return uiSwitch
}() }()
@ -32,7 +32,7 @@ class GeneralSettingsTableViewController: BasicStaticTableViewController {
let uiSwitch = UISwitch() let uiSwitch = UISwitch()
uiSwitch.onTintColor = Globals.blue uiSwitch.onTintColor = Globals.blue
uiSwitch.sizeToFit() uiSwitch.sizeToFit()
uiSwitch.addTarget(self, action: #selector(rememberPGPPassphraseSwitchAction(_:)), for: UIControlEvents.valueChanged) uiSwitch.addTarget(self, action: #selector(rememberPGPPassphraseSwitchAction(_:)), for: UIControl.Event.valueChanged)
uiSwitch.isOn = SharedDefaults[.isRememberPGPPassphraseOn] uiSwitch.isOn = SharedDefaults[.isRememberPGPPassphraseOn]
return uiSwitch return uiSwitch
}() }()
@ -41,7 +41,7 @@ class GeneralSettingsTableViewController: BasicStaticTableViewController {
let uiSwitch = UISwitch() let uiSwitch = UISwitch()
uiSwitch.onTintColor = Globals.blue uiSwitch.onTintColor = Globals.blue
uiSwitch.sizeToFit() uiSwitch.sizeToFit()
uiSwitch.addTarget(self, action: #selector(rememberGitCredentialPassphraseSwitchAction(_:)), for: UIControlEvents.valueChanged) uiSwitch.addTarget(self, action: #selector(rememberGitCredentialPassphraseSwitchAction(_:)), for: UIControl.Event.valueChanged)
uiSwitch.isOn = SharedDefaults[.isRememberGitCredentialPassphraseOn] uiSwitch.isOn = SharedDefaults[.isRememberGitCredentialPassphraseOn]
return uiSwitch return uiSwitch
}() }()
@ -50,7 +50,7 @@ class GeneralSettingsTableViewController: BasicStaticTableViewController {
let uiSwitch = UISwitch() let uiSwitch = UISwitch()
uiSwitch.onTintColor = Globals.blue uiSwitch.onTintColor = Globals.blue
uiSwitch.sizeToFit() uiSwitch.sizeToFit()
uiSwitch.addTarget(self, action: #selector(showFolderSwitchAction(_:)), for: UIControlEvents.valueChanged) uiSwitch.addTarget(self, action: #selector(showFolderSwitchAction(_:)), for: UIControl.Event.valueChanged)
uiSwitch.isOn = SharedDefaults[.isShowFolderOn] uiSwitch.isOn = SharedDefaults[.isShowFolderOn]
return uiSwitch return uiSwitch
}() }()
@ -59,7 +59,7 @@ class GeneralSettingsTableViewController: BasicStaticTableViewController {
let uiSwitch = UISwitch() let uiSwitch = UISwitch()
uiSwitch.onTintColor = Globals.blue uiSwitch.onTintColor = Globals.blue
uiSwitch.sizeToFit() uiSwitch.sizeToFit()
uiSwitch.addTarget(self, action: #selector(hidePasswordImagesSwitchAction(_:)), for: UIControlEvents.valueChanged) uiSwitch.addTarget(self, action: #selector(hidePasswordImagesSwitchAction(_:)), for: UIControl.Event.valueChanged)
uiSwitch.isOn = SharedDefaults[.isHidePasswordImagesOn] uiSwitch.isOn = SharedDefaults[.isHidePasswordImagesOn]
return uiSwitch return uiSwitch
}() }()
@ -99,7 +99,7 @@ class GeneralSettingsTableViewController: BasicStaticTableViewController {
let detailButton = UIButton(type: .detailDisclosure) let detailButton = UIButton(type: .detailDisclosure)
hideUnknownSwitch.frame = CGRect(x: detailButton.bounds.width+10, y: 0, width: hideUnknownSwitch.bounds.width, height: hideUnknownSwitch.bounds.height) hideUnknownSwitch.frame = CGRect(x: detailButton.bounds.width+10, y: 0, width: hideUnknownSwitch.bounds.width, height: hideUnknownSwitch.bounds.height)
detailButton.frame = CGRect(x: 0, y: 5, width: detailButton.bounds.width, height: detailButton.bounds.height) detailButton.frame = CGRect(x: 0, y: 5, width: detailButton.bounds.width, height: detailButton.bounds.height)
detailButton.addTarget(self, action: #selector(GeneralSettingsTableViewController.tapHideUnknownSwitchDetailButton(_:)), for: UIControlEvents.touchDown) detailButton.addTarget(self, action: #selector(GeneralSettingsTableViewController.tapHideUnknownSwitchDetailButton(_:)), for: UIControl.Event.touchDown)
let accessoryView = UIView(frame: CGRect(x: 0, y: 0, width: detailButton.bounds.width + hideUnknownSwitch.bounds.width+10, height: hideUnknownSwitch.bounds.height)) let accessoryView = UIView(frame: CGRect(x: 0, y: 0, width: detailButton.bounds.width + hideUnknownSwitch.bounds.width+10, height: hideUnknownSwitch.bounds.height))
accessoryView.addSubview(detailButton) accessoryView.addSubview(detailButton)
accessoryView.addSubview(hideUnknownSwitch) accessoryView.addSubview(hideUnknownSwitch)
@ -111,7 +111,7 @@ class GeneralSettingsTableViewController: BasicStaticTableViewController {
let detailButton = UIButton(type: .detailDisclosure) let detailButton = UIButton(type: .detailDisclosure)
hideOTPSwitch.frame = CGRect(x: detailButton.bounds.width+10, y: 0, width: hideOTPSwitch.bounds.width, height: hideOTPSwitch.bounds.height) hideOTPSwitch.frame = CGRect(x: detailButton.bounds.width+10, y: 0, width: hideOTPSwitch.bounds.width, height: hideOTPSwitch.bounds.height)
detailButton.frame = CGRect(x: 0, y: 5, width: detailButton.bounds.width, height: detailButton.bounds.height) detailButton.frame = CGRect(x: 0, y: 5, width: detailButton.bounds.width, height: detailButton.bounds.height)
detailButton.addTarget(self, action: #selector(GeneralSettingsTableViewController.tapHideOTPSwitchDetailButton(_:)), for: UIControlEvents.touchDown) detailButton.addTarget(self, action: #selector(GeneralSettingsTableViewController.tapHideOTPSwitchDetailButton(_:)), for: UIControl.Event.touchDown)
let accessoryView = UIView(frame: CGRect(x: 0, y: 0, width: detailButton.bounds.width + hideOTPSwitch.bounds.width+10, height: hideOTPSwitch.bounds.height)) let accessoryView = UIView(frame: CGRect(x: 0, y: 0, width: detailButton.bounds.width + hideOTPSwitch.bounds.width+10, height: hideOTPSwitch.bounds.height))
accessoryView.addSubview(detailButton) accessoryView.addSubview(detailButton)
accessoryView.addSubview(hideOTPSwitch) accessoryView.addSubview(hideOTPSwitch)
@ -135,7 +135,7 @@ class GeneralSettingsTableViewController: BasicStaticTableViewController {
let detailButton = UIButton(type: .detailDisclosure) let detailButton = UIButton(type: .detailDisclosure)
hidePasswordImagesSwitch.frame = CGRect(x: detailButton.bounds.width+10, y: 0, width: hidePasswordImagesSwitch.bounds.width, height: hidePasswordImagesSwitch.bounds.height) hidePasswordImagesSwitch.frame = CGRect(x: detailButton.bounds.width+10, y: 0, width: hidePasswordImagesSwitch.bounds.width, height: hidePasswordImagesSwitch.bounds.height)
detailButton.frame = CGRect(x: 0, y: 5, width: detailButton.bounds.width, height: detailButton.bounds.height) detailButton.frame = CGRect(x: 0, y: 5, width: detailButton.bounds.width, height: detailButton.bounds.height)
detailButton.addTarget(self, action: #selector(GeneralSettingsTableViewController.tapHidePasswordImagesSwitchDetailButton(_:)), for: UIControlEvents.touchDown) detailButton.addTarget(self, action: #selector(GeneralSettingsTableViewController.tapHidePasswordImagesSwitchDetailButton(_:)), for: UIControl.Event.touchDown)
let accessoryView = UIView(frame: CGRect(x: 0, y: 0, width: detailButton.bounds.width + hidePasswordImagesSwitch.bounds.width+10, height: hidePasswordImagesSwitch.bounds.height)) let accessoryView = UIView(frame: CGRect(x: 0, y: 0, width: detailButton.bounds.width + hidePasswordImagesSwitch.bounds.width+10, height: hidePasswordImagesSwitch.bounds.height))
accessoryView.addSubview(detailButton) accessoryView.addSubview(detailButton)
accessoryView.addSubview(hidePasswordImagesSwitch) accessoryView.addSubview(hidePasswordImagesSwitch)

View file

@ -18,7 +18,7 @@ class GitConfigSettingTableViewController: UITableViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
tableView.rowHeight = UITableViewAutomaticDimension tableView.rowHeight = UITableView.automaticDimension
let signature = passwordStore.gitSignatureForNow let signature = passwordStore.gitSignatureForNow
nameTextField.placeholder = signature.name nameTextField.placeholder = signature.name

View file

@ -121,16 +121,16 @@ class GitServerSettingTableViewController: UITableViewController {
SharedDefaults[.gitBranchName] = branchName SharedDefaults[.gitBranchName] = branchName
SharedDefaults[.gitAuthenticationMethod] = auth SharedDefaults[.gitAuthenticationMethod] = auth
SVProgressHUD.dismiss() SVProgressHUD.dismiss()
let savePassphraseAlert = UIAlertController(title: "Done".localize(), message: "WantToSaveGitCredential?".localize(), preferredStyle: UIAlertControllerStyle.alert) let savePassphraseAlert = UIAlertController(title: "Done".localize(), message: "WantToSaveGitCredential?".localize(), preferredStyle: UIAlertController.Style.alert)
// no // no
savePassphraseAlert.addAction(UIAlertAction(title: "No".localize(), style: UIAlertActionStyle.default) { _ in savePassphraseAlert.addAction(UIAlertAction(title: "No".localize(), style: UIAlertAction.Style.default) { _ in
SharedDefaults[.isRememberGitCredentialPassphraseOn] = false SharedDefaults[.isRememberGitCredentialPassphraseOn] = false
self.passwordStore.gitPassword = nil self.passwordStore.gitPassword = nil
self.passwordStore.gitSSHPrivateKeyPassphrase = nil self.passwordStore.gitSSHPrivateKeyPassphrase = nil
self.performSegue(withIdentifier: "saveGitServerSettingSegue", sender: self) self.performSegue(withIdentifier: "saveGitServerSettingSegue", sender: self)
}) })
// yes // yes
savePassphraseAlert.addAction(UIAlertAction(title: "Yes".localize(), style: UIAlertActionStyle.destructive) {_ in savePassphraseAlert.addAction(UIAlertAction(title: "Yes".localize(), style: UIAlertAction.Style.destructive) {_ in
SharedDefaults[.isRememberGitCredentialPassphraseOn] = true SharedDefaults[.isRememberGitCredentialPassphraseOn] = true
self.performSegue(withIdentifier: "saveGitServerSettingSegue", sender: self) self.performSegue(withIdentifier: "saveGitServerSettingSegue", sender: self)
}) })
@ -195,12 +195,12 @@ class GitServerSettingTableViewController: UITableViewController {
} }
if passwordStore.repositoryExisted() { if passwordStore.repositoryExisted() {
let alert = UIAlertController(title: "Overwrite?".localize(), message: "OperationWillOverwriteData.".localize(), preferredStyle: UIAlertControllerStyle.alert) let alert = UIAlertController(title: "Overwrite?".localize(), message: "OperationWillOverwriteData.".localize(), preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "Overwrite".localize(), style: UIAlertActionStyle.destructive, handler: { _ in alert.addAction(UIAlertAction(title: "Overwrite".localize(), style: UIAlertAction.Style.destructive, handler: { _ in
// perform segue only after a successful clone // perform segue only after a successful clone
self.cloneAndSegueIfSuccess() self.cloneAndSegueIfSuccess()
})) }))
alert.addAction(UIAlertAction(title: "Cancel".localize(), style: UIAlertActionStyle.cancel, handler: nil)) alert.addAction(UIAlertAction(title: "Cancel".localize(), style: UIAlertAction.Style.cancel, handler: nil))
self.present(alert, animated: true, completion: nil) self.present(alert, animated: true, completion: nil)
} else { } else {
// perform segue only after a successful clone // perform segue only after a successful clone
@ -285,12 +285,12 @@ class GitServerSettingTableViewController: UITableViewController {
DispatchQueue.main.async { DispatchQueue.main.async {
SVProgressHUD.dismiss() SVProgressHUD.dismiss()
let alert = UIAlertController(title: "Password".localize(), message: message, preferredStyle: UIAlertControllerStyle.alert) let alert = UIAlertController(title: "Password".localize(), message: message, preferredStyle: UIAlertController.Style.alert)
alert.addTextField(configurationHandler: {(textField: UITextField!) in alert.addTextField(configurationHandler: {(textField: UITextField!) in
textField.text = lastPassword ?? "" textField.text = lastPassword ?? ""
textField.isSecureTextEntry = true textField.isSecureTextEntry = true
}) })
alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertActionStyle.default, handler: {_ in alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertAction.Style.default, handler: {_ in
password = alert.textFields!.first!.text password = alert.textFields!.first!.text
sem.signal() sem.signal()
})) }))

View file

@ -38,7 +38,7 @@ class OpenSourceComponentsTableViewController: BasicStaticTableViewController {
tableData.append([]) tableData.append([])
for item in openSourceComponents { for item in openSourceComponents {
tableData[0].append( tableData[0].append(
[CellDataKey.title: item[0], CellDataKey.action: "link", CellDataKey.link: item[1], CellDataKey.accessoryType: UITableViewCellAccessoryType.detailDisclosureButton, CellDataKey.detailDisclosureAction: #selector(actOnDetailDisclosureButton(_:)), CellDataKey.detailDisclosureData: item[2]] [CellDataKey.title: item[0], CellDataKey.action: "link", CellDataKey.link: item[1], CellDataKey.accessoryType: UITableViewCell.AccessoryType.detailDisclosureButton, CellDataKey.detailDisclosureAction: #selector(actOnDetailDisclosureButton(_:)), CellDataKey.detailDisclosureData: item[2]]
) )
} }
super.viewDidLoad() super.viewDidLoad()

View file

@ -114,18 +114,18 @@ class PGPKeyArmorSettingTableViewController: AutoCellHeightUITableViewController
Utils.alert(title: "CannotSave".localize(), message: "SetPrivateKey.".localize(), controller: self, completion: nil) Utils.alert(title: "CannotSave".localize(), message: "SetPrivateKey.".localize(), controller: self, completion: nil)
return return
} }
let savePassphraseAlert = UIAlertController(title: "Passphrase".localize(), message: "WantToSavePassphrase?".localize(), preferredStyle: UIAlertControllerStyle.alert) let savePassphraseAlert = UIAlertController(title: "Passphrase".localize(), message: "WantToSavePassphrase?".localize(), preferredStyle: UIAlertController.Style.alert)
// no // no
savePassphraseAlert.addAction(UIAlertAction(title: "No".localize(), style: UIAlertActionStyle.default) { _ in savePassphraseAlert.addAction(UIAlertAction(title: "No".localize(), style: UIAlertAction.Style.default) { _ in
self.pgpPassphrase = nil self.pgpPassphrase = nil
SharedDefaults[.isRememberPGPPassphraseOn] = false SharedDefaults[.isRememberPGPPassphraseOn] = false
self.performSegue(withIdentifier: "savePGPKeySegue", sender: self) self.performSegue(withIdentifier: "savePGPKeySegue", sender: self)
}) })
// yes // yes
savePassphraseAlert.addAction(UIAlertAction(title: "Yes".localize(), style: UIAlertActionStyle.destructive) {_ in savePassphraseAlert.addAction(UIAlertAction(title: "Yes".localize(), style: UIAlertAction.Style.destructive) {_ in
// ask for the passphrase // ask for the passphrase
let alert = UIAlertController(title: "Passphrase".localize(), message: "FillInPgpPassphrase.".localize(), preferredStyle: UIAlertControllerStyle.alert) let alert = UIAlertController(title: "Passphrase".localize(), message: "FillInPgpPassphrase.".localize(), preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertActionStyle.default, handler: {_ in alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertAction.Style.default, handler: {_ in
self.pgpPassphrase = alert.textFields?.first?.text self.pgpPassphrase = alert.textFields?.first?.text
SharedDefaults[.isRememberPGPPassphraseOn] = true SharedDefaults[.isRememberPGPPassphraseOn] = true
self.performSegue(withIdentifier: "savePGPKeySegue", sender: self) self.performSegue(withIdentifier: "savePGPKeySegue", sender: self)

View file

@ -40,18 +40,18 @@ class PGPKeySettingTableViewController: AutoCellHeightUITableViewController {
validatePGPKeyURL(input: pgpPrivateKeyURLTextField.text) == true else { validatePGPKeyURL(input: pgpPrivateKeyURLTextField.text) == true else {
return return
} }
let savePassphraseAlert = UIAlertController(title: "Passphrase".localize(), message: "WantToSavePassphrase?".localize(), preferredStyle: UIAlertControllerStyle.alert) let savePassphraseAlert = UIAlertController(title: "Passphrase".localize(), message: "WantToSavePassphrase?".localize(), preferredStyle: UIAlertController.Style.alert)
// no // no
savePassphraseAlert.addAction(UIAlertAction(title: "No".localize(), style: UIAlertActionStyle.default) { _ in savePassphraseAlert.addAction(UIAlertAction(title: "No".localize(), style: UIAlertAction.Style.default) { _ in
self.pgpPassphrase = nil self.pgpPassphrase = nil
SharedDefaults[.isRememberPGPPassphraseOn] = false SharedDefaults[.isRememberPGPPassphraseOn] = false
self.performSegue(withIdentifier: "savePGPKeySegue", sender: self) self.performSegue(withIdentifier: "savePGPKeySegue", sender: self)
}) })
// yes // yes
savePassphraseAlert.addAction(UIAlertAction(title: "Yes".localize(), style: UIAlertActionStyle.destructive) {_ in savePassphraseAlert.addAction(UIAlertAction(title: "Yes".localize(), style: UIAlertAction.Style.destructive) {_ in
// ask for the passphrase // ask for the passphrase
let alert = UIAlertController(title: "Passphrase".localize(), message: "FillInPgpPassphrase.".localize(), preferredStyle: UIAlertControllerStyle.alert) let alert = UIAlertController(title: "Passphrase".localize(), message: "FillInPgpPassphrase.".localize(), preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertActionStyle.default, handler: {_ in alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertAction.Style.default, handler: {_ in
self.pgpPassphrase = alert.textFields?.first?.text self.pgpPassphrase = alert.textFields?.first?.text
SharedDefaults[.isRememberPGPPassphraseOn] = true SharedDefaults[.isRememberPGPPassphraseOn] = true
self.performSegue(withIdentifier: "savePGPKeySegue", sender: self) self.performSegue(withIdentifier: "savePGPKeySegue", sender: self)

View file

@ -51,8 +51,8 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
tableView.addGestureRecognizer(tapGesture) tableView.addGestureRecognizer(tapGesture)
tapGesture.delegate = self tapGesture.delegate = self
tableView.contentInset = UIEdgeInsetsMake(-36, 0, 44, 0); tableView.contentInset = UIEdgeInsets.init(top: -36, left: 0, bottom: 44, right: 0);
tableView.rowHeight = UITableViewAutomaticDimension tableView.rowHeight = UITableView.automaticDimension
tableView.estimatedRowHeight = 52 tableView.estimatedRowHeight = 52
editUIBarButtonItem.isEnabled = false editUIBarButtonItem.isEnabled = false
@ -81,8 +81,8 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
override func viewDidAppear(_ animated: Bool) { override func viewDidAppear(_ animated: Bool) {
super.viewWillAppear(animated) super.viewWillAppear(animated)
if self.shouldPopCurrentView { if self.shouldPopCurrentView {
let alert = UIAlertController(title: "Notice".localize(), message: "PreviousChangesDiscarded.".localize(), preferredStyle: UIAlertControllerStyle.alert) let alert = UIAlertController(title: "Notice".localize(), message: "PreviousChangesDiscarded.".localize(), preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertActionStyle.default, handler: {_ in alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertAction.Style.default, handler: {_ in
_ = self.navigationController?.popViewController(animated: true) _ = self.navigationController?.popViewController(animated: true)
})) }))
self.present(alert, animated: true, completion: nil) self.present(alert, animated: true, completion: nil)
@ -93,8 +93,8 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
let sem = DispatchSemaphore(value: 0) let sem = DispatchSemaphore(value: 0)
var passphrase = "" var passphrase = ""
DispatchQueue.main.async { DispatchQueue.main.async {
let alert = UIAlertController(title: "Passphrase".localize(), message: "FillInPgpPassphrase.".localize(), preferredStyle: UIAlertControllerStyle.alert) let alert = UIAlertController(title: "Passphrase".localize(), message: "FillInPgpPassphrase.".localize(), preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertActionStyle.default, handler: {_ in alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertAction.Style.default, handler: {_ in
passphrase = alert.textFields!.first!.text! passphrase = alert.textFields!.first!.text!
sem.signal() sem.signal()
})) }))
@ -127,11 +127,11 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
// remove the wrong passphrase so that users could enter it next time // remove the wrong passphrase so that users could enter it next time
self.passwordStore.pgpKeyPassphrase = nil self.passwordStore.pgpKeyPassphrase = nil
// alert: cancel or try again // alert: cancel or try again
let alert = UIAlertController(title: "CannotShowPassword".localize(), message: error.localizedDescription, preferredStyle: UIAlertControllerStyle.alert) let alert = UIAlertController(title: "CannotShowPassword".localize(), message: error.localizedDescription, preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "Cancel".localize(), style: UIAlertActionStyle.default) { _ in alert.addAction(UIAlertAction(title: "Cancel".localize(), style: UIAlertAction.Style.default) { _ in
self.navigationController!.popViewController(animated: true) self.navigationController!.popViewController(animated: true)
}) })
alert.addAction(UIAlertAction(title: "TryAgain".localize(), style: UIAlertActionStyle.destructive) {_ in alert.addAction(UIAlertAction(title: "TryAgain".localize(), style: UIAlertAction.Style.destructive) {_ in
self.decryptThenShowPassword() self.decryptThenShowPassword()
}) })
self.present(alert, animated: true, completion: nil) self.present(alert, animated: true, completion: nil)
@ -301,8 +301,8 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
if case let .success(image) = result { if case let .success(image) = result {
let indexPath = IndexPath(row: 0, section: 0) let indexPath = IndexPath(row: 0, section: 0)
self?.passwordImage = image self?.passwordImage = image
self?.tableView.reloadRows(at: [indexPath], with: UITableViewRowAnimation.automatic) self?.tableView.reloadRows(at: [indexPath], with: UITableView.RowAnimation.automatic)
let imageData = UIImageJPEGRepresentation(image, 1) let imageData = image.jpegData(compressionQuality: 1)
if let entity = self?.passwordEntity { if let entity = self?.passwordEntity {
self?.passwordStore.updateImage(passwordEntity: entity, image: imageData) self?.passwordStore.updateImage(passwordEntity: entity, image: imageData)
} }
@ -311,7 +311,7 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
} }
@objc private func tapMenu(recognizer: UITapGestureRecognizer) { @objc private func tapMenu(recognizer: UITapGestureRecognizer) {
if recognizer.state == UIGestureRecognizerState.ended { if recognizer.state == UIGestureRecognizer.State.ended {
let tapLocation = recognizer.location(in: self.tableView) let tapLocation = recognizer.location(in: self.tableView)
if let tapIndexPath = self.tableView.indexPathForRow(at: tapLocation) { if let tapIndexPath = self.tableView.indexPathForRow(at: tapLocation) {
if let tappedCell = self.tableView.cellForRow(at: tapIndexPath) as? LabelTableViewCell { if let tappedCell = self.tableView.cellForRow(at: tapIndexPath) as? LabelTableViewCell {

View file

@ -75,9 +75,9 @@ class PasswordEditorTableViewController: UITableViewController, FillPasswordTabl
tableView.register(UINib(nibName: "FillPasswordTableViewCell", bundle: nil), forCellReuseIdentifier: "fillPasswordCell") tableView.register(UINib(nibName: "FillPasswordTableViewCell", bundle: nil), forCellReuseIdentifier: "fillPasswordCell")
tableView.register(UINib(nibName: "SliderTableViewCell", bundle: nil), forCellReuseIdentifier: "passwordLengthCell") tableView.register(UINib(nibName: "SliderTableViewCell", bundle: nil), forCellReuseIdentifier: "passwordLengthCell")
tableView.rowHeight = UITableViewAutomaticDimension tableView.rowHeight = UITableView.automaticDimension
tableView.estimatedRowHeight = 48 tableView.estimatedRowHeight = 48
self.tableView.sectionFooterHeight = UITableViewAutomaticDimension; self.tableView.sectionFooterHeight = UITableView.automaticDimension;
self.tableView.estimatedSectionFooterHeight = 0; self.tableView.estimatedSectionFooterHeight = 0;
} }
override func viewDidLayoutSubviews() { override func viewDidLayoutSubviews() {
@ -161,11 +161,11 @@ class PasswordEditorTableViewController: UITableViewController, FillPasswordTabl
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let selectedCell = tableView.cellForRow(at: indexPath) let selectedCell = tableView.cellForRow(at: indexPath)
if selectedCell == deletePasswordCell { if selectedCell == deletePasswordCell {
let alert = UIAlertController(title: "DeletePassword?".localize(), message: nil, preferredStyle: UIAlertControllerStyle.alert) let alert = UIAlertController(title: "DeletePassword?".localize(), message: nil, preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "Delete".localize(), style: UIAlertActionStyle.destructive, handler: {[unowned self] (action) -> Void in alert.addAction(UIAlertAction(title: "Delete".localize(), style: UIAlertAction.Style.destructive, handler: {[unowned self] (action) -> Void in
self.performSegue(withIdentifier: "deletePasswordSegue", sender: self) self.performSegue(withIdentifier: "deletePasswordSegue", sender: self)
})) }))
alert.addAction(UIAlertAction(title: "Cancel".localize(), style: UIAlertActionStyle.cancel, handler:nil)) alert.addAction(UIAlertAction(title: "Cancel".localize(), style: UIAlertAction.Style.cancel, handler:nil))
self.present(alert, animated: true, completion: nil) self.present(alert, animated: true, completion: nil)
} else if selectedCell == scanQRCodeCell { } else if selectedCell == scanQRCodeCell {
self.performSegue(withIdentifier: "showQRScannerSegue", sender: self) self.performSegue(withIdentifier: "showQRScannerSegue", sender: self)
@ -185,11 +185,11 @@ class PasswordEditorTableViewController: UITableViewController, FillPasswordTabl
// check whether the current password looks like an OTP field // check whether the current password looks like an OTP field
func generateAndCopyPassword() { func generateAndCopyPassword() {
if let currentPassword = fillPasswordCell?.getContent(), Constants.isOtpRelated(line: currentPassword) { if let currentPassword = fillPasswordCell?.getContent(), Constants.isOtpRelated(line: currentPassword) {
let alert = UIAlertController(title: "Overwrite?".localize(), message: "OverwriteOtpConfiguration?".localize(), preferredStyle: UIAlertControllerStyle.alert) let alert = UIAlertController(title: "Overwrite?".localize(), message: "OverwriteOtpConfiguration?".localize(), preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "Yes".localize(), style: UIAlertActionStyle.destructive, handler: {_ in alert.addAction(UIAlertAction(title: "Yes".localize(), style: UIAlertAction.Style.destructive, handler: {_ in
self.generateAndCopyPasswordNoOtpCheck() self.generateAndCopyPasswordNoOtpCheck()
})) }))
alert.addAction(UIAlertAction(title: "Cancel".localize(), style: UIAlertActionStyle.cancel, handler: nil)) alert.addAction(UIAlertAction(title: "Cancel".localize(), style: UIAlertAction.Style.cancel, handler: nil))
self.present(alert, animated: true, completion: nil) self.present(alert, animated: true, completion: nil)
} else { } else {
self.generateAndCopyPasswordNoOtpCheck() self.generateAndCopyPasswordNoOtpCheck()
@ -337,11 +337,11 @@ class PasswordEditorTableViewController: UITableViewController, FillPasswordTabl
let copiedLinesSplit = UIPasteboard.general.string?.components(separatedBy: CharacterSet.whitespacesAndNewlines).filter({ !$0.isEmpty }) let copiedLinesSplit = UIPasteboard.general.string?.components(separatedBy: CharacterSet.whitespacesAndNewlines).filter({ !$0.isEmpty })
if copiedLinesSplit?.count ?? 0 > 0 { if copiedLinesSplit?.count ?? 0 > 0 {
let generatedPassword = copiedLinesSplit![0] let generatedPassword = copiedLinesSplit![0]
let alert = UIAlertController(title: "WannaUseIt?".localize(), message: "", preferredStyle: UIAlertControllerStyle.alert) let alert = UIAlertController(title: "WannaUseIt?".localize(), message: "", preferredStyle: UIAlertController.Style.alert)
let message = NSMutableAttributedString(string: "\("SeemsLikeYouHaveCopiedSomething.".localize()) \("FirstStringIs:".localize())\n") let message = NSMutableAttributedString(string: "\("SeemsLikeYouHaveCopiedSomething.".localize()) \("FirstStringIs:".localize())\n")
message.append(Utils.attributedPassword(plainPassword: generatedPassword)) message.append(Utils.attributedPassword(plainPassword: generatedPassword))
alert.setValue(message, forKey: "attributedMessage") alert.setValue(message, forKey: "attributedMessage")
alert.addAction(UIAlertAction(title: "Yes", style: UIAlertActionStyle.default, handler: {[unowned self] (action) -> Void in alert.addAction(UIAlertAction(title: "Yes", style: UIAlertAction.Style.default, handler: {[unowned self] (action) -> Void in
// update tableData so to make sure reloadData() works correctly // update tableData so to make sure reloadData() works correctly
self.tableData[self.passwordSection][0][PasswordEditorCellKey.content] = generatedPassword self.tableData[self.passwordSection][0][PasswordEditorCellKey.content] = generatedPassword
// update cell manually, no need to call reloadData() // update cell manually, no need to call reloadData()
@ -349,7 +349,7 @@ class PasswordEditorTableViewController: UITableViewController, FillPasswordTabl
// make sure the clipboard gets cleared in 45s // make sure the clipboard gets cleared in 45s
SecurePasteboard.shared.copy(textToCopy: generatedPassword) SecurePasteboard.shared.copy(textToCopy: generatedPassword)
})) }))
alert.addAction(UIAlertAction(title: "Cancel".localize(), style: UIAlertActionStyle.cancel, handler:nil)) alert.addAction(UIAlertAction(title: "Cancel".localize(), style: UIAlertAction.Style.cancel, handler:nil))
self.present(alert, animated: true, completion: nil) self.present(alert, animated: true, completion: nil)
} }
} }

View file

@ -44,7 +44,7 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
}() }()
private lazy var syncControl: UIRefreshControl = { private lazy var syncControl: UIRefreshControl = {
let syncControl = UIRefreshControl() let syncControl = UIRefreshControl()
syncControl.addTarget(self, action: #selector(handleRefresh(_:)), for: UIControlEvents.valueChanged) syncControl.addTarget(self, action: #selector(handleRefresh(_:)), for: UIControl.Event.valueChanged)
return syncControl return syncControl
}() }()
private lazy var searchBarView: UIView? = { private lazy var searchBarView: UIView? = {
@ -62,21 +62,21 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
private lazy var transitionFromRight: CATransition = { private lazy var transitionFromRight: CATransition = {
let transition = CATransition() let transition = CATransition()
transition.type = kCATransitionPush transition.type = CATransitionType.push
transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
transition.fillMode = kCAFillModeForwards transition.fillMode = CAMediaTimingFillMode.forwards
transition.duration = 0.25 transition.duration = 0.25
transition.subtype = kCATransitionFromRight transition.subtype = CATransitionSubtype.fromRight
return transition return transition
}() }()
private lazy var transitionFromLeft: CATransition = { private lazy var transitionFromLeft: CATransition = {
let transition = CATransition() let transition = CATransition()
transition.type = kCATransitionPush transition.type = CATransitionType.push
transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
transition.fillMode = kCAFillModeForwards transition.fillMode = CAMediaTimingFillMode.forwards
transition.duration = 0.25 transition.duration = 0.25
transition.subtype = kCATransitionFromLeft transition.subtype = CATransitionSubtype.fromLeft
return transition return transition
}() }()
@ -213,7 +213,7 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
navigationItem.hidesSearchBarWhenScrolling = false navigationItem.hidesSearchBarWhenScrolling = false
} else { } else {
// Fallback on earlier versions // Fallback on earlier versions
tableView.contentInset = UIEdgeInsetsMake(44, 0, 0, 0) tableView.contentInset = UIEdgeInsets.init(top: 44, left: 0, bottom: 0, right: 0)
view.addSubview(searchBarView!) view.addSubview(searchBarView!)
} }
tableView.refreshControl = syncControl tableView.refreshControl = syncControl
@ -231,7 +231,7 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
// listen to the swipe back guesture // listen to the swipe back guesture
let swipeRight = UISwipeGestureRecognizer(target: self, action: #selector(self.respondToSwipeGesture)) let swipeRight = UISwipeGestureRecognizer(target: self, action: #selector(self.respondToSwipeGesture))
swipeRight.direction = UISwipeGestureRecognizerDirection.right swipeRight.direction = UISwipeGestureRecognizer.Direction.right
self.view.addGestureRecognizer(swipeRight) self.view.addGestureRecognizer(swipeRight)
} }
@ -337,7 +337,7 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
} }
@objc func longPressAction(_ gesture: UILongPressGestureRecognizer) { @objc func longPressAction(_ gesture: UILongPressGestureRecognizer) {
if gesture.state == UIGestureRecognizerState.began { if gesture.state == UIGestureRecognizer.State.began {
let touchPoint = gesture.location(in: tableView) let touchPoint = gesture.location(in: tableView)
if let indexPath = tableView.indexPathForRow(at: touchPoint) { if let indexPath = tableView.indexPathForRow(at: touchPoint) {
decryptThenCopyPassword(from: indexPath) decryptThenCopyPassword(from: indexPath)
@ -365,8 +365,8 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
let sem = DispatchSemaphore(value: 0) let sem = DispatchSemaphore(value: 0)
var passphrase = "" var passphrase = ""
DispatchQueue.main.async { DispatchQueue.main.async {
let alert = UIAlertController(title: "Passphrase".localize(), message: "FillInPgpPassphrase.".localize(), preferredStyle: UIAlertControllerStyle.alert) let alert = UIAlertController(title: "Passphrase".localize(), message: "FillInPgpPassphrase.".localize(), preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertActionStyle.default, handler: {_ in alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertAction.Style.default, handler: {_ in
passphrase = alert.textFields!.first!.text! passphrase = alert.textFields!.first!.text!
sem.signal() sem.signal()
})) }))
@ -620,12 +620,12 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
DispatchQueue.main.async { DispatchQueue.main.async {
SVProgressHUD.dismiss() SVProgressHUD.dismiss()
let alert = UIAlertController(title: "Password".localize(), message: message, preferredStyle: UIAlertControllerStyle.alert) let alert = UIAlertController(title: "Password".localize(), message: message, preferredStyle: UIAlertController.Style.alert)
alert.addTextField(configurationHandler: {(textField: UITextField!) in alert.addTextField(configurationHandler: {(textField: UITextField!) in
textField.text = lastPassword ?? "" textField.text = lastPassword ?? ""
textField.isSecureTextEntry = true textField.isSecureTextEntry = true
}) })
alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertActionStyle.default, handler: {_ in alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertAction.Style.default, handler: {_ in
password = alert.textFields!.first!.text password = alert.textFields!.first!.text
sem.signal() sem.signal()
})) }))

View file

@ -68,7 +68,7 @@ class QRScannerController: UIViewController, AVCaptureMetadataOutputObjectsDeleg
// Move the message label to the front // Move the message label to the front
scannerOutput.layer.cornerRadius = 10 scannerOutput.layer.cornerRadius = 10
scannerOutput.text = "NoQrCodeDetected.".localize() scannerOutput.text = "NoQrCodeDetected.".localize()
view.bringSubview(toFront: scannerOutput) view.bringSubviewToFront(scannerOutput)
// Initialize QR Code Frame to highlight the QR code // Initialize QR Code Frame to highlight the QR code
qrCodeFrameView = UIView() qrCodeFrameView = UIView()
@ -77,7 +77,7 @@ class QRScannerController: UIViewController, AVCaptureMetadataOutputObjectsDeleg
qrCodeFrameView.layer.borderColor = UIColor.green.cgColor qrCodeFrameView.layer.borderColor = UIColor.green.cgColor
qrCodeFrameView.layer.borderWidth = 2 qrCodeFrameView.layer.borderWidth = 2
view.addSubview(qrCodeFrameView) view.addSubview(qrCodeFrameView)
view.bringSubview(toFront: qrCodeFrameView) view.bringSubviewToFront(qrCodeFrameView)
} }
} catch { } catch {
@ -135,7 +135,7 @@ class QRScannerController: UIViewController, AVCaptureMetadataOutputObjectsDeleg
preferredStyle: .alert) preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "Cancel".localize(), style: .default)) alertController.addAction(UIAlertAction(title: "Cancel".localize(), style: .default))
alertController.addAction(UIAlertAction(title: "Settings".localize(), style: .cancel) { _ in alertController.addAction(UIAlertAction(title: "Settings".localize(), style: .cancel) { _ in
if let url = URL(string: UIApplicationOpenSettingsURLString) { if let url = URL(string: UIApplication.openSettingsURLString) {
UIApplication.shared.open(url, options: [:], completionHandler: { _ in UIApplication.shared.open(url, options: [:], completionHandler: { _ in
// Handle // Handle
}) })

View file

@ -201,18 +201,18 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele
fileActionTitle.append(" (\("Import".localize()))") fileActionTitle.append(" (\("Import".localize()))")
let fileAction = UIAlertAction(title: fileActionTitle, style: .default) { _ in let fileAction = UIAlertAction(title: fileActionTitle, style: .default) { _ in
// passphrase related // passphrase related
let savePassphraseAlert = UIAlertController(title: "Passphrase".localize(), message: "WantToSavePassphrase?".localize(), preferredStyle: UIAlertControllerStyle.alert) let savePassphraseAlert = UIAlertController(title: "Passphrase".localize(), message: "WantToSavePassphrase?".localize(), preferredStyle: UIAlertController.Style.alert)
// no // no
savePassphraseAlert.addAction(UIAlertAction(title: "No".localize(), style: UIAlertActionStyle.default) { _ in savePassphraseAlert.addAction(UIAlertAction(title: "No".localize(), style: UIAlertAction.Style.default) { _ in
self.passwordStore.pgpKeyPassphrase = nil self.passwordStore.pgpKeyPassphrase = nil
SharedDefaults[.isRememberPGPPassphraseOn] = false SharedDefaults[.isRememberPGPPassphraseOn] = false
self.saveImportedPGPKey() self.saveImportedPGPKey()
}) })
// yes // yes
savePassphraseAlert.addAction(UIAlertAction(title: "Yes".localize(), style: UIAlertActionStyle.destructive) {_ in savePassphraseAlert.addAction(UIAlertAction(title: "Yes".localize(), style: UIAlertAction.Style.destructive) {_ in
// ask for the passphrase // ask for the passphrase
let alert = UIAlertController(title: "Passphrase".localize(), message: "FillInPgpPassphrase.".localize(), preferredStyle: UIAlertControllerStyle.alert) let alert = UIAlertController(title: "Passphrase".localize(), message: "FillInPgpPassphrase.".localize(), preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertActionStyle.default, handler: {_ in alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertAction.Style.default, handler: {_ in
self.passwordStore.pgpKeyPassphrase = alert.textFields?.first?.text self.passwordStore.pgpKeyPassphrase = alert.textFields?.first?.text
SharedDefaults[.isRememberPGPPassphraseOn] = true SharedDefaults[.isRememberPGPPassphraseOn] = true
self.saveImportedPGPKey() self.saveImportedPGPKey()
@ -296,12 +296,12 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele
setPasscodeLockAlert?.addTextField(configurationHandler: {(_ textField: UITextField) -> Void in setPasscodeLockAlert?.addTextField(configurationHandler: {(_ textField: UITextField) -> Void in
textField.placeholder = "Passcode".localize() textField.placeholder = "Passcode".localize()
textField.isSecureTextEntry = true textField.isSecureTextEntry = true
textField.addTarget(self, action: #selector(self.alertTextFieldDidChange(_:)), for: UIControlEvents.editingChanged) textField.addTarget(self, action: #selector(self.alertTextFieldDidChange(_:)), for: UIControl.Event.editingChanged)
}) })
setPasscodeLockAlert?.addTextField(configurationHandler: {(_ textField: UITextField) -> Void in setPasscodeLockAlert?.addTextField(configurationHandler: {(_ textField: UITextField) -> Void in
textField.placeholder = "PasswordConfirmation".localize() textField.placeholder = "PasswordConfirmation".localize()
textField.isSecureTextEntry = true textField.isSecureTextEntry = true
textField.addTarget(self, action: #selector(self.alertTextFieldDidChange(_:)), for: UIControlEvents.editingChanged) textField.addTarget(self, action: #selector(self.alertTextFieldDidChange(_:)), for: UIControl.Event.editingChanged)
}) })
// save action // save action

View file

@ -11,7 +11,7 @@ import UIKit
class SecurePasteboard { class SecurePasteboard {
public static let shared = SecurePasteboard() public static let shared = SecurePasteboard()
private var backgroundTaskID = UIBackgroundTaskInvalid private var backgroundTaskID = UIBackgroundTaskIdentifier.invalid
func copy(textToCopy: String?, expirationTime: Double = 45) { func copy(textToCopy: String?, expirationTime: Double = 45) {
// copy to the pasteboard // copy to the pasteboard
@ -23,21 +23,21 @@ class SecurePasteboard {
} }
// exit the existing background task, if any // exit the existing background task, if any
if backgroundTaskID != UIBackgroundTaskInvalid { if backgroundTaskID != UIBackgroundTaskIdentifier.invalid {
UIApplication.shared.endBackgroundTask(UIBackgroundTaskInvalid) UIApplication.shared.endBackgroundTask(UIBackgroundTaskIdentifier.invalid)
self.backgroundTaskID = UIBackgroundTaskInvalid self.backgroundTaskID = UIBackgroundTaskIdentifier.invalid
} }
backgroundTaskID = UIApplication.shared.beginBackgroundTask(expirationHandler: { [weak self] in backgroundTaskID = UIApplication.shared.beginBackgroundTask(expirationHandler: { [weak self] in
UIPasteboard.general.string = "" UIPasteboard.general.string = ""
UIApplication.shared.endBackgroundTask(UIBackgroundTaskInvalid) UIApplication.shared.endBackgroundTask(UIBackgroundTaskIdentifier.invalid)
self?.backgroundTaskID = UIBackgroundTaskInvalid self?.backgroundTaskID = UIBackgroundTaskIdentifier.invalid
}) })
DispatchQueue.global(qos: .utility).asyncAfter(deadline: .now() + expirationTime) { [weak self] in DispatchQueue.global(qos: .utility).asyncAfter(deadline: .now() + expirationTime) { [weak self] in
UIPasteboard.general.string = "" UIPasteboard.general.string = ""
UIApplication.shared.endBackgroundTask(UIBackgroundTaskInvalid) UIApplication.shared.endBackgroundTask(UIBackgroundTaskIdentifier.invalid)
self?.backgroundTaskID = UIBackgroundTaskInvalid self?.backgroundTaskID = UIBackgroundTaskIdentifier.invalid
} }
} }

View file

@ -13,8 +13,8 @@ import passKit
extension Utils { extension Utils {
static func alert(title: String, message: String, controller: UIViewController, handler: ((UIAlertAction) -> Void)? = nil, completion: (() -> Void)? = nil) { static func alert(title: String, message: String, controller: UIViewController, handler: ((UIAlertAction) -> Void)? = nil, completion: (() -> Void)? = nil) {
SVProgressHUD.dismiss() SVProgressHUD.dismiss()
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert) let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertActionStyle.default, handler: handler)) alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertAction.Style.default, handler: handler))
controller.present(alert, animated: true, completion: completion) controller.present(alert, animated: true, completion: completion)
} }
} }

View file

@ -12,6 +12,6 @@ class AutoCellHeightUITableViewController: UITableViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
tableView.estimatedRowHeight = 170 tableView.estimatedRowHeight = 170
tableView.rowHeight = UITableViewAutomaticDimension tableView.rowHeight = UITableView.automaticDimension
} }
} }

View file

@ -166,8 +166,8 @@ class LabelTableViewCell: UITableViewCell {
passwordDisplayButton!.frame = CGRect(x: 0, y: 0, width: width, height: height) passwordDisplayButton!.frame = CGRect(x: 0, y: 0, width: width, height: height)
passwordDisplayButton!.setImage(#imageLiteral(resourceName: "Visible"), for: .normal) passwordDisplayButton!.setImage(#imageLiteral(resourceName: "Visible"), for: .normal)
passwordDisplayButton!.imageView?.contentMode = .scaleAspectFit passwordDisplayButton!.imageView?.contentMode = .scaleAspectFit
passwordDisplayButton!.contentEdgeInsets = UIEdgeInsetsMake(marginY, marginX, marginY, marginX) passwordDisplayButton!.contentEdgeInsets = UIEdgeInsets.init(top: marginY, left: marginX, bottom: marginY, right: marginX)
passwordDisplayButton!.addTarget(self, action: #selector(reversePasswordDisplay), for: UIControlEvents.touchUpInside) passwordDisplayButton!.addTarget(self, action: #selector(reversePasswordDisplay), for: UIControl.Event.touchUpInside)
buttons = passwordDisplayButton buttons = passwordDisplayButton
} }
case .HOTP: case .HOTP:
@ -176,8 +176,8 @@ class LabelTableViewCell: UITableViewCell {
nextButton.frame = CGRect(x: 0, y: 0, width: width, height: height) nextButton.frame = CGRect(x: 0, y: 0, width: width, height: height)
nextButton.setImage(#imageLiteral(resourceName: "Refresh"), for: .normal) nextButton.setImage(#imageLiteral(resourceName: "Refresh"), for: .normal)
nextButton.imageView?.contentMode = .scaleAspectFit nextButton.imageView?.contentMode = .scaleAspectFit
nextButton.contentEdgeInsets = UIEdgeInsetsMake(marginY, marginX, marginY, marginX) nextButton.contentEdgeInsets = UIEdgeInsets.init(top: marginY, left: marginX, bottom: marginY, right: marginX)
nextButton.addTarget(self, action: #selector(getNextHOTP), for: UIControlEvents.touchUpInside) nextButton.addTarget(self, action: #selector(getNextHOTP), for: UIControl.Event.touchUpInside)
// password button // password button
passwordDisplayButton = UIButton(type: .system) passwordDisplayButton = UIButton(type: .system)
@ -185,8 +185,8 @@ class LabelTableViewCell: UITableViewCell {
passwordDisplayButton!.setImage(#imageLiteral(resourceName: "Visible"), for: .normal) passwordDisplayButton!.setImage(#imageLiteral(resourceName: "Visible"), for: .normal)
passwordDisplayButton!.imageView?.contentMode = .scaleAspectFit passwordDisplayButton!.imageView?.contentMode = .scaleAspectFit
passwordDisplayButton!.contentEdgeInsets = UIEdgeInsetsMake(marginY, marginX, marginY, marginX) passwordDisplayButton!.contentEdgeInsets = UIEdgeInsets.init(top: marginY, left: marginX, bottom: marginY, right: marginX)
passwordDisplayButton!.addTarget(self, action: #selector(reversePasswordDisplay), for: UIControlEvents.touchUpInside) passwordDisplayButton!.addTarget(self, action: #selector(reversePasswordDisplay), for: UIControl.Event.touchUpInside)
buttons = UIView() buttons = UIView()
buttons!.frame = CGRect(x: 0, y: 0, width: width * 2, height: height) buttons!.frame = CGRect(x: 0, y: 0, width: width * 2, height: height)

View file

@ -214,8 +214,8 @@ class ExtensionViewController: UIViewController, UITableViewDataSource, UITableV
let sem = DispatchSemaphore(value: 0) let sem = DispatchSemaphore(value: 0)
var passphrase = "" var passphrase = ""
DispatchQueue.main.async { DispatchQueue.main.async {
let alert = UIAlertController(title: "Passphrase".localize(), message: "FillInPgpPassphrase.".localize(), preferredStyle: UIAlertControllerStyle.alert) let alert = UIAlertController(title: "Passphrase".localize(), message: "FillInPgpPassphrase.".localize(), preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertActionStyle.default, handler: {_ in alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertAction.Style.default, handler: {_ in
passphrase = alert.textFields!.first!.text! passphrase = alert.textFields!.first!.text!
sem.signal() sem.signal()
})) }))

View file

@ -47,8 +47,8 @@ open class PasscodeLockPresenter {
} }
fileprivate func moveWindowsToFront(windowLevel: CGFloat?) { fileprivate func moveWindowsToFront(windowLevel: CGFloat?) {
let windowLevel = windowLevel ?? UIWindowLevelNormal let windowLevel = windowLevel ?? UIWindow.Level.normal.rawValue
let maxWinLevel = max(windowLevel, UIWindowLevelNormal) let maxWinLevel = max(windowLevel, UIWindow.Level.normal.rawValue)
passcodeLockWindow?.windowLevel = maxWinLevel + 1 passcodeLockWindow?.windowLevel = UIWindow.Level(rawValue: maxWinLevel + 1)
} }
} }

View file

@ -47,12 +47,12 @@ open class PasscodeLockViewController: UIViewController, UITextFieldDelegate {
self.passcodeWrongAttemptsLabel = passcodeWrongAttemptsLabel self.passcodeWrongAttemptsLabel = passcodeWrongAttemptsLabel
let passcodeTextField = UITextField(frame: CGRect(x: 0, y: 0, width: 300, height: 40)) let passcodeTextField = UITextField(frame: CGRect(x: 0, y: 0, width: 300, height: 40))
passcodeTextField.borderStyle = UITextBorderStyle.roundedRect passcodeTextField.borderStyle = UITextField.BorderStyle.roundedRect
passcodeTextField.placeholder = "Passcode".localize() passcodeTextField.placeholder = "Passcode".localize()
passcodeTextField.isSecureTextEntry = true passcodeTextField.isSecureTextEntry = true
passcodeTextField.clearButtonMode = UITextFieldViewMode.whileEditing passcodeTextField.clearButtonMode = UITextField.ViewMode.whileEditing
passcodeTextField.delegate = self passcodeTextField.delegate = self
passcodeTextField.addTarget(self, action: #selector(self.passcodeTextFieldDidChange(_:)), for: UIControlEvents.editingChanged) passcodeTextField.addTarget(self, action: #selector(self.passcodeTextFieldDidChange(_:)), for: UIControl.Event.editingChanged)
self.view.backgroundColor = UIColor.white self.view.backgroundColor = UIColor.white
passcodeTextField.translatesAutoresizingMaskIntoConstraints = false passcodeTextField.translatesAutoresizingMaskIntoConstraints = false
self.view.addSubview(passcodeTextField) self.view.addSubview(passcodeTextField)
@ -88,7 +88,7 @@ open class PasscodeLockViewController: UIViewController, UITextFieldDelegate {
cancelButton.addTarget(self, action: #selector(passcodeLockDidCancel), for: .touchUpInside) cancelButton.addTarget(self, action: #selector(passcodeLockDidCancel), for: .touchUpInside)
cancelButton.isHidden = !self.isCancellable cancelButton.isHidden = !self.isCancellable
cancelButton.translatesAutoresizingMaskIntoConstraints = false cancelButton.translatesAutoresizingMaskIntoConstraints = false
cancelButton.contentHorizontalAlignment = UIControlContentHorizontalAlignment.left cancelButton.contentHorizontalAlignment = UIControl.ContentHorizontalAlignment.left
self.view.addSubview(cancelButton) self.view.addSubview(cancelButton)
self.cancelButton = cancelButton self.cancelButton = cancelButton

View file

@ -13,7 +13,7 @@ import KeychainAccess
public class Utils { public class Utils {
public static func getPasswordFromKeychain(name: String) -> String? { public static func getPasswordFromKeychain(name: String) -> String? {
let keychain = Keychain(service: Globals.bundleIdentifier, accessGroup: Globals.groupIdentifier) let keychain = Keychain(service: Globals.bundleIdentifier, accessGroup: Globals.groupIdentifier)
return (try? keychain.getString(name)) ?? nil return try? keychain.getString(name)
} }
public static func addPasswordToKeychain(name: String, password: String?) { public static func addPasswordToKeychain(name: String, password: String?) {
@ -49,14 +49,14 @@ public class Utils {
} else { } else {
charColor = Globals.letterColor charColor = Globals.letterColor
} }
attributedPassword.addAttribute(NSAttributedStringKey.foregroundColor, value: charColor, range: NSRange(location: index, length: 1)) attributedPassword.addAttribute(NSAttributedString.Key.foregroundColor, value: charColor, range: NSRange(location: index, length: 1))
} }
return attributedPassword return attributedPassword
} }
public static func alert(title: String, message: String, controller: UIViewController, handler: ((UIAlertAction) -> Void)? = nil, completion: (() -> Void)? = nil) { public static func alert(title: String, message: String, controller: UIViewController, handler: ((UIAlertAction) -> Void)? = nil, completion: (() -> Void)? = nil) {
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert) let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertActionStyle.default, handler: handler)) alert.addAction(UIAlertAction(title: "Ok".localize(), style: UIAlertAction.Style.default, handler: handler))
controller.present(alert, animated: true, completion: completion) controller.present(alert, animated: true, completion: completion)
} }
} }

View file

@ -109,7 +109,7 @@ public class PasswordStore {
} }
public var numberOfLocalCommits: Int? { public var numberOfLocalCommits: Int? {
return (try? getLocalCommits())?.flatMap { $0.count } return (try? getLocalCommits())?.count
} }
public var lastSyncedTime: Date? { public var lastSyncedTime: Date? {