Remove unused elements (#530)

This commit is contained in:
Danny Moesch 2021-12-31 07:35:17 +01:00 committed by GitHub
parent ff6a1edf62
commit 819371f55e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 9 additions and 111 deletions

View file

@ -203,7 +203,6 @@
DCFB77A31E500D9C008DE471 /* PasswordDetailTitleTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = DCFB77A21E500D9C008DE471 /* PasswordDetailTitleTableViewCell.xib */; }; DCFB77A31E500D9C008DE471 /* PasswordDetailTitleTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = DCFB77A21E500D9C008DE471 /* PasswordDetailTitleTableViewCell.xib */; };
DCFB77A71E502DF9008DE471 /* EditPasswordTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCFB77A61E502DF9008DE471 /* EditPasswordTableViewController.swift */; }; DCFB77A71E502DF9008DE471 /* EditPasswordTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCFB77A61E502DF9008DE471 /* EditPasswordTableViewController.swift */; };
DCFB77A91E502FF6008DE471 /* PasswordEditorTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCFB77A81E502FF6008DE471 /* PasswordEditorTableViewController.swift */; }; DCFB77A91E502FF6008DE471 /* PasswordEditorTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCFB77A81E502FF6008DE471 /* PasswordEditorTableViewController.swift */; };
DCFB77AB1E503729008DE471 /* ContentProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCFB77AA1E503729008DE471 /* ContentProvider.swift */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */ /* Begin PBXContainerItemProxy section */
@ -491,7 +490,6 @@
DCFB77A21E500D9C008DE471 /* PasswordDetailTitleTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PasswordDetailTitleTableViewCell.xib; sourceTree = "<group>"; }; DCFB77A21E500D9C008DE471 /* PasswordDetailTitleTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PasswordDetailTitleTableViewCell.xib; sourceTree = "<group>"; };
DCFB77A61E502DF9008DE471 /* EditPasswordTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EditPasswordTableViewController.swift; sourceTree = "<group>"; }; DCFB77A61E502DF9008DE471 /* EditPasswordTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EditPasswordTableViewController.swift; sourceTree = "<group>"; };
DCFB77A81E502FF6008DE471 /* PasswordEditorTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasswordEditorTableViewController.swift; sourceTree = "<group>"; }; DCFB77A81E502FF6008DE471 /* PasswordEditorTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasswordEditorTableViewController.swift; sourceTree = "<group>"; };
DCFB77AA1E503729008DE471 /* ContentProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentProvider.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
@ -955,7 +953,6 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
9A8F9EE1259EDD520027CE15 /* PasswordTableViewCell.swift */, 9A8F9EE1259EDD520027CE15 /* PasswordTableViewCell.swift */,
DCFB77AA1E503729008DE471 /* ContentProvider.swift */,
DCFB779C1E4F40C7008DE471 /* FillPasswordTableViewCell.swift */, DCFB779C1E4F40C7008DE471 /* FillPasswordTableViewCell.swift */,
DCFB779D1E4F40C7008DE471 /* FillPasswordTableViewCell.xib */, DCFB779D1E4F40C7008DE471 /* FillPasswordTableViewCell.xib */,
DC4914941E434301007FF592 /* LabelTableViewCell.swift */, DC4914941E434301007FF592 /* LabelTableViewCell.swift */,
@ -1603,7 +1600,6 @@
9AFC87E225B3B5C6008D6060 /* PasswordNavigationDataSource.swift in Sources */, 9AFC87E225B3B5C6008D6060 /* PasswordNavigationDataSource.swift in Sources */,
30650E7123F82AF8005CCD5E /* SSHKeyFileImportTableViewController.swift in Sources */, 30650E7123F82AF8005CCD5E /* SSHKeyFileImportTableViewController.swift in Sources */,
DC193FFA1E49B4430077E0A3 /* AdvancedSettingsTableViewController.swift in Sources */, DC193FFA1E49B4430077E0A3 /* AdvancedSettingsTableViewController.swift in Sources */,
DCFB77AB1E503729008DE471 /* ContentProvider.swift in Sources */,
9AFC880025B51EC3008D6060 /* PasswordEncryptor.swift in Sources */, 9AFC880025B51EC3008D6060 /* PasswordEncryptor.swift in Sources */,
DCA0499C1E3362F400522E8F /* PGPKeyURLImportTableViewController.swift in Sources */, DCA0499C1E3362F400522E8F /* PGPKeyURLImportTableViewController.swift in Sources */,
DC4914961E434301007FF592 /* LabelTableViewCell.swift in Sources */, DC4914961E434301007FF592 /* LabelTableViewCell.swift in Sources */,

View file

@ -11,16 +11,12 @@ import passKit
import SafariServices import SafariServices
import UIKit import UIKit
enum CellDataType {
case link, segue, empty, detail
}
enum CellDataStyle { enum CellDataStyle {
case value1, defaultStyle case value1, defaultStyle
} }
enum CellDataKey { enum CellDataKey {
case style, type, title, link, accessoryType, detailDisclosureAction, detailDisclosureData, detailText, action case style, title, link, accessoryType, detailDisclosureAction, detailDisclosureData, detailText, action
} }
class BasicStaticTableViewController: UITableViewController, MFMailComposeViewControllerDelegate { class BasicStaticTableViewController: UITableViewController, MFMailComposeViewControllerDelegate {

View file

@ -10,8 +10,6 @@ import passKit
protocol PGPKeyImporter: KeyImporter { protocol PGPKeyImporter: KeyImporter {
func doAfterImport() func doAfterImport()
func saveImportedKeys()
} }
extension PGPKeyImporter { extension PGPKeyImporter {

View file

@ -18,7 +18,6 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
private var oneTimePasswordIndexPath: IndexPath? private var oneTimePasswordIndexPath: IndexPath?
private var shouldPopCurrentView = false private var shouldPopCurrentView = false
private let passwordStore = PasswordStore.shared private let passwordStore = PasswordStore.shared
private let keychain = AppKeychain.shared
private lazy var editUIBarButtonItem: UIBarButtonItem = { private lazy var editUIBarButtonItem: UIBarButtonItem = {
let uiBarButtonItem = UIBarButtonItem(barButtonSystemItem: .edit, target: self, action: #selector(pressEdit)) let uiBarButtonItem = UIBarButtonItem(barButtonSystemItem: .edit, target: self, action: #selector(pressEdit))

View file

@ -26,7 +26,7 @@ enum PasswordEditorCellType: Equatable {
} }
enum PasswordEditorCellKey { enum PasswordEditorCellKey {
case type, title, content, placeholders case type, title, content
} }
protocol PasswordSettingSliderTableViewCellDelegate: AnyObject { protocol PasswordSettingSliderTableViewCellDelegate: AnyObject {

View file

@ -13,7 +13,6 @@ class SSHKeyArmorImportTableViewController: AutoCellHeightUITableViewController,
@IBOutlet var armorPrivateKeyTextView: UITextView! @IBOutlet var armorPrivateKeyTextView: UITextView!
@IBOutlet var scanPrivateKeyCell: UITableViewCell! @IBOutlet var scanPrivateKeyCell: UITableViewCell!
private var gitSSHPrivateKeyPassphrase: String?
private var armorPrivateKey: String? private var armorPrivateKey: String?
private var scanner = QRKeyScanner(keyType: .sshPrivate) private var scanner = QRKeyScanner(keyType: .sshPrivate)

View file

@ -17,7 +17,6 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele
@IBOutlet var passwordRepositoryTableViewCell: UITableViewCell! @IBOutlet var passwordRepositoryTableViewCell: UITableViewCell!
var setPasscodeLockAlert: UIAlertController? var setPasscodeLockAlert: UIAlertController?
let passwordStore = PasswordStore.shared
let keychain = AppKeychain.shared let keychain = AppKeychain.shared
var passcodeLock = PasscodeLock.shared var passcodeLock = PasscodeLock.shared

View file

@ -6,11 +6,10 @@
// Copyright © 2017 Bob Sun. All rights reserved. // Copyright © 2017 Bob Sun. All rights reserved.
// //
import Foundation
import UIKit import UIKit
public class SecurePasteboard { class SecurePasteboard {
public static let shared = SecurePasteboard() static let shared = SecurePasteboard()
private var backgroundTaskID = UIBackgroundTaskIdentifier.invalid private var backgroundTaskID = UIBackgroundTaskIdentifier.invalid

View file

@ -1,12 +0,0 @@
//
// ContentProvider.swift
// pass
//
// Created by Mingshen Sun on 12/2/2017.
// Copyright © 2017 Bob Sun. All rights reserved.
//
protocol ContentProvider {
func getContent() -> String?
func setContent(content: String?)
}

View file

@ -14,7 +14,7 @@ protocol FillPasswordTableViewCellDelegate: AnyObject {
func showHidePasswordSettings() func showHidePasswordSettings()
} }
class FillPasswordTableViewCell: UITableViewCell, ContentProvider { class FillPasswordTableViewCell: UITableViewCell {
@IBOutlet var contentTextField: UITextField! @IBOutlet var contentTextField: UITextField!
@IBOutlet var settingButton: UIButton! @IBOutlet var settingButton: UIButton!
@IBOutlet var generateButton: UIButton! @IBOutlet var generateButton: UIButton!

View file

@ -65,11 +65,3 @@ class SliderTableViewCell: UITableViewCell {
return self return self
} }
} }
extension SliderTableViewCell: ContentProvider {
func getContent() -> String? {
nil
}
func setContent(content _: String?) {}
}

View file

@ -8,7 +8,7 @@
import UIKit import UIKit
class TextFieldTableViewCell: UITableViewCell, ContentProvider { class TextFieldTableViewCell: UITableViewCell {
@IBOutlet var contentTextField: UITextField! @IBOutlet var contentTextField: UITextField!
func getContent() -> String? { func getContent() -> String? {

View file

@ -8,7 +8,7 @@
import UIKit import UIKit
class TextViewTableViewCell: UITableViewCell, ContentProvider { class TextViewTableViewCell: UITableViewCell {
@IBOutlet var contentTextView: UITextView! @IBOutlet var contentTextView: UITextView!
override func awakeFromNib() { override func awakeFromNib() {

View file

@ -59,7 +59,6 @@
"RandomString" = "Zufällige Zeichenkette"; "RandomString" = "Zufällige Zeichenkette";
"ApplesKeychainStyle" = "Apples Keychain-Style"; "ApplesKeychainStyle" = "Apples Keychain-Style";
"XKCD" = "XKCD"; "XKCD" = "XKCD";
"XKCDStyle" = "XKCD-Style";
// Git // Git
"FailedToFetchPasswords" = "Abrufen von Passwörtern fehlgeschlagen"; "FailedToFetchPasswords" = "Abrufen von Passwörtern fehlgeschlagen";

View file

@ -59,7 +59,6 @@
"RandomString" = "Random String"; "RandomString" = "Random String";
"ApplesKeychainStyle" = "Apple's Keychain Style"; "ApplesKeychainStyle" = "Apple's Keychain Style";
"XKCD" = "XKCD"; "XKCD" = "XKCD";
"XKCDStyle" = "XKCD Style";
// Git // Git
"FailedToFetchPasswords" = "Failed to fetch passwords"; "FailedToFetchPasswords" = "Failed to fetch passwords";

View file

@ -10,10 +10,8 @@ import passKit
class PasscodeExtensionDisplay { class PasscodeExtensionDisplay {
private let passcodeLockVC: PasscodeLockViewControllerForExtension private let passcodeLockVC: PasscodeLockViewControllerForExtension
private let extensionContext: NSExtensionContext?
init(extensionContext: NSExtensionContext) { init(extensionContext: NSExtensionContext) {
self.extensionContext = extensionContext
self.passcodeLockVC = PasscodeLockViewControllerForExtension(extensionContext: extensionContext) self.passcodeLockVC = PasscodeLockViewControllerForExtension(extensionContext: extensionContext)
passcodeLockVC.setCancellable(true) passcodeLockVC.setCancellable(true)
} }

View file

@ -21,18 +21,4 @@ enum PassExtensionKey {
static let usernameKey = "username" static let usernameKey = "username"
static let passwordKey = "password" static let passwordKey = "password"
static let totpKey = "totp" static let totpKey = "totp"
static let titleKey = "login_title"
static let notesKey = "notes"
static let sectionTitleKey = "section_title"
static let fieldsKey = "fields"
static let returnedFieldsKey = "returned_fields"
static let oldPasswordKey = "old_password"
static let passwordGeneratorOptionsKey = "password_generator_options"
// Password Generator options
static let generatedPasswordMinLengthKey = "password_min_length"
static let generatedPasswordMaxLengthKey = "password_max_length"
static let generatedPasswordRequireDigitsKey = "password_require_digits"
static let generatedPasswordRequireSymbolsKey = "password_require_symbols"
static let generatedPasswordForbiddenCharactersKey = "password_forbidden_characters"
} }

View file

@ -18,7 +18,6 @@ open class PasscodeLockViewController: UIViewController, UITextFieldDelegate {
weak var passcodeTextField: UITextField? weak var passcodeTextField: UITextField?
weak var biometryAuthButton: UIButton? weak var biometryAuthButton: UIButton?
weak var forgotPasscodeButton: UIButton?
open weak var cancelButton: UIButton? open weak var cancelButton: UIButton?
var isCancellable = false var isCancellable = false
@ -73,7 +72,6 @@ open class PasscodeLockViewController: UIViewController, UITextFieldDelegate {
forgotPasscodeButton.isHidden = isCancellable forgotPasscodeButton.isHidden = isCancellable
forgotPasscodeButton.translatesAutoresizingMaskIntoConstraints = false forgotPasscodeButton.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(forgotPasscodeButton) view.addSubview(forgotPasscodeButton)
self.forgotPasscodeButton = forgotPasscodeButton
let cancelButton = UIButton(type: .custom) let cancelButton = UIButton(type: .custom)
cancelButton.setTitle("Cancel".localize(), for: .normal) cancelButton.setTitle("Cancel".localize(), for: .normal)

View file

@ -9,9 +9,6 @@
import ObjectivePGP import ObjectivePGP
struct ObjectivePGPInterface: PGPInterface { struct ObjectivePGPInterface: PGPInterface {
private let publicKey: Key
private let privateKey: Key
private let keyring = ObjectivePGP.defaultKeyring private let keyring = ObjectivePGP.defaultKeyring
init(publicArmoredKey: String, privateArmoredKey: String) throws { init(publicArmoredKey: String, privateArmoredKey: String) throws {
@ -22,11 +19,9 @@ struct ObjectivePGPInterface: PGPInterface {
let privateKeys = try ObjectivePGP.readKeys(from: privateKeyData) let privateKeys = try ObjectivePGP.readKeys(from: privateKeyData)
keyring.import(keys: publicKeys) keyring.import(keys: publicKeys)
keyring.import(keys: privateKeys) keyring.import(keys: privateKeys)
guard let publicKey = publicKeys.first, let privateKey = privateKeys.first else { guard publicKeys.first != nil, privateKeys.first != nil else {
throw AppError.keyImport throw AppError.keyImport
} }
self.publicKey = publicKey
self.privateKey = privateKey
} }
func decrypt(encryptedData: Data, keyID _: String?, passphrase: String) throws -> Data? { func decrypt(encryptedData: Data, keyID _: String?, passphrase: String) throws -> Data? {

View file

@ -16,7 +16,6 @@ public enum AppError: Error, Equatable {
case gitReset case gitReset
case gitCreateSignature case gitCreateSignature
case gitPushNotSuccessful case gitPushNotSuccessful
case passwordEntity
case pgpPublicKeyNotFound(keyID: String) case pgpPublicKeyNotFound(keyID: String)
case pgpPrivateKeyNotFound(keyID: String) case pgpPrivateKeyNotFound(keyID: String)
case keyExpiredOrIncompatible case keyExpiredOrIncompatible

View file

@ -15,10 +15,6 @@ public class AppKeychain: KeyStore {
.accessibility(.whenUnlockedThisDeviceOnly) .accessibility(.whenUnlockedThisDeviceOnly)
.synchronizable(false) .synchronizable(false)
public func add(data: Data?, for key: String) {
keychain[data: key] = data
}
public func add(string: String?, for key: String) { public func add(string: String?, for key: String) {
keychain[key] = string keychain[key] = string
} }
@ -27,10 +23,6 @@ public class AppKeychain: KeyStore {
(try? keychain.contains(key)) ?? false (try? keychain.contains(key)) ?? false
} }
public func get(for key: String) -> Data? {
try? keychain.getData(key)
}
public func get(for key: String) -> String? { public func get(for key: String) -> String? {
try? keychain.getString(key) try? keychain.getString(key)
} }

View file

@ -44,8 +44,6 @@ public extension DefaultsKeys {
var lastSyncedTime: DefaultsKey<Date?> { .init("lastSyncedTime") } var lastSyncedTime: DefaultsKey<Date?> { .init("lastSyncedTime") }
var isTouchIDOn: DefaultsKey<Bool> { .init("isTouchIDOn", defaultValue: false) }
var isHideUnknownOn: DefaultsKey<Bool> { .init("isHideUnknownOn", defaultValue: false) } var isHideUnknownOn: DefaultsKey<Bool> { .init("isHideUnknownOn", defaultValue: false) }
var isHideOTPOn: DefaultsKey<Bool> { .init("isHideOTPOn", defaultValue: false) } var isHideOTPOn: DefaultsKey<Bool> { .init("isHideOTPOn", defaultValue: false) }
var isRememberPGPPassphraseOn: DefaultsKey<Bool> { .init("isRememberPGPPassphraseOn", defaultValue: false) } var isRememberPGPPassphraseOn: DefaultsKey<Bool> { .init("isRememberPGPPassphraseOn", defaultValue: false) }

View file

@ -27,7 +27,6 @@ public final class Globals {
public static let pgpPublicKeyPath = documentPath + "/gpg_key.pub" public static let pgpPublicKeyPath = documentPath + "/gpg_key.pub"
public static let pgpPrivateKeyPath = documentPath + "/gpg_key" public static let pgpPrivateKeyPath = documentPath + "/gpg_key"
public static let gitSSHPrivateKeyPath = documentPath + "/ssh_key" public static let gitSSHPrivateKeyPath = documentPath + "/ssh_key"
public static let gitSSHPrivateKeyURL = URL(fileURLWithPath: gitSSHPrivateKeyPath)
public static let repositoryPath = libraryPath + "/password-store" public static let repositoryPath = libraryPath + "/password-store"
public static let dbPath = documentPath + "/pass.sqlite" public static let dbPath = documentPath + "/pass.sqlite"

View file

@ -9,10 +9,8 @@
import Foundation import Foundation
public protocol KeyStore { public protocol KeyStore {
func add(data: Data?, for key: String)
func add(string: String?, for key: String) func add(string: String?, for key: String)
func contains(key: String) -> Bool func contains(key: String) -> Bool
func get(for key: String) -> Data?
func get(for key: String) -> String? func get(for key: String) -> String?
func removeContent(for key: String) func removeContent(for key: String)
func removeAllContent() func removeAllContent()

View file

@ -150,16 +150,6 @@ public class PasswordStore {
} }
} }
public func passwordEntityExisted(path: String) -> Bool {
let passwordEntityFetchRequest = NSFetchRequest<NSFetchRequestResult>(entityName: "PasswordEntity")
do {
passwordEntityFetchRequest.predicate = NSPredicate(format: "path = %@", path)
return try context.count(for: passwordEntityFetchRequest) > 0
} catch {
fatalError("FailedToFetchPasswordEntities".localize(error))
}
}
public func getPasswordEntity(by path: String, isDir: Bool) -> PasswordEntity? { public func getPasswordEntity(by path: String, isDir: Bool) -> PasswordEntity? {
let passwordEntityFetchRequest = NSFetchRequest<NSFetchRequestResult>(entityName: "PasswordEntity") let passwordEntityFetchRequest = NSFetchRequest<NSFetchRequestResult>(entityName: "PasswordEntity")
do { do {
@ -383,8 +373,6 @@ public class PasswordStore {
return Self.dateFormatter.string(from: lastCommitDate) return Self.dateFormatter.string(from: lastCommitDate)
} }
public func updateRemoteRepo() {}
private func gitAdd(path: String) throws { private func gitAdd(path: String) throws {
guard let storeRepository = storeRepository else { guard let storeRepository = storeRepository else {
throw AppError.repositoryNotSet throw AppError.repositoryNotSet
@ -738,7 +726,7 @@ public class PasswordStore {
} }
} }
public func findGPGID(from url: URL) -> String { func findGPGID(from url: URL) -> String {
var path = url var path = url
while !FileManager.default.fileExists(atPath: path.appendingPathComponent(".gpg-id").path), while !FileManager.default.fileExists(atPath: path.appendingPathComponent(".gpg-id").path),
path.path != "file:///" { path.path != "file:///" {

View file

@ -16,15 +16,6 @@ public enum PasswordGeneratorFlavor: String {
rawValue.localize() rawValue.localize()
} }
public var longNameLocalized: String {
switch self {
case .random:
return "RandomString".localize()
case .xkcd:
return "XKCDStyle".localize()
}
}
public var lengthLimits: LengthLimits { public var lengthLimits: LengthLimits {
switch self { switch self {
case .random: case .random:

View file

@ -12,10 +12,6 @@ import passKit
class DictBasedKeychain: KeyStore { class DictBasedKeychain: KeyStore {
private var store: [String: Any] = [:] private var store: [String: Any] = [:]
func add(data: Data?, for key: String) {
store[key] = data
}
func add(string: String?, for key: String) { func add(string: String?, for key: String) {
store[key] = string store[key] = string
} }
@ -24,10 +20,6 @@ class DictBasedKeychain: KeyStore {
store[key] != nil store[key] != nil
} }
func get(for key: String) -> Data? {
store[key] as? Data
}
func get(for key: String) -> String? { func get(for key: String) -> String? {
store[key] as? String store[key] as? String
} }