diff --git a/EnzevalosContact+CoreDataClass.swift b/EnzevalosContact+CoreDataClass.swift index 412426f1e5b36e577cff5acc7816437bab3afadd..7f50b48fc098f71f9416410da21a53260bc8d64e 100644 --- a/EnzevalosContact+CoreDataClass.swift +++ b/EnzevalosContact+CoreDataClass.swift @@ -35,15 +35,15 @@ open class EnzevalosContact: NSManagedObject, Contact, Comparable { } - open var to: [Mail]{ + open var to: [PersistentMail]{ get{ - var mails = [Mail]() + var mails = [PersistentMail]() if let adrs = addresses{ for adr in adrs{ let a = adr as! Mail_Address if a.to != nil { for m in a.to!{ - mails.append(m as! Mail) + mails.append(m as! PersistentMail) } } } @@ -52,15 +52,15 @@ open class EnzevalosContact: NSManagedObject, Contact, Comparable { } } - open var bcc: [Mail]{ + open var bcc: [PersistentMail]{ get{ - var mails = [Mail]() + var mails = [PersistentMail]() if let adrs = addresses{ for adr in adrs{ let a = adr as! Mail_Address if a.bcc != nil { for m in a.bcc!{ - mails.append(m as! Mail) + mails.append(m as! PersistentMail) } } } @@ -71,15 +71,15 @@ open class EnzevalosContact: NSManagedObject, Contact, Comparable { - open var cc: [Mail]{ + open var cc: [PersistentMail]{ get{ - var mails = [Mail]() + var mails = [PersistentMail]() if let adrs = addresses{ for adr in adrs{ let a = adr as! Mail_Address if a.cc != nil { for m in a.cc!{ - mails.append(m as! Mail) + mails.append(m as! PersistentMail) } } } @@ -88,15 +88,15 @@ open class EnzevalosContact: NSManagedObject, Contact, Comparable { } } - open var from: [Mail]{ + open var from: [PersistentMail]{ get{ - var mails = [Mail]() + var mails = [PersistentMail]() if let adrs = addresses{ for adr in adrs{ let a = adr as! Mail_Address if a.from != nil { for m in a.from!{ - mails.append(m as! Mail) + mails.append(m as! PersistentMail ) } } } @@ -205,7 +205,10 @@ open class EnzevalosContact: NSManagedObject, Contact, Comparable { } func getAddressByMCOAddress(_ mcoaddress: MCOAddress)-> Mail_Address?{ - return getAddress(mcoaddress.mailbox!) + if (mcoaddress.mailbox) != nil{ + return getAddress(mcoaddress.mailbox.lowercased()) + } + return nil } open func getMailAddresses()->[MailAddress]{ diff --git a/ObjectivePGP.h b/ObjectivePGP.h index 0e114aa6730488e0ddee35c850a489e73f399d20..04e8c98f6803346161ba43820b115ea09d2c4de9 100644 --- a/ObjectivePGP.h +++ b/ObjectivePGP.h @@ -59,6 +59,6 @@ - (nullable NSData *) decryptData:(nonnull NSData *)messageDataToDecrypt passphrase:(nullable NSString *)passphrase verifyWithPublicKey:(nullable PGPKey *)publicKey signed:(nullable BOOL*)isSigned valid:(nullable BOOL*)isValid integrityProtected:(nullable BOOL*)isIntegrityProtected error:(NSError * __autoreleasing __nullable * __nullable)error; - (nonnull PGPTemporaryDecryptionObject *) decryptDataFirstPart:(nonnull NSData *)messageDataToDecrypt passphrase:(nullable NSString *)passphrase integrityProtected:(nullable BOOL*)isIntegrityProtected error:(NSError * __autoreleasing __nullable * __nullable)error; -- (BOOL *) decryptDataSecondPart:(nonnull PGPTemporaryDecryptionObject *)temporaryDecryptionObject verifyWithPublicKey:(nullable PGPKey *)publicKey signed:(nullable BOOL*)isSigned valid:(nullable BOOL*)isValid error:(NSError * __autoreleasing __nullable * __nullable)error; +- (BOOL *_Nonnull) decryptDataSecondPart:(nonnull PGPTemporaryDecryptionObject *)temporaryDecryptionObject verifyWithPublicKey:(nullable PGPKey *)publicKey signed:(nullable BOOL*)isSigned valid:(nullable BOOL*)isValid error:(NSError * __autoreleasing __nullable * __nullable)error; @end diff --git a/ObjectivePGP.m b/ObjectivePGP.m index 0429bfe4a5360dd74338fd6ec19d663150fdab26..e8979a8d7245f91185643a38e8f74470740c782e 100644 --- a/ObjectivePGP.m +++ b/ObjectivePGP.m @@ -1005,8 +1005,6 @@ NSData *armoredData = [armoredMessage dataUsingEncoding:NSASCIIStringEncoding]; - //TODO REMOVE - NSString *aString = [[NSString alloc] initWithData:armoredData encoding:NSUTF8StringEncoding]; return [self importKeysFromData: armoredData allowDuplicates:allowDuplicates]; diff --git a/PGPSignatureSubpacket.m b/PGPSignatureSubpacket.m index 2d852cab8140ee4ce4c1302b0b453f89fcde61d6..6d1bb3ff9bd5e2ba4a8eb0b1911afbc75f1ff9a1 100644 --- a/PGPSignatureSubpacket.m +++ b/PGPSignatureSubpacket.m @@ -234,7 +234,7 @@ break; default: #ifdef DEBUG - NSLog(@"Unsuported subpacket type %d", self.type); + // NSLog(@"Unsuported subpacket type %d", self.type); #endif break; } @@ -376,7 +376,7 @@ break; default: #ifdef DEBUG - NSLog(@"Unsuported subpacket type %d", self.type); + // NSLog(@"Unsuported subpacket type %d", self.type); #endif break; } diff --git a/Mail+CoreDataClass.swift b/PersistentMail +CoreDataClass.swift similarity index 94% rename from Mail+CoreDataClass.swift rename to PersistentMail +CoreDataClass.swift index 524dc4add3159df7407058a360d9df76b11c89c6..fea73f0c92d4a507c599a8ecd469db5c897bad09 100644 --- a/Mail+CoreDataClass.swift +++ b/PersistentMail +CoreDataClass.swift @@ -1,5 +1,5 @@ // -// Mail+CoreDataClass.swift +// PersistentMail+CoreDataClass.swift // enzevalos_iphone // // Created by Oliver Wiese on 27/12/16. @@ -11,9 +11,9 @@ import Foundation import CoreData -@objc(Mail) -open class Mail: NSManagedObject, Comparable { - +@objc(PersistentMail) +open class PersistentMail: NSManagedObject, Mail { + var showMessage: Bool = false var isSecure: Bool { @@ -31,7 +31,7 @@ open class Mail: NSManagedObject, Comparable { } else { flag.insert(MCOMessageFlag.seen) } - DataHandler.handler.save() + _ = DataHandler.handler.save() } } @@ -61,6 +61,10 @@ open class Mail: NSManagedObject, Comparable { } var shortBodyString: String? { + guard !trouble else { + return nil + } + var message: String? = "" if isEncrypted && !unableToDecrypt { message = decryptedBody @@ -176,12 +180,3 @@ open class Mail: NSManagedObject, Comparable { return "\(returnString)\(subj)" } } - -public func == (lhs: Mail, rhs: Mail) -> Bool { - return lhs.date == rhs.date && lhs.uid == rhs.uid -} - -public func < (lhs: Mail, rhs: Mail) -> Bool { - return lhs.date > rhs.date -} - diff --git a/enzevalos_iphone.xcodeproj/project.pbxproj b/enzevalos_iphone.xcodeproj/project.pbxproj index 0475b3fdfad88e2c8b06cf185c1377c04c88d93a..a3b9dd599b85c65e82d8d93b47061837695c59e2 100644 --- a/enzevalos_iphone.xcodeproj/project.pbxproj +++ b/enzevalos_iphone.xcodeproj/project.pbxproj @@ -8,12 +8,12 @@ /* Begin PBXBuildFile section */ 472F392A1E1277D2009260FB /* EnzevalosContact+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472F39261E1277D2009260FB /* EnzevalosContact+CoreDataClass.swift */; }; - 472F392C1E1277D2009260FB /* Mail+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472F39281E1277D2009260FB /* Mail+CoreDataClass.swift */; }; + 472F392C1E1277D2009260FB /* PersistentMail +CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472F39281E1277D2009260FB /* PersistentMail +CoreDataClass.swift */; }; 472F396E1E14F384009260FB /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 472F396D1E14F384009260FB /* CoreData.framework */; }; 472F39701E14F75C009260FB /* DataHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472F396F1E14F75C009260FB /* DataHandler.swift */; }; 472F39731E1D09C4009260FB /* State+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472F39711E1D09C4009260FB /* State+CoreDataClass.swift */; }; 472F39741E1D09C4009260FB /* State+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472F39721E1D09C4009260FB /* State+CoreDataProperties.swift */; }; - 472F397C1E1D0B0B009260FB /* Mail+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472F39781E1D0B0B009260FB /* Mail+CoreDataProperties.swift */; }; + 472F397C1E1D0B0B009260FB /* PersistentMail +CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472F39781E1D0B0B009260FB /* PersistentMail +CoreDataProperties.swift */; }; 472F397E1E1D0B0B009260FB /* EnzevalosContact+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472F397A1E1D0B0B009260FB /* EnzevalosContact+CoreDataProperties.swift */; }; 472F39811E1E5347009260FB /* Mail_Address+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472F397F1E1E5347009260FB /* Mail_Address+CoreDataClass.swift */; }; 472F39821E1E5347009260FB /* Mail_Address+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472F39801E1E5347009260FB /* Mail_Address+CoreDataProperties.swift */; }; @@ -26,6 +26,8 @@ 476142081E07E52B00FD5E4F /* Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 476142071E07E52B00FD5E4F /* Theme.swift */; }; 4761420A1E082F9C00FD5E4F /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 476142091E082F9C00FD5E4F /* Settings.bundle */; }; 476373C21E09BA88004D5EFE /* UserData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 476373C11E09BA88004D5EFE /* UserData.swift */; }; + 47691A8A1ECB56D1004BCFC5 /* Mail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47691A891ECB56D1004BCFC5 /* Mail.swift */; }; + 47691A8C1ECC3EC7004BCFC5 /* EphemeralMail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47691A8B1ECC3EC7004BCFC5 /* EphemeralMail.swift */; }; 9935BC866A86C4A4B9819F35 /* Pods_enzevalos_iphone.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4AE42F42E91A1BFBF1D5BF6A /* Pods_enzevalos_iphone.framework */; }; 9C1FA3A01B089C653802A88C /* Pods_enzevalos_iphoneUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48FB10FF406523D174F4202A /* Pods_enzevalos_iphoneUITests.framework */; }; A1083A541E8BFEA6003666B7 /* Onboarding.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1083A531E8BFEA6003666B7 /* Onboarding.swift */; }; @@ -80,12 +82,10 @@ A15B7BE81E2934CB0024E499 /* EncryptionType.swift in Sources */ = {isa = PBXBuildFile; fileRef = A15B7BE71E2934CB0024E499 /* EncryptionType.swift */; }; A16BA2121E0439B6005E29E3 /* providers.json in Resources */ = {isa = PBXBuildFile; fileRef = A16BA2111E0439B6005E29E3 /* providers.json */; }; A172F90D1E4CD37D00F2A136 /* PGPTemporaryDecryptionObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = A172F90C1E4CD37D00F2A136 /* PGPTemporaryDecryptionObject.swift */; }; - A17A06E91E8190C300C8AEF6 /* OnboardingViewCells.swift in Sources */ = {isa = PBXBuildFile; fileRef = A17A06E81E8190C300C8AEF6 /* OnboardingViewCells.swift */; }; A17A18F71DDCBE530058D934 /* PGPKeyWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = A17A18F61DDCBE530058D934 /* PGPKeyWrapper.swift */; }; A17A18F91DDCCF370058D934 /* JakobBode.asc in Resources */ = {isa = PBXBuildFile; fileRef = A17A18F81DDCCF370058D934 /* JakobBode.asc */; }; A17BEB391E55E3DD00403EBE /* PGPTemporaryDecryptionObject.m in Sources */ = {isa = PBXBuildFile; fileRef = A17BEB381E55E3DD00403EBE /* PGPTemporaryDecryptionObject.m */; }; A17C04841DC6504E00F66EDB /* LogHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = A17C04831DC6504E00F66EDB /* LogHandler.swift */; }; - A18C76871E81861C00B21414 /* OnboardingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A18C76861E81861C00B21414 /* OnboardingViewController.swift */; }; A19C12471DE602FF007F72E7 /* jabo.asc in Resources */ = {isa = PBXBuildFile; fileRef = A19C12461DE602FF007F72E7 /* jabo.asc */; }; A1B8C01A1DD5D9B10044A358 /* alice2005-2.gpg in Resources */ = {isa = PBXBuildFile; fileRef = A1B8C0191DD5D9B10044A358 /* alice2005-2.gpg */; }; A1BE3FF61E9664660040114B /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = A1BE3FF81E9664660040114B /* InfoPlist.strings */; }; @@ -113,7 +113,6 @@ A1EB059C1D956957008659C1 /* NSDateCompare.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1EB059B1D956957008659C1 /* NSDateCompare.swift */; }; A1EB05A01D95696C008659C1 /* MessageBodyTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1EB059F1D95696C008659C1 /* MessageBodyTableViewCell.swift */; }; A1EB05A41D956E32008659C1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A1EB05A31D956E32008659C1 /* Assets.xcassets */; }; - A1F1D7E41E83E93D0009CBDF /* SwitchCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = A1F1D7E31E83E93D0009CBDF /* SwitchCell.xib */; }; A1F2A5691E85586300320275 /* Providers.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1F2A5681E85586300320275 /* Providers.swift */; }; A1F992291DA7C9100073BF1B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A1F9922B1DA7C9100073BF1B /* Main.storyboard */; }; A1F992391DA7DD2E0073BF1B /* InboxTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = A1F9923B1DA7DD2E0073BF1B /* InboxTableViewCell.xib */; }; @@ -153,12 +152,12 @@ /* Begin PBXFileReference section */ 411EB2B85F99B48FFD36F966 /* Pods-enzevalos_iphoneTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-enzevalos_iphoneTests.debug.xcconfig"; path = "../workspace/Pods/Target Support Files/Pods-enzevalos_iphoneTests/Pods-enzevalos_iphoneTests.debug.xcconfig"; sourceTree = "<group>"; }; 472F39261E1277D2009260FB /* EnzevalosContact+CoreDataClass.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "EnzevalosContact+CoreDataClass.swift"; path = "../EnzevalosContact+CoreDataClass.swift"; sourceTree = "<group>"; }; - 472F39281E1277D2009260FB /* Mail+CoreDataClass.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "Mail+CoreDataClass.swift"; path = "../Mail+CoreDataClass.swift"; sourceTree = "<group>"; }; + 472F39281E1277D2009260FB /* PersistentMail +CoreDataClass.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "PersistentMail +CoreDataClass.swift"; path = "../PersistentMail +CoreDataClass.swift"; sourceTree = "<group>"; }; 472F396D1E14F384009260FB /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; 472F396F1E14F75C009260FB /* DataHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataHandler.swift; sourceTree = "<group>"; }; 472F39711E1D09C4009260FB /* State+CoreDataClass.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "State+CoreDataClass.swift"; sourceTree = "<group>"; }; 472F39721E1D09C4009260FB /* State+CoreDataProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "State+CoreDataProperties.swift"; sourceTree = "<group>"; }; - 472F39781E1D0B0B009260FB /* Mail+CoreDataProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Mail+CoreDataProperties.swift"; sourceTree = "<group>"; }; + 472F39781E1D0B0B009260FB /* PersistentMail +CoreDataProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "PersistentMail +CoreDataProperties.swift"; sourceTree = "<group>"; }; 472F397A1E1D0B0B009260FB /* EnzevalosContact+CoreDataProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "EnzevalosContact+CoreDataProperties.swift"; sourceTree = "<group>"; }; 472F397F1E1E5347009260FB /* Mail_Address+CoreDataClass.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Mail_Address+CoreDataClass.swift"; sourceTree = "<group>"; }; 472F39801E1E5347009260FB /* Mail_Address+CoreDataProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Mail_Address+CoreDataProperties.swift"; sourceTree = "<group>"; }; @@ -171,6 +170,8 @@ 476142071E07E52B00FD5E4F /* Theme.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Theme.swift; sourceTree = "<group>"; }; 476142091E082F9C00FD5E4F /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; }; 476373C11E09BA88004D5EFE /* UserData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserData.swift; sourceTree = "<group>"; }; + 47691A891ECB56D1004BCFC5 /* Mail.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Mail.swift; sourceTree = "<group>"; }; + 47691A8B1ECC3EC7004BCFC5 /* EphemeralMail.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EphemeralMail.swift; sourceTree = "<group>"; }; 48FB10FF406523D174F4202A /* Pods_enzevalos_iphoneUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_enzevalos_iphoneUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 4AE42F42E91A1BFBF1D5BF6A /* Pods_enzevalos_iphone.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_enzevalos_iphone.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 796D16D79BED5D60B580E602 /* Pods-enzevalos_iphoneUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-enzevalos_iphoneUITests.release.xcconfig"; path = "../workspace/Pods/Target Support Files/Pods-enzevalos_iphoneUITests/Pods-enzevalos_iphoneUITests.release.xcconfig"; sourceTree = "<group>"; }; @@ -273,13 +274,11 @@ A15B7BE71E2934CB0024E499 /* EncryptionType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EncryptionType.swift; sourceTree = "<group>"; }; A16BA2111E0439B6005E29E3 /* providers.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; lineEnding = 0; path = providers.json; sourceTree = "<group>"; }; A172F90C1E4CD37D00F2A136 /* PGPTemporaryDecryptionObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PGPTemporaryDecryptionObject.swift; sourceTree = "<group>"; }; - A17A06E81E8190C300C8AEF6 /* OnboardingViewCells.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnboardingViewCells.swift; sourceTree = "<group>"; }; A17A18F61DDCBE530058D934 /* PGPKeyWrapper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PGPKeyWrapper.swift; sourceTree = "<group>"; }; A17A18F81DDCCF370058D934 /* JakobBode.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = JakobBode.asc; sourceTree = "<group>"; }; A17BEB371E55E21700403EBE /* PGPTemporaryDecryptionObject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PGPTemporaryDecryptionObject.h; sourceTree = "<group>"; }; A17BEB381E55E3DD00403EBE /* PGPTemporaryDecryptionObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PGPTemporaryDecryptionObject.m; sourceTree = "<group>"; }; A17C04831DC6504E00F66EDB /* LogHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LogHandler.swift; sourceTree = "<group>"; }; - A18C76861E81861C00B21414 /* OnboardingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnboardingViewController.swift; sourceTree = "<group>"; }; A198270D1D9A8ABC0027F65C /* enzevalos_iphone-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "enzevalos_iphone-Bridging-Header.h"; sourceTree = "<group>"; }; A19C12461DE602FF007F72E7 /* jabo.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = jabo.asc; sourceTree = "<group>"; }; A1B8C0191DD5D9B10044A358 /* alice2005-2.gpg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "alice2005-2.gpg"; sourceTree = "<group>"; }; @@ -308,7 +307,6 @@ A1EB059B1D956957008659C1 /* NSDateCompare.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSDateCompare.swift; sourceTree = "<group>"; }; A1EB059F1D95696C008659C1 /* MessageBodyTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageBodyTableViewCell.swift; sourceTree = "<group>"; }; A1EB05A31D956E32008659C1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; - A1F1D7E31E83E93D0009CBDF /* SwitchCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SwitchCell.xib; sourceTree = "<group>"; }; A1F2A5681E85586300320275 /* Providers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Providers.swift; sourceTree = "<group>"; }; A1F992301DA7D22D0073BF1B /* de */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = de; path = de.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; A1F992321DA7D2360073BF1B /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; @@ -385,10 +383,41 @@ 472F398D1E251B8D009260FB /* MailAddress.swift */, 472F39851E1FA34E009260FB /* Record.swift */, 472F39891E251787009260FB /* Contact.swift */, + 47691A891ECB56D1004BCFC5 /* Mail.swift */, ); name = protocols; sourceTree = "<group>"; }; + 47B91AC01EC0C1CF000AE3EE /* coredata */ = { + isa = PBXGroup; + children = ( + 472F39781E1D0B0B009260FB /* PersistentMail +CoreDataProperties.swift */, + 472F39711E1D09C4009260FB /* State+CoreDataClass.swift */, + 472F39721E1D09C4009260FB /* State+CoreDataProperties.swift */, + 472F397A1E1D0B0B009260FB /* EnzevalosContact+CoreDataProperties.swift */, + 472F39261E1277D2009260FB /* EnzevalosContact+CoreDataClass.swift */, + 472F39801E1E5347009260FB /* Mail_Address+CoreDataProperties.swift */, + 472F39281E1277D2009260FB /* PersistentMail +CoreDataClass.swift */, + 472F397F1E1E5347009260FB /* Mail_Address+CoreDataClass.swift */, + ); + name = coredata; + sourceTree = "<group>"; + }; + 47B91AC11EC0C1FB000AE3EE /* data */ = { + isa = PBXGroup; + children = ( + 472F39921E279792009260FB /* protocols */, + 472F396F1E14F75C009260FB /* DataHandler.swift */, + 47691A8B1ECC3EC7004BCFC5 /* EphemeralMail.swift */, + 472F398B1E2519C8009260FB /* CNContactExtension.swift */, + 472F39871E1FA377009260FB /* KeyRecord.swift */, + 472F398F1E252470009260FB /* CNMailAddressesExtension.swift */, + A1EB05871D956879008659C1 /* AddressHandler.swift */, + 47B91AC01EC0C1CF000AE3EE /* coredata */, + ); + name = data; + sourceTree = "<group>"; + }; 78280F99990BFF65543B7F0B /* Frameworks */ = { isa = PBXGroup; children = ( @@ -451,7 +480,7 @@ A13526771D955BDF00D3BFE1 /* enzevalos_iphone */ = { isa = PBXGroup; children = ( - 472F39921E279792009260FB /* protocols */, + 47B91AC11EC0C1FB000AE3EE /* data */, F19B29011E02DCAC00B29DD1 /* enzevalos_iphone.entitlements */, A135CEB61DD4BDA2007E3C29 /* ObjectivePGP */, A1C7FF8B1E895316000D1E92 /* keys */, @@ -462,25 +491,12 @@ F1ACF21D1E0C290500C1B843 /* contactView */, A1D5076D1E80254D00B68B38 /* keyView */, A13526781D955BDF00D3BFE1 /* AppDelegate.swift */, - 472F396F1E14F75C009260FB /* DataHandler.swift */, 476142071E07E52B00FD5E4F /* Theme.swift */, A1230BD81E2F881E006642C7 /* Encryption */, A1EB059B1D956957008659C1 /* NSDateCompare.swift */, 476373C11E09BA88004D5EFE /* UserData.swift */, A16BA2111E0439B6005E29E3 /* providers.json */, A1EB057B1D956838008659C1 /* MailHandler.swift */, - 472F39871E1FA377009260FB /* KeyRecord.swift */, - 472F398B1E2519C8009260FB /* CNContactExtension.swift */, - 472F398F1E252470009260FB /* CNMailAddressesExtension.swift */, - 472F397A1E1D0B0B009260FB /* EnzevalosContact+CoreDataProperties.swift */, - 472F39261E1277D2009260FB /* EnzevalosContact+CoreDataClass.swift */, - 472F397F1E1E5347009260FB /* Mail_Address+CoreDataClass.swift */, - 472F39801E1E5347009260FB /* Mail_Address+CoreDataProperties.swift */, - 472F39281E1277D2009260FB /* Mail+CoreDataClass.swift */, - A1EB05871D956879008659C1 /* AddressHandler.swift */, - 472F39781E1D0B0B009260FB /* Mail+CoreDataProperties.swift */, - 472F39711E1D09C4009260FB /* State+CoreDataClass.swift */, - 472F39721E1D09C4009260FB /* State+CoreDataProperties.swift */, A198270D1D9A8ABC0027F65C /* enzevalos_iphone-Bridging-Header.h */, A1F9922B1DA7C9100073BF1B /* Main.storyboard */, F1984D731E1E92B300804E1E /* LabelStyleKit.swift */, @@ -600,9 +616,6 @@ isa = PBXGroup; children = ( A1F2A5681E85586300320275 /* Providers.swift */, - A18C76861E81861C00B21414 /* OnboardingViewController.swift */, - A17A06E81E8190C300C8AEF6 /* OnboardingViewCells.swift */, - A1F1D7E31E83E93D0009CBDF /* SwitchCell.xib */, A1083A531E8BFEA6003666B7 /* Onboarding.swift */, ); name = onboarding; @@ -806,7 +819,6 @@ buildActionMask = 2147483647; files = ( A1F992391DA7DD2E0073BF1B /* InboxTableViewCell.xib in Resources */, - A1F1D7E41E83E93D0009CBDF /* SwitchCell.xib in Resources */, A1EB058A1D956890008659C1 /* ContactCell.xib in Resources */, 4761420A1E082F9C00FD5E4F /* Settings.bundle in Resources */, A19C12471DE602FF007F72E7 /* jabo.asc in Resources */, @@ -870,7 +882,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; 6C4CB727DDC2AC31CCE50B26 /* [CP] Embed Pods Frameworks */ = { @@ -915,7 +927,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; D6F0EB205D61EA8C8A045390 /* [CP] Check Pods Manifest.lock */ = { @@ -930,7 +942,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; E98D3D9213C0A8CF7EDD28B1 /* [CP] Copy Pods Resources */ = { @@ -985,6 +997,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 47691A8A1ECB56D1004BCFC5 /* Mail.swift in Sources */, 472F398A1E251787009260FB /* Contact.swift in Sources */, 472F39861E1FA34E009260FB /* Record.swift in Sources */, A1C3270E1DB907D900CE2ED5 /* TextFormatter.swift in Sources */, @@ -1000,6 +1013,7 @@ A1EB05821D95685B008659C1 /* CollectionDataDelegate.swift in Sources */, A17C04841DC6504E00F66EDB /* LogHandler.swift in Sources */, A1EB05801D956851008659C1 /* SendViewController.swift in Sources */, + 47691A8C1ECC3EC7004BCFC5 /* EphemeralMail.swift in Sources */, A135CF231DD4BDD1007E3C29 /* PGPUserAttributePacket.m in Sources */, A1230BD71E2F8818006642C7 /* PGPEncryption.swift in Sources */, A1EB05981D956947008659C1 /* InboxViewController.swift in Sources */, @@ -1027,7 +1041,7 @@ 476142081E07E52B00FD5E4F /* Theme.swift in Sources */, A1EB057A1D956829008659C1 /* ContactCell.swift in Sources */, A135CF1E1DD4BDD1007E3C29 /* PGPSubKey.m in Sources */, - 472F392C1E1277D2009260FB /* Mail+CoreDataClass.swift in Sources */, + 472F392C1E1277D2009260FB /* PersistentMail +CoreDataClass.swift in Sources */, A135CF0D1DD4BDD1007E3C29 /* PGPLiteralPacket.m in Sources */, A135CF1D1DD4BDD1007E3C29 /* PGPSignatureSubpacket.m in Sources */, F119D2901E364B59001D732A /* AnimatedSendIcon.swift in Sources */, @@ -1051,7 +1065,7 @@ A1416C1B1E268F1A001809F3 /* Encryption.swift in Sources */, A1EB05841D956867008659C1 /* TableViewDataDelegate.swift in Sources */, A15B7BE41E29306D0024E499 /* EnzevalosEncryptionHandler.swift in Sources */, - 472F397C1E1D0B0B009260FB /* Mail+CoreDataProperties.swift in Sources */, + 472F397C1E1D0B0B009260FB /* PersistentMail +CoreDataProperties.swift in Sources */, A1EB05961D956939008659C1 /* InboxTableViewCell.swift in Sources */, A135CF131DD4BDD1007E3C29 /* PGPPKCSEme.m in Sources */, A135CF241DD4BDD1007E3C29 /* PGPUserAttributeSubpacket.m in Sources */, @@ -1071,7 +1085,6 @@ 472F398E1E251B8D009260FB /* MailAddress.swift in Sources */, A135CF101DD4BDD1007E3C29 /* PGPOnePassSignaturePacket.m in Sources */, F12060821DA552FC00F6EF37 /* MailHandlerDelegator.swift in Sources */, - A17A06E91E8190C300C8AEF6 /* OnboardingViewCells.swift in Sources */, F1984D741E1E92B300804E1E /* LabelStyleKit.swift in Sources */, A15B7BE81E2934CB0024E499 /* EncryptionType.swift in Sources */, A1EB05861D956872008659C1 /* FrequentCell.swift in Sources */, @@ -1083,7 +1096,6 @@ 472F397E1E1D0B0B009260FB /* EnzevalosContact+CoreDataProperties.swift in Sources */, A135CF1B1DD4BDD1007E3C29 /* PGPSecretSubKeyPacket.m in Sources */, A172F90D1E4CD37D00F2A136 /* PGPTemporaryDecryptionObject.swift in Sources */, - A18C76871E81861C00B21414 /* OnboardingViewController.swift in Sources */, A135CF071DD4BDD1007E3C29 /* PGPCompressedPacket.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/enzevalos_iphone/AddressHandler.swift b/enzevalos_iphone/AddressHandler.swift index 7c16f5bc4b2d1101acd91ee48320949d8b6da664..b74f47f98d00fb78627bc2657e762b1ac51db6fe 100644 --- a/enzevalos_iphone/AddressHandler.swift +++ b/enzevalos_iphone/AddressHandler.swift @@ -79,6 +79,7 @@ class AddressHandler { // var cons = DataHandler.handler.contacts var cons = DataHandler.handler.receiverRecords var list: [(UIImage,String,String,UIImage?,UIColor)] = [] + var localInserted = inserted for con: KeyRecord in cons { if list.count >= CollectionDataDelegate.maxFrequent { @@ -87,7 +88,7 @@ class AddressHandler { var insertedEntry = false var address = con.ezContact.getMailAddresses()[0] for addr in con.ezContact.getMailAddresses() { - if inserted.contains(addr.mailAddress) { + if localInserted.contains(addr.mailAddress) { insertedEntry = true } if addr.hasKey { @@ -114,6 +115,7 @@ class AddressHandler { var entry = (cn.getImageOrDefault(), con.ezContact.displayname!, address.mailAddress, addrType, color) list.append(entry) + localInserted.append(address.mailAddress) } } } diff --git a/enzevalos_iphone/AppDelegate.swift b/enzevalos_iphone/AppDelegate.swift index 32bce471f225afc3a8436e23d377d9b83033508a..180883537b2b6c83e8c1ab74acdff4a335e43e7d 100644 --- a/enzevalos_iphone/AppDelegate.swift +++ b/enzevalos_iphone/AppDelegate.swift @@ -18,15 +18,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? var contactStore = CNContactStore() var mailHandler = MailHandler() - private var initialViewController : UIViewController? = nil func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. //UINavigationBar.appearance().backgroundColor = UIColor.blueColor() - ThemeManager.currentTheme() if (!UserDefaults.standard.bool(forKey: "launchedBefore")) { - self.initialViewController = self.window?.rootViewController self.window = UIWindow(frame: UIScreen.main.bounds) //self.window?.rootViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("onboarding") self.window?.rootViewController = Onboarding.onboarding(self.credentialCheck) @@ -77,7 +74,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { /*self.window?.rootViewController = Onboarding.keyHandlingView() Onboarding.keyHandling()*/ UserDefaults.standard.set(true, forKey: "launchedBefore") - self.window?.rootViewController = self.initialViewController! + self.window?.rootViewController = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController() } func applicationWillResignActive(_ application: UIApplication) { diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-001_alpha.imageset/Contents.json b/enzevalos_iphone/Assets.xcassets/Icon_animated001-001_alpha.imageset/Contents.json deleted file mode 100644 index 664e622ad18c405e29e5a66d9abf0dce7b2e79e4..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/Assets.xcassets/Icon_animated001-001_alpha.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Icon_animated001-001_alpha.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-001_alpha.imageset/Icon_animated001-001_alpha.png b/enzevalos_iphone/Assets.xcassets/Icon_animated001-001_alpha.imageset/Icon_animated001-001_alpha.png deleted file mode 100644 index 5661191e07ed50af1a285b0c076f9616ab02abdf..0000000000000000000000000000000000000000 Binary files a/enzevalos_iphone/Assets.xcassets/Icon_animated001-001_alpha.imageset/Icon_animated001-001_alpha.png and /dev/null differ diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-001_alpha_breit.imageset/Contents.json b/enzevalos_iphone/Assets.xcassets/Icon_animated001-001_alpha_breit.imageset/Contents.json deleted file mode 100644 index 5728fd9418728d623cd93f23f370e845546338ee..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/Assets.xcassets/Icon_animated001-001_alpha_breit.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Icon_animated001-001_alpha_breit.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-001_alpha_breit.imageset/Icon_animated001-001_alpha_breit.png b/enzevalos_iphone/Assets.xcassets/Icon_animated001-001_alpha_breit.imageset/Icon_animated001-001_alpha_breit.png deleted file mode 100644 index 41c5f7cacf07cbb91e9dd4f600da7e5b9a454647..0000000000000000000000000000000000000000 Binary files a/enzevalos_iphone/Assets.xcassets/Icon_animated001-001_alpha_breit.imageset/Icon_animated001-001_alpha_breit.png and /dev/null differ diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-001_alpha_verschoben-90.imageset/Contents.json b/enzevalos_iphone/Assets.xcassets/Icon_animated001-001_alpha_verschoben-90.imageset/Contents.json deleted file mode 100644 index 92a73c90663ef45ccb7308615128c4555571ee05..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/Assets.xcassets/Icon_animated001-001_alpha_verschoben-90.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Icon_animated001-001_alpha_verschoben-90.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-001_alpha_verschoben-90.imageset/Icon_animated001-001_alpha_verschoben-90.png b/enzevalos_iphone/Assets.xcassets/Icon_animated001-001_alpha_verschoben-90.imageset/Icon_animated001-001_alpha_verschoben-90.png deleted file mode 100644 index 5f2c7eebe8aac675788da7aa80deefb87d65eeb7..0000000000000000000000000000000000000000 Binary files a/enzevalos_iphone/Assets.xcassets/Icon_animated001-001_alpha_verschoben-90.imageset/Icon_animated001-001_alpha_verschoben-90.png and /dev/null differ diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-002_alpha.imageset/Contents.json b/enzevalos_iphone/Assets.xcassets/Icon_animated001-002_alpha.imageset/Contents.json deleted file mode 100644 index ac77d5644b1d1d0f16f47ff2ce5300b89e83aec5..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/Assets.xcassets/Icon_animated001-002_alpha.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Icon_animated001-002_alpha.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-002_alpha.imageset/Icon_animated001-002_alpha.png b/enzevalos_iphone/Assets.xcassets/Icon_animated001-002_alpha.imageset/Icon_animated001-002_alpha.png deleted file mode 100644 index 9daec15e7b87f5471e76c297fe8b99bc3348a11e..0000000000000000000000000000000000000000 Binary files a/enzevalos_iphone/Assets.xcassets/Icon_animated001-002_alpha.imageset/Icon_animated001-002_alpha.png and /dev/null differ diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-002_alpha_verschoben-90.imageset/Contents.json b/enzevalos_iphone/Assets.xcassets/Icon_animated001-002_alpha_verschoben-90.imageset/Contents.json deleted file mode 100644 index 675860a2e05d877be962dcc9f758b402fdb6426f..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/Assets.xcassets/Icon_animated001-002_alpha_verschoben-90.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Icon_animated001-002_alpha_verschoben-90.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-002_alpha_verschoben-90.imageset/Icon_animated001-002_alpha_verschoben-90.png b/enzevalos_iphone/Assets.xcassets/Icon_animated001-002_alpha_verschoben-90.imageset/Icon_animated001-002_alpha_verschoben-90.png deleted file mode 100644 index 564dd0c9c5d97d61483e8488277890eb92699cc5..0000000000000000000000000000000000000000 Binary files a/enzevalos_iphone/Assets.xcassets/Icon_animated001-002_alpha_verschoben-90.imageset/Icon_animated001-002_alpha_verschoben-90.png and /dev/null differ diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-003_alpha.imageset/Contents.json b/enzevalos_iphone/Assets.xcassets/Icon_animated001-003_alpha.imageset/Contents.json deleted file mode 100644 index dc653eb50cfa3607160fc521c1d0b85db39c764d..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/Assets.xcassets/Icon_animated001-003_alpha.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Icon_animated001-003_alpha.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-003_alpha.imageset/Icon_animated001-003_alpha.png b/enzevalos_iphone/Assets.xcassets/Icon_animated001-003_alpha.imageset/Icon_animated001-003_alpha.png deleted file mode 100644 index 99d7d8a2f127f2cb8050146a5e3d6ff76a532176..0000000000000000000000000000000000000000 Binary files a/enzevalos_iphone/Assets.xcassets/Icon_animated001-003_alpha.imageset/Icon_animated001-003_alpha.png and /dev/null differ diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-003_alpha_verschoben-90.imageset/Contents.json b/enzevalos_iphone/Assets.xcassets/Icon_animated001-003_alpha_verschoben-90.imageset/Contents.json deleted file mode 100644 index 38e9f16d6f1b670ddde582a6c42003e2d5ec6860..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/Assets.xcassets/Icon_animated001-003_alpha_verschoben-90.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Icon_animated001-003_alpha_verschoben-90.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-003_alpha_verschoben-90.imageset/Icon_animated001-003_alpha_verschoben-90.png b/enzevalos_iphone/Assets.xcassets/Icon_animated001-003_alpha_verschoben-90.imageset/Icon_animated001-003_alpha_verschoben-90.png deleted file mode 100644 index 3e29dccfbd88adaec07f459f63a543e5f7b6dc68..0000000000000000000000000000000000000000 Binary files a/enzevalos_iphone/Assets.xcassets/Icon_animated001-003_alpha_verschoben-90.imageset/Icon_animated001-003_alpha_verschoben-90.png and /dev/null differ diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-004_alpha.imageset/Contents.json b/enzevalos_iphone/Assets.xcassets/Icon_animated001-004_alpha.imageset/Contents.json deleted file mode 100644 index d260dab3452d6bc0242843f61470283d32b452b9..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/Assets.xcassets/Icon_animated001-004_alpha.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Icon_animated001-004_alpha.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-004_alpha.imageset/Icon_animated001-004_alpha.png b/enzevalos_iphone/Assets.xcassets/Icon_animated001-004_alpha.imageset/Icon_animated001-004_alpha.png deleted file mode 100644 index 3fa46b42b146968028e6ba74b1fef7bc2ac4f14e..0000000000000000000000000000000000000000 Binary files a/enzevalos_iphone/Assets.xcassets/Icon_animated001-004_alpha.imageset/Icon_animated001-004_alpha.png and /dev/null differ diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-004_alpha_verschoben-90.imageset/Contents.json b/enzevalos_iphone/Assets.xcassets/Icon_animated001-004_alpha_verschoben-90.imageset/Contents.json deleted file mode 100644 index 429d697ec5d2847c4a29e7edb8d22e5d17a727d7..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/Assets.xcassets/Icon_animated001-004_alpha_verschoben-90.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Icon_animated001-004_alpha_verschoben-90.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-004_alpha_verschoben-90.imageset/Icon_animated001-004_alpha_verschoben-90.png b/enzevalos_iphone/Assets.xcassets/Icon_animated001-004_alpha_verschoben-90.imageset/Icon_animated001-004_alpha_verschoben-90.png deleted file mode 100644 index e1eb4dee906131e909d0a2306bbdf6081f88bde2..0000000000000000000000000000000000000000 Binary files a/enzevalos_iphone/Assets.xcassets/Icon_animated001-004_alpha_verschoben-90.imageset/Icon_animated001-004_alpha_verschoben-90.png and /dev/null differ diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-005_alpha.imageset/Contents.json b/enzevalos_iphone/Assets.xcassets/Icon_animated001-005_alpha.imageset/Contents.json deleted file mode 100644 index 2afc7c052b2904517ed8f9ed857265f542089b09..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/Assets.xcassets/Icon_animated001-005_alpha.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Icon_animated001-005_alpha.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-005_alpha.imageset/Icon_animated001-005_alpha.png b/enzevalos_iphone/Assets.xcassets/Icon_animated001-005_alpha.imageset/Icon_animated001-005_alpha.png deleted file mode 100644 index 38d203abae42e80fc7ea6165d784bc72370914c7..0000000000000000000000000000000000000000 Binary files a/enzevalos_iphone/Assets.xcassets/Icon_animated001-005_alpha.imageset/Icon_animated001-005_alpha.png and /dev/null differ diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-005_alpha_verschoben-90.imageset/Contents.json b/enzevalos_iphone/Assets.xcassets/Icon_animated001-005_alpha_verschoben-90.imageset/Contents.json deleted file mode 100644 index c4c141205427d3d54082ed3be792d6344ddae732..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/Assets.xcassets/Icon_animated001-005_alpha_verschoben-90.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Icon_animated001-005_alpha_verschoben-90.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-005_alpha_verschoben-90.imageset/Icon_animated001-005_alpha_verschoben-90.png b/enzevalos_iphone/Assets.xcassets/Icon_animated001-005_alpha_verschoben-90.imageset/Icon_animated001-005_alpha_verschoben-90.png deleted file mode 100644 index 25d02d9b3fe81f930dd28f8e8e6db73bbe5b7bcf..0000000000000000000000000000000000000000 Binary files a/enzevalos_iphone/Assets.xcassets/Icon_animated001-005_alpha_verschoben-90.imageset/Icon_animated001-005_alpha_verschoben-90.png and /dev/null differ diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-006_alpha.imageset/Contents.json b/enzevalos_iphone/Assets.xcassets/Icon_animated001-006_alpha.imageset/Contents.json deleted file mode 100644 index 6e913b07994d9c2725eaeb25bb18966ca1ddecfd..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/Assets.xcassets/Icon_animated001-006_alpha.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Icon_animated001-006_alpha.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-006_alpha.imageset/Icon_animated001-006_alpha.png b/enzevalos_iphone/Assets.xcassets/Icon_animated001-006_alpha.imageset/Icon_animated001-006_alpha.png deleted file mode 100644 index 22cd5df8a3a1148a6e931efdce77e21ec809ddf5..0000000000000000000000000000000000000000 Binary files a/enzevalos_iphone/Assets.xcassets/Icon_animated001-006_alpha.imageset/Icon_animated001-006_alpha.png and /dev/null differ diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-006_alpha_verschoben-90.imageset/Contents.json b/enzevalos_iphone/Assets.xcassets/Icon_animated001-006_alpha_verschoben-90.imageset/Contents.json deleted file mode 100644 index aa835fe782716b15e7e2376bfed81d9923493796..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/Assets.xcassets/Icon_animated001-006_alpha_verschoben-90.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Icon_animated001-006_alpha_verschoben-90.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-006_alpha_verschoben-90.imageset/Icon_animated001-006_alpha_verschoben-90.png b/enzevalos_iphone/Assets.xcassets/Icon_animated001-006_alpha_verschoben-90.imageset/Icon_animated001-006_alpha_verschoben-90.png deleted file mode 100644 index 8295c5c72bb17fdf2a048b88ce6be537022a062d..0000000000000000000000000000000000000000 Binary files a/enzevalos_iphone/Assets.xcassets/Icon_animated001-006_alpha_verschoben-90.imageset/Icon_animated001-006_alpha_verschoben-90.png and /dev/null differ diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-007_alpha.imageset/Contents.json b/enzevalos_iphone/Assets.xcassets/Icon_animated001-007_alpha.imageset/Contents.json deleted file mode 100644 index a4c72891f66dfe9933abe0551f2b29854ce59692..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/Assets.xcassets/Icon_animated001-007_alpha.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Icon_animated001-007_alpha.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-007_alpha.imageset/Icon_animated001-007_alpha.png b/enzevalos_iphone/Assets.xcassets/Icon_animated001-007_alpha.imageset/Icon_animated001-007_alpha.png deleted file mode 100644 index b763b9b5e0b276d2aa75f33bb15d684b55c56765..0000000000000000000000000000000000000000 Binary files a/enzevalos_iphone/Assets.xcassets/Icon_animated001-007_alpha.imageset/Icon_animated001-007_alpha.png and /dev/null differ diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-007_alpha_verschoben-90.imageset/Contents.json b/enzevalos_iphone/Assets.xcassets/Icon_animated001-007_alpha_verschoben-90.imageset/Contents.json deleted file mode 100644 index 0421c274b39d86d1f145f9f1f4f331be4d32dd14..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/Assets.xcassets/Icon_animated001-007_alpha_verschoben-90.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Icon_animated001-007_alpha_verschoben-90.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-007_alpha_verschoben-90.imageset/Icon_animated001-007_alpha_verschoben-90.png b/enzevalos_iphone/Assets.xcassets/Icon_animated001-007_alpha_verschoben-90.imageset/Icon_animated001-007_alpha_verschoben-90.png deleted file mode 100644 index 48355f4e3b6469fe66f9a6045f08ed6b56471597..0000000000000000000000000000000000000000 Binary files a/enzevalos_iphone/Assets.xcassets/Icon_animated001-007_alpha_verschoben-90.imageset/Icon_animated001-007_alpha_verschoben-90.png and /dev/null differ diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-1.imageset/Contents.json b/enzevalos_iphone/Assets.xcassets/Icon_animated001-1.imageset/Contents.json deleted file mode 100644 index 990308f40bed072c10055603d0cdc16f0a84ac7c..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/Assets.xcassets/Icon_animated001-1.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Icon_animated001-1.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-1.imageset/Icon_animated001-1.png b/enzevalos_iphone/Assets.xcassets/Icon_animated001-1.imageset/Icon_animated001-1.png deleted file mode 100644 index 80cec683413a0bb87da0ea3741fc9143403c8d72..0000000000000000000000000000000000000000 Binary files a/enzevalos_iphone/Assets.xcassets/Icon_animated001-1.imageset/Icon_animated001-1.png and /dev/null differ diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-3.imageset/Contents.json b/enzevalos_iphone/Assets.xcassets/Icon_animated001-3.imageset/Contents.json deleted file mode 100644 index cfb94d4f0fe2e77507a3cafe757199cce8a8226f..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/Assets.xcassets/Icon_animated001-3.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Icon_animated001-3.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-3.imageset/Icon_animated001-3.png b/enzevalos_iphone/Assets.xcassets/Icon_animated001-3.imageset/Icon_animated001-3.png deleted file mode 100644 index b146d0056ff10f5f0b45bedefbd7fe82454c8873..0000000000000000000000000000000000000000 Binary files a/enzevalos_iphone/Assets.xcassets/Icon_animated001-3.imageset/Icon_animated001-3.png and /dev/null differ diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-4.imageset/Contents.json b/enzevalos_iphone/Assets.xcassets/Icon_animated001-4.imageset/Contents.json deleted file mode 100644 index bb75a9ab8ebd8909e1496271ff8028250897b11f..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/Assets.xcassets/Icon_animated001-4.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Icon_animated001-4.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-4.imageset/Icon_animated001-4.png b/enzevalos_iphone/Assets.xcassets/Icon_animated001-4.imageset/Icon_animated001-4.png deleted file mode 100644 index b826bd4c65e2bcb2800dabf4843625953d870309..0000000000000000000000000000000000000000 Binary files a/enzevalos_iphone/Assets.xcassets/Icon_animated001-4.imageset/Icon_animated001-4.png and /dev/null differ diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-5.imageset/Contents.json b/enzevalos_iphone/Assets.xcassets/Icon_animated001-5.imageset/Contents.json deleted file mode 100644 index 26e4ff7178e99f9421eba900921b2e72919231e5..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/Assets.xcassets/Icon_animated001-5.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Icon_animated001-5.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-5.imageset/Icon_animated001-5.png b/enzevalos_iphone/Assets.xcassets/Icon_animated001-5.imageset/Icon_animated001-5.png deleted file mode 100644 index c9d57b274a2f489f43619975a32b4dba3fd91ae5..0000000000000000000000000000000000000000 Binary files a/enzevalos_iphone/Assets.xcassets/Icon_animated001-5.imageset/Icon_animated001-5.png and /dev/null differ diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-6.imageset/Contents.json b/enzevalos_iphone/Assets.xcassets/Icon_animated001-6.imageset/Contents.json deleted file mode 100644 index 80a0715f9ed508a78596f48bf6d348af680ab3c5..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/Assets.xcassets/Icon_animated001-6.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Icon_animated001-6.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-6.imageset/Icon_animated001-6.png b/enzevalos_iphone/Assets.xcassets/Icon_animated001-6.imageset/Icon_animated001-6.png deleted file mode 100644 index f73c760724a67c91e0f809550a7187205169f61a..0000000000000000000000000000000000000000 Binary files a/enzevalos_iphone/Assets.xcassets/Icon_animated001-6.imageset/Icon_animated001-6.png and /dev/null differ diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-7.imageset/Contents.json b/enzevalos_iphone/Assets.xcassets/Icon_animated001-7.imageset/Contents.json deleted file mode 100644 index 0cf9bba6559e1214bb00cc75dee5c4d01ba733f2..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/Assets.xcassets/Icon_animated001-7.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "Icon_animated001-7.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/enzevalos_iphone/Assets.xcassets/Icon_animated001-7.imageset/Icon_animated001-7.png b/enzevalos_iphone/Assets.xcassets/Icon_animated001-7.imageset/Icon_animated001-7.png deleted file mode 100644 index ddb43e438a7ce162f9a24bfb03de98793aa9d7d3..0000000000000000000000000000000000000000 Binary files a/enzevalos_iphone/Assets.xcassets/Icon_animated001-7.imageset/Icon_animated001-7.png and /dev/null differ diff --git a/enzevalos_iphone/Base.lproj/InboxTableViewCell.xib b/enzevalos_iphone/Base.lproj/InboxTableViewCell.xib index f4dd18e6731f98fb600d6d50c3815f964a765734..4ab7e473a8489a5b916493325e2cb09717a8b8f4 100644 --- a/enzevalos_iphone/Base.lproj/InboxTableViewCell.xib +++ b/enzevalos_iphone/Base.lproj/InboxTableViewCell.xib @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11542" systemVersion="16C67" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> <device id="retina4_7" orientation="portrait"> <adaptation id="fullscreen"/> </device> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/> <capability name="Constraints to layout margins" minToolsVersion="6.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> @@ -16,7 +16,7 @@ <rect key="frame" x="0.0" y="0.0" width="400" height="130"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="CFu-ns-kay" id="iQP-01-jFC" userLabel="Container"> - <rect key="frame" x="0.0" y="0.0" width="400" height="129"/> + <rect key="frame" x="0.0" y="0.0" width="400" height="129.5"/> <autoresizingMask key="autoresizingMask"/> <subviews> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Klo-Po-J7v" userLabel="Contact Button"> @@ -84,7 +84,7 @@ <color key="textColor" red="0.43529411759999997" green="0.4431372549" blue="0.47450980390000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalCompressionResistancePriority="749" verticalCompressionResistancePriority="749" text="Keine weiteren Nachrichten..." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5es-fE-2Ig"> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalCompressionResistancePriority="749" verticalCompressionResistancePriority="749" text="Keine weiteren Nachrichten..." textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5es-fE-2Ig"> <rect key="frame" x="110" y="60" width="274" height="16"/> <fontDescription key="fontDescription" type="system" pointSize="13"/> <color key="textColor" red="0.66666666666666663" green="0.66666666666666663" blue="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> diff --git a/enzevalos_iphone/Base.lproj/Main.storyboard b/enzevalos_iphone/Base.lproj/Main.storyboard index a492c9d7e56d33f83edfcab80d9047608f43c4af..2ac94be50ad9175e4e30a000f714a52a969231ea 100644 --- a/enzevalos_iphone/Base.lproj/Main.storyboard +++ b/enzevalos_iphone/Base.lproj/Main.storyboard @@ -316,7 +316,7 @@ <!--Navigation Controller--> <scene sceneID="qoE-UA-ZLX"> <objects> - <navigationController automaticallyAdjustsScrollViewInsets="NO" toolbarHidden="NO" id="Amm-QN-vA7" sceneMemberID="viewController"> + <navigationController storyboardIdentifier="RootViewController" automaticallyAdjustsScrollViewInsets="NO" toolbarHidden="NO" id="Amm-QN-vA7" sceneMemberID="viewController"> <toolbarItems/> <navigationBar key="navigationBar" contentMode="scaleToFill" id="A4w-tO-f2v"> <rect key="frame" x="0.0" y="0.0" width="320" height="44"/> @@ -438,24 +438,6 @@ </objects> <point key="canvasLocation" x="-31.199999999999999" y="-949.47526236881572"/> </scene> - <!--Init View Controller--> - <scene sceneID="Mrv-VC-JsN"> - <objects> - <viewController id="bpj-aZ-wCZ" customClass="InitViewController" customModule="enzevalos_iphone" customModuleProvider="target" sceneMemberID="viewController"> - <layoutGuides> - <viewControllerLayoutGuide type="top" id="PLX-Da-XGG"/> - <viewControllerLayoutGuide type="bottom" id="HGD-sZ-too"/> - </layoutGuides> - <view key="view" contentMode="scaleToFill" id="top-pS-mh8"> - <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> - </view> - </viewController> - <placeholder placeholderIdentifier="IBFirstResponder" id="RRR-L4-jfz" userLabel="First Responder" sceneMemberID="firstResponder"/> - </objects> - <point key="canvasLocation" x="834" y="-948"/> - </scene> <!--Inbox--> <scene sceneID="ue1-yd-fJq"> <objects> @@ -709,11 +691,11 @@ <rect key="frame" x="0.0" y="252" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="dM9-jb-EcN" id="tvN-re-z1Z"> - <rect key="frame" x="0.0" y="0.0" width="342" height="43.5"/> + <rect key="frame" x="0.0" y="0.0" width="341" height="43.5"/> <autoresizingMask key="autoresizingMask"/> <subviews> <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="VTZ-4w-fot"> - <rect key="frame" x="15" y="0.0" width="325" height="43.5"/> + <rect key="frame" x="16" y="0.0" width="324" height="43.5"/> <autoresizingMask key="autoresizingMask"/> <fontDescription key="fontDescription" type="system" pointSize="17"/> <nil key="textColor"/> @@ -820,7 +802,7 @@ <autoresizingMask key="autoresizingMask"/> <subviews> <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Z5E-3a-5Ef"> - <rect key="frame" x="15" y="12" width="33.5" height="20.5"/> + <rect key="frame" x="16" y="12" width="33.5" height="20.5"/> <autoresizingMask key="autoresizingMask"/> <fontDescription key="fontDescription" type="system" pointSize="17"/> <nil key="textColor"/> @@ -844,7 +826,7 @@ <autoresizingMask key="autoresizingMask"/> <subviews> <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="xLe-fn-BGo"> - <rect key="frame" x="15" y="12" width="33.5" height="20.5"/> + <rect key="frame" x="16" y="12" width="33.5" height="20.5"/> <autoresizingMask key="autoresizingMask"/> <fontDescription key="fontDescription" type="system" pointSize="17"/> <nil key="textColor"/> @@ -868,7 +850,7 @@ <autoresizingMask key="autoresizingMask"/> <subviews> <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="SsF-tc-fh9"> - <rect key="frame" x="15" y="12" width="33.5" height="20.5"/> + <rect key="frame" x="16" y="12" width="33.5" height="20.5"/> <autoresizingMask key="autoresizingMask"/> <fontDescription key="fontDescription" type="system" pointSize="17"/> <nil key="textColor"/> @@ -892,7 +874,7 @@ <autoresizingMask key="autoresizingMask"/> <subviews> <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="xHD-7H-RVy"> - <rect key="frame" x="15" y="12" width="33.5" height="20.5"/> + <rect key="frame" x="16" y="12" width="33.5" height="20.5"/> <autoresizingMask key="autoresizingMask"/> <fontDescription key="fontDescription" type="system" pointSize="17"/> <nil key="textColor"/> @@ -945,7 +927,7 @@ <!--Send View Controller--> <scene sceneID="gr5-XJ-geZ"> <objects> - <viewController id="4Ey-v4-VeB" customClass="SendViewController" customModule="enzevalos_iphone" customModuleProvider="target" sceneMemberID="viewController"> + <viewController storyboardIdentifier="SendViewController" id="4Ey-v4-VeB" customClass="SendViewController" customModule="enzevalos_iphone" customModuleProvider="target" sceneMemberID="viewController"> <layoutGuides> <viewControllerLayoutGuide type="top" id="Pd7-8i-0I9"/> <viewControllerLayoutGuide type="bottom" id="zNd-c4-1JB"/> @@ -970,88 +952,7 @@ <size key="footerReferenceSize" width="0.0" height="0.0"/> <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/> </collectionViewFlowLayout> - <cells> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="K2l-pc-7Ct"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="26x-eU-QWB"> - <rect key="frame" x="90" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="UiH-nA-0gD"> - <rect key="frame" x="180" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="tje-kJ-Wrn"> - <rect key="frame" x="270" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="s98-Hj-jpN"> - <rect key="frame" x="360" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="5oM-zr-fKL"> - <rect key="frame" x="450" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="dZt-Ck-FRF"> - <rect key="frame" x="540" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="4JR-3M-ptB"> - <rect key="frame" x="630" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="GPW-Nd-0KD"> - <rect key="frame" x="720" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="qgx-L7-bRo"> - <rect key="frame" x="810" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - </cells> + <cells/> <connections> <outletCollection property="gestureRecognizers" destination="b27-VB-voz" appends="YES" id="XZE-Dy-asu"/> <outletCollection property="gestureRecognizers" destination="Dyz-bi-xHw" appends="YES" id="LL1-Iz-H3Q"/> @@ -1089,88 +990,7 @@ <size key="footerReferenceSize" width="0.0" height="0.0"/> <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/> </collectionViewFlowLayout> - <cells> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="5m2-6Y-9NT"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="DBp-X0-Ixz"> - <rect key="frame" x="90" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="F0w-yL-FnJ"> - <rect key="frame" x="180" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="BbP-GQ-7LM"> - <rect key="frame" x="270" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="z2O-ho-YAB"> - <rect key="frame" x="360" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="Fdk-rc-v08"> - <rect key="frame" x="450" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="K3g-dl-n9K"> - <rect key="frame" x="540" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="GST-wo-9BA"> - <rect key="frame" x="630" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="s4l-JR-nx4"> - <rect key="frame" x="720" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="mU7-wR-fF4"> - <rect key="frame" x="810" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> - <rect key="frame" x="0.0" y="0.0" width="90" height="100"/> - <autoresizingMask key="autoresizingMask"/> - </view> - </collectionViewCell> - </cells> + <cells/> <connections> <outletCollection property="gestureRecognizers" destination="7ir-1V-kSk" appends="YES" id="l5Z-Xj-HlA"/> </connections> @@ -1344,6 +1164,7 @@ <outlet property="seperator3Leading" destination="yXj-sj-waX" id="b9Q-d9-eDe"/> <outlet property="subjectText" destination="zbn-j5-Dz7" id="5wb-G0-ipJ"/> <outlet property="tableview" destination="iEa-Rh-6bS" id="DWg-RH-6ph"/> + <outlet property="tableviewBegin" destination="fYk-q4-9QZ" id="WFK-6z-jOv"/> <outlet property="tableviewHeight" destination="fcx-4L-TLn" id="onv-6z-sYk"/> <outlet property="textView" destination="quA-hP-Xkp" id="bsZ-Gx-Cds"/> <outlet property="textViewLeading" destination="7wJ-8N-go2" id="uKC-m1-WGE"/> @@ -1352,6 +1173,7 @@ <outlet property="toHeight" destination="CIk-PS-cBx" id="J4L-8a-qeq"/> <outlet property="toText" destination="zgt-Nh-yna" id="VXM-m0-UCm"/> <segue destination="8Di-x2-cWQ" kind="show" identifier="showContact" id="DcR-GX-scc"/> + <segue destination="olx-gF-WdV" kind="presentation" identifier="inviteSegue" id="QXm-7K-984"/> </connections> </viewController> <placeholder placeholderIdentifier="IBFirstResponder" id="Lv5-U9-uUg" userLabel="First Responder" sceneMemberID="firstResponder"/> @@ -1441,7 +1263,7 @@ <objects> <navigationController automaticallyAdjustsScrollViewInsets="NO" id="olx-gF-WdV" sceneMemberID="viewController"> <toolbarItems/> - <navigationBar key="navigationBar" contentMode="scaleToFill" id="wwS-7W-6ti"> + <navigationBar key="navigationBar" contentMode="scaleToFill" translucent="NO" id="wwS-7W-6ti"> <rect key="frame" x="0.0" y="0.0" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> </navigationBar> @@ -1457,8 +1279,8 @@ </scenes> <inferredMetricsTieBreakers> <segue reference="DcR-GX-scc"/> - <segue reference="rhW-cI-4c4"/> - <segue reference="ecN-Wn-7S0"/> + <segue reference="3Wb-uL-BB5"/> <segue reference="D6m-L0-5AB"/> + <segue reference="ecN-Wn-7S0"/> </inferredMetricsTieBreakers> -</document> +</document> \ No newline at end of file diff --git a/enzevalos_iphone/CNMailAddressesExtension.swift b/enzevalos_iphone/CNMailAddressesExtension.swift index 9cae698777d25db9c23bc4effc856650c1617575..bddb1c0e7ae263f5f30f25902d3fe91b4627114b 100644 --- a/enzevalos_iphone/CNMailAddressesExtension.swift +++ b/enzevalos_iphone/CNMailAddressesExtension.swift @@ -31,6 +31,19 @@ open class CNMailAddressExtension: MailAddress{ } } + + open var keyID: String?{ + get{ + return nil + } + } + + open var contact: EnzevalosContact?{ + get{ + return nil + } + } + init(addr: CNLabeledValue<NSString>){ //FIXME: NSString hier richtig? self.label = addr } diff --git a/enzevalos_iphone/CollectionDataDelegate.swift b/enzevalos_iphone/CollectionDataDelegate.swift index 95bc805865e18af012d21cda572a39c490b03b32..c23b2db1eda8c3e244de629dc9b6297a4ad34319 100644 --- a/enzevalos_iphone/CollectionDataDelegate.swift +++ b/enzevalos_iphone/CollectionDataDelegate.swift @@ -34,7 +34,6 @@ class CollectionDataDelegate : NSObject, UICollectionViewDataSource, UICollectio } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - print(indexPath.row, indexPath.description) let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "frequent", for: indexPath) as! FrequentCell cell.autoresizingMask = UIViewAutoresizing.flexibleHeight cell.clipsToBounds = true diff --git a/enzevalos_iphone/ContactViewController.swift b/enzevalos_iphone/ContactViewController.swift index e44405273a8642fd4577b1dfdef3f7d61dad5cf3..0af3692678b27d5f4af2b4f4d779b1919047a68c 100644 --- a/enzevalos_iphone/ContactViewController.swift +++ b/enzevalos_iphone/ContactViewController.swift @@ -10,30 +10,6 @@ import Foundation import UIKit import Contacts import ContactsUI -// FIXME: comparison operators with optionals were removed from the Swift Standard Libary. -// Consider refactoring the code to use the non-optional operators. -fileprivate func < <T : Comparable>(lhs: T?, rhs: T?) -> Bool { - switch (lhs, rhs) { - case let (l?, r?): - return l < r - case (nil, _?): - return true - default: - return false - } -} - -// FIXME: comparison operators with optionals were removed from the Swift Standard Libary. -// Consider refactoring the code to use the non-optional operators. -fileprivate func > <T : Comparable>(lhs: T?, rhs: T?) -> Bool { - switch (lhs, rhs) { - case let (l?, r?): - return l > r - default: - return rhs < lhs - } -} - class ContactViewController: UIViewController { var keyRecord: KeyRecord? = nil @@ -70,6 +46,7 @@ class ContactViewController: UIViewController { if let row = tableView.indexPathForSelectedRow { tableView.deselectRow(at: row, animated: false) } + navigationController?.toolbar.isHidden = false } func prepareContactSheet() { @@ -142,10 +119,11 @@ class ContactViewController: UIViewController { func showContact() { self.navigationController?.pushViewController(vc!, animated: true) + navigationController?.toolbar.isHidden = true } func contactViewController(_ viewController: CNContactViewController, didCompleteWith contact: CNContact?) { - self.navigationController?.popViewController(animated: true) + _ = self.navigationController?.popViewController(animated: true) prepareContactSheet() } @@ -154,18 +132,23 @@ class ContactViewController: UIViewController { let myPath = IndexPath(row: 1, section: 0) tableView.selectRow(at: myPath, animated: false, scrollPosition: .none) performSegue(withIdentifier: "otherRecord", sender: nil) + } else if (sender as? UIButton)?.titleLabel?.text == NSLocalizedString("invite", comment: "invite contact") { + let mail = EphemeralMail(to: NSSet.init(array: keyRecord!.addresses), cc: NSSet.init(), bcc: NSSet.init(), date: Date(), subject: NSLocalizedString("inviteSubject", comment: ""), body: NSLocalizedString("inviteText", comment: ""), uid: 0) + performSegue(withIdentifier: "newMail", sender: mail) } } override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == "newMail" { let navigationController = segue.destination as? UINavigationController - let controller = navigationController?.topViewController as? SendViewController - let indexPath = tableView.indexPathForSelectedRow - if controller != nil { - // TODO: add address to SendView - if indexPath!.row < keyRecord!.ezContact.getMailAddresses().count { - controller!.toField = keyRecord!.ezContact.getMailAddresses()[indexPath!.row].mailAddress + if let controller = navigationController?.topViewController as? SendViewController { + if let mail = sender as? EphemeralMail { + controller.prefilledMail = mail + } else { + let indexPath = tableView.indexPathForSelectedRow + if indexPath!.row < keyRecord!.ezContact.getMailAddresses().count { + controller.toField = keyRecord!.ezContact.getMailAddresses()[indexPath!.row].mailAddress + } } } } else if segue.identifier == "mailList" { @@ -208,7 +191,7 @@ extension ContactViewController: UITableViewDataSource { cell.contactStatus.text = NSLocalizedString("Verified", comment: "Contact is verified") } else if keyRecord!.hasKey { cell.contactStatus.text = NSLocalizedString("notVerified", comment: "Contact is not verified jet") - } else if otherRecords?.filter({ $0.hasKey }).count > 0 { + } else if (otherRecords?.filter({ $0.hasKey }).count ?? 0) > 0 { cell.contactStatus.text = NSLocalizedString("otherEncryption", comment: "Contact is using encryption, this is the unsecure collection") } else { cell.contactStatus.text = NSLocalizedString("noEncryption", comment: "Contact is not jet using encryption") @@ -218,7 +201,7 @@ extension ContactViewController: UITableViewDataSource { let actionCell = tableView.dequeueReusableCell(withIdentifier: "ActionCell", for: indexPath) as! ActionCell if keyRecord!.hasKey { actionCell.Button.setTitle(NSLocalizedString("verifyNow", comment: "Verify now"), for: UIControlState()) - } else if otherRecords?.filter({ $0.hasKey }).count > 0 { + } else if (otherRecords?.filter({ $0.hasKey }).count ?? 0) > 0 { actionCell.Button.setTitle(NSLocalizedString("toEncrypted", comment: "switch to encrypted"), for: UIControlState()) } else { actionCell.Button.setTitle(NSLocalizedString("invite", comment: "Invide contact to use encryption"), for: UIControlState()) @@ -294,7 +277,7 @@ extension ContactViewController: UITableViewDataSource { func numberOfSections(in tableView: UITableView) -> Int { var sections = 3 - if keyRecord?.ezContact.records.count > 1 { + if (keyRecord?.ezContact.records.count ?? 0) > 1 { sections += 1 } if let hasKey = keyRecord?.hasKey, hasKey { @@ -304,14 +287,14 @@ extension ContactViewController: UITableViewDataSource { } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - if let con = keyRecord { + if let record = keyRecord { switch section { case 0: - if !con.isVerified { + if !record.isVerified { return 2 } case 1: - return con.ezContact.getMailAddresses().count + return record.ezContact.getMailAddresses().count case 3 where !((keyRecord?.hasKey) ?? false): if let rec = otherRecords { return rec.count diff --git a/enzevalos_iphone/DataHandler.swift b/enzevalos_iphone/DataHandler.swift index 73c643f18debf76c0e8f7af804d88f7bfd6a3099..4c5f7ea5dc8ae961aaa38674a35a75de510ecd59 100644 --- a/enzevalos_iphone/DataHandler.swift +++ b/enzevalos_iphone/DataHandler.swift @@ -42,7 +42,7 @@ class DataHandler { static let handler: DataHandler = DataHandler() private var managedObjectContext: NSManagedObjectContext - lazy var mails: [Mail] = self.readMails() + lazy var mails: [PersistentMail] = self.readMails() lazy var contacts: [EnzevalosContact] = self.getContacts() lazy var currentstate: State = self.getCurrentState() @@ -116,15 +116,12 @@ class DataHandler { save() } - func save() -> Bool { - var succ = false + func save(){ do{ try managedObjectContext.save() - succ = true } catch{ fatalError("Failure to save context\(error)") } - return succ } private func cleanContacts() { @@ -150,7 +147,7 @@ class DataHandler { for c in contacts { while c.from.count > MaxMailsPerRecord { let last = c.from.last! - print("delete \(last.uid) of \(last.from.address)") + print("delete \(last.uid) of \(last.from.mailAddress)") managedObjectContext.delete(last) save() if let index = mails.index(of: last) { @@ -251,11 +248,12 @@ class DataHandler { func getContactByAddress(_ address: String) -> EnzevalosContact { // Core function + let lowerAdr = address.lowercased() for c in contacts { if c.addresses != nil { for adr in c.addresses!{ let a = adr as! MailAddress - if a.mailAddress == address { + if a.mailAddress == lowerAdr { return c } } @@ -263,8 +261,8 @@ class DataHandler { if let cnContact = c.cnContact { for adr in cnContact.emailAddresses { let name = adr.value as String - if name == address { - let adr = getMailAddress(address, temporary: false) as! Mail_Address + if name == lowerAdr { + let adr = getMailAddress(lowerAdr, temporary: false) as! Mail_Address c.addToAddresses(adr) adr.contact = c return c @@ -273,12 +271,12 @@ class DataHandler { } } - let search = find("EnzevalosContact", type: "addresses", search: address) + let search = find("EnzevalosContact", type: "addresses", search: lowerAdr) var contact: EnzevalosContact if search == nil || search!.count == 0 { contact = NSEntityDescription.insertNewObject(forEntityName: "EnzevalosContact", into: managedObjectContext) as! EnzevalosContact - contact.displayname = address - let adr = getMailAddress(address, temporary: false)as! Mail_Address + contact.displayname = lowerAdr + let adr = getMailAddress(lowerAdr, temporary: false)as! Mail_Address contact.addToAddresses(adr) adr.contact = contact contacts.append(contact) @@ -295,11 +293,9 @@ class DataHandler { let contact = getContactByAddress(address) contact.displayname = name contact.getAddress(address)?.keyID = key - contact.getAddress(address)?.prefer_encryption //TODO IOptimize: look for Mail_Address and than for contact! + _ = contact.getAddress(address)?.prefer_encryption //TODO IOptimize: look for Mail_Address and than for contact! return contact } - - func getContacts(_ receivers: [MCOAddress]) -> [EnzevalosContact] { var contacts = [EnzevalosContact]() @@ -322,7 +318,7 @@ class DataHandler { // -------- Start handle to, cc, from addresses -------- - private func handleFromAddress(_ sender: MCOAddress, fromMail: Mail, autocrypt: AutocryptContact?) { + private func handleFromAddress(_ sender: MCOAddress, fromMail: PersistentMail, autocrypt: AutocryptContact?) { let adr: Mail_Address let contact = getContactByMCOAddress(sender) adr = contact.getAddressByMCOAddress(sender)! @@ -333,11 +329,11 @@ class DataHandler { fromMail.from = adr } - private func handleToAddresses(_ receivers: [MCOAddress], mail: Mail) { + private func handleToAddresses(_ receivers: [MCOAddress], mail: PersistentMail) { mail.addToTo(NSSet(array: getMailAddressesByMCOAddresses(receivers))) } - private func handleCCAddresses(_ cc: [MCOAddress], mail: Mail) { + private func handleCCAddresses(_ cc: [MCOAddress], mail: PersistentMail) { mail.addToCc(NSSet(array: getMailAddressesByMCOAddresses(cc))) } @@ -345,14 +341,14 @@ class DataHandler { // -------- End handle to, cc, from addresses -------- - func createMail(_ uid: UInt64, sender: MCOAddress, receivers: [MCOAddress], cc: [MCOAddress], time: Date, received: Bool, subject: String, body: String, flags: MCOMessageFlag, record: KeyRecord?, autocrypt: AutocryptContact?) -> Mail { + func createMail(_ uid: UInt64, sender: MCOAddress, receivers: [MCOAddress], cc: [MCOAddress], time: Date, received: Bool, subject: String, body: String, flags: MCOMessageFlag, record: KeyRecord?, autocrypt: AutocryptContact?) /*-> Mail*/ { - let finding = findNum("Mail", type: "uid", search: uid) - let mail: Mail + let finding = findNum("PersistentMail", type: "uid", search: uid) + let mail: PersistentMail if finding == nil || finding!.count == 0 { // create new mail object - mail = NSEntityDescription.insertNewObject(forEntityName: "Mail", into: managedObjectContext) as! Mail + mail = NSEntityDescription.insertNewObject(forEntityName: "PersistentMail", into: managedObjectContext) as! PersistentMail mail.body = body mail.date = time @@ -374,7 +370,7 @@ class DataHandler { mail.decryptIfPossible() } else { - return finding![0] as! Mail + return //finding![0] as! Mail } save() @@ -392,15 +388,15 @@ class DataHandler { } - return mail + //return mail } - private func readMails() -> [Mail] { - var mails = [Mail]() - let result = findAll("Mail") + private func readMails() -> [PersistentMail] { + var mails = [PersistentMail]() + let result = findAll("PersistentMail") if result != nil { for r in result! { - let m = r as! Mail + let m = r as! PersistentMail mails.append(m) if getCurrentState().maxUID < m.uid { getCurrentState().maxUID = m.uid @@ -448,10 +444,12 @@ class DataHandler { r.mails.sort() } records.sort() + print("#KeyRecords: \(records.count) ") + print("#Mails: \(mails.count)") return records } - private func addToRecords(_ m:Mail, records: inout [KeyRecord] ){ + private func addToRecords(_ m: PersistentMail, records: inout [KeyRecord] ){ var found = false for r in records { @@ -463,12 +461,47 @@ class DataHandler { } if !found { let r = KeyRecord(mail: m) + mergeRecords(newRecord: r, records: &records) records.append(r) records.sort() } } - private func addToReceiverRecords(_ m: Mail){ + + private func mergeRecords(newRecord: KeyRecord, records: inout[KeyRecord]){ + var j = 0 + if !newRecord.hasKey{ + return + } + while j < records.count{ + let r = records[j] + if !r.hasKey && r.ezContact == newRecord.ezContact{ + var i = 0 + while i < r.mails.count{ + let mail = r.mails[i] + var remove = false + if mail.from.keyID == newRecord.key{ + remove = newRecord.addNewMail(mail) + if remove{ + r.mails.remove(at: i) + } + } + if !remove{ + i = i + 1 + } + } + if r.mails.count == 0{ + records.remove(at: j) + } else{ + j = j + 1 + } + } else{ + j = j + 1 + } + } + } + + private func addToReceiverRecords(_ m: PersistentMail){ addToRecords(m, records: &receiverRecords) } diff --git a/enzevalos_iphone/Encryption.swift b/enzevalos_iphone/Encryption.swift index 024869b2566b715235558a242deaacaa9ac30619..2be3e2771b0b828528fe5d00ae24686c06c345d9 100644 --- a/enzevalos_iphone/Encryption.swift +++ b/enzevalos_iphone/Encryption.swift @@ -7,7 +7,6 @@ // public protocol Encryption { - /** * ATTENTION: always have a look at the concrete Encryption you are working with! It my differ in some cases from this definition. e.g. some parameters may be used or unused. * In some functions nil is returned, if there is no answer to be made at the moment. An example for this case is the PGPEncryption. You have to decrypt the message before you can see, if there is a signature @@ -19,41 +18,41 @@ public protocol Encryption { init(encHandler: EncryptionHandler) //check whether this encryption is used in this mail. This means is it used for encryption OR signing. - func isUsed(_ mail: Mail) -> Bool + func isUsed(_ mail: PersistentMail) -> Bool //check whether this encryption is used in this text. This means is it used for encryption OR signing. the key is not known to be used. nil is returned, if there is no answer to be made at the moment. func isUsed(_ text: String, key: KeyWrapper?) -> Bool //check whether this encryption is used in this mail for encryption. nil is returned, if there is no answer to be made at the moment. - func isUsedForEncryption(_ mail: Mail) -> Bool? + func isUsedForEncryption(_ mail: PersistentMail) -> Bool? //check whether this encryption is used in this text for encryption. the key is not known to be used. nil is returned, if there is no answer to be made at the moment. func isUsedForEncryption(_ text: String, key: KeyWrapper?) -> Bool? //check whether this encryption is used in this mail for signing. nil is returned, if there is no answer to be made at the moment. - func isUsedForSignature(_ mail: Mail) -> Bool? + func isUsedForSignature(_ mail: PersistentMail) -> Bool? //check whether this encryption is used in this text for signing. nil is returned, if there is no answer to be made at the moment. func isUsedForSignature(_ text: String, key: KeyWrapper?) -> Bool? //decrypt the mails body. the decryted body will be saved in the mail object. - func decrypt(_ mail: Mail) -> String? + func decrypt(_ mail: PersistentMail) -> String? //decrypt the mails body. the decryted body will be saved in the mail object. //Signaturechecking included. will be set in mail object too. - func decryptAndSignatureCheck(_ mail: Mail) + func decryptAndSignatureCheck(_ mail: PersistentMail) //decrypt the text with the given key and return it. func decrypt(_ text: String, keyID: String) -> String? //check whether the mail is correctly signed with this encryption. nil is returned, if there is no answer to be made at the moment. - func isCorrectlySigned(_ mail: Mail) -> Bool? + func isCorrectlySigned(_ mail: PersistentMail) -> Bool? //check whether the text is correctly signed with this encryption. func isCorrectlySigned(_ text: String, key: KeyWrapper) -> Bool? //encrypt mail for contact - func encrypt(_ mail: Mail) + func encrypt(_ mail: PersistentMail) func encrypt(_ text: String, mailaddresses: [String]) -> Data? @@ -61,22 +60,22 @@ public protocol Encryption { func encrypt(_ text: String, keyIDs: [String]) -> Data? //sign mail - func sign(_ mail: Mail) + func sign(_ mail: PersistentMail) //sign text func sign(_ text: String, key: KeyWrapper) -> String //sign and encrypt mail for contact - func signAndEncrypt(_ mail: Mail, forContact: KeyRecord) + func signAndEncrypt(_ mail: PersistentMail, forContact: KeyRecord) func signAndEncrypt(_ text: String, keyIDs: [String]) -> Data? func signAndEncrypt(_ text: String, mailaddresses: [String]) -> Data? - func addKey(_ keyData: Data, forMailAddresses: [String]?) -> String? + @discardableResult func addKey(_ keyData: Data, forMailAddresses: [String]?) -> String? - func addKey(_ keyData: Data, forMailAddresses: [String]?, discoveryMailUID: UInt64?) -> String? + @discardableResult func addKey(_ keyData: Data, forMailAddresses: [String]?, discoveryMailUID: UInt64?) -> String? //key is connected to the senders address, if discoveryMail is set - func addKey(_ keyData: Data, discoveryMail: Mail?) -> String? + @discardableResult func addKey(_ keyData: Data, discoveryMail: PersistentMail?) -> String? //will be maybe deleted... because keyWrapper will be added when constructed //func addKey(key: KeyWrapper, forMailAddress: [String]?, callBack: ((success: Bool) -> Void)?) diff --git a/enzevalos_iphone/EncryptionHandler.swift b/enzevalos_iphone/EncryptionHandler.swift index 07c6aa4f8a4a8a223b0e4bf165931f57627fc486..4b8f77c04231d2d0346eda2e13f84ca575323ae6 100644 --- a/enzevalos_iphone/EncryptionHandler.swift +++ b/enzevalos_iphone/EncryptionHandler.swift @@ -11,6 +11,13 @@ import Foundation public protocol EncryptionHandler { //var keychain + //----- static stuff ----- + // static func getEncryption(_ encryptionType: EncryptionType) -> Encryption? + // static func hasKey(_ enzContact: EnzevalosContact) -> Bool + // static func hasKey(_ mailAddress: String) -> Bool + // static func getEncryptionTypeForMail(_ mail: Mail) -> EncryptionType + // static func sortMailaddressesByEncryption(_ mailaddresses: [String]) -> [EncryptionType: [String]] + // static func sortMailaddressesByEncryptionMCOAddress(_ mailaddresses: [String]) -> [EncryptionType: [MCOAddress]] //handle entrys in keychain for different Encryptions diff --git a/enzevalos_iphone/EnzevalosEncryptionHandler.swift b/enzevalos_iphone/EnzevalosEncryptionHandler.swift index 31e9507d9ee231281e803decd39e095838692183..6ee0137f81d7565e7bd42a87be5c2fe7968c2561 100644 --- a/enzevalos_iphone/EnzevalosEncryptionHandler.swift +++ b/enzevalos_iphone/EnzevalosEncryptionHandler.swift @@ -46,9 +46,18 @@ class EnzevalosEncryptionHandler : EncryptionHandler { return false } + static func getEncryptionType(_ mailAddress: String) -> EncryptionType { + for (_, enc) in encryptions { + if enc.hasKey(mailAddress){ + return enc.encryptionType + } + } + return EncryptionType.unknown + } + - static func getEncryptionTypeForMail(_ mail: Mail) -> EncryptionType { + static func getEncryptionTypeForMail(_ mail: PersistentMail) -> EncryptionType { for (type, enc) in encryptions { if enc.isUsed(mail) { return type diff --git a/enzevalos_iphone/EphemeralMail.swift b/enzevalos_iphone/EphemeralMail.swift new file mode 100644 index 0000000000000000000000000000000000000000..846994e7072b47d8ed88a777b9dd19be16cb0326 --- /dev/null +++ b/enzevalos_iphone/EphemeralMail.swift @@ -0,0 +1,30 @@ +// +// EphemeralMail.swift +// enzevalos_iphone +// +// Created by Oliver Wiese on 17/05/17. +// Copyright © 2017 fu-berlin. All rights reserved. +// + +import Foundation + +open class EphemeralMail: Mail { + + public var cc: NSSet? + public var bcc: NSSet? + public var to: NSSet + public var date: Date + public var subject: String? + public var body: String? + public var uid: UInt64 + + public init(to: NSSet, cc: NSSet, bcc: NSSet, date: Date, subject: String?, body: String?, uid: UInt64) { //TODO: is casting cc and bcc necessary? + self.cc = cc + self.bcc = bcc + self.to = to + self.body = body + self.date = date + self.subject = subject + self.uid = uid + } +} diff --git a/enzevalos_iphone/FlipTransition.swift b/enzevalos_iphone/FlipTransition.swift index a5f4e2a1f8ac133ec5bb5a2dda39955b37a8e323..d1642577ace9a854ee80de3a2af6b1160d9362c7 100644 --- a/enzevalos_iphone/FlipTransition.swift +++ b/enzevalos_iphone/FlipTransition.swift @@ -28,10 +28,10 @@ class FlipTransition: NSObject, UIViewControllerAnimatedTransitioning { let initalFrame = transitionContext.initialFrame(for: fromVC!) toVC.view.frame = initalFrame fromVC!.view.frame = initalFrame - toVC.view.layer.transform = CATransform3DMakeRotation(CGFloat(M_PI_2), 0, 1, 0) + toVC.view.layer.transform = CATransform3DMakeRotation(.pi / 2, 0, 1, 0) UIView.animate(withDuration: transitionDuration(using: transitionContext), delay: 0, options: .curveEaseOut, animations: { () -> Void in - fromVC!.view.layer.transform = CATransform3DMakeRotation(CGFloat(-M_PI_2), 0, 1, 0) + fromVC!.view.layer.transform = CATransform3DMakeRotation(.pi / -2, 0, 1, 0) }) { (finished: Bool) -> Void in container.bringSubview(toFront: toVC.view) UIView.animate(withDuration: self.transitionDuration(using: transitionContext), delay: 0, options: .curveEaseOut, animations: { () -> Void in diff --git a/enzevalos_iphone/FrequentCell.swift b/enzevalos_iphone/FrequentCell.swift index 3f62c2ea2d907fac0515d79f89aace755b0c9cec..9067ee4f6c4d3394a83fb836fa62edeab22f06b9 100644 --- a/enzevalos_iphone/FrequentCell.swift +++ b/enzevalos_iphone/FrequentCell.swift @@ -19,14 +19,12 @@ class FrequentCell : UICollectionViewCell { override init(frame: CGRect) { super.init(frame: frame) - print("Rect") - self.frame = CGRect.init(x: 0, y: 0, width: 90, height: 90) + self.frame = CGRect.init(x: 0, y: 0, width: 90, height: 100) } required init?(coder aDecoder: NSCoder) { - print("Coder") super.init(coder: aDecoder) - self.frame = CGRect.init(x: 0, y: 33, width: 90, height: 90) + self.frame = CGRect.init(x: 0, y: 33, width: 90, height: 100) } func drawBackgroud(_ color : UIColor){ diff --git a/enzevalos_iphone/IconsStyleKit.swift b/enzevalos_iphone/IconsStyleKit.swift index b250367f4eb43ca9da234baa35f8bcca0d02afcf..7b23385ee12945541e56c210be845e6c858964ff 100644 --- a/enzevalos_iphone/IconsStyleKit.swift +++ b/enzevalos_iphone/IconsStyleKit.swift @@ -539,7 +539,7 @@ open class IconsStyleKit : NSObject { set { Cache.letterTargets = newValue for target: AnyObject in newValue { - target.perform(NSSelectorFromString("setImage:"), with: IconsStyleKit.imageOfLetter) + _ = target.perform(NSSelectorFromString("setImage:"), with: IconsStyleKit.imageOfLetter) } } } @@ -549,7 +549,7 @@ open class IconsStyleKit : NSObject { set { Cache.letterCorruptedTargets = newValue for target: AnyObject in newValue { - target.perform(NSSelectorFromString("setImage:"), with: IconsStyleKit.imageOfLetterCorrupted) + _ = target.perform(NSSelectorFromString("setImage:"), with: IconsStyleKit.imageOfLetterCorrupted) } } } @@ -559,7 +559,7 @@ open class IconsStyleKit : NSObject { set { Cache.postcardTargets = newValue for target: AnyObject in newValue { - target.perform(NSSelectorFromString("setImage:"), with: IconsStyleKit.imageOfPostcard) + _ = target.perform(NSSelectorFromString("setImage:"), with: IconsStyleKit.imageOfPostcard) } } } @@ -569,7 +569,7 @@ open class IconsStyleKit : NSObject { set { Cache.letterOpenTargets = newValue for target: AnyObject in newValue { - target.perform(NSSelectorFromString("setImage:"), with: IconsStyleKit.imageOfLetterOpen) + _ = target.perform(NSSelectorFromString("setImage:"), with: IconsStyleKit.imageOfLetterOpen) } } } diff --git a/enzevalos_iphone/InboxCellDelegator.swift b/enzevalos_iphone/InboxCellDelegator.swift index 8989b99f958db5fd8ce5837c1261f0a6b1a4258a..355d636530938689f4402825930586081abfe1d4 100644 --- a/enzevalos_iphone/InboxCellDelegator.swift +++ b/enzevalos_iphone/InboxCellDelegator.swift @@ -7,7 +7,8 @@ // protocol InboxCellDelegator { - func callSegueFromCell(_ mail: Mail?) + + func callSegueFromCell(_ mail: PersistentMail?) func callSegueFromCell2(_ contact: KeyRecord?) func callSegueToContact(_ contact: KeyRecord?) } diff --git a/enzevalos_iphone/InboxTableViewCell.swift b/enzevalos_iphone/InboxTableViewCell.swift index 6f90af65018aa5b47420d01c9782fc5534ef2194..34654e206626e173a3683bda2151723c6e78104f 100644 --- a/enzevalos_iphone/InboxTableViewCell.swift +++ b/enzevalos_iphone/InboxTableViewCell.swift @@ -87,7 +87,7 @@ class InboxTableViewCell: UITableViewCell { secondMessageLabel.text = NSLocalizedString("NoFurtherMessages", comment: "There is only one message from this sender.") secondButton.isEnabled = false } - if con.hasKey { + if con.isSecure { iconView.image = IconsStyleKit.imageOfLetterBG } else { iconView.image = IconsStyleKit.imageOfPostcardBG @@ -102,7 +102,7 @@ class InboxTableViewCell: UITableViewCell { } } - var firstMail: Mail? { + var firstMail: PersistentMail? { didSet { if let mail = firstMail { if !mail.isRead { @@ -120,7 +120,7 @@ class InboxTableViewCell: UITableViewCell { } } - var secondMail: Mail? { + var secondMail: PersistentMail? { didSet { if let mail = secondMail { if !mail.isRead { diff --git a/enzevalos_iphone/InboxViewController.swift b/enzevalos_iphone/InboxViewController.swift index 50812ee312d39521f4857d06c25284eca3ecbafc..07879cc6bc902b7dd2bf7e4636a52c6f76529024 100644 --- a/enzevalos_iphone/InboxViewController.swift +++ b/enzevalos_iphone/InboxViewController.swift @@ -144,7 +144,7 @@ class InboxViewController: UITableViewController, InboxCellDelegator { return 0.01 } - func callSegueFromCell(_ mail: Mail?) { + func callSegueFromCell(_ mail: PersistentMail?) { performSegue(withIdentifier: "readMailSegue", sender: mail) } @@ -160,7 +160,7 @@ class InboxViewController: UITableViewController, InboxCellDelegator { override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == "readMailSegue" { - if let mail = sender as? Mail { + if let mail = sender as? PersistentMail { let DestinationViewController: ReadViewController = segue.destination as! ReadViewController DestinationViewController.mail = mail } diff --git a/enzevalos_iphone/InitViewController.swift b/enzevalos_iphone/InitViewController.swift index 1f3027172ec8a4b9b5c842cb5465f6ddbd9daacc..5cf67b181f6be69d0e5592f9d83f9f2297ab2b6e 100644 --- a/enzevalos_iphone/InitViewController.swift +++ b/enzevalos_iphone/InitViewController.swift @@ -20,19 +20,25 @@ class InitViewController : UIViewController { let manager = MCOMailProvidersManager.shared()!//.init() //sharedManager() print(manager) let path = Bundle.main.path(forResource: "providers", ofType: "json") - print(path) + print(path ?? "nil") manager.registerProviders(withFilename: path) - print(manager.provider(forEmail: "alice2005@yahoo.com") == nil) - print(manager.provider(forEmail: "alice2005@aol.com") == nil) + print(manager.provider(forEmail: "alice2005@web.de") == nil) + print(manager.provider(forEmail: "alice2005@aol.com") == nil) //x print(manager.provider(forEmail: "aol.com") == nil) print(manager.provider(forMX: "imap.aol.com") == nil) - print(manager.provider(forMX: "web") == nil) - print(manager.provider(forMX: "web.de") == nil) - print(manager.provider(forIdentifier: "web") == nil) + print(manager.provider(forMX: "web") == nil) //x + print(manager.provider(forMX: "web.de") == nil) //x + print(manager.provider(forIdentifier: "web") == nil) //x print(manager.provider(forIdentifier: "web.de") == nil) print(manager.provider(forIdentifier: "alice2005@aol.com") == nil) - print(manager.provider(forIdentifier: "aol") == nil) + print(manager.provider(forIdentifier: "aol") == nil) //x print(manager.provider(forIdentifier: "aol.com") == nil) + + print(manager.provider(forMX: "web.de").imapServices()) + print(manager.provider(forMX: "web.de").smtpServices()) + + let nService : MCONetService = (manager.provider(forMX: "web.de").smtpServices() as! [MCONetService])[0] + print(nService.info()) } } diff --git a/enzevalos_iphone/KeyRecord.swift b/enzevalos_iphone/KeyRecord.swift index 5b7dd1e72a9767f673f86b76de62923d935ae641..77f7603634393394bd44032ba4e9ee832c1c1a1a 100644 --- a/enzevalos_iphone/KeyRecord.swift +++ b/enzevalos_iphone/KeyRecord.swift @@ -11,6 +11,7 @@ import Contacts import UIKit open class KeyRecord: Record { + /* A record contains a signing key (or none because of insecure communication), a contact (inlucding mail-addresses) and mails. For each key we have a different record for mailboxes. Mails and contact are affliate with the key. @@ -25,8 +26,11 @@ open class KeyRecord: Record { return ezContact.name } open var hasKey: Bool { + // Public encryption key. May missing for secure mails since mail is only signed and encrypted return key != nil } + + open var isSecure: Bool = false open var isVerified: Bool { if let key = self.key { @@ -39,7 +43,7 @@ open class KeyRecord: Record { } - open var mails: [Mail] = [Mail]() + open var mails: [PersistentMail] = [PersistentMail]() open var ezContact: EnzevalosContact @@ -48,12 +52,6 @@ open class KeyRecord: Record { return ezContact.cnContact } - public init(contact: EnzevalosContact, key: String?) { - self.ezContact = contact - self.key = key - self.mails = [Mail] () - } - open var image: UIImage { return ezContact.getImageOrDefault() } @@ -62,17 +60,18 @@ open class KeyRecord: Record { } - public init(mail: Mail) { - if(mail.isSecure) { + public init(mail: PersistentMail) { + self.isSecure = mail.isSecure + if(mail.isSecure && mail.from.hasKey) { self.key = mail.from.keyID } - else { + else { self.key = nil } mails.append(mail) mails.sort() - self.ezContact = mail.from.contact - addNewAddress(mail.from) + self.ezContact = mail.from.contact! + _ = addNewAddress(mail.from) } open static func deleteRecordFromRecordArray(_ records: [KeyRecord], delRecord: KeyRecord) -> [KeyRecord] { @@ -118,7 +117,7 @@ open class KeyRecord: Record { open func showInfos() { print("-----------------") print("Name: \(ezContact.displayname) | State: \(hasKey) | #Mails: \(mails.count)") - print("First mail: \(mails.first?.uid) | Adr: \(mails.first?.from.address) | date: \(mails.first?.date.description) ") + print("First mail: \(mails.first?.uid) | Adr: \(mails.first?.from.mailAddress) | date: \(mails.first?.date.description) ") print("subj: \(mails.first?.subject?.capitalized)") } @@ -132,23 +131,23 @@ open class KeyRecord: Record { return true } - open func addNewMail(_ mail: Mail) -> Bool { - //TODO: signed only mails are dropped ?? - if mail.isSecure && self.hasKey { + open func addNewMail(_ mail: PersistentMail) -> Bool { + // TODO: signed only mails are dropped ?? + if mail.isSecure && self.isSecure { if mail.from.keyID == self.key { mails.append(mail) mails.sort() - addNewAddress(mail.from) + _ = addNewAddress(mail.from) return true } return false } - else if mail.isSecure && !self.hasKey || !mail.isSecure && self.hasKey { + else if mail.isSecure != self.isSecure { return false } - if ezContact.getAddress(mail.from.address) != nil { + if ezContact.getAddress(mail.from.mailAddress) != nil { for m in mails { if m.uid == mail.uid { return true @@ -157,11 +156,9 @@ open class KeyRecord: Record { break } } - - mails.append(mail) mails.sort() - addNewAddress(mail.from) + _ = addNewAddress(mail.from) return true } return false @@ -187,7 +184,6 @@ public func == (lhs: KeyRecord, rhs: KeyRecord) -> Bool { if isEmpty(rhs) { return false } - return lhs.mails.first!.date == rhs.mails.first!.date && lhs.hasKey == rhs.hasKey && lhs.key == rhs.key } diff --git a/enzevalos_iphone/KeyViewController.swift b/enzevalos_iphone/KeyViewController.swift index caa5f33dff6eb240ac3c49cc86e2897bddd49ea8..e63d9f268f21b2993b3881b4b9080afbadba2dd0 100644 --- a/enzevalos_iphone/KeyViewController.swift +++ b/enzevalos_iphone/KeyViewController.swift @@ -85,12 +85,12 @@ extension KeyViewController: UITableViewDataSource { } else if toRowType(indexPath) == .verified { let cell = tableView.dequeueReusableCell(withIdentifier: "VerifiedCell")! - cell.textLabel?.text = NSLocalizedString("KeyIsVerified", comment: "The Key is verified. The time when the Key was verified") + "\(keyWrapper?.verifyTime)" + cell.textLabel?.text = NSLocalizedString("KeyIsVerified", comment: "The Key is verified. The time when the Key was verified") + "\(String(describing: keyWrapper?.verifyTime))" return cell } else if toRowType(indexPath) == .revoked { let cell = tableView.dequeueReusableCell(withIdentifier: "RevokedCell")! - cell.textLabel?.text = NSLocalizedString("KeyIsRevoked", comment: "The Key is revoked. The time when the Key was revoked") + "\(keyWrapper?.revokeTime)" + cell.textLabel?.text = NSLocalizedString("KeyIsRevoked", comment: "The Key is revoked. The time when the Key was revoked") + "\(String(describing: keyWrapper?.revokeTime))" return cell } } diff --git a/enzevalos_iphone/LabelStyleKit.swift b/enzevalos_iphone/LabelStyleKit.swift index dd44646481fb23d9d7b951c6a02136c63aa81242..461f457e45465ac3096b0ea183d68b578179c9d1 100644 --- a/enzevalos_iphone/LabelStyleKit.swift +++ b/enzevalos_iphone/LabelStyleKit.swift @@ -246,7 +246,7 @@ open class LabelStyleKit : NSObject { set { Cache.homeTargets = newValue for target: AnyObject in newValue { - target.perform(NSSelectorFromString("setImage:"), with: LabelStyleKit.imageOfHome) + _ = target.perform(NSSelectorFromString("setImage:"), with: LabelStyleKit.imageOfHome) } } } @@ -256,7 +256,7 @@ open class LabelStyleKit : NSObject { set { Cache.workTargets = newValue for target: AnyObject in newValue { - target.perform(NSSelectorFromString("setImage:"), with: LabelStyleKit.imageOfWork) + _ = target.perform(NSSelectorFromString("setImage:"), with: LabelStyleKit.imageOfWork) } } } @@ -266,7 +266,7 @@ open class LabelStyleKit : NSObject { set { Cache.otherTargets = newValue for target: AnyObject in newValue { - target.perform(NSSelectorFromString("setImage:"), with: LabelStyleKit.imageOfOther) + _ = target.perform(NSSelectorFromString("setImage:"), with: LabelStyleKit.imageOfOther) } } } diff --git a/enzevalos_iphone/ListViewController.swift b/enzevalos_iphone/ListViewController.swift index 28c7a4cc1d717b879065d1d4d32b4f5cea7d95b1..2017fc7589701a13701adc0ebd29bb5032d02ccd 100644 --- a/enzevalos_iphone/ListViewController.swift +++ b/enzevalos_iphone/ListViewController.swift @@ -46,7 +46,7 @@ fileprivate func >= <T : Comparable>(lhs: T?, rhs: T?) -> Bool { class ListViewController: UITableViewController { let searchController = UISearchController(searchResultsController: nil) - var filteredMails = [Mail]() + var filteredMails = [PersistentMail]() var contact: KeyRecord? { didSet { self.title = contact!.name @@ -160,7 +160,7 @@ class ListViewController: UITableViewController { } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let mail: Mail? + let mail: PersistentMail? if searchController.isActive && searchController.searchBar.text != "" { mail = filteredMails[indexPath.row] @@ -186,7 +186,7 @@ class ListViewController: UITableViewController { } override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - let mail: Mail? + let mail: PersistentMail? if searchController.isActive && searchController.searchBar.text != "" { mail = filteredMails[indexPath.row] @@ -218,7 +218,7 @@ class ListViewController: UITableViewController { override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == "readMailSegue" { - if let mail = sender as? Mail { + if let mail = sender as? PersistentMail { let DestinationViewController: ReadViewController = segue.destination as! ReadViewController DestinationViewController.mail = mail } diff --git a/enzevalos_iphone/LogHandler.swift b/enzevalos_iphone/LogHandler.swift index b6f5c720573fd5a8cb0186a82c3ef2c7b103e7e5..c890590a649dbcae1c3fd4703c3768ab6572b006 100644 --- a/enzevalos_iphone/LogHandler.swift +++ b/enzevalos_iphone/LogHandler.swift @@ -73,7 +73,7 @@ class LogHandler { print() print("--------------------LOG OUTPUT--------------------") print("LoggingSession ",session) - print(defaults.object(forKey: String(session)+"-date")) + print(defaults.object(forKey: String(session)+"-date") as Any) print() for i in 0 ..< defaults.integer(forKey: String(session)+"-index")+1{ if let entry = defaults.object(forKey: String(session)+"-"+String(i)) { diff --git a/enzevalos_iphone/Mail.swift b/enzevalos_iphone/Mail.swift new file mode 100644 index 0000000000000000000000000000000000000000..cd8dfd7bc97dc023c36ea595a015593ce2186f48 --- /dev/null +++ b/enzevalos_iphone/Mail.swift @@ -0,0 +1,29 @@ +// +// Mail.swift +// enzevalos_iphone +// +// Created by Oliver Wiese on 16/05/17. +// Copyright © 2017 fu-berlin. All rights reserved. +// + +import Foundation + + +public protocol Mail: Comparable { + + var cc: NSSet? { get } + var bcc: NSSet? { get } + var to: NSSet { get } + var date: Date { get } + var subject: String? { get } + var body: String? { get } + var uid: UInt64 { get } +} + +public func == <T: Mail> (lhs: T, rhs: T) -> Bool { + return lhs.date == rhs.date && lhs.uid == rhs.uid +} + +public func << T: Mail > (lhs: T, rhs: T) -> Bool { + return lhs.date > rhs.date +} diff --git a/enzevalos_iphone/MailAddress.swift b/enzevalos_iphone/MailAddress.swift index 0f2f0a2c3451efbaffe5d429bb5503116f0d1cdd..a0362417787d95f7c6b6343a0c1f42af8fa1f634 100644 --- a/enzevalos_iphone/MailAddress.swift +++ b/enzevalos_iphone/MailAddress.swift @@ -14,4 +14,7 @@ public protocol MailAddress { 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 prefEnc: Bool{get set} var hasKey: Bool{get} + + var keyID: String?{get} + var contact: EnzevalosContact?{get} } diff --git a/enzevalos_iphone/MailHandler.swift b/enzevalos_iphone/MailHandler.swift index b3d33264c224ca9864f070893eb906d7af15f713..bec5f76e09b4c5c7d68e52743d9a80c0031e902d 100644 --- a/enzevalos_iphone/MailHandler.swift +++ b/enzevalos_iphone/MailHandler.swift @@ -69,7 +69,7 @@ class AutocryptContact { init(addr: String, type: String, prefer_encryption: String, key: String) { self.addr = addr self.type = EncryptionType.typeFromAutocrypt(type) - setPrefer_encryption(prefer_encryption) + _ = setPrefer_encryption(prefer_encryption) self.key = key } @@ -140,7 +140,7 @@ class AutocryptContact { } func toString() -> String { - return "Addr: \(addr) | type: \(type) | encryption? \(prefer_encryption) | key: \(key)" + return "Addr: \(addr) | type: \(type) | encryption? \(prefer_encryption)" } } @@ -363,6 +363,7 @@ class MailHandler { return } if let msgs = msg { + print("#mails on server: \(msgs.count)") let dispatchGroup = DispatchGroup() for m in msgs { let message: MCOIMAPMessage = m as! MCOIMAPMessage @@ -382,7 +383,7 @@ class MailHandler { } func parseMail(_ error: Error?, parser: MCOMessageParser?, message: MCOIMAPMessage, record: KeyRecord?, newMailCallback: (() -> ())) { guard error == nil else { - print("Error while fetching mail: \(error)") + print("Error while fetching mail: \(String(describing: error))") return } if let data = parser?.data() { @@ -402,17 +403,16 @@ func parseMail(_ error: Error?, parser: MCOMessageParser?, message: MCOIMAPMessa var autocrypt: AutocryptContact? = nil if let _ = header?.extraHeaderValue(forName: AUTOCRYPTHEADER){ autocrypt = AutocryptContact(header: header!) - print(autocrypt?.toString() ?? "nil") if(autocrypt?.type == EncryptionType.PGP && autocrypt?.key.characters.count > 0){ let pgp = ObjectivePGP.init() pgp.importPublicKey(fromHeader: (autocrypt?.key)!, allowDuplicates: false) let enc = EnzevalosEncryptionHandler.getEncryption(EncryptionType.PGP) do { let pgpKey = try pgp.keys[0].export() - enc?.addKey(pgpKey, forMailAddresses: [(header?.from.mailbox)!]) + _ = enc?.addKey(pgpKey, forMailAddresses: [(header?.from.mailbox)!]) } catch { - print("Could not conntect key! \(autocrypt?.toString())") + print("Could not conntect key! \(autocrypt?.toString() ?? "empty autocrypt")") } } @@ -428,7 +428,7 @@ func parseMail(_ error: Error?, parser: MCOMessageParser?, message: MCOIMAPMessa } } - DataHandler.handler.createMail(UInt64(message.uid), sender: (header?.from)!, receivers: rec, cc: cc, time: (header?.date)!, received: true, subject: header?.subject ?? "", body: body, flags: message.flags, record: record, autocrypt: autocrypt) //@Olli: fatal error: unexpectedly found nil while unwrapping an Optional value //crash wenn kein header vorhanden ist + _ = DataHandler.handler.createMail(UInt64(message.uid), sender: (header?.from)!, receivers: rec, cc: cc, time: (header?.date)!, received: true, subject: header?.subject ?? "", body: body, flags: message.flags, record: record, autocrypt: autocrypt) //@Olli: fatal error: unexpectedly found nil while unwrapping an Optional value //crash wenn kein header vorhanden ist newMailCallback() } } diff --git a/enzevalos_iphone/MailHandlerDelegator.swift b/enzevalos_iphone/MailHandlerDelegator.swift index a72c196b3532cc554240d26791dcbde539d32dc5..2d920f9dcb7ed886803c7503e19fac92ed642054 100644 --- a/enzevalos_iphone/MailHandlerDelegator.swift +++ b/enzevalos_iphone/MailHandlerDelegator.swift @@ -9,6 +9,7 @@ import Foundation protocol MailHandlerDelegator { - func addNewMail(_ mail: Mail) + + func addNewMail(_ mail: PersistentMail) func getMailCompleted() } diff --git a/enzevalos_iphone/Mail_Address+CoreDataClass.swift b/enzevalos_iphone/Mail_Address+CoreDataClass.swift index 872bf93e396dec0737c38563760e26dd6e39bb23..b60cb98e5281fd58172b90b54cfc679a15f4d852 100644 --- a/enzevalos_iphone/Mail_Address+CoreDataClass.swift +++ b/enzevalos_iphone/Mail_Address+CoreDataClass.swift @@ -15,11 +15,11 @@ import Contacts open class Mail_Address: NSManagedObject, MailAddress { open var mailAddress: String { - return address + return address.lowercased() } open var label: CNLabeledValue<NSString> { //Wie in MailAddress; Ist der NSString hier richtig? (http://stackoverflow.com/questions/39648830/how-to-add-new-email-to-cnmutablecontact-in-swift-3) - if let cnc = self.contact.cnContact { + if let cnc = self.contact?.cnContact { for adr in cnc.emailAddresses { if adr.value as String == address { return adr @@ -38,9 +38,12 @@ open class Mail_Address: NSManagedObject, MailAddress { } } - //TODO think about it! + //TODO think about it! Better safe state or update state??? open var keyID: String? { get { + if self.encryptionType == EncryptionType.unknown{ + self.encryptionType = EnzevalosEncryptionHandler.getEncryptionType(self.address) + } if let encryption = EnzevalosEncryptionHandler.getEncryption(self.encryptionType) { return encryption.getActualKeyID(self.address) } @@ -57,7 +60,7 @@ open class Mail_Address: NSManagedObject, MailAddress { } } } - else { + else { if let encryption = EnzevalosEncryptionHandler.getEncryption(self.encryptionType) { if let currentID = self.keyID { encryption.removeMailAddressForKey(self.mailAddress, keyID: currentID) diff --git a/enzevalos_iphone/Mail_Address+CoreDataProperties.swift b/enzevalos_iphone/Mail_Address+CoreDataProperties.swift index 0bd743e93fcf1007dfb30661641faff05c3becaf..3740481dd736e6f1bfff57e7b1948f59250208bc 100644 --- a/enzevalos_iphone/Mail_Address+CoreDataProperties.swift +++ b/enzevalos_iphone/Mail_Address+CoreDataProperties.swift @@ -19,7 +19,7 @@ extension Mail_Address { @NSManaged public var address: String @NSManaged public var prefer_encryption: Bool - @NSManaged public var contact: EnzevalosContact + @NSManaged public var contact: EnzevalosContact? public var encryptionType: EncryptionType{ set { @@ -51,10 +51,10 @@ extension Mail_Address { extension Mail_Address { @objc(addBccObject:) - @NSManaged public func addToBcc(_ value: Mail) + @NSManaged public func addToBcc(_ value: PersistentMail) @objc(removeBccObject:) - @NSManaged public func removeFromBcc(_ value: Mail) + @NSManaged public func removeFromBcc(_ value: PersistentMail) @objc(addBcc:) @NSManaged public func addToBcc(_ values: NSSet) @@ -68,10 +68,10 @@ extension Mail_Address { extension Mail_Address { @objc(addCcObject:) - @NSManaged public func addToCc(_ value: Mail) + @NSManaged public func addToCc(_ value: PersistentMail) @objc(removeCcObject:) - @NSManaged public func removeFromCc(_ value: Mail) + @NSManaged public func removeFromCc(_ value: PersistentMail) @objc(addCc:) @NSManaged public func addToCc(_ values: NSSet) @@ -85,10 +85,10 @@ extension Mail_Address { extension Mail_Address { @objc(addToObject:) - @NSManaged public func addToTo(_ value: Mail) + @NSManaged public func addToTo(_ value: PersistentMail) @objc(removeToObject:) - @NSManaged public func removeFromTo(_ value: Mail) + @NSManaged public func removeFromTo(_ value: PersistentMail) @objc(addTo:) @NSManaged public func addToTo(_ values: NSSet) diff --git a/enzevalos_iphone/Onboarding.swift b/enzevalos_iphone/Onboarding.swift index 198d0b83f7bd4863a0abe8f730a9726e42c5bf70..58dea8a2d260b52202e31d98ae1907259970f8a3 100644 --- a/enzevalos_iphone/Onboarding.swift +++ b/enzevalos_iphone/Onboarding.swift @@ -9,7 +9,13 @@ import Foundation import Onboard -class Onboarding { +class Onboarding: NSObject { + + override init() { + super.init() + } + + static var textDelegate = TextFieldDelegate.init() static var mailaddress = UITextField.init() static var username = UITextField.init() static var password = UITextField.init() @@ -48,55 +54,145 @@ class Onboarding { var myBounds = CGRect() myBounds.size.width = 70 myBounds.size.height = 70 - UIGraphicsBeginImageContextWithOptions(myBounds.size, false, 2) //try 200 here - - let context = UIGraphicsGetCurrentContext() - - // - // Clip context to a circle - // - let path = CGPath(ellipseIn: myBounds, transform: nil); - context!.addPath(path); - context!.clip(); - - - // - // Fill background of context - // - context!.setFillColor(UIColor.init(red: 0.1, green: 1.0, blue: 0.3, alpha: 0.0).cgColor) + UIGraphicsBeginImageContextWithOptions(myBounds.size, true, 0) //try 200 here + var context = UIGraphicsGetCurrentContext() + context!.setFillColor(UIColor.init(red: 1, green: 1, blue: 1, alpha: 1).cgColor)//ThemeManager.encryptedMessageColor().cgColor)// context!.fill(CGRect(x: 0, y: 0, width: myBounds.size.width, height: myBounds.size.height)); - let snapshot = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); + myBounds = CGRect() + myBounds.size.width = 70 + myBounds.size.height = 70 + UIGraphicsBeginImageContextWithOptions(myBounds.size, true, 0) + context = UIGraphicsGetCurrentContext() + context!.setFillColor(ThemeManager.uncryptedMessageColor().cgColor) + context!.fill(CGRect(x: 0, y: 0, width: myBounds.size.width, height: myBounds.size.height)); + let snapshot2 = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + background = snapshot! + let postcardBg = snapshot2! + let defaultColor = UIColor.init(red: 0.6, green: 0.6, blue: 1, alpha: 1) + + //Introduction + let intro1 = OnboardingContentViewController.content(withTitle: "Brief", body: "• Eine vertrauliche E-Mail\n• Sie stammt tatsächlich vom angegebenen Absender\n• Benötigt Beteiligung von Sender und Empfänger. Dafür besteht in der App die Möglichkeit Kontakte einzuladen.", image: /*IconsStyleKit.imageOfLetterBG*/ nil, buttonText: nil, action: nil) + + intro1.iconHeight = 70 + intro1.iconWidth = 100 + UIGraphicsBeginImageContextWithOptions(CGSize(width: 100, height: 70), false, 0) + IconsStyleKit.drawLetter(frame: CGRect(x: 0, y: 0, width: 100, height: 70), fillBackground: true) + intro1.iconImageView.image = UIGraphicsGetImageFromCurrentImageContext()! + UIGraphicsEndImageContext() + intro1.bodyLabel.textAlignment = NSTextAlignment.left + + let intro2 = OnboardingContentViewController.content(withTitle: "Postkarte", body: "• Eine E-Mail, wie du sie bisher kennst\n• Weder vertraulich, noch steht fest, ob sie gefälscht wurde\n• Von jedem lesbar und veränderbar", image: IconsStyleKit.imageOfPostcardBG, buttonText: nil, action: nil) + + intro2.iconHeight = 70 + intro2.iconWidth = 100 + UIGraphicsBeginImageContextWithOptions(CGSize(width: 100, height: 70), false, 0) + IconsStyleKit.drawPostcard(frame: CGRect(x: 0, y: 0, width: 100, height: 70), fillBackground: true) + intro2.iconImageView.image = UIGraphicsGetImageFromCurrentImageContext()! + UIGraphicsEndImageContext() + intro2.bodyLabel.textAlignment = NSTextAlignment.left //Content let page1 = OnboardingContentViewController.content(withTitle: NSLocalizedString("Hello", comment: "Welcome"), body: NSLocalizedString("InterestedInSecureMail", comment: "commendation to user for using secure mail"), image: nil, buttonText: nil, action: nil) + mailaddress = UITextField.init() //text.textColor = UIColor.whiteColor() //text.tintColor = UIColor.whiteColor() - mailaddress.borderStyle = UITextBorderStyle.roundedRect + mailaddress.borderStyle = UITextBorderStyle.line mailaddress.keyboardType = UIKeyboardType.emailAddress + mailaddress.returnKeyType = UIReturnKeyType.next mailaddress.autocorrectionType = UITextAutocorrectionType.no - mailaddress.frame = CGRect.init(x: 0, y: 0, width: 50, height: 30) + mailaddress.frame = CGRect.init(x: 0, y: /*mailaddressLabel.frame.height+padding*/ 0, width: 50, height: 30) mailaddress.placeholder = NSLocalizedString("Address", comment: "") - let page2 = OnboardingContentViewController.content(withTitle: nil, body: NSLocalizedString("InsertMailAddress", comment: ""), videoURL: nil, inputView: mailaddress, buttonText: nil, actionBlock: nil) + mailaddress.isUserInteractionEnabled = true + mailaddress.delegate = textDelegate + //let page2 = OnboardingContentViewController.content(withTitle: nil, body: NSLocalizedString("InsertMailAddress", comment: ""), videoURL: nil, inputView: mailaddress, buttonText: nil, actionBlock: nil) + password = UITextField.init() //text.textColor = UIColor.whiteColor() //text.tintColor = UIColor.whiteColor() - password.borderStyle = UITextBorderStyle.roundedRect + password.borderStyle = UITextBorderStyle.none password.isSecureTextEntry = true - password.frame = CGRect.init(x: 0, y: 0, width: 50, height: 30) + password.returnKeyType = UIReturnKeyType.done + password.frame = CGRect.init(x: 0, y: mailaddress.frame.height+padding, width: 50, height: 30) password.placeholder = NSLocalizedString("Password", comment: "") - let page3 = OnboardingContentViewController.content(withTitle: nil, body: NSLocalizedString("InsertPassword", comment: ""), videoURL: nil, inputView: password, buttonText: nil, actionBlock: nil) - let page4 = OnboardingContentViewController.content(withTitle: NSLocalizedString("EverythingCorrect", comment: ""), body: nil, videoURL: nil, inputView: nil, buttonText: NSLocalizedString("next", comment: ""), actionBlock: callback) - + password.delegate = textDelegate + + let keyboardToolbar = UIToolbar() + keyboardToolbar.sizeToFit() + let flexBarButton = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil) + let doneBarButton = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(self.dismissKeyboard)) + keyboardToolbar.items = [flexBarButton, doneBarButton] + mailaddress.inputAccessoryView = keyboardToolbar + password.inputAccessoryView = keyboardToolbar + + let credentials = UIView.init(frame: CGRect.init(x:0, y:0, width: 50, height: mailaddress.frame.height+padding+password.frame.height)) + credentials.addSubview(mailaddress) + credentials.addSubview(password) + + let page3 = OnboardingContentViewController.content(withTitle: nil, body: NSLocalizedString("InsertMailAddressAndPassword", comment: ""), videoURL: nil, inputView: credentials, buttonText: NSLocalizedString("next", comment: ""), actionBlock: callback) + //page3.onlyInputView = true + + //let page4 = OnboardingContentViewController.content(withTitle: NSLocalizedString("EverythingCorrect", comment: ""), body: nil, videoURL: nil, inputView: nil, buttonText: NSLocalizedString("next", comment: ""), actionBlock: callback) + + let vc = Onboard.OnboardingViewController(backgroundImage: background, contents: [page1, intro1, intro2, /*page2,*/ page3/*, page4*/]) + //vc?.shouldBlurBackground = true + vc?.view.backgroundColor = defaultColor//UIColor.white//UIColor.init(red: 1, green: 1, blue: 1, alpha: 0) + //vc?.backgroundImage = postcardBg + vc?.shouldFadeTransitions = true + //vc?.shouldMaskBackground = false + + let duration = 0.5 + + intro2.viewWillAppearBlock = { + //vc?.backgroundImage = postcardBg + //UIView.animate(withDuration: 1.3, delay: 0, options: UIViewAnimationOptions.curveEaseIn, animations: { vc?.backgroundImageView.image = postcardBg; vc?.view.setNeedsDisplay()}) + UIView.animate(withDuration: duration, delay: 0, options: UIViewAnimationOptions.curveEaseIn, animations: { + vc?.view.backgroundColor = ThemeManager.uncryptedMessageColor() + vc?.view.setNeedsDisplay() + }) + //vc?.fadeBackground(postcardBg) + } + intro2.viewWillDisappearBlock = { + //UIView.animate(withDuration: 0.3, animations: { vc?.backgroundImageView.image = background}) + UIView.animate(withDuration: duration, delay: 0.05, options: UIViewAnimationOptions.curveEaseIn, animations: { + if (vc?.view.backgroundColor != ThemeManager.encryptedMessageColor()) { + vc?.view.backgroundColor = defaultColor + vc?.view.setNeedsDisplay() + } + }) + } + intro1.viewWillAppearBlock = { + //vc?.backgroundImage = postcardBg + //UIView.animate(withDuration: 1.3, delay: 0, options: UIViewAnimationOptions.curveEaseIn, animations: { vc?.backgroundImageView.image = postcardBg; vc?.view.setNeedsDisplay()}) + UIView.animate(withDuration: duration, delay: 0, options: UIViewAnimationOptions.curveEaseIn, animations: { vc?.view.backgroundColor = ThemeManager.encryptedMessageColor(); vc?.view.setNeedsDisplay()}) + //vc?.fadeBackground(postcardBg) + } + intro1.viewWillDisappearBlock = { + //UIView.animate(withDuration: 0.3, animations: { vc?.backgroundImageView.image = background}) + //UIView.animate(withDuration: 0.7, delay: 0, options: UIViewAnimationOptions.curveEaseIn, animations: { vc?.view.backgroundColor = UIColor.white; vc?.view.setNeedsDisplay()}) + UIView.animate(withDuration: duration, delay: 0.05, options: UIViewAnimationOptions.curveEaseIn, animations: { + if (vc?.view.backgroundColor != ThemeManager.uncryptedMessageColor()) { + vc?.view.backgroundColor = defaultColor + vc?.view.setNeedsDisplay() + } + }) + } - return Onboard.OnboardingViewController(backgroundImage: background, contents: [page1, page2, page3, page4]) + return vc! + } + + static func dismissKeyboard(){ + mailaddress.endEditing(true) + password.endEditing(true) } + //UI Definition static func checkConfigView() -> UIViewController { let activity = UIActivityIndicatorView.init() activity.startAnimating() @@ -106,9 +202,12 @@ class Onboarding { view.frame = activity.frame let page1 = OnboardingContentViewController.content(withTitle: NSLocalizedString("ConnectingToMailServer", comment: ""), body: nil, videoURL: nil, inputView: view, buttonText: nil, actionBlock: nil) - return Onboard.OnboardingViewController(backgroundImage: background, contents: [page1]) + let vc = Onboard.OnboardingViewController(backgroundImage: background, contents: [page1])! + vc.pageControl = UIPageControl.init() + return vc } + //UI Definition static func keyHandlingView() -> UIViewController { let activity = UIActivityIndicatorView.init() activity.startAnimating() @@ -120,6 +219,7 @@ class Onboarding { return Onboard.OnboardingViewController(backgroundImage: background, contents: [page1]) } + //UI Definition static func detailOnboarding(_ callback: @escaping ()->()) -> UIViewController { let start = OnboardingContentViewController.content(withTitle: NSLocalizedString("WhatAShame", comment: ""), body: NSLocalizedString("CouldNotConnect", comment: ""), videoURL: nil, inputView: nil, buttonText: nil, actionBlock: nil) @@ -303,7 +403,9 @@ class Onboarding { view.frame = activity.frame let page1 = OnboardingContentViewController.content(withTitle: NSLocalizedString("AccessContacts", comment: ""), body: NSLocalizedString("AccessContactsDescription", comment: "Description, why we need access"), videoURL: nil, inputView: nil, buttonText: NSLocalizedString("next", comment: ""), actionBlock: callback) - return Onboard.OnboardingViewController(backgroundImage: background, contents: [page1]) + let vc = Onboard.OnboardingViewController(backgroundImage: background, contents: [page1])! + vc.pageControl = UIPageControl.init() + return vc } static func checkContact(_ callback : @escaping (Bool) -> ()){ @@ -353,25 +455,26 @@ class Onboarding { if let mailAddress = mailaddress.text, !manualSet && mailAddress != "" && mailAddress.contains("@") { let guessedUserName = mailAddress.components(separatedBy: "@")[0] let provider = mailAddress.components(separatedBy: "@")[1] + setServerValues(mailaddress: mailAddress) UserManager.storeUserValue(mailAddress as AnyObject?, attribute: Attribute.userAddr)//Attribute.attributeValues[Attribute.UserAddr] = addr UserManager.storeUserValue(guessedUserName as AnyObject?, attribute: Attribute.userName) if provider == Provider.FU.rawValue { - Providers.setValues(Provider.FU) + //Providers.setValues(Provider.FU) UserManager.storeUserValue("jakobsbode" as AnyObject?, attribute: Attribute.accountname) UserManager.storeUserValue("jakobsbode" as AnyObject?, attribute: Attribute.userName) } if provider == Provider.ZEDAT.rawValue { - Providers.setValues(Provider.ZEDAT) + //Providers.setValues(Provider.ZEDAT) UserManager.storeUserValue("jakobsbode" as AnyObject?, attribute: Attribute.accountname) UserManager.storeUserValue("jakobsbode" as AnyObject?, attribute: Attribute.userName) } if provider == Provider.ENZEVALOS.rawValue { - Providers.setValues(Provider.ENZEVALOS) + //Providers.setValues(Provider.ENZEVALOS) UserManager.storeUserValue(guessedUserName as AnyObject?, attribute: Attribute.accountname) UserManager.storeUserValue(guessedUserName as AnyObject?, attribute: Attribute.userName) } if provider == Provider.WEB.rawValue { - Providers.setValues(Provider.WEB) + //Providers.setValues(Provider.WEB) } } if let pw = password.text, pw != "" { @@ -394,8 +497,97 @@ class Onboarding { } + static func setServerValues(mailaddress: String) { + let manager = MCOMailProvidersManager.shared()! + let path = Bundle.main.path(forResource: "providers", ofType: "json") + manager.registerProviders(withFilename: path) + + //------- DEBUG ------- + if let provider = manager.provider(forEmail: mailaddress) { + if let imap = (provider.imapServices() as? [MCONetService]), let smtp = (provider.smtpServices() as? [MCONetService]) { + print(imap) + print(smtp) + } + } + //------- DEBUG ------- + + if let provider = manager.provider(forEmail: mailaddress), let imap = (provider.imapServices() as? [MCONetService]), imap != [], let smtp = (provider.smtpServices() as? [MCONetService]), smtp != [] { + let imapService = imap[0] + UserManager.storeUserValue((imapService.info()["hostname"] ?? "imap.web.de") as AnyObject?, attribute: Attribute.imapHostname) + UserManager.storeUserValue((imapService.info()["port"] ?? 587) as AnyObject?, attribute: Attribute.imapPort) + + if let trans = imapService.info()["ssl"] as? Bool, trans { + UserManager.storeUserValue(MCOConnectionType.TLS.rawValue as AnyObject?, attribute: Attribute.imapConnectionType) + } else if let trans = imapService.info()["starttls"] as? Bool, trans { + UserManager.storeUserValue(MCOConnectionType.startTLS.rawValue as AnyObject?, attribute: Attribute.imapConnectionType) + } else { + UserManager.storeUserValue(MCOConnectionType.clear.rawValue as AnyObject?, attribute: Attribute.imapConnectionType) + } + + if let auth = imapService.info()["auth"] as? String, auth == "saslPlain" { + UserManager.storeUserValue(MCOAuthType.saslPlain.rawValue as AnyObject?, attribute: Attribute.imapAuthType) + } else if let auth = imapService.info()["auth"] as? String, auth == "saslLogin" { + UserManager.storeUserValue(MCOAuthType.saslLogin.rawValue as AnyObject?, attribute: Attribute.imapAuthType) + } else if let auth = imapService.info()["auth"] as? String, auth == "saslKerberosV4" { + UserManager.storeUserValue(MCOAuthType.saslKerberosV4.rawValue as AnyObject?, attribute: Attribute.imapAuthType) + } else if let auth = imapService.info()["auth"] as? String, auth == "saslCRAMMD5" { + UserManager.storeUserValue(MCOAuthType.SASLCRAMMD5.rawValue as AnyObject?, attribute: Attribute.imapAuthType) + } else if let auth = imapService.info()["auth"] as? String, auth == "saslDIGESTMD5" { + UserManager.storeUserValue(MCOAuthType.SASLDIGESTMD5.rawValue as AnyObject?, attribute: Attribute.imapAuthType) + } else if let auth = imapService.info()["auth"] as? String, auth == "saslGSSAPI" { + UserManager.storeUserValue(MCOAuthType.SASLGSSAPI.rawValue as AnyObject?, attribute: Attribute.imapAuthType) + } else if let auth = imapService.info()["auth"] as? String, auth == "saslSRP" { + UserManager.storeUserValue(MCOAuthType.SASLSRP.rawValue as AnyObject?, attribute: Attribute.imapAuthType) + } else if let auth = imapService.info()["auth"] as? String, auth == "saslNTLM" { + UserManager.storeUserValue(MCOAuthType.SASLNTLM.rawValue as AnyObject?, attribute: Attribute.imapAuthType) + } else if let auth = imapService.info()["auth"] as? String, auth == "xoAuth2" { + UserManager.storeUserValue(MCOAuthType.xoAuth2.rawValue as AnyObject?, attribute: Attribute.imapAuthType) + } else if let auth = imapService.info()["auth"] as? String, auth == "xoAuth2Outlook" { + UserManager.storeUserValue(MCOAuthType.SASLCRAMMD5.rawValue as AnyObject?, attribute: Attribute.imapAuthType) + } else { + UserManager.storeUserValue(MCOAuthType.saslPlain.rawValue as AnyObject?, attribute: Attribute.imapAuthType) + } + + let smtpService = smtp[0] + UserManager.storeUserValue((smtpService.info()["hostname"] ?? "smtp.web.de") as AnyObject?, attribute: Attribute.smtpHostname) + UserManager.storeUserValue((smtpService.info()["port"] ?? 993) as AnyObject?, attribute: Attribute.smtpPort) + + if let trans = smtpService.info()["ssl"] as? Bool, trans { + UserManager.storeUserValue(MCOConnectionType.TLS.rawValue as AnyObject?, attribute: Attribute.smtpConnectionType) + } else if let trans = smtpService.info()["starttls"] as? Bool, trans { + UserManager.storeUserValue(MCOConnectionType.startTLS.rawValue as AnyObject?, attribute: Attribute.smtpConnectionType) + } else { + UserManager.storeUserValue(MCOConnectionType.clear.rawValue as AnyObject?, attribute: Attribute.smtpConnectionType) + } + + if let auth = smtpService.info()["auth"] as? String, auth == "saslPlain" { + UserManager.storeUserValue(MCOAuthType.saslPlain.rawValue as AnyObject?, attribute: Attribute.smtpAuthType) + } else if let auth = smtpService.info()["auth"] as? String, auth == "saslLogin" { + UserManager.storeUserValue(MCOAuthType.saslLogin.rawValue as AnyObject?, attribute: Attribute.smtpAuthType) + } else if let auth = smtpService.info()["auth"] as? String, auth == "saslKerberosV4" { + UserManager.storeUserValue(MCOAuthType.saslKerberosV4.rawValue as AnyObject?, attribute: Attribute.smtpAuthType) + } else if let auth = smtpService.info()["auth"] as? String, auth == "saslCRAMMD5" { + UserManager.storeUserValue(MCOAuthType.SASLCRAMMD5.rawValue as AnyObject?, attribute: Attribute.smtpAuthType) + } else if let auth = smtpService.info()["auth"] as? String, auth == "saslDIGESTMD5" { + UserManager.storeUserValue(MCOAuthType.SASLDIGESTMD5.rawValue as AnyObject?, attribute: Attribute.smtpAuthType) + } else if let auth = smtpService.info()["auth"] as? String, auth == "saslGSSAPI" { + UserManager.storeUserValue(MCOAuthType.SASLGSSAPI.rawValue as AnyObject?, attribute: Attribute.smtpAuthType) + } else if let auth = smtpService.info()["auth"] as? String, auth == "saslSRP" { + UserManager.storeUserValue(MCOAuthType.SASLSRP.rawValue as AnyObject?, attribute: Attribute.smtpAuthType) + } else if let auth = smtpService.info()["auth"] as? String, auth == "saslNTLM" { + UserManager.storeUserValue(MCOAuthType.SASLNTLM.rawValue as AnyObject?, attribute: Attribute.smtpAuthType) + } else if let auth = smtpService.info()["auth"] as? String, auth == "xoAuth2" { + UserManager.storeUserValue(MCOAuthType.xoAuth2.rawValue as AnyObject?, attribute: Attribute.smtpAuthType) + } else if let auth = smtpService.info()["auth"] as? String, auth == "xoAuth2Outlook" { + UserManager.storeUserValue(MCOAuthType.SASLCRAMMD5.rawValue as AnyObject?, attribute: Attribute.smtpAuthType) + } else { + UserManager.storeUserValue(MCOAuthType.saslPlain.rawValue as AnyObject?, attribute: Attribute.smtpAuthType) + } + } + } + static func keyHandling() { - for encType in iterateEnum(EncryptionType) { + for encType in iterateEnum(EncryptionType.self) { let encryption = EnzevalosEncryptionHandler.getEncryption(encType) if let enc = encryption { enc.removeAllKeys() @@ -414,7 +606,7 @@ class Onboarding { var enc = EnzevalosEncryptionHandler.getEncryption(EncryptionType.PGP) do { let data = try pgp.keys[0].export() - enc?.addKey(data, forMailAddresses: []) + _ = enc?.addKey(data, forMailAddresses: []) } catch _ {} @@ -429,7 +621,7 @@ class Onboarding { enc = EnzevalosEncryptionHandler.getEncryption(EncryptionType.PGP) do { let data = try pgp.keys[0].export() - enc?.addKey(data, forMailAddresses: ["jakob.bode@fu-berlin.de"]) //<---- Emailadresse + _ = enc?.addKey(data, forMailAddresses: ["jakob.bode@fu-berlin.de"]) //<---- Emailadresse } catch _ {} @@ -444,7 +636,7 @@ class Onboarding { enc = EnzevalosEncryptionHandler.getEncryption(EncryptionType.PGP) do { let data = try pgp.keys[0].export() - enc?.addKey(data, forMailAddresses: ["alice2005@web.de"]) //<---- Emailadresse + _ = enc?.addKey(data, forMailAddresses: ["alice2005@web.de"]) //<---- Emailadresse } catch _ {} @@ -459,7 +651,7 @@ class Onboarding { enc = EnzevalosEncryptionHandler.getEncryption(EncryptionType.PGP) do { let data = try pgp.keys[0].export() - enc?.addKey(data, forMailAddresses: ["quizer1@enzevalos.de"]) //<---- Emailadresse + _ = enc?.addKey(data, forMailAddresses: ["quizer1@enzevalos.de"]) //<---- Emailadresse } catch _ {} @@ -488,6 +680,31 @@ class Onboarding { } } +class TextFieldDelegate: NSObject, UITextFieldDelegate { + + func textFieldDidBeginEditing(_ textField: UITextField) { + print("hallo") + } + + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + if textField == Onboarding.mailaddress { + textField.resignFirstResponder() + Onboarding.password.becomeFirstResponder() + return false + } + else if textField == Onboarding.password { + textField.resignFirstResponder() + return true + } + return true + } + + func textFieldShouldEndEditing(_ textField: UITextField) -> Bool { + textField.endEditing(true) + return true + } +} + class PickerDataDelegate : NSObject, UIPickerViewDataSource { var rows = ["Keine", "Normal, Password", "Login"] var pickedValue = "" diff --git a/enzevalos_iphone/OnboardingViewCells.swift b/enzevalos_iphone/OnboardingViewCells.swift deleted file mode 100644 index 6d38ce4a9d1598631ab4c2aa3db3c34ac28c48ee..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/OnboardingViewCells.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// OnboardingViewCells.swift -// enzevalos_iphone -// -// Created by jakobsbode on 21.03.17. -// Copyright © 2017 fu-berlin. All rights reserved. -// - -import UIKit - -open class SwitchCell : UITableViewCell { - @IBOutlet weak var label: UILabel! - @IBOutlet weak var switcher: UISwitch! -} - -class InputCell : UITableViewCell { - @IBOutlet weak var label: UILabel! - @IBOutlet weak var textfield: UITextField! -} diff --git a/enzevalos_iphone/OnboardingViewController.swift b/enzevalos_iphone/OnboardingViewController.swift deleted file mode 100644 index 52d8024eab76547124ec6a383c1ba6f41a4398a0..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/OnboardingViewController.swift +++ /dev/null @@ -1,286 +0,0 @@ -// -// OnboardingViewController.swift -// enzevalos_iphone -// -// Created by jakobsbode on 21.03.17. -// Copyright © 2017 fu-berlin. All rights reserved. -// - -import Foundation -import UIKit - -class OnboardingViewController : UIViewController { - - var pKey = true - var jKey = true - var aKey = true - var q1Key = true - - var smtpCheckDone = false - var imapCheckDone = false - - var smtpCheck = false - var imapCheck = false - - var mailaddress : UITextField? = nil - var password : UITextField? = nil - - @IBOutlet var tableView: UITableView! - override func viewDidLoad() { - super.viewDidLoad() - self.tableView.dataSource = self - self.tableView.delegate = self - EnzevalosEncryptionHandler.getEncryption(.PGP)?.printAllKeyIDs() - } - - @IBAction func privateKey(_ sender: AnyObject, forEvent event: UIEvent) { - pKey = !pKey - } - @IBAction func jakobKey(_ sender: AnyObject, forEvent event: UIEvent) { - jKey = !jKey - } - @IBAction func aliceKey(_ sender: AnyObject, forEvent event: UIEvent) { - aKey = !aKey - } - @IBAction func quizer1Key(_ sender: AnyObject, forEvent event: UIEvent) { - q1Key = !q1Key - } - - override func prepare(for segue: UIStoryboardSegue, sender: Any?){ - if segue.identifier == "onboarding" { - var mAddr = "" - var mPw = "" - if let addr = mailaddress?.text, addr != "" { - //if addr.componentsSeparatedByString("@")[1] != "web.de" { - // naechste view - //} - /*let guessedUserName = addr.componentsSeparatedByString("@")[0] - UserManager.storeUserValue(addr, attribute: Attribute.UserAddr)//Attribute.attributeValues[Attribute.UserAddr] = addr - UserManager.storeUserValue(guessedUserName, attribute: Attribute.UserName)*/ - mAddr = addr - } - if let pw = password?.text, pw != "" { - //UserManager.storeUserValue(pw, attribute: Attribute.UserPW)//Attribute.attributeValues[Attribute.UserPW] = pw - mPw = pw - } - self.setGuessValues(mAddr, pw: mPw) - for encType in iterateEnum(EncryptionType) { - let encryption = EnzevalosEncryptionHandler.getEncryption(encType) - if let enc = encryption { - enc.removeAllKeys() - } - } - EnzevalosEncryptionHandler.getEncryption(.PGP)?.printAllKeyIDs() - if pKey { - //--------------------------------------- - //Import private Key BEGIN - - var path = Bundle.main.path(forResource: "alice2005-private", ofType: "gpg") //<---- Schlüsseldatei - if mAddr.contains("@") && mAddr.components(separatedBy: "@")[1] == Provider.ENZEVALOS.rawValue { - path = Bundle.main.path(forResource: "quizer1-private", ofType: "asc") - } - let pgp = ObjectivePGP.init() - pgp.importKeys(fromFile: path!, allowDuplicates: false) - let enc = EnzevalosEncryptionHandler.getEncryption(EncryptionType.PGP) - do { - let data = try pgp.keys[0].export() - enc?.addKey(data, forMailAddresses: []) - } - catch _ {} - - //Import private key END - //--------------------------------------- - } - if jKey { - //--------------------------------------- - //Import public Key BEGIN - - let path = Bundle.main.path(forResource: "JakobBode", ofType: "asc") //<---- Schlüsseldatei - let pgp = ObjectivePGP.init() - pgp.importKeys(fromFile: path!, allowDuplicates: false) - let enc = EnzevalosEncryptionHandler.getEncryption(EncryptionType.PGP) - do { - let data = try pgp.keys[0].export() - enc?.addKey(data, forMailAddresses: ["jakob.bode@fu-berlin.de"]) //<---- Emailadresse - } - catch _ {} - - //Import public key END - //--------------------------------------- - } - if aKey { - //--------------------------------------- - //Import public Key BEGIN - - let path = Bundle.main.path(forResource: "alice2005-public", ofType: "gpg") //<---- Schlüsseldatei - let pgp = ObjectivePGP.init() - pgp.importKeys(fromFile: path!, allowDuplicates: false) - let enc = EnzevalosEncryptionHandler.getEncryption(EncryptionType.PGP) - do { - let data = try pgp.keys[0].export() - enc?.addKey(data, forMailAddresses: ["alice2005@web.de"]) //<---- Emailadresse - } - catch _ {} - - //Import public key END - //--------------------------------------- - } - if q1Key { - //--------------------------------------- - //Import public Key BEGIN - - let path = Bundle.main.path(forResource: "quizer1-public", ofType: "asc") //<---- Schlüsseldatei - let pgp = ObjectivePGP.init() - pgp.importKeys(fromFile: path!, allowDuplicates: false) - let enc = EnzevalosEncryptionHandler.getEncryption(EncryptionType.PGP) - do { - let data = try pgp.keys[0].export() - enc?.addKey(data, forMailAddresses: ["quizer1@enzevalos.de"]) //<---- Emailadresse - } - catch _ {} - - //Import public key END - //--------------------------------------- - } - UserDefaults.standard.set(true, forKey: "launchedBefore") - } - } - - func iterateEnum<T: Hashable>(_: T.Type) -> AnyIterator<T> { - var i = 0 - return AnyIterator { - let next = withUnsafePointer(to: &i) { UnsafeRawPointer($0).load(as: T.self) } - i += 1 - return next.hashValue == i-1 ? next : nil - } - } - - func setGuessValues(_ mailAddress: String, pw: String) { - if mailAddress != "" { - let guessedUserName = mailAddress.components(separatedBy: "@")[0] - let provider = mailAddress.components(separatedBy: "@")[1] - UserManager.storeUserValue(mailAddress as AnyObject?, attribute: Attribute.userAddr)//Attribute.attributeValues[Attribute.UserAddr] = addr - UserManager.storeUserValue(guessedUserName as AnyObject?, attribute: Attribute.userName) - if provider == Provider.FU.rawValue { - Providers.setValues(Provider.FU) - UserManager.storeUserValue("jakobsbode" as AnyObject?, attribute: Attribute.accountname) - UserManager.storeUserValue("jakobsbode" as AnyObject?, attribute: Attribute.userName) - } - if provider == Provider.ZEDAT.rawValue { - Providers.setValues(Provider.ZEDAT) - UserManager.storeUserValue("jakobsbode" as AnyObject?, attribute: Attribute.accountname) - UserManager.storeUserValue("jakobsbode" as AnyObject?, attribute: Attribute.userName) - } - if provider == Provider.ENZEVALOS.rawValue { - Providers.setValues(Provider.ENZEVALOS) - UserManager.storeUserValue(guessedUserName as AnyObject?, attribute: Attribute.accountname) - UserManager.storeUserValue(guessedUserName as AnyObject?, attribute: Attribute.userName) - } - } - if pw != "" { - UserManager.storeUserValue(pw as AnyObject?, attribute: Attribute.userPW) - } - smtpCheckDone = false - imapCheckDone = false - /*AppDelegate.getAppDelegate().mailHandler.checkSMTP(SMTPCompletion) - AppDelegate.getAppDelegate().mailHandler.checkIMAP(IMAPCompletion) - while (!imapCheckDone || !smtpCheckDone) { - - }*/ - print("checks ", imapCheck, smtpCheck) - } - - private func SMTPCompletion(_ error: NSError?) { - if error == nil { - smtpCheck = true - } - smtpCheckDone = true - } - - private func IMAPCompletion(_ error: NSError?) { - if error == nil { - imapCheck = true - } - imapCheckDone = true - } - -} - -extension OnboardingViewController : UITableViewDelegate { - -} - -extension OnboardingViewController : UITableViewDataSource { - - func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - if section == 0 { - return 2 - } - if section == 1 { - return 4 - } - return 0 - } - - func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { - if section == 0 { - return "Credentials" - } - return "Keys" - } - - func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - if indexPath.section == 0 { - if indexPath.row == 0 { - let cell = tableView.dequeueReusableCell(withIdentifier: "InputCell") as! InputCell - cell.label.text = "Mailaddress" - cell.textfield.placeholder = "address" - cell.textfield.keyboardType = UIKeyboardType.emailAddress - cell.textfield.autocorrectionType = UITextAutocorrectionType.no - self.mailaddress = cell.textfield - return cell - } - if indexPath.row == 1 { - let cell = tableView.dequeueReusableCell(withIdentifier: "InputCell") as! InputCell - cell.label.text = "Password" - cell.textfield.placeholder = "password" - cell.textfield.isSecureTextEntry = true - self.password = cell.textfield - return cell - - } - } - if indexPath.section == 1 { - if indexPath.row == 0 { - let cell = tableView.dequeueReusableCell(withIdentifier: "SwitchCell") as! SwitchCell - cell.label.text = "import private key" - cell.switcher.addTarget(self, action: #selector(privateKey), for: .valueChanged) - return cell - } - if indexPath.row == 1 { - let cell = tableView.dequeueReusableCell(withIdentifier: "SwitchCell") as! SwitchCell - cell.label.text = "import jakob's pub-key" - cell.switcher.addTarget(self, action: #selector(jakobKey), for: .valueChanged) - return cell - } - if indexPath.row == 2 { - let cell = tableView.dequeueReusableCell(withIdentifier: "SwitchCell") as! SwitchCell - cell.label.text = "import alice's pub-key" - cell.switcher.addTarget(self, action: #selector(aliceKey), for: .valueChanged) - return cell - } - if indexPath.row == 3 { - let cell = tableView.dequeueReusableCell(withIdentifier: "SwitchCell") as! SwitchCell - cell.label.text = "import quizer1's pub-key" - cell.switcher.addTarget(self, action: #selector(quizer1Key), for: .valueChanged) - return cell - } - } - let cell = tableView.dequeueReusableCell(withIdentifier: "AliceKeyCell")! - return cell - } - - func numberOfSections(in tableView: UITableView) -> Int { - return 2 - } -} diff --git a/enzevalos_iphone/PGPEncryption.swift b/enzevalos_iphone/PGPEncryption.swift index 212483b9bee61c226c3aeef7d87ef4f05c8ba76f..a5d8e0fb53a2cd2a63e74a35f86a8d37be21a55c 100644 --- a/enzevalos_iphone/PGPEncryption.swift +++ b/enzevalos_iphone/PGPEncryption.swift @@ -8,7 +8,6 @@ class PGPEncryption : Encryption { - internal let encryptionHandler: EncryptionHandler internal let keyManager: PGPKeyManagement //internal let keyIDs : [] @@ -28,7 +27,7 @@ class PGPEncryption : Encryption { return keyManager } - func isUsed(_ mail: Mail) -> Bool { + func isUsed(_ mail: PersistentMail) -> Bool { if let plain = mail.body { return isUsed(plain, key: nil) } @@ -44,7 +43,7 @@ class PGPEncryption : Encryption { } //check whether this encryption is used in this mail for encryption. nil is returned, if there is no answer to be made at the moment. - func isUsedForEncryption(_ mail: Mail) -> Bool? { + func isUsedForEncryption(_ mail: PersistentMail) -> Bool? { if let plain = mail.body { return isUsedForEncryption(plain, key: nil) } @@ -58,7 +57,7 @@ class PGPEncryption : Encryption { } //check whether this encryption is used in this mail for signing. nil is returned, if there is no answer to be made at the moment. - func isUsedForSignature(_ mail: Mail) -> Bool?{ + func isUsedForSignature(_ mail: PersistentMail) -> Bool?{ //TODO api-check //baut auf der Annahme auf, dass der signierte Teil nach dem entschlüsseln noch vorhanden ist. if let plain = mail.decryptedBody { @@ -81,7 +80,7 @@ class PGPEncryption : Encryption { //TODO //decrypt the mails body. the decryted body will be saved in the mail object. - func decrypt(_ mail: Mail)-> String?{ + func decrypt(_ mail: PersistentMail)-> String?{ if self.isUsed(mail) { let bodyData = mail.body!.data(using: String.Encoding.utf8)! var data = try? keyManager.pgp.decryptData(bodyData, passphrase: nil) @@ -122,18 +121,21 @@ class PGPEncryption : Encryption { return nil } - func decryptAndSignatureCheck(_ mail: Mail) { + func decryptAndSignatureCheck(_ mail: PersistentMail) { if self.isUsed(mail) { let bodyData = mail.body!.data(using: String.Encoding.utf8)! var data: Data? + //has to be var because it is given as pointer to obj-c-code var error: NSErrorPointer = NSErrorPointer.none var temp = keyManager.pgp.decryptDataFirstPart(bodyData, passphrase: nil, integrityProtected: nil, error: error) var maybeUsedKeys: [String] = [] + //has to be var because it is given as pointer to obj-c-code var signed = UnsafeMutablePointer<ObjCBool>.allocate(capacity: 1) signed[0] = false + //has to be var because it is given as pointer to obj-c-code var valid = UnsafeMutablePointer<ObjCBool>.allocate(capacity: 1) valid[0] = false - print(temp.incompleteKeyID," ",temp.onePassSignaturePacket) + //print(temp.incompleteKeyID," ",temp.onePassSignaturePacket) data = temp.plaintextData if data == nil { self.keyManager.useAllPrivateKeys() @@ -149,16 +151,15 @@ class PGPEncryption : Encryption { } if let unwrappedData = data { mail.decryptedBody = String(data: unwrappedData, encoding: String.Encoding.utf8) - if let allKeyIDs = self.keyManager.getKeyIDsForMailAddress(mail.from.address), let theirKeyID = temp.incompleteKeyID { + if let allKeyIDs = self.keyManager.getKeyIDsForMailAddress(mail.from.mailAddress), let theirKeyID = temp.incompleteKeyID { maybeUsedKeys = self.getLibaryKeyIDOverlap(theirKeyID, ourKeyIDs: allKeyIDs) } for maybeUsedKey in maybeUsedKeys { if let key = self.keyManager.getKey(maybeUsedKey) { //FIXME let done : ObjCBool - do { - try done = (self.keyManager.pgp.decryptDataSecondPart(temp, verifyWithPublicKey: key.key, signed: signed, valid: valid)[0]) - }catch { + done = (self.keyManager.pgp.decryptDataSecondPart(temp, verifyWithPublicKey: key.key, signed: signed, valid: valid, error: error)[0]) + if let errorHappening = (error?.debugDescription.contains("Missing")), errorHappening { mail.trouble = true mail.isCorrectlySigned = false break @@ -205,7 +206,7 @@ class PGPEncryption : Encryption { //TODO //check whether the mail is correctly signed with this encryption. nil is returned, if there is no answer to be made at the moment. - func isCorrectlySigned(_ mail: Mail) -> Bool?{ + func isCorrectlySigned(_ mail: PersistentMail) -> Bool?{ return false } @@ -217,7 +218,7 @@ class PGPEncryption : Encryption { //TODO //encrypt mail for contact - func encrypt(_ mail: Mail){ + func encrypt(_ mail: PersistentMail){ } @@ -266,7 +267,7 @@ class PGPEncryption : Encryption { //TODO //sign mail - func sign(_ mail: Mail){ + func sign(_ mail: PersistentMail){ } @@ -278,7 +279,7 @@ class PGPEncryption : Encryption { //TODO //sign and encrypt mail for contact - func signAndEncrypt(_ mail: Mail, forContact: KeyRecord){ + func signAndEncrypt(_ mail: PersistentMail, forContact: KeyRecord){ } @@ -362,12 +363,12 @@ class PGPEncryption : Encryption { } //chooses first key in data. others will be ignored - func addKey(_ keyData: Data, discoveryMail: Mail?) -> String? { + func addKey(_ keyData: Data, discoveryMail: PersistentMail?) -> String? { var discoveryMailUID: UInt64? = nil var forMailAddresses: [String]? = nil if let mail = discoveryMail { discoveryMailUID = mail.uid - forMailAddresses = [mail.from.address] + forMailAddresses = [mail.from.mailAddress] } return self.addKey(keyData, forMailAddresses: forMailAddresses, discoveryMailUID: discoveryMailUID) } diff --git a/enzevalos_iphone/PGPKeyManagement.swift b/enzevalos_iphone/PGPKeyManagement.swift index 56481828cbba8b3799205a87cc60d3c4c9aaefe9..e53f748c0069a9664eefc683f8a8527f9eb4c223 100644 --- a/enzevalos_iphone/PGPKeyManagement.swift +++ b/enzevalos_iphone/PGPKeyManagement.swift @@ -64,7 +64,7 @@ class PGPKeyManagement { return index } - func addKey(_ key: PGPKeyWrapper, forMailAddresses: [String]) -> String{ + @discardableResult func addKey(_ key: PGPKeyWrapper, forMailAddresses: [String]) -> String{ var index : Int64 = 0 let searchKey = key.key.keyID.longKeyString+"-index" var existent = false @@ -94,7 +94,7 @@ class PGPKeyManagement { var returnedKeyID = keyID if index > 1 { for otherIndex in 1...index { - var otherKeyID = key.key.keyID.longKeyString+"-"+String(otherIndex) + let otherKeyID = key.key.keyID.longKeyString+"-"+String(otherIndex) if key.key.isEqual(self.getKey(otherKeyID)?.key) { alreadyInserted = true returnedKeyID = otherKeyID diff --git a/enzevalos_iphone/Mail+CoreDataProperties.swift b/enzevalos_iphone/PersistentMail +CoreDataProperties.swift similarity index 81% rename from enzevalos_iphone/Mail+CoreDataProperties.swift rename to enzevalos_iphone/PersistentMail +CoreDataProperties.swift index 2b77176ef82ab956a2e50350eebde70f42387bb9..7d3bd43cf463eeedbfb438b51b31a5ca308baee4 100644 --- a/enzevalos_iphone/Mail+CoreDataProperties.swift +++ b/enzevalos_iphone/PersistentMail +CoreDataProperties.swift @@ -1,5 +1,5 @@ // -// Mail+CoreDataProperties.swift +// PersistentMail+CoreDataProperties.swift // enzevalos_iphone // // Created by Oliver Wiese on 04/01/17. @@ -10,10 +10,10 @@ import Foundation import CoreData -extension Mail { +extension PersistentMail { @nonobjc open override class func fetchRequest() -> NSFetchRequest<NSFetchRequestResult> { - return NSFetchRequest(entityName: "Mail"); + return NSFetchRequest(entityName: "PersistentMail"); } @NSManaged public var body: String? @@ -59,9 +59,6 @@ extension Mail { self.willAccessValue(forKey: "trouble") let text = self.primitiveValue(forKey: "trouble") as? Bool self.didAccessValue(forKey: "trouble") - if(text == nil){ - print("NIL!!!") - } return text! } @@ -80,15 +77,36 @@ extension Mail { return text! } } + + + public var from: MailAddress{ + set { + if newValue is Mail_Address{ + let adr = newValue as! Mail_Address + self.willChangeValue(forKey: "from") + self.setValue(adr, forKey: "from" ) + self.didChangeValue(forKey: "from") + } + + } + get { + self.willAccessValue(forKey: "from") + let text = (self.primitiveValue(forKey: "from") as? Mail_Address) + self.didAccessValue(forKey: "from") + return text as! MailAddress + } + + } + @NSManaged public var bcc: NSSet? @NSManaged public var cc: NSSet? - @NSManaged public var from: Mail_Address + //@NSManaged public var from: Mail_Address @NSManaged public var to: NSSet } // MARK: Generated accessors for bcc -extension Mail { +extension PersistentMail { @objc(addBccObject:) @NSManaged public func addToBcc(_ value: Mail_Address) @@ -105,7 +123,7 @@ extension Mail { } // MARK: Generated accessors for cc -extension Mail { +extension PersistentMail { @objc(addCcObject:) @NSManaged public func addToCc(_ value: Mail_Address) @@ -122,7 +140,7 @@ extension Mail { } // MARK: Generated accessors for to -extension Mail { +extension PersistentMail { @objc(addToObject:) @NSManaged public func addToTo(_ value: Mail_Address) diff --git a/enzevalos_iphone/Providers.swift b/enzevalos_iphone/Providers.swift index 74394c407ff45920b4c60872ff95f3c319ddf08d..f833a4ecf68fb65591f77318bcb8e645e2fc7cc8 100644 --- a/enzevalos_iphone/Providers.swift +++ b/enzevalos_iphone/Providers.swift @@ -12,11 +12,6 @@ enum Provider : String { class Providers { static let config: [Provider : [Attribute : AnyObject?]] = createConfig() - - /*Provider.WEB : [.smtpHostname : "smtp.web.de" as AnyObject?, .smtpPort : 587 as AnyObject?, .imapHostname : "imap.web.de" as AnyObject?, .imapPort : 993 as AnyObject?, .imapConnectionType: MCOConnectionType.TLS.rawValue as AnyObject?, .imapAuthType: MCOAuthType.saslPlain.rawValue as AnyObject?, .smtpConnectionType: MCOConnectionType.startTLS.rawValue as AnyObject?, .smtpAuthType: MCOAuthType.saslPlain.rawValue as AnyObject?], - Provider.FU : [.smtpHostname : "mail.zedat.fu-berlin.de" as AnyObject?, .smtpPort : 587 as AnyObject?, .imapHostname : "mail.zedat.fu-berlin.de" as AnyObject?, .imapPort : 993 as AnyObject?, .imapConnectionType: MCOConnectionType.TLS.rawValue as AnyObject?, .imapAuthType: MCOAuthType.saslPlain.rawValue as AnyObject?, .smtpConnectionType: MCOConnectionType.startTLS.rawValue as AnyObject?, .smtpAuthType: MCOAuthType.saslPlain.rawValue as AnyObject?], - Provider.ZEDAT : [.smtpHostname : "mail.zedat.fu-berlin.de" as AnyObject?, .smtpPort : 587 as AnyObject?, .imapHostname : "mail.zedat.fu-berlin.de" as AnyObject?, .imapPort : 143 as AnyObject?, .imapConnectionType: MCOConnectionType.startTLS.rawValue as AnyObject?, .imapAuthType: MCOAuthType.saslPlain.rawValue as AnyObject?, .smtpConnectionType: MCOConnectionType.TLS.rawValue as AnyObject?, .smtpAuthType: MCOAuthType.saslPlain.rawValue as AnyObject?], - Provider.ENZEVALOS : [.smtpHostname : "mail.enzevalos.de" as AnyObject?, .smtpPort : 465 as AnyObject?, .imapHostname : "mail.enzevalos.de" as AnyObject?, .imapPort : 993 as AnyObject?, .imapConnectionType: MCOConnectionType.TLS.rawValue as AnyObject?, .imapAuthType: MCOAuthType.saslPlain.rawValue as AnyObject?, .smtpConnectionType: MCOConnectionType.TLS.rawValue as AnyObject?, .smtpAuthType: MCOAuthType.saslPlain.rawValue as AnyObject?]*/ static func createConfig() -> [Provider : [Attribute : AnyObject?]] { var config: [Provider : [Attribute : AnyObject?]] = [:] diff --git a/enzevalos_iphone/ReadViewController.swift b/enzevalos_iphone/ReadViewController.swift index fb403dc8c1acaa43c5827c4464b3a1871926e70c..95a7094b41d40317b8ea3ba5fe5d9202466233e5 100644 --- a/enzevalos_iphone/ReadViewController.swift +++ b/enzevalos_iphone/ReadViewController.swift @@ -36,7 +36,7 @@ class ReadViewController: UITableViewController { var VENDelegate: ReadVENDelegate? - var mail: Mail? = nil + var mail: PersistentMail? = nil override func viewDidLoad() { super.viewDidLoad() @@ -76,7 +76,7 @@ class ReadViewController: UITableViewController { if !mail.showMessage { answerButton.isEnabled = false } - navigationController?.navigationBar + _ = navigationController?.navigationBar } else if mail.isSecure { self.navigationController?.navigationBar.barTintColor = ThemeManager.encryptedMessageColor() } else { @@ -127,7 +127,7 @@ class ReadViewController: UITableViewController { override func numberOfSections(in tableView: UITableView) -> Int { if let mail = mail { - if mail.trouble && mail.showMessage || !mail.trouble && !mail.isSecure && mail.from.contact.hasKey { + if mail.trouble && mail.showMessage || !mail.trouble && !mail.isSecure && mail.from.contact!.hasKey || mail.isEncrypted && mail.unableToDecrypt { return 3 } } @@ -139,6 +139,7 @@ class ReadViewController: UITableViewController { if section == 0 { return 3 } + if let mail = mail { if section == 1 && mail.trouble && !mail.showMessage { return 2 @@ -163,24 +164,13 @@ class ReadViewController: UITableViewController { if let mail = mail { if mail.trouble { if indexPath.row == 0 { - infoSymbol.text = "!" - infoSymbol.textColor = ThemeManager.troubleMessageColor() - infoHeadline.text = NSLocalizedString("corruptedHeadline", comment: "This mail is corrupted") - infoHeadline.textColor = UIColor.black - infoText.text = NSLocalizedString("corruptedText", comment: "This mail is corrupted") - infoCell.setNeedsLayout() - infoCell.layoutIfNeeded() - infoCell.translatesAutoresizingMaskIntoConstraints = true return infoCell } else if indexPath.row == 1 { return infoButtonCell } + } else if mail.isEncrypted && mail.unableToDecrypt { + return infoCell } else if mail.from.hasKey && !mail.isSecure { - infoSymbol.text = "?" - infoSymbol.textColor = ThemeManager.uncryptedMessageColor() - infoHeadline.text = NSLocalizedString("encryptedBeforeHeadline", comment: "The sender has encrypted before") - infoHeadline.textColor = UIColor.gray - infoText.text = NSLocalizedString("encryptedBeforeText", comment: "The sender has encrypted before") return infoCell } } else { @@ -191,14 +181,6 @@ class ReadViewController: UITableViewController { return messageCell } - override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { - if indexPath.section == 1 && indexPath.row == 0 { - // get the tableview to use the correct height for this cell; please replace this with a better way if you know one - tableView.beginUpdates() - tableView.endUpdates() - } - } - @IBAction func showEmailButton(_ sender: UIButton) { mail?.showMessage = true @@ -212,16 +194,16 @@ class ReadViewController: UITableViewController { } @IBAction func ignoreEmailButton(_ sender: AnyObject) { - navigationController?.popViewController(animated: true) + _ = navigationController?.popViewController(animated: true) } @IBAction func markUnreadButton(_ sender: AnyObject) { mail?.isRead = false - navigationController?.popViewController(animated: true) + _ = navigationController?.popViewController(animated: true) } @IBAction func deleteButton(_ sender: AnyObject) { - navigationController?.popViewController(animated: true) + _ = navigationController?.popViewController(animated: true) } @IBAction func iconButton(_ sender: AnyObject) { @@ -247,7 +229,7 @@ class ReadViewController: UITableViewController { alert = UIAlertController(title: NSLocalizedString("Postcard", comment: "postcard label"), message: NSLocalizedString("ReceiveInsecureInfo", comment: "Postcard infotext"), preferredStyle: .alert) url = "https://enzevalos.de/infos/postcard" } - alert.addAction(UIAlertAction(title: "Mehr Informationen", style: .default, handler: { (action: UIAlertAction!) -> Void in UIApplication.shared.openURL(URL(string: url)!) })) + alert.addAction(UIAlertAction(title: NSLocalizedString("MoreInformation", comment: "More Information label"), style: .default, handler: { (action: UIAlertAction!) -> Void in UIApplication.shared.openURL(URL(string: url)!) })) alert.addAction(UIAlertAction(title: "OK", style: .cancel, handler: nil)) DispatchQueue.main.async(execute: { self.present(alert, animated: true, completion: nil) @@ -270,10 +252,10 @@ class ReadViewController: UITableViewController { } } - senderTokenField.delegate?.tokenField!(senderTokenField, didEnterText: m.from.contact.displayname!, mail: m.from.address) + senderTokenField.delegate?.tokenField!(senderTokenField, didEnterText: (m.from.contact?.displayname!)!, mail: m.from.mailAddress) for receiver in m.getReceivers() { - if let displayname = receiver.contact.displayname { + if let displayname = receiver.contact?.displayname { toTokenField.delegate?.tokenField!(toTokenField, didEnterText: displayname, mail: receiver.address) } else { toTokenField.delegate?.tokenField!(toTokenField, didEnterText: receiver.address, mail: receiver.address) @@ -281,7 +263,7 @@ class ReadViewController: UITableViewController { } for receiver in m.getCCs() { - if let displayname = receiver.contact.displayname { + if let displayname = receiver.contact?.displayname { toTokenField.delegate?.tokenField!(toTokenField, didEnterText: displayname, mail: receiver.address) } else { toTokenField.delegate?.tokenField!(toTokenField, didEnterText: receiver.address, mail: receiver.address) @@ -289,7 +271,7 @@ class ReadViewController: UITableViewController { } for receiver in m.getBCCs() { - if let displayname = receiver.contact.displayname { + if let displayname = receiver.contact?.displayname { toTokenField.delegate?.tokenField!(toTokenField, didEnterText: displayname, mail: receiver.address) } else { toTokenField.delegate?.tokenField!(toTokenField, didEnterText: receiver.address, mail: receiver.address) @@ -312,10 +294,11 @@ class ReadViewController: UITableViewController { if m.isEncrypted && !m.unableToDecrypt { messageBody.text = m.decryptedBody - } - else { + } else { messageBody.text = m.body } + messageBody.text = messageBody.text?.trimmingCharacters(in: NSCharacterSet.whitespacesAndNewlines).appending("\n") + // NavigationBar Icon let iconView = UIImageView() iconView.autoresizingMask = [.flexibleHeight, .flexibleWidth] @@ -331,6 +314,30 @@ class ReadViewController: UITableViewController { iconView.image = icon iconButton.setImage(icon, for: UIControlState()) + // Mail info text + if m.trouble { + infoSymbol.text = "!" + infoSymbol.textColor = ThemeManager.troubleMessageColor() + infoHeadline.text = NSLocalizedString("corruptedHeadline", comment: "This mail is corrupted") + infoHeadline.textColor = UIColor.black + infoText.text = NSLocalizedString("corruptedText", comment: "This mail is corrupted") + infoCell.setNeedsLayout() + infoCell.layoutIfNeeded() + infoCell.translatesAutoresizingMaskIntoConstraints = true + } else if m.isEncrypted && m.unableToDecrypt { + infoSymbol.text = "?" + infoSymbol.textColor = ThemeManager.uncryptedMessageColor() + infoHeadline.text = NSLocalizedString("couldNotDecryptHeadline", comment: "Message could not be decrypted") + infoHeadline.textColor = UIColor.gray + infoText.text = NSLocalizedString("couldNotDecryptText", comment: "Message could not be decrypted") + } else if m.from.hasKey && !m.isSecure { + infoSymbol.text = "?" + infoSymbol.textColor = ThemeManager.uncryptedMessageColor() + infoHeadline.text = NSLocalizedString("encryptedBeforeHeadline", comment: "The sender has encrypted before") + infoHeadline.textColor = UIColor.gray + infoText.text = NSLocalizedString("encryptedBeforeText", comment: "The sender has encrypted before") + } + print("enc: ", m.isEncrypted, ", unableDec: ", m.unableToDecrypt, ", signed: ", m.isSigned, ", correctlySig: ", m.isCorrectlySigned, ", oldPrivK: ", m.decryptedWithOldPrivateKey) EnzevalosEncryptionHandler.getEncryption(.PGP)?.decryptAndSignatureCheck(m) } @@ -339,9 +346,39 @@ class ReadViewController: UITableViewController { override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == "answerTo" { let navigationController = segue.destination as? UINavigationController - let controller = navigationController?.topViewController as? SendViewController - if controller != nil { - controller?.answerTo = mail + if let controller = navigationController?.topViewController as? SendViewController, mail != nil { + var answerTo = [mail!.from] + var answerCC = [Mail_Address]() + var body = NSLocalizedString("mail from", comment: "describing who send the mail") + " " + body.append(mail!.from.mailAddress) + body.append(" " + NSLocalizedString("sent at", comment: "describing when the mail was send") + " " + mail!.timeString) + body.append("\n" + NSLocalizedString("To", comment: "describing adressee") + ": ") + let myAddress = UserManager.loadUserValue(Attribute.userAddr) as! String + if mail!.to.count > 0 { + for case let mail as Mail_Address in mail!.to { + body.append("\(mail.address), ") + if mail.address != myAddress { + answerTo.append(mail) + } + } + } + if mail!.cc?.count ?? 0 > 0 { + body.append("\n\(NSLocalizedString("Cc", comment: "")): ") + for case let mail as Mail_Address in mail!.cc! { + body.append("\(mail.address), ") + if mail.address != myAddress { + answerCC.append(mail) + } + } + } + body.append("\n" + NSLocalizedString("subject", comment: "describing what subject was choosen") + ": " + (mail!.subject ?? "")) + body.append("\n------------------------\n\n" + (mail!.decryptedBody ?? mail!.body ?? "")) + body = TextFormatter.insertBeforeEveryLine("> ", text: body) + body = "\n\n" + body + + let answerMail = EphemeralMail(to: NSSet.init(array: answerTo), cc: NSSet.init(array: answerCC), bcc: [], date: mail!.date, subject: NSLocalizedString("Re", comment: "prefix for subjects of answered mails") + ": " + (mail!.subject ?? ""), body: body, uid: mail!.uid) + + controller.prefilledMail = answerMail } } else if segue.identifier == "showContact" { let destinationVC = segue.destination as! ContactViewController diff --git a/enzevalos_iphone/Record.swift b/enzevalos_iphone/Record.swift index b3e757b3bc495de2c57e59329115a556b0320420..7da8e2039a46dc07e9db950ea4ab42d2db808d56 100644 --- a/enzevalos_iphone/Record.swift +++ b/enzevalos_iphone/Record.swift @@ -12,11 +12,12 @@ import UIKit public protocol Record: Comparable { + var name: String { get } var hasKey: Bool { get } var isVerified: Bool { get } var ezContact: EnzevalosContact { get } - var mails: [Mail] { get } + var mails: [PersistentMail] { get } var cnContact: CNContact? { get } var color: UIColor { get } var image: UIImage { get } @@ -24,5 +25,5 @@ public protocol Record: Comparable { func addNewAddress(_ adr: MailAddress) -> Bool - func addNewMail(_ mail: Mail) -> Bool + func addNewMail(_ mail:PersistentMail) -> Bool } diff --git a/enzevalos_iphone/SendViewController.swift b/enzevalos_iphone/SendViewController.swift index 72ba82aa3f32272a30e1decd04d7302d7bf05d02..94f82e57d322670036b637a078be3fd50cb817de 100644 --- a/enzevalos_iphone/SendViewController.swift +++ b/enzevalos_iphone/SendViewController.swift @@ -40,7 +40,6 @@ class SendViewController: UIViewController { var keyboardOpened = false var keyboardY: CGFloat = 0 - var reducedSize: CGFloat = 0 var secureState = true var toSecure = true var ccSecure = true @@ -50,12 +49,12 @@ class SendViewController: UIViewController { var collectionDataDelegate = CollectionDataDelegate(suggestionFunc: AddressHandler.frequentAddresses, insertCallback: { (name: String, address: String) -> Void in return }) var recognizer: UIGestureRecognizer = UIGestureRecognizer.init() - var answerTo: Mail? = nil + var prefilledMail: EphemeralMail? = nil var toField: String? = nil override func viewDidLoad() { super.viewDidLoad() - dataDelegate = VENDataDelegate(changeFunc: self.editName, tappedWhenSelectedFunc: self.showContact, deleteFunc: {() -> Void in return}) + dataDelegate = VENDataDelegate(changeFunc: self.editName, tappedWhenSelectedFunc: self.showContact, beginFunc: self.beginEditing, endFunc: self.endEditing, deleteFunc: { () -> Void in return }) tableDataDelegate = TableViewDataDelegate(insertCallback: self.insertName) collectionDataDelegate = CollectionDataDelegate(suggestionFunc: AddressHandler.frequentAddresses, insertCallback: self.insertName) setAnimation() @@ -85,7 +84,7 @@ class SendViewController: UIViewController { ccCollectionview.register(UINib(nibName: "FrequentCell", bundle: nil), forCellWithReuseIdentifier: "frequent") ccCollectionviewHeight.constant = 0 toCollectionviewHeight.constant = 0 - + subjectText.delegate = self subjectText.setColorScheme(self.view.tintColor) @@ -96,32 +95,20 @@ class SendViewController: UIViewController { if let to = toField { let ezCon = DataHandler.handler.getContactByAddress(to) toText.delegate?.tokenField!(toText, didEnterText: ezCon.name, mail: to) - } else if answerTo != nil { - toText.delegate?.tokenField!(toText, didEnterText: (answerTo?.from.address)!) - for r in (answerTo?.getReceivers())! { - if r.address != UserManager.loadUserValue(Attribute.userAddr) as! String { - ccText.delegate?.tokenField!(ccText, didEnterText: r.address) + } else if let prefilledMail = prefilledMail { + for case let mail as MailAddress in prefilledMail.to { + if mail.mailAddress != UserManager.loadUserValue(Attribute.userAddr) as! String { + toText.delegate?.tokenField!(toText, didEnterText: mail.mailAddress) } } - subjectText.setText(NSLocalizedString("Re", comment: "prefix for subjects of answered mails") + ": " + (answerTo?.subject!)!) - textView.text = NSLocalizedString("mail from", comment: "describing who send the mail") + " " - textView.text.append((answerTo?.from.address)!) - textView.text.append(" " + NSLocalizedString("sent at", comment: "describing when the mail was send") + " " + (answerTo?.timeString)!) - textView.text.append("\n" + NSLocalizedString("to", comment: "describing adressee") + ": ") - textView.text.append(UserManager.loadUserValue(Attribute.userAddr) as! String) - if ccText.mailTokens.count > 0 { - textView.text.append(", ") - } - textView.text.append(ccText.mailTokens.componentsJoined(by: ", ")) - textView.text.append("\n" + NSLocalizedString("subject", comment: "describing what subject was choosen") + ": " + (answerTo?.subject!)!) - if answerTo!.isEncrypted { - if answerTo?.decryptedBody != nil { - textView.text.append("\n--------------------\n\n" + (answerTo?.decryptedBody)!) + for case let mail as MailAddress in prefilledMail.cc ?? [] { + if mail.mailAddress != UserManager.loadUserValue(Attribute.userAddr) as! String { + ccText.delegate?.tokenField!(ccText, didEnterText: mail.mailAddress) } - } else { - textView.text.append("\n--------------------\n\n" + (answerTo?.body)!) //textView.text.appendContentsOf("\n"+NSLocalizedString("original message", comment: "describing contents of the original message")+": \n\n"+(answerTo?.body)!) } - textView.text = TextFormatter.insertBeforeEveryLine("> ", text: textView.text) + + subjectText.setText(prefilledMail.subject ?? "") + textView.text.append(prefilledMail.body ?? "") } let sepConst: CGFloat = 1 / UIScreen.main.scale @@ -151,6 +138,7 @@ class SendViewController: UIViewController { NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardOpen(_:)), name: NSNotification.Name.UIKeyboardWillShow, object: nil); NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardClose(_:)), name: NSNotification.Name.UIKeyboardWillHide, object: nil); + toText.tag = UIViewResolver.toText.rawValue ccText.tag = UIViewResolver.ccText.rawValue textView.tag = UIViewResolver.textView.rawValue @@ -185,16 +173,38 @@ class SendViewController: UIViewController { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } - + func reloadCollectionViews() { - collectionDataDelegate.alreadyInserted = (toText.mailTokens as NSArray as! [String])+(ccText.mailTokens as NSArray as! [String]) + collectionDataDelegate.alreadyInserted = (toText.mailTokens as NSArray as! [String]) + (ccText.mailTokens as NSArray as! [String]) DispatchQueue.main.async { - self.collectionDataDelegate.alreadyInserted = (self.toText.mailTokens as NSArray as! [String])+(self.ccText.mailTokens as NSArray as! [String]) + self.collectionDataDelegate.alreadyInserted = (self.toText.mailTokens as NSArray as! [String]) + (self.ccText.mailTokens as NSArray as! [String]) + if self.ccText.isFirstResponder { + if self.collectionDataDelegate.collectionView(self.ccCollectionview, numberOfItemsInSection: 0) > 0 { + self.ccCollectionview.reloadData() + self.ccCollectionviewHeight.constant = 100 + self.ccCollectionview.isHidden = false + } + else { + self.ccCollectionviewHeight.constant = 1 + self.ccCollectionview.isHidden = true + } + } + if self.toText.isFirstResponder { + if self.collectionDataDelegate.collectionView(self.toCollectionview, numberOfItemsInSection: 0) > 0 { + self.toCollectionview.reloadData() + self.toCollectionviewHeight.constant = 100 + self.toCollectionview.isHidden = false + } + else { + self.toCollectionviewHeight.constant = 1 + self.toCollectionview.isHidden = true + } + } self.toCollectionview.reloadData() self.ccCollectionview.reloadData() } } - + func showContact(_ email: String) { let records = DataHandler.handler.getContactByAddress(email).records for r in records { @@ -217,6 +227,27 @@ class SendViewController: UIViewController { destinationVC.keyRecord = (sender["record"] as! KeyRecord) destinationVC.highlightEmail = (sender["email"] as! String) } + } else if segue.identifier == "inviteSegue" { + let navigationController = segue.destination as? UINavigationController + if let controller = navigationController?.topViewController as? SendViewController { + var to = [MailAddress]() + var cc = [MailAddress]() + for mail in toText.mailTokens { + if let mail = mail as? String, !EnzevalosEncryptionHandler.hasKey(mail) { + to.append(DataHandler.handler.getMailAddress(mail, temporary: true)) + } + } + for mail in ccText.mailTokens { + if let mail = mail as? String, !EnzevalosEncryptionHandler.hasKey(mail) { + cc.append(DataHandler.handler.getMailAddress(mail, temporary: true)) + } + } + + let mail = EphemeralMail(to: NSSet.init(array: to), cc: NSSet.init(array: cc), bcc: NSSet.init(), date: Date(), subject: NSLocalizedString("inviteSubject", comment: "Subject for the invitation mail"), body: NSLocalizedString("inviteText", comment: "Body for the invitation mail"), uid: 0) + + + controller.prefilledMail = mail + } } } @@ -238,6 +269,40 @@ class SendViewController: UIViewController { } } + func beginEditing(_ tokenField: VENTokenField) { + if tokenField == toText { + if self.collectionDataDelegate.collectionView(self.toCollectionview, numberOfItemsInSection: 0) > 0 { + self.toCollectionview.reloadData() + self.toCollectionviewHeight.constant = 100 + self.toCollectionview.isHidden = false + } + else { + self.toCollectionviewHeight.constant = 1 + self.toCollectionview.isHidden = true + } + } else if tokenField == ccText { + if self.collectionDataDelegate.collectionView(self.ccCollectionview, numberOfItemsInSection: 0) > 0 { + self.ccCollectionview.reloadData() + self.ccCollectionviewHeight.constant = 100 + self.ccCollectionview.isHidden = false + } + else { + self.ccCollectionviewHeight.constant = 1 + self.ccCollectionview.isHidden = true + } + } + } + + func endEditing(_ tokenField: VENTokenField) { + if tokenField == toText { + self.toCollectionviewHeight.constant = 1 + self.toCollectionview.isHidden = true + } else if tokenField == ccText { + self.ccCollectionviewHeight.constant = 1 + self.ccCollectionview.isHidden = true + } + } + func insertName(_ name: String, address: String) { if toText.isFirstResponder { toText.delegate?.tokenField!(toText, didEnterText: name, mail: address) @@ -283,8 +348,8 @@ class SendViewController: UIViewController { print("no Access!") } } - - func newInput(_ tokenField: VENTokenField){ + + func newInput(_ tokenField: VENTokenField) { animateIfNeeded() reloadCollectionViews() } @@ -293,63 +358,21 @@ class SendViewController: UIViewController { LogHandler.doLog("keyboard", interaction: "open", point: CGPoint(x: 0, y: 0), comment: "") var info = notification.userInfo! let keyboardFrame: CGRect = (info[UIKeyboardFrameEndUserInfoKey] as! NSValue).cgRectValue - reducedSize = keyboardFrame.size.height - keyboardY = keyboardFrame.origin.y - - if toText.isFirstResponder { - toCollectionview.reloadData() - UIView.animate(withDuration: 2.5, delay: 0, options: UIViewAnimationOptions.curveLinear, animations: { self.toCollectionviewHeight.constant = 100 }, completion: nil) - toCollectionview.isHidden = false - } - if ccText.isFirstResponder { - ccCollectionview.reloadData() - ccCollectionviewHeight.constant = 100 - ccCollectionview.isHidden = false - } - if !toText.isFirstResponder { - UIView.animate(withDuration: 2.5, animations: { () -> Void in self.toCollectionviewHeight.constant = 1 }) - toCollectionview.isHidden = true - } - if !ccText.isFirstResponder { - ccCollectionviewHeight.constant = 1 - ccCollectionview.isHidden = true - } - - UIView.animate(withDuration: 0.1, animations: { () -> Void in - - let contentInsets = UIEdgeInsetsMake(self.topLayoutGuide.length, 0.0, self.reducedSize, 0.0) - self.scrollview!.contentInset = contentInsets - }) } func keyboardClose(_ notification: Notification) { LogHandler.doLog("keyboard", interaction: "close", point: CGPoint(x: 0, y: 0), comment: "") - if reducedSize != 0 { - UIView.animate(withDuration: 0.1, animations: { () -> Void in - self.reducedSize = 0 - let contentInsets = UIEdgeInsetsMake(self.topLayoutGuide.length, 0.0, self.reducedSize, 0.0) - self.scrollview!.contentInset = contentInsets - }) - if !toText.isFirstResponder { - toCollectionviewHeight.constant = 1 - toCollectionview.isHidden = true - } - if !ccText.isFirstResponder { - ccCollectionviewHeight.constant = 1 - ccCollectionview.isHidden = true - } - } } func mailSend(_ error: Error?) { if (error != nil) { - NSLog("Error sending email: \(error)") + NSLog("Error sending email: \(String(describing: error))") AppDelegate.getAppDelegate().showMessage("An error occured", completion: nil) } else { NSLog("Send successful!") - if (self.answerTo != nil) { - AppDelegate.getAppDelegate().mailHandler.addFlag((self.answerTo?.uid)!, flags: MCOMessageFlag.answered) + if (self.prefilledMail != nil) { + AppDelegate.getAppDelegate().mailHandler.addFlag((self.prefilledMail?.uid)!, flags: MCOMessageFlag.answered) } self.sendCompleted() } @@ -373,8 +396,8 @@ extension SendViewController: VENTokenFieldDelegate { LogHandler.newLog() } } - - func tokenFieldDidEndEditing(_ tokenField: VENTokenField) {} + + func tokenFieldDidEndEditing(_ tokenField: VENTokenField) { } } //messagefield @@ -394,7 +417,7 @@ extension SendViewController { ccSecure = ccText.dataSource!.isSecure!(ccText) return toSecure && ccSecure } - + func updateNavigationBar() { if(getContemporarySecurityState()) { self.navigationController?.navigationBar.barTintColor = ThemeManager.encryptedMessageColor() @@ -402,7 +425,7 @@ extension SendViewController { self.navigationController?.navigationBar.barTintColor = ThemeManager.uncryptedMessageColor() } } - + func animateIfNeeded() { let contemporarySecureState = getContemporarySecurityState() if (contemporarySecureState) != self.secureState { @@ -427,20 +450,26 @@ extension SendViewController { updateNavigationBar() self.secureState = getContemporarySecurityState() } - + func setAnimation() { if let view = iconButton.subviews.first as? AnimatedSendIcon { view.switchIcons() } } - + func iconButton(_ sender: AnyObject) { - let m = self.secureState + let secureState = self.secureState let alert: UIAlertController let url: String - if !m { + if !secureState { alert = UIAlertController(title: NSLocalizedString("Postcard", comment: "Postcard label"), message: NSLocalizedString("SendInsecureInfo", comment: "Postcard infotext"), preferredStyle: .alert) url = "https://enzevalos.org/infos/postcard" + if subjectText.inputText() != NSLocalizedString("inviteSubject", comment: "") { + alert.addAction(UIAlertAction(title: NSLocalizedString("inviteContacts", comment: "Allows users to invite contacts without encryption key"), style: .default, handler: { + (action: UIAlertAction) -> Void in + self.performSegue(withIdentifier: "inviteSegue", sender: nil) + })) + } } else { alert = UIAlertController(title: NSLocalizedString("Letter", comment: "Letter label"), message: NSLocalizedString("SendSecureInfo", comment: "Letter infotext"), preferredStyle: .alert) url = "https://enzevalos.org/infos/letter" @@ -451,11 +480,11 @@ extension SendViewController { self.present(alert, animated: true, completion: nil) }) } - + @IBAction func iconButtonPressed(_ sender: AnyObject) { iconButton(sender) } - + @IBAction func pressCancel(_ sender: AnyObject) { var alert: UIAlertController var firstResponder: UIView? @@ -480,13 +509,13 @@ extension SendViewController { }) } } - + @IBAction func pressSend(_ sender: AnyObject) { let toEntrys = toText.mailTokens let ccEntrys = ccText.mailTokens let subject = subjectText.inputText()! let message = textView.text! - + mailHandler.send(toEntrys as NSArray as! [String], ccEntrys: ccEntrys as NSArray as! [String], bccEntrys: [], subject: subject, message: message, callback: self.mailSend) } } @@ -494,17 +523,17 @@ extension SendViewController { //Logging extension SendViewController: UIGestureRecognizerDelegate { - + func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool { return true } - + @IBAction func tapped(_ sender: UITapGestureRecognizer) { if LogHandler.logging { LogHandler.doLog(UIViewResolver.resolve((sender.view?.tag)!), interaction: "tap", point: sender.location(ofTouch: sender.numberOfTouches - 1, in: self.view), /*debugDescription: sender.view.debugDescription,*/ comment: "") } } - + @IBAction func panned(_ sender: UIPanGestureRecognizer) { if LogHandler.logging { if sender.state == .began { @@ -515,13 +544,13 @@ extension SendViewController: UIGestureRecognizerDelegate { } } } - + @IBAction func swiped(_ sender: UISwipeGestureRecognizer) { if LogHandler.logging { LogHandler.doLog(UIViewResolver.resolve((sender.view?.tag)!), interaction: "swipe", point: sender.location(ofTouch: sender.numberOfTouches - 1, in: sender.view), comment: String(describing: sender.direction)) } } - + @IBAction func rotated(_ sender: UIRotationGestureRecognizer) { if LogHandler.logging { LogHandler.doLog(UIViewResolver.resolve((sender.view?.tag)!), interaction: "rotate", point: CGPoint(x: 0, y: 0), comment: String(describing: sender.rotation)) diff --git a/enzevalos_iphone/SwitchCell.xib b/enzevalos_iphone/SwitchCell.xib deleted file mode 100644 index d6995916c5c8a1301cd1132ed7ac3fd2a65e0e16..0000000000000000000000000000000000000000 --- a/enzevalos_iphone/SwitchCell.xib +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="15G1217" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> - <device id="retina4_7" orientation="portrait"> - <adaptation id="fullscreen"/> - </device> - <dependencies> - <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/> - <capability name="Constraints to layout margins" minToolsVersion="6.0"/> - <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> - </dependencies> - <objects> - <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> - <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> - <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="SwitchCell" id="Gm7-G9-1ZQ" customClass="SwitchCell" customModule="enzevalos_iphone" customModuleProvider="target"> - <rect key="frame" x="0.0" y="0.0" width="375" height="44"/> - <autoresizingMask key="autoresizingMask"/> - <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Gm7-G9-1ZQ" id="t2J-0m-8Qs"> - <rect key="frame" x="0.0" y="0.0" width="375" height="43"/> - <autoresizingMask key="autoresizingMask"/> - <subviews> - <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="7wk-9h-yLU"> - <rect key="frame" x="312" y="6" width="51" height="31"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> - </switch> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fqM-ef-jLI"> - <rect key="frame" x="16" y="11" width="288" height="21"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> - <fontDescription key="fontDescription" type="system" pointSize="17"/> - <nil key="textColor"/> - <nil key="highlightedColor"/> - </label> - </subviews> - </tableViewCellContentView> - <connections> - <outlet property="label" destination="fqM-ef-jLI" id="t5e-16-gWe"/> - <outlet property="switcher" destination="7wk-9h-yLU" id="1zw-0J-QIX"/> - </connections> - <point key="canvasLocation" x="-899" y="-537"/> - </tableViewCell> - <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="InputCell" id="WPX-Cb-BHm" customClass="InputCell" customModule="enzevalos_iphone" customModuleProvider="target"> - <rect key="frame" x="0.0" y="0.0" width="375" height="44"/> - <autoresizingMask key="autoresizingMask"/> - <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="WPX-Cb-BHm" id="ow3-rZ-z80"> - <rect key="frame" x="0.0" y="0.0" width="375" height="43"/> - <autoresizingMask key="autoresizingMask"/> - <subviews> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GNY-Wr-Z6n"> - <rect key="frame" x="14" y="11" width="103" height="21"/> - <fontDescription key="fontDescription" type="system" pointSize="17"/> - <nil key="textColor"/> - <nil key="highlightedColor"/> - </label> - <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Input" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="GGS-za-Wwh"> - <rect key="frame" x="118" y="10.5" width="249" height="21"/> - <nil key="textColor"/> - <fontDescription key="fontDescription" type="system" pointSize="17"/> - <textInputTraits key="textInputTraits"/> - </textField> - </subviews> - <constraints> - <constraint firstItem="GNY-Wr-Z6n" firstAttribute="top" secondItem="ow3-rZ-z80" secondAttribute="topMargin" constant="3" id="G0d-lN-C8N"/> - <constraint firstItem="GGS-za-Wwh" firstAttribute="leading" secondItem="GNY-Wr-Z6n" secondAttribute="trailing" constant="1" id="Q2Z-qO-z6B"/> - <constraint firstItem="GGS-za-Wwh" firstAttribute="leading" secondItem="ow3-rZ-z80" secondAttribute="leadingMargin" constant="110" id="SzI-89-I9C"/> - <constraint firstItem="GGS-za-Wwh" firstAttribute="centerY" secondItem="GNY-Wr-Z6n" secondAttribute="centerY" id="a96-Fl-lM0"/> - <constraint firstAttribute="trailingMargin" secondItem="GGS-za-Wwh" secondAttribute="trailing" id="c3e-4H-e3r"/> - <constraint firstItem="GNY-Wr-Z6n" firstAttribute="leading" secondItem="ow3-rZ-z80" secondAttribute="leadingMargin" constant="6" id="dUr-77-AnE"/> - </constraints> - </tableViewCellContentView> - <connections> - <outlet property="label" destination="GNY-Wr-Z6n" id="1kE-w9-S1a"/> - <outlet property="textfield" destination="GGS-za-Wwh" id="MCG-JF-cNI"/> - </connections> - <point key="canvasLocation" x="-899.5" y="-424"/> - </tableViewCell> - </objects> -</document> diff --git a/enzevalos_iphone/UserData.swift b/enzevalos_iphone/UserData.swift index aa99d3656c1457ac5664e002b5bf625549f1782c..360ba888bec66ea69db0b13d8701d1866b472764 100644 --- a/enzevalos_iphone/UserData.swift +++ b/enzevalos_iphone/UserData.swift @@ -55,10 +55,9 @@ enum Attribute: Int{ struct UserManager{ - static func storeUserValue(_ value: AnyObject?, attribute: Attribute) -> Bool{ + static func storeUserValue(_ value: AnyObject?, attribute: Attribute) { UserDefaults.standard.setValue(value, forKey: "\(attribute.hashValue)") UserDefaults.standard.synchronize() - return true } static func loadUserValue(_ attribute: Attribute) -> AnyObject?{ @@ -67,7 +66,7 @@ struct UserManager{ return value as AnyObject? } else{ - storeUserValue(attribute.defaultValue, attribute: attribute) + _ = storeUserValue(attribute.defaultValue, attribute: attribute) return attribute.defaultValue } diff --git a/enzevalos_iphone/VENDataDelegate.swift b/enzevalos_iphone/VENDataDelegate.swift index f682ca97ff628f2c9b8f49718f0b61545a7624c3..4126b5d3913820f9e9052fa2fd1959b6cf20fa58 100644 --- a/enzevalos_iphone/VENDataDelegate.swift +++ b/enzevalos_iphone/VENDataDelegate.swift @@ -14,6 +14,8 @@ class VENDataDelegate : NSObject, VENTokenFieldDataSource , VENTokenFieldDelegat var beginFunc: ((VENTokenField) -> Void) = {(_ : VENTokenField) -> Void in } + var endFunc: ((VENTokenField) -> Void) = {(_ : VENTokenField) -> Void in } + var deleteFunc: (() -> Void) = {() -> Void in } var tappedWhenSelectedFunc: ((String) -> Void)? = nil @@ -22,10 +24,12 @@ class VENDataDelegate : NSObject, VENTokenFieldDataSource , VENTokenFieldDelegat super.init() } - init(changeFunc: @escaping ((VENTokenField) -> Void), tappedWhenSelectedFunc: ((String) -> Void)?/*, beginFunc: (VENTokenField -> Void)*/, deleteFunc: @escaping (() -> Void)){ + init(changeFunc: @escaping ((VENTokenField) -> Void), tappedWhenSelectedFunc: ((String) -> Void)?, beginFunc: @escaping ((VENTokenField) -> Void), endFunc: @escaping ((VENTokenField) -> Void), deleteFunc: @escaping (() -> Void)){ self.changeFunc = changeFunc self.tappedWhenSelectedFunc = tappedWhenSelectedFunc self.deleteFunc = deleteFunc + self.beginFunc = beginFunc + self.endFunc = endFunc super.init() } @@ -106,6 +110,7 @@ class VENDataDelegate : NSObject, VENTokenFieldDataSource , VENTokenFieldDelegat tokenField(tokenF, didEnterText: last) } } + endFunc(tokenF) } func isSecure(_ tokenField: VENTokenField) -> Bool { diff --git a/enzevalos_iphone/de.lproj/Localizable.strings b/enzevalos_iphone/de.lproj/Localizable.strings index 254f3e25b0121cd7f42bf91cf4c65071fe9487c3..22efef10c81bd1c873c6ee5786d30702e1ea3f60 100644 --- a/enzevalos_iphone/de.lproj/Localizable.strings +++ b/enzevalos_iphone/de.lproj/Localizable.strings @@ -27,7 +27,7 @@ "DiscoveryTime" = "Bekannt seit"; "Checkmarks" = "Du hast Nachrichten von den Adressen mit Haken bekommen"; "Drafts" = "Entwürfe"; -"Emailaddress" = "Emailadresse"; +"Emailaddress" = "E-Mail-adresse"; "EncryptionType" = "Verschlüsselungsart"; "EverythingCorrect" = "Alles richtig?"; "Forward" = "Weiterleiten"; @@ -35,10 +35,11 @@ "Hello" = "Hallo"; "Inbox" = "Postfach";//Briefkasten? "Insecure" = "Unsicher"; -"InsertMailAddress" = "Bitte gib deine Emailadresse ein"; +"InsertMailAddress" = "Bitte gib deine E-Mail-Adresse ein"; +"InsertMailAddressAndPassword" = "Bitte gib deine E-Mail-Adresse und dein Passwort ein"; "InsertPassword" = "Bitte gib\ndein Passwort ein"; "InsertUSername" = "Bitte gib deinen Nutzernamen ein"; -"InterestedInSecureMail" = "Schön, dass du dich für sichere Email interessierst!"; +"InterestedInSecureMail" = "Schön, dass du dich für sichere E-Mail interessierst!"; "Junk" = "Spam"; "KeyAddresses" = "Mailadressen im Schlüssel"; "KeyDetails" = "Key Details"; @@ -76,8 +77,8 @@ "Secure" = "Sicher"; "Send" = "Senden"; "SendError" = "Ein Fehler ist aufgetreten"; //mehr spezifizieren? -"SendInsecureInfo" = "Diese Nachricht wird unverschlüsselt an alle orange eingefärbten Kontakte gesendet. Somit kann sie unterwegs von anderen gelesen und manipuliert werden."; //anstatt unterwegs: auf ihrem Weg -"SendSecureInfo" = "Super! Diese Nachricht wird verschlüsselt gesendet. Somit kann sie unterwegs nicht gelesen oder ihr Inhalt verändert werden."; +"SendInsecureInfo" = "Diese Nachricht würde unsicher an alle orange eingefärbten Kontakte gesendet werden. Somit kann sie unterwegs von anderen gelesen oder manipuliert werden. Du könntest die orangen Kontakte einladen Enzavalos zu verwenden, um sicher mit ihnen zu kommunizieren."; //anstatt unterwegs: auf ihrem Weg +"SendSecureInfo" = "Super! Diese Nachricht würde sicher versendet werden. Somit ist ihr Inhalt vor neugierigen Augen geschützt und kann nicht manipuliert werden."; "SendSuccess" = "Erfolgreich gesendet"; "Sent" = "Gesendet"; "sent at" = "gesendet am"; @@ -117,7 +118,12 @@ "and" = "und"; "more" = "weitere"; "encryptedBeforeHeadline" = "Unsichere Nachricht"; -"encryptedBeforeText" = "Früher hat dieser Kontakt sichere Nachrichten gesendet. Vertraue dem Inhalt vielleicht nicht zu sehr."; -"corruptedText" = "Diese E-Mail könnte verändert worden sein! Bitte misstrauen Sie dem Inhalt, falls Sie ihn trotzdem lesen möchten."; +"encryptedBeforeText" = "Früher hat dieser Kontakt sichere Nachrichten gesendet. Vertraue dem Inhalt vielleicht nicht zu sehr.\n"; +"corruptedText" = "Diese E-Mail könnte verändert worden sein! Bitte misstrauen Sie dem Inhalt, falls Sie ihn trotzdem lesen möchten.\n"; "corruptedHeadline" = "Achtung!"; "answer" = "Antworten"; +"couldNotDecryptHeadline" = "Entschlüsseln nicht möglich"; +"couldNotDecryptText" = "Diese Nachricht konnte nicht entschlüsselt werden. Vielleicht hat der Absender den falschen Schlüssel verwendet. Falls du von diesem Absender eine Nachricht erwartest könntest du versuchen auf einem anderen Weg in Verbindung zu treten.\n"; +"inviteContacts" = "Unsichere Kontakte einladen"; +"inviteSubject" = "Lass uns unsere E-Mails verschlüsseln!"; +"inviteText" = "Hallo!\n\nEs gibt eine neue App die es super einfach macht verschlüsselt über E-Mail zu kommunizieren. Sie heißt Enzevalos und ist kostenlos im App Store zu finden.\n\nEs wäre toll wenn du sie mal ausprobieren würdest!\n\nViele Grüße!"; diff --git a/enzevalos_iphone/en.lproj/Localizable.strings b/enzevalos_iphone/en.lproj/Localizable.strings index a05adeb056244fb47e6381f0ad0afa383bc20d60..0eb7487f5e851acd6ea90b7fed0cdae02785f93d 100644 --- a/enzevalos_iphone/en.lproj/Localizable.strings +++ b/enzevalos_iphone/en.lproj/Localizable.strings @@ -14,9 +14,9 @@ "Attachment" = "Attachment"; "Authentification" = "Authentification"; "Back" = "Back"; -"Bcc" = "Bcc";//"Blindkopie"; +"Bcc" = "BCC";//"Blindkopie"; "Cancel" = "Cancel"; -"Cc" = "Cc";//"Kopie"; +"Cc" = "CC";//"Kopie"; "CouldNotConnect" = "Couldn't connect to server. Please check your data and modify it maybe."; "ConnectingToMailServer" = "Connecting to mailserver"; "Contacts" = "Contacts"; @@ -35,10 +35,11 @@ "Hello" = "Hello"; "Inbox" = "Inbox"; "Insecure" = "Insecure"; -"InsertMailAddress" = "Please insert your mailaddress"; -"InsertPassword" = "Please insert your password"; -"InsertUsername" = "Please insert your username"; -"InterestedInSecureMail" = "Nice to see you interested in secure mail!"; +"InsertMailAddress" = "Please enter your email address"; +"InsertMailAddressAndPassword" = "Please enter your email address and password"; +"InsertPassword" = "Please enter your password"; +"InsertUsername" = "Please enter your username"; +"InterestedInSecureMail" = "Nice to see that you are interested in secure mail!"; "Junk" = "Junk"; "KeyAddresses" = "Mailaddresses from the key"; "KeyDetails" = "Key Details"; @@ -75,8 +76,8 @@ "Secure" = "Secure"; "Send" = "Send"; "SendError" = "An error occured"; //mehr spezifizieren? -"SendInsecureInfo" = "This Mail will be send unencrypted to all orange contacts. So everybody could read and manipulate it."; -"SendSecureInfo" = "Congratulations! This Mail will be send encrypted. It is not possible for everybody to read and manipulate it."; +"SendInsecureInfo" = "This Mail would be send unsecurely to all orange contacts. So everybody could read and manipulate it. You could invite them to use Enzevalos to communicate securely."; +"SendSecureInfo" = "Congratulations! This Mail would be send securely. It is impossible for anybody to read or manipulate it."; "SendSuccess" = "Sent successfully"; "Sent" = "Sent"; "sent at" = "sent at"; @@ -116,8 +117,12 @@ "and" = "and"; "more" = "more"; "encryptedBeforeHeadline" = "Insecure Message"; -"encryptedBeforeText" = "You received secure messages from this contact before. Maybe don't trust this email too much."; +"encryptedBeforeText" = "You received secure messages from this contact before. Maybe don't trust this email too much.\n"; "corruptedText" = "This E-Mail may have been modified! If you want to read it anyways, please be weary of its content."; "corruptedHeadline" = "Attention!"; "answer" = "Answer"; - +"couldNotDecryptHeadline" = "Could not decrypt Message"; +"couldNotDecryptText" = "It was not possible to decrypt this message. This might be because the sender used the wrong key. If you expect a message from this contact, you could try reaching out on another channel.\n"; +"inviteContacts" = "Invite unsecure Contacts"; +"inviteSubject" = "Lets use secure email!"; +"inviteText" = "Hey there!\n\nThere is this new App called Enzevalos which makes it really easy to communicate encrypted over email.\n\nI would love for you to try it!\n\nBest regards!"; diff --git a/enzevalos_iphone/enzevalos_iphone.xcdatamodeld/enzevalos_iphone.xcdatamodel/contents b/enzevalos_iphone/enzevalos_iphone.xcdatamodeld/enzevalos_iphone.xcdatamodel/contents index 99371ea38de086c3cdc376a67fb5f62e1280883d..44a1c95b654c58c0de166d69fd3ffc8ef399370e 100644 --- a/enzevalos_iphone/enzevalos_iphone.xcdatamodeld/enzevalos_iphone.xcdatamodel/contents +++ b/enzevalos_iphone/enzevalos_iphone.xcdatamodeld/enzevalos_iphone.xcdatamodel/contents @@ -1,11 +1,21 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="11759" systemVersion="15G31" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier=""> +<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="11759" systemVersion="15G1421" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier=""> <entity name="EnzevalosContact" representedClassName="EnzevalosContact" syncable="YES"> <attribute name="cnidentifier" optional="YES" attributeType="String" syncable="YES"/> <attribute name="displayname" attributeType="String" syncable="YES"/> <relationship name="addresses" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Mail_Address" inverseName="contact" inverseEntity="Mail_Address" syncable="YES"/> </entity> - <entity name="Mail" representedClassName="Mail" syncable="YES"> + <entity name="Mail_Address" representedClassName="Mail_Address" syncable="YES"> + <attribute name="address" attributeType="String" defaultValueString="""" syncable="YES"/> + <attribute name="encryptionType" optional="YES" attributeType="String" syncable="YES"/> + <attribute name="prefer_encryption" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/> + <relationship name="bcc" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="PersistentMail" inverseName="bcc" inverseEntity="PersistentMail" syncable="YES"/> + <relationship name="cc" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="PersistentMail" inverseName="cc" inverseEntity="PersistentMail" syncable="YES"/> + <relationship name="contact" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="EnzevalosContact" inverseName="addresses" inverseEntity="EnzevalosContact" syncable="YES"/> + <relationship name="from" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="PersistentMail" inverseName="from" inverseEntity="PersistentMail" syncable="YES"/> + <relationship name="to" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="PersistentMail" inverseName="to" inverseEntity="PersistentMail" syncable="YES"/> + </entity> + <entity name="PersistentMail" representedClassName="PersistentMail" syncable="YES"> <attribute name="body" attributeType="String" syncable="YES"/> <attribute name="date" attributeType="Date" defaultDateTimeInterval="-31582140" usesScalarValueType="NO" indexed="YES" syncable="YES"/> <attribute name="decryptedBody" optional="YES" attributeType="String" syncable="YES"/> @@ -24,16 +34,6 @@ <relationship name="from" maxCount="1" deletionRule="Nullify" destinationEntity="Mail_Address" inverseName="from" inverseEntity="Mail_Address" syncable="YES"/> <relationship name="to" toMany="YES" deletionRule="Nullify" destinationEntity="Mail_Address" inverseName="to" inverseEntity="Mail_Address" syncable="YES"/> </entity> - <entity name="Mail_Address" representedClassName="Mail_Address" syncable="YES"> - <attribute name="address" attributeType="String" defaultValueString="""" syncable="YES"/> - <attribute name="encryptionType" optional="YES" attributeType="String" syncable="YES"/> - <attribute name="prefer_encryption" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/> - <relationship name="bcc" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Mail" inverseName="bcc" inverseEntity="Mail" syncable="YES"/> - <relationship name="cc" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Mail" inverseName="cc" inverseEntity="Mail" syncable="YES"/> - <relationship name="contact" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="EnzevalosContact" inverseName="addresses" inverseEntity="EnzevalosContact" syncable="YES"/> - <relationship name="from" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Mail" inverseName="from" inverseEntity="Mail" syncable="YES"/> - <relationship name="to" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Mail" inverseName="to" inverseEntity="Mail" syncable="YES"/> - </entity> <entity name="State" representedClassName="State" syncable="YES"> <attribute name="currentContacts" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/> <attribute name="currentMails" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/> @@ -41,7 +41,7 @@ </entity> <elements> <element name="EnzevalosContact" positionX="-209" positionY="198" width="128" height="90"/> - <element name="Mail" positionX="-416" positionY="-189" width="128" height="300"/> + <element name="PersistentMail" positionX="-416" positionY="-189" width="128" height="300"/> <element name="Mail_Address" positionX="-297" positionY="-18" width="128" height="165"/> <element name="State" positionX="-306" positionY="-27" width="128" height="90"/> </elements> diff --git a/enzevalos_iphone/providers.json b/enzevalos_iphone/providers.json index 4782583404c6b4d58daa08544b54f171b5bda09a..2afb2ab742dc713942b443ea45f726cd89de575c 100644 --- a/enzevalos_iphone/providers.json +++ b/enzevalos_iphone/providers.json @@ -1,24 +1,25 @@ { "web":{ "servers":{ - "imap:" + "imap":[ { "port":993, "hostname":"imap.web.de", - "ssl":true + "ssl":true, + "auth":"saslPlain" } - , - "smtp": - { + ], + "smtp":[ + { "port":587, "hostname":"smtp.web.de", - "starttls":true - } - ] + "starttls":true, + "auth":"saslPlain" + } + ] }, "domain-match":[ - //"web\\.de", - "web\\.de", + "web.de", "web" ], "mx-match": [ @@ -27,15 +28,43 @@ "" ] }, - "aol":{ + "enzevalos":{ "servers":{ - "imap:"[ + "imap":[ { "port":993, - "hostname":"imap.aol.com", - "ssl":true + "hostname":"mail.enzevalos.de", + "ssl":true, + "auth":"saslPlain" } ], + "smtp":[ + { + "port":465, + "hostname":"mail.enzevalos.de", + "ssl":true, + "auth":"saslPlain" + } + ] + }, + "domain-match":[ + "enzevalos.de", + "enzevalos" + ], + "mx-match": [ + "enzevalos", + "enzevalos.de" + ] + }, + "aol":{ + "servers":{ + "imap" : [ + { + "port":993, + "hostname":"imap.aol.com", + "ssl":true + } + ], "smtp":[ { "port":587, @@ -45,7 +74,6 @@ ] }, "domain-match":[ - //"web\\.de", "aol\\.com", "aol" ],