diff --git a/enzevalos_iphone/DataHandler.swift b/enzevalos_iphone/DataHandler.swift index d222f8e16ae92cd288e722611bca82e4474040c9..a0e4e1819e5fb11bc7930ab943099572dd5aab0a 100644 --- a/enzevalos_iphone/DataHandler.swift +++ b/enzevalos_iphone/DataHandler.swift @@ -261,20 +261,14 @@ class DataHandler { func deleteSecretKeys() { let keys = findSecretKeys() let pgp = SwiftPGP() - let adr = UserManager.loadUserValue(Attribute.userAddr) as! String pgp.deleteSecretKeys() - for key in keys { - //let keyID = key.keyID! if let mails = key.decryptedMails as? Set<PersistentMail> { for mail in mails { mail.decryptedKey = nil } } - delete(key: key) - //seems to be unnecassary, because there already exists a corresponding pubilc key, if we generated a keypair - //_ = DataHandler.handler.newPublicKey(keyID: keyID, cryptoType: .PGP, adr: adr, autocrypt: false, newGenerated: false) } } @@ -302,7 +296,6 @@ class DataHandler { } // Save, load, search - func newSecretKey(keyID: String, addPk: Bool, saveKey: Bool = true) -> SecretKey { let sk: SecretKey if let key = findSecretKey(keyID: keyID) { @@ -993,7 +986,6 @@ class DataHandler { } func deleteDecryptedMailCopies() { - let secureRecords = getAllKeyRecords().filter({ $0.hasKey }) let secureMails = getAllPersistentMails().filter({ $0.isSecure }) for mail in secureMails { mail.decryptedBody = nil diff --git a/enzevalos_iphone/IntroSecretViewController.swift b/enzevalos_iphone/IntroSecretViewController.swift index eef0a8a99d516f84c9ad64099a2b509cd9565469..2e890ac224fae62da21a2d35c59fe6e02a17b994 100644 --- a/enzevalos_iphone/IntroSecretViewController.swift +++ b/enzevalos_iphone/IntroSecretViewController.swift @@ -73,7 +73,7 @@ class IntroSecretViewController: UIViewController, IntroInfoButton { super.viewDidLoad() descriptionLabel.text = descriptionText secretLabel.text = secretText - if let navigationController = navigationController { + if navigationController != nil { self.navigationItem.setRightBarButton(UIBarButtonItem(title: doneText, style: .plain, target: self, action: #selector(doneTapped(_:))), animated: true) } getButton().addTarget(self, action: #selector(titleTapped(sender:)), for: .touchUpInside) diff --git a/enzevalos_iphone/MailHandler.swift b/enzevalos_iphone/MailHandler.swift index d9b422ca1c6fcfdce0543a3323abe46405dfb0d2..f05f7bcffc97e67cd8c97e74d87a3d2230813370 100644 --- a/enzevalos_iphone/MailHandler.swift +++ b/enzevalos_iphone/MailHandler.swift @@ -867,22 +867,6 @@ class MailHandler { } private func parseSecretKey(attachment: MCOAttachment) -> [String]? { - if let content = attachment.decodedString() { -// if content.contains("-----BEGIN PGP PRIVATE KEY BLOCK-----") { -// if let start = content.range(of: "-----BEGIN PGP PRIVATE KEY BLOCK-----"), -// let end = content.range(of: "-----END PGP PRIVATE KEY BLOCK-----") { -// let s = start.lowerBound -// let e = end.upperBound -// let sk = String(content[s..<e]) -// return sk -// } -// } - } else if attachment.mimeType == "application/pgp-keys" { - let pgp = SwiftPGP() - if let keyIds = try? pgp.importKeys(data: attachment.data, pw: nil, secret: true) { - return keyIds - } - } return nil } diff --git a/enzevalos_iphone/NSLayoutConstraintExtension.swift b/enzevalos_iphone/NSLayoutConstraintExtension.swift index 7d4acd7423d6a5297f4d908a5f5915271e789e52..e1dd715f89e532555278bae9dcccad81db8c33dc 100644 --- a/enzevalos_iphone/NSLayoutConstraintExtension.swift +++ b/enzevalos_iphone/NSLayoutConstraintExtension.swift @@ -11,6 +11,6 @@ import Foundation //inspired by https://stackoverflow.com/questions/37294522/ios-change-the-multiplier-of-constraint-by-swift extension NSLayoutConstraint { func constraintWithMultiplier(_ multiplier: CGFloat) -> NSLayoutConstraint { - return NSLayoutConstraint(item: self.firstItem, attribute: self.firstAttribute, relatedBy: self.relation, toItem: self.secondItem, attribute: self.secondAttribute, multiplier: multiplier, constant: self.constant) + return NSLayoutConstraint(item: self.firstItem as Any, attribute: self.firstAttribute, relatedBy: self.relation, toItem: self.secondItem, attribute: self.secondAttribute, multiplier: multiplier, constant: self.constant) } } diff --git a/enzevalos_iphone/SendViewController.swift b/enzevalos_iphone/SendViewController.swift index 5f32fd47c3c9e823d3992a70666517d8a011f846..a60f2f1a9a6dc89b1e448f3fa2ae73aa632e5518 100644 --- a/enzevalos_iphone/SendViewController.swift +++ b/enzevalos_iphone/SendViewController.swift @@ -360,7 +360,6 @@ class SendViewController: UIViewController { if let controller = navigationController?.topViewController as? SendViewController { controller.invite = true var to = [MailAddress]() - var cc = [MailAddress]() for mail in contactsWithRepealedKeys { to.append(DataHandler.handler.getMailAddress(mail, temporary: false)) }