Skip to content
Snippets Groups Projects
Commit 1407d0d3 authored by cruxfilm's avatar cruxfilm
Browse files

Mailbot wants [] argument but has nil. Might have to resolve later during merge.

parent 4ed61100
No related branches found
No related tags found
1 merge request!74Integration of new ComposeView
......@@ -22,7 +22,7 @@ class Mailbot {
static let welcomeBodyDE =
"""
"""
Liebe Nutzerin, lieber Nutzer von Letterbox,
Ich bin Lette, der Letterbox-Mailbot. Wir freuen uns, dass du dich für unsere App entschieden hast. Magst du mir gleich auf die E-Mail antworten? Dann kannst du gleich erfahren, wie einfach es ist sichere Mails zu schreiben. Du und ich wissen dann das es bei dir auch klappt.
......@@ -37,7 +37,7 @@ class Mailbot {
static let welcomeBodyEn =
"""
"""
Hi,
Thank you for using and testing our app! This is an automatically generated email and you can reply and test how to write a confidential mail. Our bot will reply and you can get an idea about confidential communication. We look forward to receiving your feedback!
......@@ -77,11 +77,45 @@ class Mailbot {
}
let user = AddressProperties(email: email)
var pkproperty: PublicKeyProperties? = nil
if let addrRecord = PersistentDataProvider.dataProvider.generateFetchedAddresesWithKeyResultsController(addresses: [senderAdr]).fetchedObjects?.first, let key = addrRecord.primaryKey {
pkproperty = PublicKeyProperties(fingerprint: key.keyID, cryptoProtocol: key.type, origin: Origin(rawValue: key.origin) ?? Origin.FileTransfer, preferEncryption: AutocryptState.find(i: Int(key.preferEncryption)), lastSeenInAutocryptHeader: key.lastSeenInAutocryptHeader, lastSeenSignedMail: key.lastSeenSignedMail, secretKeyProperty: nil, usedAddresses: [sender])
if let addrRecord = PersistentDataProvider.dataProvider.generateFetchedAddresesWithKeyResultsController(
addresses: [senderAdr]).fetchedObjects?.first,
let key = addrRecord.primaryKey {
pkproperty = PublicKeyProperties(
fingerprint: key.keyID,
cryptoProtocol: key.type,
origin: Origin(rawValue: key.origin) ?? Origin.FileTransfer,
preferEncryption: AutocryptState.find(i: Int(key.preferEncryption)),
lastSeenInAutocryptHeader: key.lastSeenInAutocryptHeader,
lastSeenSignedMail: key.lastSeenSignedMail,
secretKeyProperty: nil,
usedAddresses: [sender])
}
let mail = MailProperties(messageID: UUID().uuidString, subject: subject, date: Date(), flags: 0, from: sender, to: [user], cc: [], bcc: [], folder: FolderProperties(delimiter: nil, uidValidity: nil, lastUpdate: nil, maxUID: nil, minUID: nil, path: UserManager.backendInboxFolderPath, parent: nil, children: nil), body: body, attachments: [], signatureState: SignatureState.ValidSignature.rawValue, encryptionState: EncryptionState.ValidedEncryptedWithCurrentKey.rawValue, signatureKey: pkproperty, decryptionKey: nil, autocryptHeaderKey: nil, attachedPublicKeys: [], attachedSecretKeys: [])
let mail = MailProperties(
messageID: UUID().uuidString,
subject: subject, date: Date(),
flags: 0,
from: sender,
to: [user],
cc: [],
bcc: [],
folder: FolderProperties(
delimiter: nil,
uidValidity: nil,
lastUpdate: nil,
maxUID: nil,
minUID: nil,
path: UserManager.backendInboxFolderPath,
parent: nil, children: nil),
body: body,
attachments: [],
signatureState: SignatureState.ValidSignature.rawValue,
encryptionState: EncryptionState.ValidedEncryptedWithCurrentKey.rawValue,
signatureKey: pkproperty,
decryptionKey: nil,
autocryptHeaderKey: nil,
attachedPublicKeys: [],
attachedSecretKeys: [])
PersistentDataProvider.dataProvider.importNewData(from: [mail], completionHandler: {error in })
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment