diff --git a/enzevalos_iphone.xcodeproj/project.pbxproj b/enzevalos_iphone.xcodeproj/project.pbxproj index 977c7c95f6abb66a7d54b62348c5acc72b3a4b8f..50e6c16a4142de88471a34c01401be245ddc6f09 100644 --- a/enzevalos_iphone.xcodeproj/project.pbxproj +++ b/enzevalos_iphone.xcodeproj/project.pbxproj @@ -43,6 +43,7 @@ 472F39901E252470009260FB /* CNMailAddressesExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472F398F1E252470009260FB /* CNMailAddressesExtension.swift */; }; 474054982244D7A9007CF83B /* MailServerConfigurationTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 474054972244D7A9007CF83B /* MailServerConfigurationTest.swift */; }; 474994022261E4E6000F8DA5 /* SimpleSendIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 474994012261E4E6000F8DA5 /* SimpleSendIcon.swift */; }; + 4751C6EE233CA583006B2A4D /* DateExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4751C6ED233CA583006B2A4D /* DateExtension.swift */; }; 4756DE0E20402F8E00452288 /* invitationTextCensor.html in Resources */ = {isa = PBXBuildFile; fileRef = 4756DE0D20402F8E00452288 /* invitationTextCensor.html */; }; 475B00331F7B9565006CDD41 /* SwiftPGP.swift in Sources */ = {isa = PBXBuildFile; fileRef = 475B00301F7B9565006CDD41 /* SwiftPGP.swift */; }; 475B00341F7B9565006CDD41 /* Cryptography.swift in Sources */ = {isa = PBXBuildFile; fileRef = 475B00311F7B9565006CDD41 /* Cryptography.swift */; }; @@ -287,6 +288,7 @@ 472F398F1E252470009260FB /* CNMailAddressesExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CNMailAddressesExtension.swift; sourceTree = "<group>"; }; 474054972244D7A9007CF83B /* MailServerConfigurationTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MailServerConfigurationTest.swift; sourceTree = "<group>"; }; 474994012261E4E6000F8DA5 /* SimpleSendIcon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimpleSendIcon.swift; sourceTree = "<group>"; }; + 4751C6ED233CA583006B2A4D /* DateExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateExtension.swift; sourceTree = "<group>"; }; 4756DE0D20402F8E00452288 /* invitationTextCensor.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = invitationTextCensor.html; path = Invitation/invitationTextCensor.html; sourceTree = "<group>"; }; 475B00301F7B9565006CDD41 /* SwiftPGP.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftPGP.swift; sourceTree = "<group>"; }; 475B00311F7B9565006CDD41 /* Cryptography.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Cryptography.swift; sourceTree = "<group>"; }; @@ -717,6 +719,7 @@ A15D215A223BE5F4003E0CE0 /* TempAttachment.swift */, 472F39921E279792009260FB /* protocols */, A114E4311FACB23000E40243 /* StringExtension.swift */, + 4751C6ED233CA583006B2A4D /* DateExtension.swift */, 47691A8B1ECC3EC7004BCFC5 /* EphemeralMail.swift */, 472F398B1E2519C8009260FB /* CNContactExtension.swift */, 472F398F1E252470009260FB /* CNMailAddressesExtension.swift */, @@ -1521,6 +1524,7 @@ 476801DB218436B600F7F259 /* Autocrypt.swift in Sources */, A1EB057A1D956829008659C1 /* ContactCell.swift in Sources */, A12FC23120221A1400196008 /* ExportInfoViewController.swift in Sources */, + 4751C6EE233CA583006B2A4D /* DateExtension.swift in Sources */, 477548DE21F5DABE000B22A8 /* MailServerConnectionError.swift in Sources */, 475DF47A1F0D54C9009D807F /* Folder+CoreDataProperties.swift in Sources */, 475B00431F7BB6D6006CDD41 /* PersistentKey+CoreDataProperties.swift in Sources */, diff --git a/enzevalos_iphone.xcodeproj/xcshareddata/xcschemes/enzevalos_iphone.xcscheme b/enzevalos_iphone.xcodeproj/xcshareddata/xcschemes/enzevalos_iphone.xcscheme index eab64b2c429453d2ca9a20593c611ac6b6f0555d..a96d2b4f5b40e52bd3d386370f8e2734d997743e 100644 --- a/enzevalos_iphone.xcodeproj/xcshareddata/xcschemes/enzevalos_iphone.xcscheme +++ b/enzevalos_iphone.xcodeproj/xcshareddata/xcschemes/enzevalos_iphone.xcscheme @@ -48,7 +48,7 @@ skipped = "NO"> <BuildableReference BuildableIdentifier = "primary" - BlueprintIdentifier = "A13526961D955BE000D3BFE1" + BlueprintIdentifier = "476EEF9522A872BF00BB4EF7" BuildableName = "enzevalos_iphoneUITests.xctest" BlueprintName = "enzevalos_iphoneUITests" ReferencedContainer = "container:enzevalos_iphone.xcodeproj"> @@ -65,11 +65,6 @@ </BuildableReference> </MacroExpansion> <AdditionalOptions> - <AdditionalOption - key = "NSZombieEnabled" - value = "YES" - isEnabled = "YES"> - </AdditionalOption> </AdditionalOptions> </TestAction> <LaunchAction diff --git a/enzevalos_iphone/Base.lproj/Main.storyboard b/enzevalos_iphone/Base.lproj/Main.storyboard index 5e817131cd3506d97e40b9ae070e6b92d88a41d1..5e8bb6a8b5f3b85bdf69ff70febed4ebd506b807 100644 --- a/enzevalos_iphone/Base.lproj/Main.storyboard +++ b/enzevalos_iphone/Base.lproj/Main.storyboard @@ -16,7 +16,7 @@ <objects> <tableViewController storyboardIdentifier="UITableViewController-Ouw-WD-EV6" id="Ouw-WD-EV6" customClass="ReadViewController" customModule="enzevalos_iphone" customModuleProvider="target" sceneMemberID="viewController"> <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" allowsSelection="NO" rowHeight="44" sectionHeaderHeight="8" sectionFooterHeight="1" id="oZT-OA-Re5"> - <rect key="frame" x="0.0" y="0.0" width="320" height="504"/> + <rect key="frame" x="0.0" y="0.0" width="320" height="568"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <sections> @@ -182,7 +182,7 @@ </constraints> </view> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qTi-rO-CH3"> - <rect key="frame" x="148" y="5.5" width="140" height="33"/> + <rect key="frame" x="148" y="0.0" width="140" height="44"/> <constraints> <constraint firstAttribute="height" constant="44" id="voC-CF-ncN"/> </constraints> @@ -576,8 +576,8 @@ <constraint firstAttribute="width" constant="15" id="ons-Pp-k3n"/> </constraints> </imageView> - <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="sfv-2Q-95I"> - <rect key="frame" x="0.0" y="15" width="15" height="18"/> + <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="sfv-2Q-95I"> + <rect key="frame" x="0.0" y="18" width="15" height="15"/> <constraints> <constraint firstAttribute="height" constant="15" id="SmT-9e-ovi"/> <constraint firstAttribute="width" constant="15" id="uKU-PK-flD"/> @@ -662,7 +662,7 @@ <objects> <tableViewController storyboardIdentifier="UITableViewController-ooe-0X-glz" id="ooe-0X-glz" customClass="ListViewController" customModule="enzevalos_iphone" customModuleProvider="target" sceneMemberID="viewController"> <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="ipK-4X-lVA"> - <rect key="frame" x="0.0" y="0.0" width="320" height="504"/> + <rect key="frame" x="0.0" y="0.0" width="320" height="568"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <prototypes> @@ -748,7 +748,7 @@ <objects> <tableViewController storyboardIdentifier="UITableViewController-8Di-x2-cWQ" id="8Di-x2-cWQ" customClass="ContactViewController" customModule="enzevalos_iphone" customModuleProvider="target" sceneMemberID="viewController"> <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="lK7-ug-OyQ"> - <rect key="frame" x="0.0" y="0.0" width="320" height="504"/> + <rect key="frame" x="0.0" y="0.0" width="320" height="568"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/> <prototypes> @@ -953,8 +953,49 @@ <outlet property="secondProgress" destination="ZFX-bP-Gr0" id="28r-lV-5xG"/> </connections> </tableViewCell> + <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="KnownSinceCell" textLabel="iln-tB-cUf" detailTextLabel="LXh-0V-sEL" style="IBUITableViewCellStyleValue1" id="5Hg-7T-NET" userLabel="KnownSinceCell"> + <rect key="frame" x="0.0" y="437.5" width="320" height="44"/> + <autoresizingMask key="autoresizingMask"/> + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="5Hg-7T-NET" id="hUE-pu-Qok"> + <rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/> + <autoresizingMask key="autoresizingMask"/> + <subviews> + <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="iln-tB-cUf"> + <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"/> + <nil key="highlightedColor"/> + </label> + <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Detail" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="LXh-0V-sEL"> + <rect key="frame" x="260" y="12" width="44" height="20.5"/> + <autoresizingMask key="autoresizingMask"/> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <nil key="textColor"/> + <nil key="highlightedColor"/> + </label> + </subviews> + </tableViewCellContentView> + </tableViewCell> + <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="LastMailCell" textLabel="0j5-Ji-UQu" style="IBUITableViewCellStyleDefault" id="cbB-Ur-FcA" userLabel="LastMailCell"> + <rect key="frame" x="0.0" y="481.5" width="320" height="44"/> + <autoresizingMask key="autoresizingMask"/> + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="cbB-Ur-FcA" id="LRS-OK-eLi"> + <rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/> + <autoresizingMask key="autoresizingMask"/> + <subviews> + <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Title1" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="0j5-Ji-UQu"> + <rect key="frame" x="16" y="0.0" width="288" height="43.5"/> + <autoresizingMask key="autoresizingMask"/> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <nil key="textColor"/> + <nil key="highlightedColor"/> + </label> + </subviews> + </tableViewCellContentView> + </tableViewCell> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="MailCell" rowHeight="64" id="8qd-Go-Jup" customClass="MailCell" customModule="enzevalos_iphone" customModuleProvider="target"> - <rect key="frame" x="0.0" y="437.5" width="320" height="64"/> + <rect key="frame" x="0.0" y="525.5" width="320" height="64"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="8qd-Go-Jup" id="CEB-dH-z8s"> <rect key="frame" x="0.0" y="0.0" width="320" height="63.5"/> @@ -988,14 +1029,14 @@ </connections> </tableViewCell> <tableViewCell hidden="YES" clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="BadgeCaseCell" textLabel="W4e-hv-Sye" style="IBUITableViewCellStyleDefault" id="jQz-hn-5EU"> - <rect key="frame" x="0.0" y="501.5" width="320" height="44"/> + <rect key="frame" x="0.0" y="589.5" width="320" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="jQz-hn-5EU" id="uhD-6F-ygC"> - <rect key="frame" x="0.0" y="0.0" width="286" height="43.5"/> + <rect key="frame" x="0.0" y="0.0" width="294" height="43.5"/> <autoresizingMask key="autoresizingMask"/> <subviews> <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Your Badges" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="W4e-hv-Sye"> - <rect key="frame" x="16" y="0.0" width="269" height="43.5"/> + <rect key="frame" x="15" y="0.0" width="270" height="43.5"/> <autoresizingMask key="autoresizingMask"/> <fontDescription key="fontDescription" type="system" pointSize="17"/> <nil key="textColor"/> @@ -1008,14 +1049,14 @@ </connections> </tableViewCell> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="AllMails" textLabel="VTZ-4w-fot" style="IBUITableViewCellStyleDefault" id="dM9-jb-EcN"> - <rect key="frame" x="0.0" y="545.5" width="320" height="44"/> + <rect key="frame" x="0.0" y="633.5" width="320" 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="286" height="43.5"/> + <rect key="frame" x="0.0" y="0.0" width="294" 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="16" y="0.0" width="269" height="43.5"/> + <rect key="frame" x="15" y="0.0" width="270" height="43.5"/> <autoresizingMask key="autoresizingMask"/> <fontDescription key="fontDescription" type="system" pointSize="17"/> <nil key="textColor"/> @@ -1028,7 +1069,7 @@ </connections> </tableViewCell> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="KeyCell" id="Lke-0s-P0i" userLabel="KeyCell"> - <rect key="frame" x="0.0" y="589.5" width="320" height="44"/> + <rect key="frame" x="0.0" y="677.5" width="320" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Lke-0s-P0i" id="QYX-AX-hbo"> <rect key="frame" x="0.0" y="0.0" width="294" height="43.5"/> @@ -1039,7 +1080,7 @@ </connections> </tableViewCell> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="RecordCell" id="hTc-vs-AIl" customClass="RecordCell" customModule="enzevalos_iphone" customModuleProvider="target"> - <rect key="frame" x="0.0" y="633.5" width="320" height="44"/> + <rect key="frame" x="0.0" y="721.5" width="320" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="hTc-vs-AIl" id="pJ9-4e-7at"> <rect key="frame" x="0.0" y="0.0" width="294" height="43.5"/> @@ -1111,7 +1152,7 @@ <objects> <viewController id="jYD-fk-aIP" customClass="KeyViewController" customModule="enzevalos_iphone" customModuleProvider="target" sceneMemberID="viewController"> <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="ZAH-bZ-S6n"> - <rect key="frame" x="0.0" y="0.0" width="320" height="504"/> + <rect key="frame" x="0.0" y="0.0" width="320" height="568"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES"/> <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/> <edgeInsets key="layoutMargins" top="10" left="20" bottom="10" right="20"/> @@ -1294,7 +1335,7 @@ <objects> <tableViewController storyboardIdentifier="exportInfoViewController" id="7Pd-d5-0wz" customClass="ExportInfoViewController" customModule="enzevalos_iphone" customModuleProvider="target" sceneMemberID="viewController"> <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" dataMode="prototypes" style="grouped" separatorStyle="default" sectionIndexMinimumDisplayRowCount="1" rowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" id="2Uv-bd-pB1"> - <rect key="frame" x="0.0" y="0.0" width="320" height="504"/> + <rect key="frame" x="0.0" y="0.0" width="320" height="568"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/> <prototypes> @@ -1868,6 +1909,6 @@ Um deine sicheren E-Mails auch auf einem anderen Gerät lesen zu können, muss d <segue reference="hSn-Um-hji"/> <segue reference="DcR-GX-scc"/> <segue reference="TgN-rB-esa"/> - <segue reference="PxQ-Nb-6Fq"/> + <segue reference="ecN-Wn-7S0"/> </inferredMetricsTieBreakers> </document> diff --git a/enzevalos_iphone/ContactViewController.swift b/enzevalos_iphone/ContactViewController.swift index d1b2879c614aa62382669422badcbc3d15b48517..43c6b9e5e119a031a7737abc35dc276482d65ece 100644 --- a/enzevalos_iphone/ContactViewController.swift +++ b/enzevalos_iphone/ContactViewController.swift @@ -24,7 +24,7 @@ import ContactsUI class ContactViewController: UIViewController { static let HideVerifycation = true - + var keyRecord: KeyRecord? = nil var addressWithKey: MailAddress? /// This email will be highlighted blue to indicate from which addres a mail was received @@ -283,11 +283,42 @@ extension ContactViewController: UITableViewDataSource { cell.contactImage.clipsToBounds = true cell.iconImage.image = drawStatusCircle() if isUser { - cell.contactStatus.text = NSLocalizedString("thisIsYou", comment: "This contact is the user") + var stringTag = "ContactView.ID.Explaination.youNoCrypto" + if keyRecord.hasKey { + if let prefkey = DataHandler.handler.prefSecretKey(), prefkey.keyID == keyRecord.keyID { + if DataHandler.handler.findSecretKeys().count > 1 { + stringTag = "ContactView.ID.Explaination.youCryptoPrim" + } + else { + stringTag = "ContactView.ID.Explaination.youCrypto" + } + } else { // not primary/pref secret key + stringTag = "ContactView.ID.Explaination.youCryptoOther" + } + } + cell.contactStatus.text = NSLocalizedString(stringTag, comment: "This contact is the user") } else if keyRecord.isVerified { cell.contactStatus.text = NSLocalizedString("Verified", comment: "Contact is verified") } else if keyRecord.hasKey { - cell.contactStatus.text = NSLocalizedString("notVerified", comment: "Contact is not verified jet") + var stringTag = "ContactView.ID.Explaination.othersCrypto" + var keys = [PersistentKey] () + for adr in keyRecord.addresses { + keys.append(contentsOf: adr.publicKeys) + } + if keys.count > 1 { + var firstKey = keys[0] + for key in keys { + if let date1 = key.discoveryDate, let dateFirstKey = firstKey.discoveryDate, date1 < dateFirstKey { + firstKey = key + } + } + if keyRecord.key?.keyID == firstKey.keyID { + stringTag = "ContactView.ID.Explaination.othersCryptoFirst" + } else { + stringTag = "ContactView.ID.Explaination.othersCryptoOther" + } + } + cell.contactStatus.text = NSLocalizedString(stringTag, comment: "Contact is not verified jet") } 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 if addressWithKey?.hasKey ?? false { @@ -345,6 +376,18 @@ extension ContactViewController: UITableViewDataSource { return progressCell } + if !isUser && keyRecord.hasKey{ + let knownSince = tableView.dequeueReusableCell(withIdentifier: "KnownSinceCell", for: indexPath) + + if let date = keyRecord.firstSecureMailReceived { + knownSince.textLabel?.text = NSLocalizedString("ContactView.KnownSince", comment: "known since") + knownSince.detailTextLabel?.text = date.timeAgoText() + } else { + knownSince.textLabel?.text = NSLocalizedString("ContactView.KnownSince.Unknown", comment: "unknown since we know contact") + knownSince.detailTextLabel?.text = "" + } + return knownSince + } } else if indexPath.row == 3 { if isUser && keyRecord.hasKey { if TravelHandler.instance().mode != .borderCrossing { @@ -352,7 +395,8 @@ extension ContactViewController: UITableViewDataSource { actionCell.Button.setTitle(NSLocalizedString("ReadOnOtherDevices", comment: "read secure mails on other devices (export secret key)"), for: UIControl.State()) return actionCell - } else { + } + else { let actionCell = tableView.dequeueReusableCell(withIdentifier: "ActionCell", for: indexPath) as! ActionCell actionCell.Button.setTitle(NSLocalizedString("BorderCrossed", comment: "read secure mails on other devices (export secret key)"), for: UIControl.State()) @@ -360,6 +404,31 @@ extension ContactViewController: UITableViewDataSource { } } + else if !isUser && keyRecord.hasKey { + let lastMailFrom = tableView.dequeueReusableCell(withIdentifier: "LastMailCell", for: indexPath) + + if let date = keyRecord.newestDate { + if date.isToday() { + lastMailFrom.textLabel?.text = NSLocalizedString("ContactView.LastMail.Today", comment: "last mail today") + } else { + lastMailFrom.textLabel?.text = String(format: NSLocalizedString("ContactView.LastMail.Ago", comment: "last mail received a couple of times ago"), date.timeAgoText()) + lastMailFrom.detailTextLabel?.text = date.timeAgoText() + } + } else { + lastMailFrom.textLabel?.text = NSLocalizedString("ContactView.LastMail.No", comment: "no last mail") + lastMailFrom.detailTextLabel?.text = "" + } + + return lastMailFrom + } + } else if indexPath.row == 4 { + if !isUser { + let actionCell = tableView.dequeueReusableCell(withIdentifier: "ActionCell", for: indexPath) as! ActionCell + actionCell.Button.setTitle(NSLocalizedString("BorderCrossed", comment: "read secure mails on other devices (export secret key)"), for: UIControl.State()) + + return actionCell + } + print("Missing data for index: \(indexPath.row)") } case 1: let cell = tableView.dequeueReusableCell(withIdentifier: "MailCell") as! MailCell @@ -415,16 +484,21 @@ extension ContactViewController: UITableViewDataSource { cell.dateLabel.text = dateFormatter.string(from: time as Date) cell.iconImage.image = StudySettings.securityIndicator.imageOfSecureIndicator() //TODO: add insecure travel keyRecord here + cell.label.text = r[indexPath.row].addresses.first?.mailAddress } else { cell.dateLabel.text = "" cell.iconImage.image = StudySettings.securityIndicator.imageOfInsecureIndicator() + cell.label.text = NSLocalizedString("ContactView.OtherIDs.Insecure.Title", comment: "insecure label instead of addr") + } - cell.label.text = r[indexPath.row].addresses.first?.mailAddress } return cell case 5 where isUser: let badgeCell = tableView.dequeueReusableCell(withIdentifier: "BadgeCaseCell", for: indexPath) badgeCell.detailTextLabel?.text = NSLocalizedString("YourBadges", comment: "") + if StudySettings.hideBadges { + badgeCell.isHidden = true + } return badgeCell case 6 where isUser: let actionCell = tableView.dequeueReusableCell(withIdentifier: "ActionCell", for: indexPath) as! ActionCell @@ -472,6 +546,9 @@ extension ContactViewController: UITableViewDataSource { if isUser && record.hasKey { counter += 2 } + if !isUser && record.hasKey { + counter += 2 + } return counter case 1: return record.ezContact.getMailAddresses().count diff --git a/enzevalos_iphone/DateExtension.swift b/enzevalos_iphone/DateExtension.swift new file mode 100644 index 0000000000000000000000000000000000000000..708fc1e5402bc9374b797a10ed334921ae97132a --- /dev/null +++ b/enzevalos_iphone/DateExtension.swift @@ -0,0 +1,58 @@ +// +// DateExtension.swift +// enzevalos_iphone +// +// Created by Oliver Wiese on 26.09.19. +// Copyright © 2019 fu-berlin. All rights reserved. +// + +import Foundation +extension Date{ + + func timeAgo() -> DateComponents { + let calender = Calendar.current + let start = calender.startOfDay(for: self) + let current = calender.startOfDay(for: Date()) + return calender.dateComponents([.day, .month, .year], from: start, to: current) + } + + func isToday() -> Bool { + let dateComponents = self.timeAgo() + if let day = dateComponents.day, let month = dateComponents.month, let year = dateComponents.year, day == 0 && month == 0, year == 0 { + return true + } + return false + } + + func timeAgoText() -> String { + let components = self.timeAgo() + if let years = components.year, years > 0 { + if years == 1 { + return NSLocalizedString("Time.year.one", comment: "one year") + } + else { + return String(format: NSLocalizedString("Time.year.multiple", comment: "multiple years"), years) + } + } + else if let months = components.month, months > 0 { + if months == 1 { + return NSLocalizedString("Time.month.one", comment: "one month") + } + else { + return String(format: NSLocalizedString("Time.month.multiple", comment: "multiple month"), months) + } + } + else if let days = components.day { + if days == 0 { + return NSLocalizedString("Time.day.today", comment: "today") + } + else if days == 1 { + return NSLocalizedString("Time.day.one", comment: "one day") + } + else { + return String(format: NSLocalizedString("Time.day.multiple", comment: "multiple days"), days) + } + } + return self.description(with: .autoupdatingCurrent) + } +} diff --git a/enzevalos_iphone/KeyRecord+CoreDataClass.swift b/enzevalos_iphone/KeyRecord+CoreDataClass.swift index ac6af3c7081e93eb5117fe9cdb15a1db460e1a1c..95ff913043d7945495f705d8b8365897469da2f2 100644 --- a/enzevalos_iphone/KeyRecord+CoreDataClass.swift +++ b/enzevalos_iphone/KeyRecord+CoreDataClass.swift @@ -230,8 +230,6 @@ public class KeyRecord: NSManagedObject, Record { } return nil } - - } diff --git a/enzevalos_iphone/PLists/enzevalos-Info.plist b/enzevalos_iphone/PLists/enzevalos-Info.plist index df935ae6494feb6174ceb1209a3615f9dff2bf87..0ea05abcf583aca056624af354f667f76ca867e4 100644 --- a/enzevalos_iphone/PLists/enzevalos-Info.plist +++ b/enzevalos_iphone/PLists/enzevalos-Info.plist @@ -17,7 +17,7 @@ <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> - <string>0.8.27</string> + <string>0.8.28</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleURLTypes</key> @@ -32,7 +32,7 @@ </dict> </array> <key>CFBundleVersion</key> - <string>0.8.27</string> + <string>0.8.28</string> <key>LSRequiresIPhoneOS</key> <true/> <key>NSAppTransportSecurity</key> diff --git a/enzevalos_iphone/PersistentKey+CoreDataClass.swift b/enzevalos_iphone/PersistentKey+CoreDataClass.swift index 02b5f05baca895bbe9c9a1062ddfe04fec87f0fa..39181f2eb03b31fe7b8cd882badbadb5b1b43a40 100644 --- a/enzevalos_iphone/PersistentKey+CoreDataClass.swift +++ b/enzevalos_iphone/PersistentKey+CoreDataClass.swift @@ -19,6 +19,20 @@ public class PersistentKey: NSManagedObject { return 0 } + var lastReceivedMail: PersistentMail? { + var lastMail: PersistentMail? + for m in signedMails ?? [] { + if let mail = m as? PersistentMail { + if lastMail == nil { + lastMail = mail + }else if let l = lastMail, l.date < mail.date { + lastMail = mail + } + } + } + return lastMail + } + func verify() { failedCallForUse = false repealed = false diff --git a/enzevalos_iphone/StringExtension.swift b/enzevalos_iphone/StringExtension.swift index 184c4b8ea23f58f6ebd1c902af4ddbc98d30a233..06ef570ba354dea3c9be355f59090a06f482ea35 100644 --- a/enzevalos_iphone/StringExtension.swift +++ b/enzevalos_iphone/StringExtension.swift @@ -55,5 +55,9 @@ extension String { let components = self.components(separatedBy: seperatedBy) return components.filter { !$0.isEmpty }.joined(separator: " ") } + + func makeBlocks(size: Int = 4) -> String { + return String(enumerated().map { $0 > 0 && $0 % size == 0 ? [" ", $1] : [$1]}.joined()) + } } diff --git a/enzevalos_iphone/StudySettings.swift b/enzevalos_iphone/StudySettings.swift index 2f402f8fb731924f9a360c44f4dd4a976bc30788..90babfd7c6fb36052accd549cceffeaa474f72be 100644 --- a/enzevalos_iphone/StudySettings.swift +++ b/enzevalos_iphone/StudySettings.swift @@ -32,7 +32,13 @@ class StudySettings { } static var hideWarning: Bool { get { - return false + return true + } + } + + static var hideBadges: Bool { + get { + return true } } diff --git a/enzevalos_iphone/de.lproj/Localizable.strings b/enzevalos_iphone/de.lproj/Localizable.strings index d192f8b46ee54651bdfb447c7d4f06dcb7a0aa5b..5b0385a910eaf1b89e9c16f4e58040930df1f890 100644 --- a/enzevalos_iphone/de.lproj/Localizable.strings +++ b/enzevalos_iphone/de.lproj/Localizable.strings @@ -83,8 +83,8 @@ "PostcardDescription" = "Du, die sendende Person und beide Mail-Provider kennen den Inhalt der Mail, aber wer hat sie versendet?\nAbsenderadressen können frei gewählt werden. Ein Betrüger kann eine bekannte Mailadresse angeben und sich so als eine andere Person ausgeben."; "Re" = "Re"; "ReadFollowingPages" = "Wir machen vertrauliche Mail-Kommunikation einfach nutzbar.\Bitte lies dir dafür die nächsten drei Seiten durch."; -"ReadMailOnOtherDevice" = "Auf anderem Gerät lesen"; -"ReadOnOtherDevices" = "Vertrauliche Mails auf anderen Geräten lesen!"; +"ReadMailOnOtherDevice" = "Warum kann ich nicht diese Mail auf anderem Geräten lesen?"; +"ReadOnOtherDevices" = "Warum kann ich nicht alle Mails auf anderen Geräten lesen?"; "Receive" = "Empfangen"; "ReceiveError" = "Ein Fehler ist aufgetreten"; //mehr spezifizieren? "ReceiveDamagedInfo" = "Die kryptographischen Eigenschaften der Mail sind kaputt. Der Inhalt wurde manipuliert."; @@ -138,15 +138,15 @@ "LastUpdate" = "Letzte Aktualisierung"; "notVerified" = "Dieser Kontakt wurde noch nicht verifiziert."; "noEncryption" = "Dieser Kontakt hat noch nie vertrauliche Mails versendet."; -"otherEncryption" = "Dies ist die Ablage für unvertrauliche Mail dieser Person"; +"otherEncryption" = "Dies ist die ID für unvertrauliche Mail dieser Person"; "hasKeyButNoMail" = "Dieser Kontakt kann vertrauliche Mails versenden und empfangen, hat aber noch nie vertrauliche Mails versendet."; "Verified" = "Kontakt ist verifiziert"; "verifyNow" = "Jetzt verifizieren"; -"toEncrypted" = "Zur Ablage von vertraulichen Mails"; +"toEncrypted" = "Zur vertrauenswürdigen ID"; "invite" = "Bitte um vertrauliche Kommunikation"; "discardButton" = "Verwerfen"; -"allMessages" = "Alle Nachrichten dieser Ablage"; -"otherRecords" = "Andere Ablagen dieses Kontakts"; +"allMessages" = "Alle Nachrichten dieser ID"; +"otherRecords" = "Andere zur Adresse verbundende IDs"; "connectedAddresses" = "Verknüpfte Mailadressen"; "CC" = "An/CC"; "All" = "Alles"; @@ -206,8 +206,22 @@ "inviteSubject" = "Lass uns vertrauliche Mails ausprobieren!"; "inviteText" = "Hallo, \n\nbisher waren unsere E-Mails immer wie Postkarten und die E-Mail-Provider konnten immer mitlesen. Davor schützt Ende-Zu-Ende-Verschlüsselung. Ich probiere gerade Letterbox aus, aber es gibt auch andere Programme. Letterbox ist besonders einfach und unkompliziert. Wollen wir es mal gemeinsam ausprobieren? \n\n Eine Übersicht über andere Programme und weitere Erklärungen finden sich hier: \n\n http://letterbox.imp.fu-berlin.de?id=%@&invitation=Mail \n\nViele Grüße!";//"Hallo!\n\nEs gibt eine neue App die es super einfach macht verschlüsselt über E-Mail zu kommunizieren. Sie heißt Letterbox und wird aktuell in einer wissenschaftlichen Studie getestet.\n\nEs wäre toll wenn du sie mal ausprobieren würdest!\n\nGehe einfach auf https://userpage.fu-berlin.de/letterbox um mitzumachen.\n\nViele Grüße!"; "noName" = "OHNE NAME"; -"you" = "Deine Ablage"; -"thisIsYou" = "Hier werden E-Mails, die du dir selber schickst, gesammelt"; +"you" = "Deine ID"; +"ContactView.ID.Explaination.youCrypto" = "Das ist deine Identität."; // thisIsYou +"ContactView.ID.Explaination.youCryptoPrim" = "Das ist deine primäre Identität."; +"ContactView.ID.Explaination.youCryptoOther" = "Das ist eine weitere kryptographische Identität von Dir."; +"ContactView.ID.Explaination.youNoCrypto" = "Das ist Sammlung von Behauptungen. Wir wissen nicht, ob die Mails tatsächlich von dir kommen."; +"ContactView.ID.Explaination.othersCrypto" = "Das ist eine fremde Identität und alle Mails stammen von der selben Person."; // thisIsYou +"ContactView.ID.Explaination.othersCryptoFirst" = "Das ist deine erste Identität der Person und alle Mails stammen von der Identität."; +"ContactView.ID.Explaination.othersCryptoOther" = "Das ist eine weitere kryptographische Identität von der Person."; +"ContactView.ID.Explaination.othersNoCrypto" = "Das ist Sammlung von Behauptungen. Wir wissen nicht, ob die Mails tatsächlich von der Person kommen."; +"ContactView.KnownSince" = "Bekannt seit"; +"ContactView.KnownSince.Unknown" = "Unbekanntes erstes Auftauchsdatum"; +"ContactView.LastMail" = "Letzte erhaltene Mail von "; +"ContactView.LastMail.Today" = "Letzte Mail heute erhalten."; +"ContactView.LastMail.Ago" = "Letzte Mail vor %@ erhalten."; +"ContactView.LastMail.No" = "Noch keine Mail erhalten."; +"ContactView.OtherIDs.Insecure.Title" = "Unsichere ID"; "didYouSendThis" = "Hallo, haben Sie mir diese E-Mail geschickt?\nIch frage nur, weil die Mail Ihnen nicht eindeutig zugeordnet werden kann und Ihre vorherige Mails eindeutig Ihnen zu ordnenbar waren. Für Erfahrende: Die Mail hat keine digitale Signatur.\n\n"; "reactButton" = "Um Bestätigung bitten"; "sendSecureIfPossible" = "Wenn möglich vertraulich senden"; @@ -275,3 +289,10 @@ "SecretKeyCell.date" = "Bekannt seit "; "SecretKeyCell.origin" = "Importiert aus "; "SecretKeyCell.generated" = "Auf diesem Gerät erzeugt."; +"Time.year.one" = "ein Jahr"; +"Time.year.multiple" = "%@ Jahre"; +"Time.month.one" = "ein Monat"; +"Time.month.multiple" = "%@ Monate"; +"Time.day.one" = "ein Tag"; +"Time.day.multiple" = "%@ Tage"; +"Time.day.today" = "heute"; diff --git a/enzevalos_iphone/en.lproj/Localizable.strings b/enzevalos_iphone/en.lproj/Localizable.strings index 471935a447e190d281f844b75c8173a9006abfd5..87ac6bfd9e2a0c767b2164ca72c44056ccc24ffe 100644 --- a/enzevalos_iphone/en.lproj/Localizable.strings +++ b/enzevalos_iphone/en.lproj/Localizable.strings @@ -82,8 +82,8 @@ "PostcardDescription" = "You, the sender and both mail providers know the content of the mail but who sent the mail?\nSender addresses can be freely chosen. A fraud can impersonate a person when using a known mail address as sender address."; "Re" = "Re"; "ReadFollowingPages" = "We make confidential mail communication easy to use.\nPlease read the next three pages to learn how."; -"ReadMailOnOtherDevice" = "Read this mail on a different device"; -"ReadOnOtherDevices" = "Read secure mails on different devices!"; +"ReadMailOnOtherDevice" = "Why can't I read this mail on a different device?"; +"ReadOnOtherDevices" = "Why can't I read all mails on different devices?"; "Receive" = "Receive"; "ReceiveError" = "An error occurred"; "ReceiveDamagedInfo" = "The cryptographic properties of this mail are broken. The content has be manipulated."; // Other reasons? @@ -137,15 +137,15 @@ "LastUpdate" = "Last Update"; "notVerified" = "Contact is not verified yet."; "noEncryption" = "Contact has never sent confidential mails."; -"otherEncryption" = "This is the insecure tray with this Contact"; //What about association???? +"otherEncryption" = "This is the insecure ID with this Contact"; //What about association???? "hasKeyButNoMail" = "Contact could send and receive confidential mails but never send confidential mails."; "Verified" = "Contact is verified"; //TODO other word for verified "verifyNow" = "Verify now"; -"toEncrypted" = "Switch to confidential and genuine tray"; +"toEncrypted" = "Switch to genuine ID"; "invite" = "Ask for confidential communication"; // Volker: ask??? "discardButton" = "Discard"; -"allMessages" = "All messages from this tray"; -"otherRecords" = "Other trays of this contact"; +"allMessages" = "All messages from this ID"; +"otherRecords" = "Other related IDs to address"; "connectedAddresses" = "Associated addresses"; "CC" = "To/CC"; "All" = "All"; @@ -176,8 +176,21 @@ "inviteSubject" = "Let's try to use confidential mail!"; "inviteText" = "Hey there!\n\nThere is this new App called Letterbox which makes it really easy to communicate confidentially over mail.\n\nI would love for you to try it!\n\nBest regards!"; //TODO CHANGE! "noName" = "NO NAME"; -"you" = "Your Tray"; -"thisIsYou" = "Your mails to yourself are collected here"; +"you" = "Your ID"; +"ContactView.ID.Explaination.youCrypto" = "This is your identity."; +"ContactView.ID.Explaination.youCryptoPrim" = "This is your primary identity."; +"ContactView.ID.Explaination.youCryptoOther" = "This is another cryptographic identity of you."; +"ContactView.ID.Explaination.youNoCrypto" = "This is a collection of claims. We do not know if since mails are truely from you."; +"ContactView.ID.Explaination.othersCrypto" = "This is an identity of others und all mails are from the same person."; +"ContactView.ID.Explaination.othersCryptoFirst" = "This is the first identity of the person and all mails are from this identity."; +"ContactView.ID.Explaination.othersCryptoOther" = "This is an other identity of the person."; +"ContactView.ID.Explaination.othersNoCrypto" = "This is a collection of claims. We do not know if since mails are truely from this person."; +"ContactView.KnownSince" = "Known since"; +"ContactView.KnownSince.Unknown" = "Unknown first appearance date"; +"ContactView.LastMail.Today" = "Last mail received today."; +"ContactView.LastMail.Ago" = "Last received mail %@ ago."; +"ContactView.LastMail.No" = "No mails received."; +"ContactView.OtherIDs.Insecure.Title" = "Insecure ID"; "didYouSendThis" = "Hey, did you send me this mail?\nI'm just asking because the mail is not confidentially and we communicated confidentially before.\n\n"; "reactButton" = "Request Confirmation"; "sendSecureIfPossible" = "Send confidentially if possible"; @@ -245,3 +258,10 @@ "SecretKeyCell.date" = "Known since "; "SecretKeyCell.origin" = "Imported using "; "SecretKeyCell.generated" = "Generated on this device."; +"Time.year.one" = "one year"; +"Time.year.multiple" = "%@ years"; +"Time.month.one" = "one month"; +"Time.month.multiple" = "%@ months"; +"Time.day.one" = "one day"; +"Time.day.multiple" = "%@ days"; +"Time.day.today" = "today";