diff --git a/enzevalos_iphone.xcodeproj/project.pbxproj b/enzevalos_iphone.xcodeproj/project.pbxproj index e773f8170c7782874ea0853af43b3f981653153a..0b6b17842c63a7b245cb230af9efb064a48e7fbd 100644 --- a/enzevalos_iphone.xcodeproj/project.pbxproj +++ b/enzevalos_iphone.xcodeproj/project.pbxproj @@ -62,6 +62,8 @@ 4733B206252B16D100AB5600 /* FolderRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4733B205252B16D100AB5600 /* FolderRecord.swift */; }; 47358D92244A5AEA000116D7 /* SelectableTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47358D91244A5AEA000116D7 /* SelectableTextView.swift */; }; 474054982244D7A9007CF83B /* MailServerConfigurationTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 474054972244D7A9007CF83B /* MailServerConfigurationTest.swift */; }; + 4750BDBC25399D8200F6D5AB /* AddressRecord+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4750BDBA25399D8200F6D5AB /* AddressRecord+CoreDataClass.swift */; }; + 4750BDBD25399D8200F6D5AB /* AddressRecord+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4750BDBB25399D8200F6D5AB /* AddressRecord+CoreDataProperties.swift */; }; 4751C6EE233CA583006B2A4D /* DateExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4751C6ED233CA583006B2A4D /* DateExtension.swift */; }; 4756DE0E20402F8E00452288 /* invitationTextCensor.html in Resources */ = {isa = PBXBuildFile; fileRef = 4756DE0D20402F8E00452288 /* invitationTextCensor.html */; }; 475B00331F7B9565006CDD41 /* SwiftPGP.swift in Sources */ = {isa = PBXBuildFile; fileRef = 475B00301F7B9565006CDD41 /* SwiftPGP.swift */; }; @@ -301,6 +303,8 @@ 4733B205252B16D100AB5600 /* FolderRecord.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FolderRecord.swift; sourceTree = "<group>"; }; 47358D91244A5AEA000116D7 /* SelectableTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectableTextView.swift; sourceTree = "<group>"; }; 474054972244D7A9007CF83B /* MailServerConfigurationTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MailServerConfigurationTest.swift; sourceTree = "<group>"; }; + 4750BDBA25399D8200F6D5AB /* AddressRecord+CoreDataClass.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "AddressRecord+CoreDataClass.swift"; sourceTree = "<group>"; }; + 4750BDBB25399D8200F6D5AB /* AddressRecord+CoreDataProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "AddressRecord+CoreDataProperties.swift"; sourceTree = "<group>"; }; 4751C6ED233CA583006B2A4D /* DateExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateExtension.swift; sourceTree = "<group>"; }; 4756DE0D20402F8E00452288 /* invitationTextCensor.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = invitationTextCensor.html; path = Invitation/invitationTextCensor.html; sourceTree = "<group>"; }; 475B00301F7B9565006CDD41 /* SwiftPGP.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftPGP.swift; sourceTree = "<group>"; }; @@ -747,6 +751,15 @@ name = protocols; sourceTree = "<group>"; }; + 4750BDB925399D7A00F6D5AB /* records */ = { + isa = PBXGroup; + children = ( + 4750BDBA25399D8200F6D5AB /* AddressRecord+CoreDataClass.swift */, + 4750BDBB25399D8200F6D5AB /* AddressRecord+CoreDataProperties.swift */, + ); + name = records; + sourceTree = "<group>"; + }; 476403FA2413F95300C7D426 /* OpenSSL */ = { isa = PBXGroup; children = ( @@ -1141,6 +1154,7 @@ 47FAE3052524AA30005A1BCB /* persistentData */ = { isa = PBXGroup; children = ( + 4750BDB925399D7A00F6D5AB /* records */, 47FAE30C2524AA97005A1BCB /* DataModel.xcdatamodeld */, 47FAE3112524BFDB005A1BCB /* PersistentDataError.swift */, 47FAE31B2524C07B005A1BCB /* MailRecord.swift */, @@ -1833,11 +1847,13 @@ 47A5D6E42294BFF50084F81D /* Logger.swift in Sources */, 3EB4FAA420120096001D0625 /* DialogOption.swift in Sources */, F14239C11F30A99C00998A83 /* QRCodeGenerator.swift in Sources */, + 4750BDBD25399D8200F6D5AB /* AddressRecord+CoreDataProperties.swift in Sources */, 4764069C2416B54D00C7D426 /* VCSwiftUIView.swift in Sources */, 478154A921FF3FF400A931EC /* Invitation.swift in Sources */, 4733B1E52527196100AB5600 /* PersistentDataProvider.swift in Sources */, F1866C86201F707200B72453 /* EmailHelper.m in Sources */, 476142081E07E52B00FD5E4F /* Theme.swift in Sources */, + 4750BDBC25399D8200F6D5AB /* AddressRecord+CoreDataClass.swift in Sources */, 476801DB218436B600F7F259 /* Autocrypt.swift in Sources */, 4751C6EE233CA583006B2A4D /* DateExtension.swift in Sources */, 47FAE31C2524C07B005A1BCB /* MailRecord.swift in Sources */, diff --git a/enzevalos_iphone/AddressHandler.swift b/enzevalos_iphone/AddressHandler.swift index 299c8a61a88bdd91a654495e5fa012b58a2886eb..42531c1ff3466f38cb4b9b5c80e42d6d4a6f82ee 100644 --- a/enzevalos_iphone/AddressHandler.swift +++ b/enzevalos_iphone/AddressHandler.swift @@ -252,7 +252,7 @@ class AddressHandler { for email in result.emailAddresses { for adr in addresses { let adrRest = email.value as String - if adrRest.lowercased() == adr.mailAddress.lowercased() { + if adrRest.lowercased() == adr.email.lowercased() { return true } } @@ -268,7 +268,7 @@ class AddressHandler { do { try AppDelegate.getAppDelegate().contactStore.enumerateContacts(with: fetchRequest, usingBlock: { (contact, _) in for addr in mailaddreses { - let contains = Set(contact.emailAddresses.map({ $0.value as String })).contains(addr.mailAddress) + let contains = Set(contact.emailAddresses.map({ $0.value as String })).contains(addr.email) if contains { contacts.append(contact) } @@ -302,7 +302,7 @@ class AddressHandler { for adr1 in contact.getMailAddresses() { var found = false for adr2 in addresses { - if adr1.mailAddress == adr2.mailAddress { + if adr1.email == adr2.email { found = true break } diff --git a/enzevalos_iphone/CNMailAddressesExtension.swift b/enzevalos_iphone/CNMailAddressesExtension.swift index d2998304f7a62cb10de9acb42c3e3239fdb5b04b..ade36a39cb37fedf0153c00d5830ae6ac4516cfc 100644 --- a/enzevalos_iphone/CNMailAddressesExtension.swift +++ b/enzevalos_iphone/CNMailAddressesExtension.swift @@ -25,7 +25,7 @@ open class CNMailAddressExtension: MailAddress { public var isUser: Bool { get { if let userAdr = UserManager.loadUserValue(.userAddr) as? String { - return self.mailAddress.lowercased() == userAdr.lowercased() + return self.email.lowercased() == userAdr.lowercased() } return false } @@ -36,7 +36,7 @@ open class CNMailAddressExtension: MailAddress { public var publicKeys: Set<PublicKeyRecord> - open var mailAddress: String { + open var email: String { get { return label.value as String } diff --git a/enzevalos_iphone/LoggerDetail.swift b/enzevalos_iphone/LoggerDetail.swift index 08a36f25b8f2550e0e925d9b4864abbd33329b70..47ade68551f8c3aac8caa6dd60875287062db2be 100644 --- a/enzevalos_iphone/LoggerDetail.swift +++ b/enzevalos_iphone/LoggerDetail.swift @@ -501,7 +501,7 @@ class LoggerDetail { if mailAddress.isUser { return "self" } - return mailAddress.mailAddress//TODO .pseudonym + return mailAddress.email//TODO .pseudonym } diff --git a/enzevalos_iphone/MailAddress.swift b/enzevalos_iphone/MailAddress.swift index 37d5b8e6283036ab83f406c05c35abcfc8ddab5e..dcc69bf8d281c18f0b11560c0691bfb6b09e98f2 100644 --- a/enzevalos_iphone/MailAddress.swift +++ b/enzevalos_iphone/MailAddress.swift @@ -89,8 +89,11 @@ public enum AutocryptState { } +/* + This protocol is for the backend. Handling email addresses to store, send and fetch them from the email server. + */ public protocol MailAddress { - var mailAddress: String { get } + var email: String { get } var label: CNLabeledValue<NSString> { get } //FIXME: ist der NSString hier wirklich richtig? (http://stackoverflow.com/questions/39648830/how-to-add-new-email-to-cnmutablecontact-in-swift-3) var hasKey: Bool { get } var isUser: Bool {get } @@ -104,8 +107,8 @@ public protocol MailAddress { extension MailAddress { var mcoAddress: MCOAddress { get { - var name = self.contact?.name ?? mailAddress - return MCOAddress.init(displayName: name, mailbox: mailAddress) + let name = self.contact?.name ?? email + return MCOAddress.init(displayName: name, mailbox: email) } } } diff --git a/enzevalos_iphone/MailComparison.swift b/enzevalos_iphone/MailComparison.swift index 724bf6c0b940d8cbc1861da574a48b548c838e30..52820b360dde73f2bf493d302e63bca4a5057dd8 100644 --- a/enzevalos_iphone/MailComparison.swift +++ b/enzevalos_iphone/MailComparison.swift @@ -80,7 +80,7 @@ extension String { let contMailAddr = contact.cnContact?.getMailAddresses() if contMailAddr != nil{ for mAddr in contMailAddr!{ - if mAddr.mailAddress == self { + if mAddr.email == self { return ResultCompareSenderToContacts.isContact } } diff --git a/enzevalos_iphone/OutgoingMail.swift b/enzevalos_iphone/OutgoingMail.swift index 0bbe5f9ce6990156914069b535ace23a006aaf4c..52e672430e185e2954311d0b15f946746cf085ee 100644 --- a/enzevalos_iphone/OutgoingMail.swift +++ b/enzevalos_iphone/OutgoingMail.swift @@ -213,21 +213,21 @@ class OutgoingMail { var secureAddresses: [MailAddress] = [] for addr in toLogging { for sec in secureAddrsInString { - if addr.mailAddress == sec { + if addr.email == sec { secureAddresses.append(addr) } } } for addr in ccLogging { for sec in secureAddrsInString { - if addr.mailAddress == sec { + if addr.email == sec { secureAddresses.append(addr) } } } for addr in bccLogging { for sec in secureAddrsInString { - if addr.mailAddress == sec { + if addr.email == sec { secureAddresses.append(addr) } } diff --git a/enzevalos_iphone/SwiftUI/Data/DisplayProtocols.swift b/enzevalos_iphone/SwiftUI/Data/DisplayProtocols.swift index ba290a971e537cc05eae85900d354569a30df99f..4b8e59a6ed3d9b689c688e0ac8ee4bc3b0be81bc 100644 --- a/enzevalos_iphone/SwiftUI/Data/DisplayProtocols.swift +++ b/enzevalos_iphone/SwiftUI/Data/DisplayProtocols.swift @@ -9,6 +9,10 @@ import Foundation import SwiftUI + +/* + Here are protocols to display an email, key, address and a contact + */ /// Enums enum FolderType { case Archive, Trash, Inbox, Sent, Draft, Other @@ -59,7 +63,7 @@ protocol DisplayAttachment { protocol DisplayContact { // General var name: String { get } - var addr: String { get } + var email: String { get } var myImage: Image { get } var isInContactBook: Bool { get } var otherAddresses: [String] { get } diff --git a/enzevalos_iphone/SwiftUI/Data/SimulatorData.swift b/enzevalos_iphone/SwiftUI/Data/SimulatorData.swift index 2f8e4be2fcb69f251a4b4b4c0a900b5b990bb140..a61a277901ca1e902556aa830f38cdcf3d1d9b21 100644 --- a/enzevalos_iphone/SwiftUI/Data/SimulatorData.swift +++ b/enzevalos_iphone/SwiftUI/Data/SimulatorData.swift @@ -38,9 +38,9 @@ struct SimulatorData_Previews: PreviewProvider { struct ProxyData { // Different Contacts - static let Alice = ProxyContact(name: "Alice", addr: "alice@example.com", myImage: ProxyContact.makeImg("Alice", color: .blue)) - static let Bob = ProxyContact(name: "Bob", addr: "Bob.lord.of.kingsbridge.and.king.of.england@huge.subdomain.with. a.long.long.long.domain.example.com", myImage: ProxyContact.makeImg("Bob", color: .red)) - static let Charlie = ProxyContact(name: "Charlie", addr: "charlie@example.com", myImage: ProxyContact.makeImg("Charlie", color: .green)) + static let Alice = ProxyContact(name: "Alice", email: "alice@example.com", myImage: ProxyContact.makeImg("Alice", color: .blue)) + static let Bob = ProxyContact(name: "Bob", email: "Bob.lord.of.kingsbridge.and.king.of.england@huge.subdomain.with. a.long.long.long.domain.example.com", myImage: ProxyContact.makeImg("Bob", color: .red)) + static let Charlie = ProxyContact(name: "Charlie", email: "charlie@example.com", myImage: ProxyContact.makeImg("Charlie", color: .green)) static let Landmarks = [ Landmark(name: "Berlin", domain: "exampledomain.de", location: .init(latitude: 52.520008, longitude: 13.404954)), Landmark(name: "New York", domain: "secondexampledomain.de", location: .init(latitude: 40.730610, longitude: -73.935242)), @@ -68,7 +68,7 @@ struct ProxyContact: DisplayContact { var name: String - var addr: String + var email: String var myImage: Image diff --git a/enzevalos_iphone/SwiftUI/Read/ReadViewCoordinator.swift b/enzevalos_iphone/SwiftUI/Read/ReadViewCoordinator.swift index f4d7dab481c9a6c219102c77ca7e65388070d48a..84b8a5763791e0d40c2725f1b8ea8f08bf53ea7e 100644 --- a/enzevalos_iphone/SwiftUI/Read/ReadViewCoordinator.swift +++ b/enzevalos_iphone/SwiftUI/Read/ReadViewCoordinator.swift @@ -148,14 +148,14 @@ class ReadViewCoordinator <M: DisplayMail, C: DisplayContact> { func askSenderToConfirm <M: DisplayMail>(mail: M) { let to = [mail.sender.findAddress(temp: false)] - print(mail.sender.findAddress(temp: false).mailAddress) + print(mail.sender.findAddress(temp: false).email) let body = NSLocalizedString("didYouSendThis", comment: "Did you sent this mail?") + "\n"+preparePreviousMailBody(mail: mail) pushComposeView(to: to, cc: [], bcc: [], subject: mail.subject, body: body, responseType: .Reply) } private func preparePreviousMailBody<M: DisplayMail>(mail: M) -> String{ var body = NSLocalizedString("mail from", comment: "describing who send the mail") + " " - body.append(mail.sender.addr) + body.append(mail.sender.email) let time = DateFormatter.init() time.dateStyle = .short time.timeStyle = .short @@ -163,12 +163,12 @@ class ReadViewCoordinator <M: DisplayMail, C: DisplayContact> { body.append(" " + NSLocalizedString("sent at", comment: "describing when the mail was send") + " " + time.string(from: mail.date ?? Date())) body.append("\n" + NSLocalizedString("To", comment: "describing adressee") + ": ") for addr in mail.tos { - body.append("\(addr.addr), ") + body.append("\(addr.email), ") } if mail.ccs.count > 0 { body.append("\n\(NSLocalizedString("Cc", comment: "")): ") for addr in mail.ccs { - body.append("\(addr.addr), ") } + body.append("\(addr.email), ") } } body.append("\n" + NSLocalizedString("subject", comment: "describing what subject was choosen") + ": " + (mail.subject ?? "")) body.append("\n------------------------\n\n" + (mail.body ?? "")) diff --git a/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewChildren/SmallContactListView.swift b/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewChildren/SmallContactListView.swift index 6a3a25adb94a0ff68447bdba6f9d8e0d92d17104..938d80625ad6fe6389f2563ea5aceb2c7cf794e4 100644 --- a/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewChildren/SmallContactListView.swift +++ b/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewChildren/SmallContactListView.swift @@ -30,14 +30,14 @@ struct SmallContactListView <C: DisplayContact>: View { Spacer() } if showList { - ForEach(contacts, id: \.addr) {contact in + ForEach(contacts, id: \.email) {contact in Group { HStack { CircleImage(image: contact.myImage, radius: 40) VStack (alignment: .leading, spacing: 2){ Text(contact.name) .font(.subheadline) - Text(contact.addr) + Text(contact.email) .foregroundColor(.gray) } Spacer() @@ -66,9 +66,9 @@ struct SmallContactListView <C: DisplayContact>: View { struct SmallContactListView_Previews: PreviewProvider { - static let alice = ProxyContact(name: "Alice", addr: "alice@example.com", myImage: ProxyContact.makeImg("Alice", color: .blue)) - static let bob = ProxyContact(name: "Bob", addr: "Bob.lord.of.kingsbridge.and.king.of.england@huge.subdomain.with. a.long.long.long.domain.example.com", myImage: ProxyContact.makeImg("Bob", color: .red)) - static let charlie = ProxyContact(name: "Charlie", addr: "charlie@example.com", myImage: ProxyContact.makeImg("Charlie", color: .green)) + static let alice = ProxyData.Alice + static let bob = ProxyData.Bob + static let charlie = ProxyData.Charlie static var previews: some View { VStack{ diff --git a/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewMain.swift b/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewMain.swift index 16d43797920470a6b12762f12aaeeb4732b868da..5451307458e8c8d7901fce6303bfc402a9a5eb96 100644 --- a/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewMain.swift +++ b/enzevalos_iphone/SwiftUI/Read/Tabbed Views/SenderViewMain.swift @@ -98,7 +98,7 @@ struct SenderViewMain <M: DisplayMail>: View { .padding(.bottom, 10) Text(mail.sender.name) .font(.subheadline) - Text(mail.sender.addr) + Text(mail.sender.email) .foregroundColor(.gray) } Spacer() diff --git a/enzevalos_iphone/persistentData/AddressRecord+CoreDataClass.swift b/enzevalos_iphone/persistentData/AddressRecord+CoreDataClass.swift new file mode 100644 index 0000000000000000000000000000000000000000..646c761a1bc754f7521d98c575efd27446d68967 --- /dev/null +++ b/enzevalos_iphone/persistentData/AddressRecord+CoreDataClass.swift @@ -0,0 +1,15 @@ +// +// AddressRecord+CoreDataClass.swift +// +// +// Created by Oliver Wiese on 16.10.20. +// +// + +import Foundation +import CoreData + +@objc(AddressRecord) +public class AddressRecord: NSManagedObject { + +} diff --git a/enzevalos_iphone/persistentData/AddressRecord+CoreDataProperties.swift b/enzevalos_iphone/persistentData/AddressRecord+CoreDataProperties.swift new file mode 100644 index 0000000000000000000000000000000000000000..fd59cb0f8d7420ec0c20c1d78d943685371908f4 --- /dev/null +++ b/enzevalos_iphone/persistentData/AddressRecord+CoreDataProperties.swift @@ -0,0 +1,115 @@ +// +// AddressRecord+CoreDataProperties.swift +// +// +// Created by Oliver Wiese on 16.10.20. +// +// + +import Foundation +import CoreData + +// DO NOT WORK HERE. +// If you like to extend the address record, use AddressRecord.swift + +extension AddressRecord { + + @nonobjc public class func fetchRequest() -> NSFetchRequest<AddressRecord> { + return NSFetchRequest<AddressRecord>(entityName: "AddressRecord") + } + + @NSManaged public var displayname: String? + @NSManaged public var email: String + @NSManaged public var phoneBookID: String? + @NSManaged public var inBCCField: NSSet? + @NSManaged public var inCCField: NSSet? + @NSManaged public var inFromField: NSSet? + @NSManaged public var inToField: NSSet? + @NSManaged public var usedPublicKeys: NSSet? + +} + +// MARK: Generated accessors for inBCCField +extension AddressRecord { + + @objc(addInBCCFieldObject:) + @NSManaged public func addToInBCCField(_ value: MailRecord) + + @objc(removeInBCCFieldObject:) + @NSManaged public func removeFromInBCCField(_ value: MailRecord) + + @objc(addInBCCField:) + @NSManaged public func addToInBCCField(_ values: NSSet) + + @objc(removeInBCCField:) + @NSManaged public func removeFromInBCCField(_ values: NSSet) + +} + +// MARK: Generated accessors for inCCField +extension AddressRecord { + + @objc(addInCCFieldObject:) + @NSManaged public func addToInCCField(_ value: MailRecord) + + @objc(removeInCCFieldObject:) + @NSManaged public func removeFromInCCField(_ value: MailRecord) + + @objc(addInCCField:) + @NSManaged public func addToInCCField(_ values: NSSet) + + @objc(removeInCCField:) + @NSManaged public func removeFromInCCField(_ values: NSSet) + +} + +// MARK: Generated accessors for inFromField +extension AddressRecord { + + @objc(addInFromFieldObject:) + @NSManaged public func addToInFromField(_ value: MailRecord) + + @objc(removeInFromFieldObject:) + @NSManaged public func removeFromInFromField(_ value: MailRecord) + + @objc(addInFromField:) + @NSManaged public func addToInFromField(_ values: NSSet) + + @objc(removeInFromField:) + @NSManaged public func removeFromInFromField(_ values: NSSet) + +} + +// MARK: Generated accessors for inToField +extension AddressRecord { + + @objc(addInToFieldObject:) + @NSManaged public func addToInToField(_ value: MailRecord) + + @objc(removeInToFieldObject:) + @NSManaged public func removeFromInToField(_ value: MailRecord) + + @objc(addInToField:) + @NSManaged public func addToInToField(_ values: NSSet) + + @objc(removeInToField:) + @NSManaged public func removeFromInToField(_ values: NSSet) + +} + +// MARK: Generated accessors for usedPublicKeys +extension AddressRecord { + + @objc(addUsedPublicKeysObject:) + @NSManaged public func addToUsedPublicKeys(_ value: PublicKeyRecord) + + @objc(removeUsedPublicKeysObject:) + @NSManaged public func removeFromUsedPublicKeys(_ value: PublicKeyRecord) + + @objc(addUsedPublicKeys:) + @NSManaged public func addToUsedPublicKeys(_ values: NSSet) + + @objc(removeUsedPublicKeys:) + @NSManaged public func removeFromUsedPublicKeys(_ values: NSSet) + +} diff --git a/enzevalos_iphone/persistentData/AddressRecord.swift b/enzevalos_iphone/persistentData/AddressRecord.swift index 0ad7026032bbe66ecc61a7e1c478e181935835e9..a610518fe89bd5c241ab1c6a843ef8b41b6db5f4 100644 --- a/enzevalos_iphone/persistentData/AddressRecord.swift +++ b/enzevalos_iphone/persistentData/AddressRecord.swift @@ -21,7 +21,6 @@ extension AddressRecord { } } - public var name: String { get { if let contact = self.phoneBookID { @@ -31,7 +30,7 @@ extension AddressRecord { if let displayname = self.displayname { return displayname } - return self.email ?? NSLocalizedString("noName", comment: "We have no name for this one") // TODO FIX! + return self.email } } @@ -65,12 +64,12 @@ extension AddressRecord { extension AddressRecord: MailAddress { public var mailAddress: String { get { - return email ?? "" + return email } } public var label: CNLabeledValue<NSString> { - return CNLabeledValue.init(label: CNLabelWork, value: (email ?? "") as NSString) // TODO + return CNLabeledValue.init(label: CNLabelWork, value: (email) as NSString) // TODO } public var hasKey: Bool { @@ -121,10 +120,6 @@ extension AddressRecord: Contact { } extension AddressRecord: DisplayContact { - var addr: String { - return email ?? "" - } - var myImage: Image { return Image(uiImage: getImageOrDefault()) } @@ -134,7 +129,7 @@ extension AddressRecord: DisplayContact { } var otherAddresses: [String] { - return getMailAddresses().map{$0.mailAddress} + return getMailAddresses().map{$0.email} } var keyIDs: [String] { diff --git a/enzevalos_iphone/persistentData/DataModel.xcdatamodeld/DataModel.xcdatamodel/contents b/enzevalos_iphone/persistentData/DataModel.xcdatamodeld/DataModel.xcdatamodel/contents index eb871de9b077117cacd489d0e84f7b696f61146f..f6c4035da36a0380c9bded39d000b376fce46322 100644 --- a/enzevalos_iphone/persistentData/DataModel.xcdatamodeld/DataModel.xcdatamodel/contents +++ b/enzevalos_iphone/persistentData/DataModel.xcdatamodeld/DataModel.xcdatamodel/contents @@ -4,7 +4,7 @@ <attribute name="cryptoProtocol" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES"/> <attribute name="fingerprint" attributeType="String"/> </entity> - <entity name="AddressRecord" representedClassName="AddressRecord" syncable="YES" codeGenerationType="class"> + <entity name="AddressRecord" representedClassName="AddressRecord" syncable="YES"> <attribute name="displayname" optional="YES" attributeType="String"/> <attribute name="email" attributeType="String"/> <attribute name="phoneBookID" optional="YES" attributeType="String"/> diff --git a/enzevalos_iphone/persistentData/records/AddressRecord+CoreDataClass.swift b/enzevalos_iphone/persistentData/records/AddressRecord+CoreDataClass.swift new file mode 100644 index 0000000000000000000000000000000000000000..646c761a1bc754f7521d98c575efd27446d68967 --- /dev/null +++ b/enzevalos_iphone/persistentData/records/AddressRecord+CoreDataClass.swift @@ -0,0 +1,15 @@ +// +// AddressRecord+CoreDataClass.swift +// +// +// Created by Oliver Wiese on 16.10.20. +// +// + +import Foundation +import CoreData + +@objc(AddressRecord) +public class AddressRecord: NSManagedObject { + +} diff --git a/enzevalos_iphone/persistentData/records/AddressRecord+CoreDataProperties.swift b/enzevalos_iphone/persistentData/records/AddressRecord+CoreDataProperties.swift new file mode 100644 index 0000000000000000000000000000000000000000..36996ec95a6ed5e92511d0f8a2f082c904cc21d1 --- /dev/null +++ b/enzevalos_iphone/persistentData/records/AddressRecord+CoreDataProperties.swift @@ -0,0 +1,113 @@ +// +// AddressRecord+CoreDataProperties.swift +// +// +// Created by Oliver Wiese on 16.10.20. +// +// + +import Foundation +import CoreData + + +extension AddressRecord { + + @nonobjc public class func fetchRequest() -> NSFetchRequest<AddressRecord> { + return NSFetchRequest<AddressRecord>(entityName: "AddressRecord") + } + + @NSManaged public var displayname: String? + @NSManaged public var email: String? + @NSManaged public var phoneBookID: String? + @NSManaged public var inBCCField: NSSet? + @NSManaged public var inCCField: NSSet? + @NSManaged public var inFromField: NSSet? + @NSManaged public var inToField: NSSet? + @NSManaged public var usedPublicKeys: NSSet? + +} + +// MARK: Generated accessors for inBCCField +extension AddressRecord { + + @objc(addInBCCFieldObject:) + @NSManaged public func addToInBCCField(_ value: MailRecord) + + @objc(removeInBCCFieldObject:) + @NSManaged public func removeFromInBCCField(_ value: MailRecord) + + @objc(addInBCCField:) + @NSManaged public func addToInBCCField(_ values: NSSet) + + @objc(removeInBCCField:) + @NSManaged public func removeFromInBCCField(_ values: NSSet) + +} + +// MARK: Generated accessors for inCCField +extension AddressRecord { + + @objc(addInCCFieldObject:) + @NSManaged public func addToInCCField(_ value: MailRecord) + + @objc(removeInCCFieldObject:) + @NSManaged public func removeFromInCCField(_ value: MailRecord) + + @objc(addInCCField:) + @NSManaged public func addToInCCField(_ values: NSSet) + + @objc(removeInCCField:) + @NSManaged public func removeFromInCCField(_ values: NSSet) + +} + +// MARK: Generated accessors for inFromField +extension AddressRecord { + + @objc(addInFromFieldObject:) + @NSManaged public func addToInFromField(_ value: MailRecord) + + @objc(removeInFromFieldObject:) + @NSManaged public func removeFromInFromField(_ value: MailRecord) + + @objc(addInFromField:) + @NSManaged public func addToInFromField(_ values: NSSet) + + @objc(removeInFromField:) + @NSManaged public func removeFromInFromField(_ values: NSSet) + +} + +// MARK: Generated accessors for inToField +extension AddressRecord { + + @objc(addInToFieldObject:) + @NSManaged public func addToInToField(_ value: MailRecord) + + @objc(removeInToFieldObject:) + @NSManaged public func removeFromInToField(_ value: MailRecord) + + @objc(addInToField:) + @NSManaged public func addToInToField(_ values: NSSet) + + @objc(removeInToField:) + @NSManaged public func removeFromInToField(_ values: NSSet) + +} + +// MARK: Generated accessors for usedPublicKeys +extension AddressRecord { + + @objc(addUsedPublicKeysObject:) + @NSManaged public func addToUsedPublicKeys(_ value: PublicKeyRecord) + + @objc(removeUsedPublicKeysObject:) + @NSManaged public func removeFromUsedPublicKeys(_ value: PublicKeyRecord) + + @objc(addUsedPublicKeys:) + @NSManaged public func addToUsedPublicKeys(_ values: NSSet) + + @objc(removeUsedPublicKeys:) + @NSManaged public func removeFromUsedPublicKeys(_ values: NSSet) + +}