From 5c1f02cc7659a5927aabe6b6ffcae9acabd15493 Mon Sep 17 00:00:00 2001 From: Joscha <joscha@virtual-artz.de> Date: Tue, 19 Dec 2017 17:39:12 +0100 Subject: [PATCH] Two bugfixes: don't show not decrypt-able mails as trouble; crashing force unwrap --- enzevalos_iphone/ContactViewController.swift | 2 +- enzevalos_iphone/DataHandler.swift | 4 ++-- enzevalos_iphone/SwiftPGP.swift | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/enzevalos_iphone/ContactViewController.swift b/enzevalos_iphone/ContactViewController.swift index f5c1ef0e..707c72dc 100644 --- a/enzevalos_iphone/ContactViewController.swift +++ b/enzevalos_iphone/ContactViewController.swift @@ -343,7 +343,7 @@ extension ContactViewController: UITableViewDataSource { return cell case 4 where !keyRecord.hasKey: let cell = tableView.dequeueReusableCell(withIdentifier: "KeyCell", for: indexPath) - cell.textLabel?.text = "abc" + cell.textLabel?.text = "abc" // @jakob: ?? return cell case 4 where keyRecord.hasKey: let cell = tableView.dequeueReusableCell(withIdentifier: "RecordCell", for: indexPath) as! RecordCell diff --git a/enzevalos_iphone/DataHandler.swift b/enzevalos_iphone/DataHandler.swift index 01b82cf2..5da14025 100644 --- a/enzevalos_iphone/DataHandler.swift +++ b/enzevalos_iphone/DataHandler.swift @@ -362,8 +362,8 @@ class DataHandler { sk.obsolete = false sk.importedDate = Date () as NSDate UserManager.storeUserValue(keyID as AnyObject, attribute: Attribute.prefSecretKeyID) - let name = UserManager.loadUserValue(Attribute.accountname) as! String let adr = UserManager.loadUserValue(Attribute.userAddr) as! String + let name = UserManager.loadUserValue(Attribute.accountname) as? String ?? adr _ = getContact(name: name, address: adr, key: keyID, prefer_enc: true) } save(during: "new sk") @@ -768,7 +768,7 @@ class DataHandler { case EncryptionState.UnableToDecrypt: mail.unableToDecrypt = true mail.isEncrypted = true - mail.trouble = true + mail.trouble = false //TODO @jakob: we should discuss this case EncryptionState.ValidEncryptedWithOldKey, EncryptionState.ValidedEncryptedWithCurrentKey: mail.isEncrypted = true mail.trouble = false diff --git a/enzevalos_iphone/SwiftPGP.swift b/enzevalos_iphone/SwiftPGP.swift index b39376db..f206e89a 100644 --- a/enzevalos_iphone/SwiftPGP.swift +++ b/enzevalos_iphone/SwiftPGP.swift @@ -317,7 +317,7 @@ class SwiftPGP: Encryption{ } }catch{ encState = EncryptionState.UnableToDecrypt - sigState = SignatureState.InvalidSignature + sigState = SignatureState.NoSignature break } } -- GitLab