diff --git a/enzevalos_iphone.xcodeproj/project.pbxproj b/enzevalos_iphone.xcodeproj/project.pbxproj index 96e0025e88dc91aa9ebaa0f90eae7a1f848c733a..d3afdb029c92e8e11262f34ffc2a7f11c44cc207 100644 --- a/enzevalos_iphone.xcodeproj/project.pbxproj +++ b/enzevalos_iphone.xcodeproj/project.pbxproj @@ -63,11 +63,14 @@ 477548DE21F5DABE000B22A8 /* MailServerConnectionError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 477548DD21F5DABE000B22A8 /* MailServerConnectionError.swift */; }; 477548E221F77466000B22A8 /* SecurityIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 477548E121F77466000B22A8 /* SecurityIndicator.swift */; }; 477548E421F77BA0000B22A8 /* StudyParameterProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 477548E321F77BA0000B22A8 /* StudyParameterProtocol.swift */; }; + 477670C4228453FB00043604 /* ButtonCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 477670C3228453FB00043604 /* ButtonCell.xib */; }; + 477670C6228454F700043604 /* ButtonCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 477670C5228454F700043604 /* ButtonCell.swift */; }; 478154A721FF3F0900A931EC /* Warning.swift in Sources */ = {isa = PBXBuildFile; fileRef = 478154A621FF3F0900A931EC /* Warning.swift */; }; 478154A921FF3FF400A931EC /* Invitation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 478154A821FF3FF400A931EC /* Invitation.swift */; }; 478154AC21FF6A9600A931EC /* Mailbot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 478154AB21FF6A9600A931EC /* Mailbot.swift */; }; 478154AE2200641900A931EC /* StudyTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 478154AD2200641900A931EC /* StudyTest.swift */; }; 478AF715222FD5C600AEF69E /* IncomingMail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 478AF714222FD5C600AEF69E /* IncomingMail.swift */; }; + 479011492289975D0057AB04 /* NoSecIconStyleKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 479011482289975C0057AB04 /* NoSecIconStyleKit.swift */; }; 479AFDA222571AB90063A332 /* EccAlice(777879D4)–Public.asc in Resources */ = {isa = PBXBuildFile; fileRef = 479AFDA122571AB90063A332 /* EccAlice(777879D4)–Public.asc */; }; 479B5977206914BE00B3944D /* CryptoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 479B5976206914BE00B3944D /* CryptoTests.swift */; }; 479B597820691BE400B3944D /* ObjectivePGP.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 47CEF4EC2052C3E600887CDB /* ObjectivePGP.framework */; }; @@ -85,6 +88,10 @@ 47CEF4EB2052C3C800887CDB /* ObjectivePGP.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 47CEF4EA2052C3C700887CDB /* ObjectivePGP.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 47CEF4ED2052C3E700887CDB /* ObjectivePGP.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 47CEF4EC2052C3E600887CDB /* ObjectivePGP.framework */; }; 47D1302B1F7CEE6D007B14DF /* DebugSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47D1302A1F7CEE6D007B14DF /* DebugSettings.swift */; }; + 47E7376E22845EC400972401 /* SecretKeyTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47E7376D22845EC400972401 /* SecretKeyTableViewController.swift */; }; + 47E7377022845F3A00972401 /* KeyViews.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 47E7376F22845F3A00972401 /* KeyViews.storyboard */; }; + 47E737742284610E00972401 /* KeyCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 47E737732284610E00972401 /* KeyCell.xib */; }; + 47E737762284632F00972401 /* KeyCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47E737752284632F00972401 /* KeyCell.swift */; }; 47E7BE5B22319B6900C8EF94 /* EncMailFromMac.eml in Resources */ = {isa = PBXBuildFile; fileRef = 47E7BE5A22319B6900C8EF94 /* EncMailFromMac.eml */; }; 47E7BE5D22319B7100C8EF94 /* SignedMailFromMac.eml in Resources */ = {isa = PBXBuildFile; fileRef = 47E7BE5C22319B7000C8EF94 /* SignedMailFromMac.eml */; }; 47E7BE5F22319B7D00C8EF94 /* SecureMailFromMac.eml in Resources */ = {isa = PBXBuildFile; fileRef = 47E7BE5E22319B7D00C8EF94 /* SecureMailFromMac.eml */; }; @@ -288,11 +295,14 @@ 477548DD21F5DABE000B22A8 /* MailServerConnectionError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MailServerConnectionError.swift; sourceTree = "<group>"; }; 477548E121F77466000B22A8 /* SecurityIndicator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecurityIndicator.swift; sourceTree = "<group>"; }; 477548E321F77BA0000B22A8 /* StudyParameterProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StudyParameterProtocol.swift; sourceTree = "<group>"; }; + 477670C3228453FB00043604 /* ButtonCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ButtonCell.xib; sourceTree = "<group>"; }; + 477670C5228454F700043604 /* ButtonCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonCell.swift; sourceTree = "<group>"; }; 478154A621FF3F0900A931EC /* Warning.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Warning.swift; sourceTree = "<group>"; }; 478154A821FF3FF400A931EC /* Invitation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Invitation.swift; sourceTree = "<group>"; }; 478154AB21FF6A9600A931EC /* Mailbot.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Mailbot.swift; sourceTree = "<group>"; }; 478154AD2200641900A931EC /* StudyTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StudyTest.swift; sourceTree = "<group>"; }; 478AF714222FD5C600AEF69E /* IncomingMail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = IncomingMail.swift; path = mail/IncomingMail.swift; sourceTree = "<group>"; }; + 479011482289975C0057AB04 /* NoSecIconStyleKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NoSecIconStyleKit.swift; sourceTree = "<group>"; }; 479AFDA122571AB90063A332 /* EccAlice(777879D4)–Public.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "EccAlice(777879D4)–Public.asc"; sourceTree = "<group>"; }; 479B5976206914BE00B3944D /* CryptoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CryptoTests.swift; sourceTree = "<group>"; }; 479C649521F2139B00A01071 /* support_pk.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = support_pk.asc; sourceTree = "<group>"; }; @@ -307,6 +317,10 @@ 47CEF4EA2052C3C700887CDB /* ObjectivePGP.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = ObjectivePGP.framework; sourceTree = "<group>"; }; 47CEF4EC2052C3E600887CDB /* ObjectivePGP.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ObjectivePGP.framework; path = ../enzevalos_iphone_workspace/ObjectivePGP.framework; sourceTree = "<group>"; }; 47D1302A1F7CEE6D007B14DF /* DebugSettings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DebugSettings.swift; sourceTree = "<group>"; }; + 47E7376D22845EC400972401 /* SecretKeyTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecretKeyTableViewController.swift; sourceTree = "<group>"; }; + 47E7376F22845F3A00972401 /* KeyViews.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = KeyViews.storyboard; sourceTree = "<group>"; }; + 47E737732284610E00972401 /* KeyCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KeyCell.xib; sourceTree = "<group>"; }; + 47E737752284632F00972401 /* KeyCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyCell.swift; sourceTree = "<group>"; }; 47E7BE5A22319B6900C8EF94 /* EncMailFromMac.eml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EncMailFromMac.eml; sourceTree = "<group>"; }; 47E7BE5C22319B7000C8EF94 /* SignedMailFromMac.eml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SignedMailFromMac.eml; sourceTree = "<group>"; }; 47E7BE5E22319B7D00C8EF94 /* SecureMailFromMac.eml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SecureMailFromMac.eml; sourceTree = "<group>"; }; @@ -615,6 +629,16 @@ path = "New Group"; sourceTree = "<group>"; }; + 4790114A228997620057AB04 /* StyleKits */ = { + isa = PBXGroup; + children = ( + 479011482289975C0057AB04 /* NoSecIconStyleKit.swift */, + F1984D711E1D327200804E1E /* IconsStyleKit.swift */, + F1984D731E1E92B300804E1E /* LabelStyleKit.swift */, + ); + path = StyleKits; + sourceTree = "<group>"; + }; 47B91AC01EC0C1CF000AE3EE /* coredata */ = { isa = PBXGroup; children = ( @@ -803,8 +827,7 @@ 476373C11E09BA88004D5EFE /* UserData.swift */, A198270D1D9A8ABC0027F65C /* enzevalos_iphone-Bridging-Header.h */, A1F9922B1DA7C9100073BF1B /* Main.storyboard */, - F1984D731E1E92B300804E1E /* LabelStyleKit.swift */, - F1984D711E1D327200804E1E /* IconsStyleKit.swift */, + 4790114A228997620057AB04 /* StyleKits */, A1123E6C1DA682850069551C /* Localizable.strings */, A13526841D955BDF00D3BFE1 /* LaunchScreen.storyboard */, A1EB05A31D956E32008659C1 /* Assets.xcassets */, @@ -950,6 +973,12 @@ isa = PBXGroup; children = ( A1D5076E1E80257A00B68B38 /* KeyViewController.swift */, + 477670C3228453FB00043604 /* ButtonCell.xib */, + 477670C5228454F700043604 /* ButtonCell.swift */, + 47E7376D22845EC400972401 /* SecretKeyTableViewController.swift */, + 47E7376F22845F3A00972401 /* KeyViews.storyboard */, + 47E737732284610E00972401 /* KeyCell.xib */, + 47E737752284632F00972401 /* KeyCell.swift */, ); name = keyView; sourceTree = "<group>"; @@ -1171,12 +1200,15 @@ files = ( A102AA8A1EDDB4F40024B457 /* videoOnboarding2.m4v in Resources */, A1F992391DA7DD2E0073BF1B /* InboxTableViewCell.xib in Resources */, + 47E737742284610E00972401 /* KeyCell.xib in Resources */, 47CD5AAD2012369400E771A1 /* support_pk2.asc in Resources */, A1EB058A1D956890008659C1 /* ContactCell.xib in Resources */, F1F070281FA0DF3F004A860A /* Inbox.storyboard in Resources */, 4761420A1E082F9C00FD5E4F /* Settings.bundle in Resources */, A16BA2121E0439B6005E29E3 /* providers.json in Resources */, F12D8DBB2069422A0068788E /* About.storyboard in Resources */, + 477670C4228453FB00043604 /* ButtonCell.xib in Resources */, + 47E7377022845F3A00972401 /* KeyViews.storyboard in Resources */, A1E5960E1FCC871F003791E9 /* researchteam.asc in Resources */, A1123E6A1DA682850069551C /* Localizable.strings in Resources */, A1F992291DA7C9100073BF1B /* Main.storyboard in Resources */, @@ -1377,6 +1409,7 @@ A114E4321FACB23000E40243 /* StringExtension.swift in Sources */, 472F398C1E2519C8009260FB /* CNContactExtension.swift in Sources */, F113C3851F30D06800E7F1D6 /* QRScannerView.swift in Sources */, + 477670C6228454F700043604 /* ButtonCell.swift in Sources */, F18B44601E704C550080C041 /* ReplaceSegue.swift in Sources */, 8428A8661F436A11007649A5 /* ArrowTableViewCell.swift in Sources */, F1ACF21C1E0C1C6800C1B843 /* ContactViewController.swift in Sources */, @@ -1430,6 +1463,7 @@ A182183421E51DD200918A29 /* IntroContactCell.swift in Sources */, 472F397C1E1D0B0B009260FB /* PersistentMail +CoreDataProperties.swift in Sources */, 8428A85C1F436A05007649A5 /* ArrowView.swift in Sources */, + 47E737762284632F00972401 /* KeyCell.swift in Sources */, A1EB05961D956939008659C1 /* InboxTableViewCell.swift in Sources */, 47F79240203492E3005E7DB6 /* KeyRecord+CoreDataClass.swift in Sources */, A1083A541E8BFEA6003666B7 /* Onboarding.swift in Sources */, @@ -1453,11 +1487,13 @@ A1EB05901D956923008659C1 /* ReadViewController.swift in Sources */, 472F398E1E251B8D009260FB /* MailAddress.swift in Sources */, A198D2292056B384004CC838 /* SendViewDelegate.swift in Sources */, + 479011492289975D0057AB04 /* NoSecIconStyleKit.swift in Sources */, F12060821DA552FC00F6EF37 /* MailHandlerDelegator.swift in Sources */, A12F91D821F3A99800AB0589 /* NSLayoutConstraintExtension.swift in Sources */, A18E7D771FBDE5D9002F7CC9 /* LoggingEventType.swift in Sources */, F1984D741E1E92B300804E1E /* LabelStyleKit.swift in Sources */, A1FA44A721E10E1400DB02AC /* TravelHandler.swift in Sources */, + 47E7376E22845EC400972401 /* SecretKeyTableViewController.swift in Sources */, 478154A721FF3F0900A931EC /* Warning.swift in Sources */, 8428A8681F436A11007649A5 /* SubBadgeTableViewCell.swift in Sources */, A1EB05861D956872008659C1 /* FrequentCell.swift in Sources */, diff --git a/enzevalos_iphone/Base.lproj/Main.storyboard b/enzevalos_iphone/Base.lproj/Main.storyboard index aa9d9444944a0dc2dab7d72dff390b22f69208d3..5549f216393e7e1fe364473a74503042b2898671 100644 --- a/enzevalos_iphone/Base.lproj/Main.storyboard +++ b/enzevalos_iphone/Base.lproj/Main.storyboard @@ -158,7 +158,7 @@ <rect key="frame" x="16" y="0.0" width="288" height="44"/> <subviews> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="I7i-jf-aSX"> - <rect key="frame" x="0.0" y="0.0" width="147" height="44"/> + <rect key="frame" x="0.0" y="5.5" width="147" height="33"/> <constraints> <constraint firstAttribute="height" constant="44" id="81H-Ed-3bH"/> </constraints> @@ -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="0.0" width="140" height="44"/> + <rect key="frame" x="148" y="5.5" width="140" height="33"/> <constraints> <constraint firstAttribute="height" constant="44" id="voC-CF-ncN"/> </constraints> @@ -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> @@ -1011,7 +1011,7 @@ <rect key="frame" x="0.0" y="545.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="294" height="43.5"/> + <rect key="frame" x="0.0" y="0.0" width="286" 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"> @@ -1111,18 +1111,9 @@ <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" flexibleMaxY="YES"/> <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/> - <button key="tableFooterView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="KaX-Vg-m5j"> - <rect key="frame" x="0.0" y="425.5" width="320" height="44"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> - <fontDescription key="fontDescription" name=".AppleSystemUIFont" family=".AppleSystemUIFont" pointSize="15"/> - <state key="normal" title="Copy Key"/> - <connections> - <action selector="copyKey:" destination="jYD-fk-aIP" eventType="primaryActionTriggered" id="dzD-Ik-KEZ"/> - </connections> - </button> <prototypes> <tableViewCell clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="KeyIDCell" textLabel="Z5E-3a-5Ef" detailTextLabel="Vun-jB-lcm" style="IBUITableViewCellStyleValue1" id="a8L-fv-t1M"> <rect key="frame" x="0.0" y="55.5" width="320" height="44"/> @@ -1268,10 +1259,25 @@ <autoresizingMask key="autoresizingMask"/> </tableViewCellContentView> </tableViewCell> + <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="CopyButtonCell" id="DEU-D7-xEg" userLabel="CopyButtonCell" customClass="ButtonCell" customModule="enzevalos_iphone" customModuleProvider="target"> + <rect key="frame" x="0.0" y="407.5" width="320" height="44"/> + <autoresizingMask key="autoresizingMask"/> + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="DEU-D7-xEg" id="hnv-Ix-6dI"> + <rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/> + <autoresizingMask key="autoresizingMask"/> + </tableViewCellContentView> + </tableViewCell> + <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="ChangeKeyCell" id="0lf-fY-Iuy" userLabel="ChangeKeyCell" customClass="ButtonCell" customModule="enzevalos_iphone" customModuleProvider="target"> + <rect key="frame" x="0.0" y="451.5" width="320" height="44"/> + <autoresizingMask key="autoresizingMask"/> + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="0lf-fY-Iuy" id="Nhq-ql-XcS"> + <rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/> + <autoresizingMask key="autoresizingMask"/> + </tableViewCellContentView> + </tableViewCell> </prototypes> </tableView> <connections> - <outlet property="copyButton" destination="KaX-Vg-m5j" id="bsa-2i-eWo"/> <outlet property="tableView" destination="ZAH-bZ-S6n" id="U5l-d5-Nz5"/> </connections> </viewController> @@ -1481,7 +1487,7 @@ Um deine sicheren E-Mails auch auf einem anderen Gerät lesen zu können, muss d <nil key="textColor"/> <nil key="highlightedColor"/> </label> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="3456-7890-1234-" textAlignment="center" lineBreakMode="characterWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QaR-WZ-20E"> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="3456-7890-1234-" textAlignment="center" lineBreakMode="characterWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QaR-WZ-20E"> <rect key="frame" x="85.5" y="173.5" width="153" height="17.5"/> <fontDescription key="fontDescription" type="boldSystem" pointSize="17"/> <nil key="textColor"/> @@ -1854,15 +1860,9 @@ Um deine sicheren E-Mails auch auf einem anderen Gerät lesen zu können, muss d </scene> </scenes> <inferredMetricsTieBreakers> -<!--<<<<<<< HEAD--> - <segue reference="hd4-SZ-DZ0"/> - <segue reference="hSn-Um-hji"/> + <segue reference="3Wb-uL-BB5"/> + <segue reference="td8-VW-Wrt"/> <segue reference="DcR-GX-scc"/> -<!--=======--> - <segue reference="rhW-cI-4c4"/> - <segue reference="hSn-Um-hji"/> - <segue reference="btx-4o-o0r"/> -<!-->>>>>>> master--> <segue reference="TgN-rB-esa"/> <segue reference="ecN-Wn-7S0"/> </inferredMetricsTieBreakers> diff --git a/enzevalos_iphone/ButtonCell.swift b/enzevalos_iphone/ButtonCell.swift new file mode 100644 index 0000000000000000000000000000000000000000..40bba834c6559f5b58b2b0945e884a226d8ce39b --- /dev/null +++ b/enzevalos_iphone/ButtonCell.swift @@ -0,0 +1,26 @@ +// +// ButtonCell.swift +// enzevalos_iphone +// +// Created by Oliver Wiese on 09.05.19. +// Copyright © 2019 fu-berlin. All rights reserved. +// + +import Foundation + +class ButtonCell: UITableViewCell { + @IBOutlet weak var button: UIButton! + var listener: ButtonCellHandler? + var id = 0 + + @IBAction func touchDown(_ sender: UIButton) { + if let l = listener { + l.touchDown(id: id) + } + } +} + + +protocol ButtonCellHandler { + func touchDown(id: Int) +} diff --git a/enzevalos_iphone/ButtonCell.xib b/enzevalos_iphone/ButtonCell.xib new file mode 100644 index 0000000000000000000000000000000000000000..a08526fbe18da64891847d42c7f428ff8b11dcf8 --- /dev/null +++ b/enzevalos_iphone/ButtonCell.xib @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> + <device id="retina4_7" orientation="portrait"> + <adaptation id="fullscreen"/> + </device> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/> + <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" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" id="sQS-Z3-iQw" customClass="ButtonCell" 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" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="sQS-Z3-iQw" id="AZc-cU-0wb" userLabel="ContentView"> + <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/> + <autoresizingMask key="autoresizingMask"/> + <subviews> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6rJ-hZ-bvC"> + <rect key="frame" x="0.0" y="0.0" width="375" height="44"/> + <state key="normal" title="Button"/> + <connections> + <action selector="touchDown:" destination="sQS-Z3-iQw" eventType="touchDown" id="REz-2d-96j"/> + </connections> + </button> + </subviews> + <constraints> + <constraint firstItem="6rJ-hZ-bvC" firstAttribute="centerX" secondItem="AZc-cU-0wb" secondAttribute="centerX" id="284-Nb-T8z"/> + <constraint firstItem="6rJ-hZ-bvC" firstAttribute="height" secondItem="AZc-cU-0wb" secondAttribute="height" id="MXG-hL-dmK"/> + <constraint firstItem="6rJ-hZ-bvC" firstAttribute="centerY" secondItem="AZc-cU-0wb" secondAttribute="centerY" id="sn5-uN-8cd"/> + <constraint firstItem="6rJ-hZ-bvC" firstAttribute="width" secondItem="AZc-cU-0wb" secondAttribute="width" id="yy0-dt-xml"/> + </constraints> + </tableViewCellContentView> + <connections> + <outlet property="button" destination="6rJ-hZ-bvC" id="d7K-Sw-tEf"/> + </connections> + <point key="canvasLocation" x="133.59999999999999" y="154.72263868065968"/> + </tableViewCell> + </objects> +</document> diff --git a/enzevalos_iphone/DataHandler.swift b/enzevalos_iphone/DataHandler.swift index d6d6b4e41541ec8d4a99a9a683af91e77bd53f06..40310396723312aa9ffbdbc9ed79d9cdb9ce1c42 100644 --- a/enzevalos_iphone/DataHandler.swift +++ b/enzevalos_iphone/DataHandler.swift @@ -458,6 +458,10 @@ class DataHandler { } return createNewSecretKey(adr: "") } + + func changePrefKey(newPrefKey: SecretKey) { + UserManager.storeUserValue(newPrefKey.keyID as AnyObject, attribute: Attribute.prefSecretKeyID) + } func findSecretKeys() -> [SecretKey] { if let result = findAll("SecretKey") { diff --git a/enzevalos_iphone/KeyCell.swift b/enzevalos_iphone/KeyCell.swift new file mode 100644 index 0000000000000000000000000000000000000000..82e10b61ddcb569143f106db45cc215419a0ea9f --- /dev/null +++ b/enzevalos_iphone/KeyCell.swift @@ -0,0 +1,23 @@ +// +// KeyCell.swift +// enzevalos_iphone +// +// Created by Oliver Wiese on 09.05.19. +// Copyright © 2019 fu-berlin. All rights reserved. +// + +import Foundation + +class KeyCell: UITableViewCell { + @IBOutlet weak var idLabel: UILabel! + @IBOutlet weak var originLabel: UILabel! + @IBOutlet weak var dateLabel: UILabel! + @IBOutlet weak var prefIcon: UIImageView! + @IBOutlet weak var orignName: UILabel! + @IBOutlet weak var dateName: UILabel! + + + + + +} diff --git a/enzevalos_iphone/KeyCell.xib b/enzevalos_iphone/KeyCell.xib new file mode 100644 index 0000000000000000000000000000000000000000..2420ba39656ea61c047737e70360dda6a87111cf --- /dev/null +++ b/enzevalos_iphone/KeyCell.xib @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> + <device id="retina4_7" orientation="portrait"> + <adaptation id="fullscreen"/> + </device> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/> + <capability name="Safe area layout guides" minToolsVersion="9.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" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" rowHeight="148" id="wRd-M0-fdb" customClass="KeyCell" customModule="enzevalos_iphone" customModuleProvider="target"> + <rect key="frame" x="0.0" y="0.0" width="406" height="148"/> + <autoresizingMask key="autoresizingMask"/> + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="wRd-M0-fdb" id="Emm-NH-1K1"> + <rect key="frame" x="0.0" y="0.0" width="406" height="147.5"/> + <autoresizingMask key="autoresizingMask"/> + <subviews> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" misplaced="YES" text="ID" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1WN-Xm-ow9"> + <rect key="frame" x="20" y="17" width="259" height="51"/> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <nil key="textColor"/> + <nil key="highlightedColor"/> + </label> + <imageView hidden="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" insetsLayoutMarginsFromSafeArea="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vo5-ax-qtB"> + <rect key="frame" x="305" y="37" width="80" height="80"/> + <constraints> + <constraint firstAttribute="width" secondItem="vo5-ax-qtB" secondAttribute="height" multiplier="1:1" id="lxE-e0-5DU"/> + </constraints> + </imageView> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="known since" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LBs-As-DEo"> + <rect key="frame" x="20" y="63" width="75" height="16"/> + <fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/> + <nil key="textColor"/> + <nil key="highlightedColor"/> + </label> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="origin:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="z7A-kG-Hmf"> + <rect key="frame" x="20" y="79" width="38" height="16"/> + <fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/> + <nil key="textColor"/> + <nil key="highlightedColor"/> + </label> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="yesterday" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QMx-FE-uVs"> + <rect key="frame" x="105" y="63" width="59.5" height="16"/> + <fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/> + <nil key="textColor"/> + <nil key="highlightedColor"/> + </label> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="iTunes import" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="n9T-OX-sTx"> + <rect key="frame" x="68" y="79" width="83" height="16"/> + <fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/> + <nil key="textColor"/> + <nil key="highlightedColor"/> + </label> + </subviews> + <constraints> + <constraint firstItem="1WN-Xm-ow9" firstAttribute="width" secondItem="Emm-NH-1K1" secondAttribute="width" id="A9A-XA-qVq"/> + <constraint firstItem="1WN-Xm-ow9" firstAttribute="top" secondItem="lA0-Xm-beh" secondAttribute="top" constant="10" id="AkA-nz-1cY"/> + <constraint firstItem="n9T-OX-sTx" firstAttribute="leading" secondItem="z7A-kG-Hmf" secondAttribute="trailing" constant="10" id="BG2-Vl-rvF"/> + <constraint firstItem="1WN-Xm-ow9" firstAttribute="leading" secondItem="Emm-NH-1K1" secondAttribute="leading" constant="20" id="CKO-wk-Szk"/> + <constraint firstItem="z7A-kG-Hmf" firstAttribute="leading" secondItem="Emm-NH-1K1" secondAttribute="leading" constant="20" id="D5n-Vf-TMR"/> + <constraint firstItem="lA0-Xm-beh" firstAttribute="trailing" secondItem="vo5-ax-qtB" secondAttribute="trailing" constant="20" id="Fml-F6-GtS"/> + <constraint firstItem="LBs-As-DEo" firstAttribute="leading" secondItem="Emm-NH-1K1" secondAttribute="leading" constant="20" id="Qdx-37-iHt"/> + <constraint firstItem="z7A-kG-Hmf" firstAttribute="firstBaseline" secondItem="LBs-As-DEo" secondAttribute="baseline" constant="16" symbolType="layoutAnchor" id="Vn3-iv-9rd"/> + <constraint firstItem="lA0-Xm-beh" firstAttribute="bottom" secondItem="z7A-kG-Hmf" secondAttribute="bottom" constant="10" id="Wgb-NL-oZY"/> + <constraint firstItem="QMx-FE-uVs" firstAttribute="centerY" secondItem="LBs-As-DEo" secondAttribute="centerY" id="b7W-wn-XxQ"/> + <constraint firstItem="LBs-As-DEo" firstAttribute="firstBaseline" secondItem="1WN-Xm-ow9" secondAttribute="baseline" constant="20" symbolType="layoutAnchor" id="hse-xA-Xhf"/> + <constraint firstItem="vo5-ax-qtB" firstAttribute="centerY" secondItem="lA0-Xm-beh" secondAttribute="centerY" id="qmq-gD-8Cp"/> + <constraint firstItem="n9T-OX-sTx" firstAttribute="centerY" secondItem="z7A-kG-Hmf" secondAttribute="centerY" id="seT-Da-i22"/> + <constraint firstItem="QMx-FE-uVs" firstAttribute="leading" secondItem="LBs-As-DEo" secondAttribute="trailing" constant="10" id="zR3-OB-U9G"/> + </constraints> + <viewLayoutGuide key="safeArea" id="lA0-Xm-beh"/> + </tableViewCellContentView> + <connections> + <outlet property="dateLabel" destination="QMx-FE-uVs" id="7Qh-1w-o7v"/> + <outlet property="dateName" destination="LBs-As-DEo" id="aDY-hl-8AS"/> + <outlet property="idLabel" destination="1WN-Xm-ow9" id="9ug-Yf-pyT"/> + <outlet property="originLabel" destination="n9T-OX-sTx" id="xki-TX-CL7"/> + <outlet property="orignName" destination="z7A-kG-Hmf" id="ZM1-jZ-ura"/> + <outlet property="prefIcon" destination="vo5-ax-qtB" id="NVe-Hh-iZP"/> + </connections> + <point key="canvasLocation" x="121.59999999999999" y="-107.0464767616192"/> + </tableViewCell> + </objects> +</document> diff --git a/enzevalos_iphone/KeyViewController.swift b/enzevalos_iphone/KeyViewController.swift index 3efb3f5f62e5a85b261b4b78fdbd1196c70b0611..891c6adfe4542d92360740e66b328705d3495d49 100644 --- a/enzevalos_iphone/KeyViewController.swift +++ b/enzevalos_iphone/KeyViewController.swift @@ -23,7 +23,6 @@ import UIKit class KeyViewController: UIViewController { @IBOutlet var tableView: UITableView! - @IBOutlet weak var copyButton: UIButton! var openDate: Date = Date() //used for logging issues [see Logger.log(keyViewClose keyID:String, timevisited: Date)] @@ -31,31 +30,12 @@ class KeyViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() tableView.dataSource = self - tableView.delegate = self tableView.rowHeight = UITableView.automaticDimension tableView.estimatedRowHeight = 100 openDate = Date() -// Logger.queue.async(flags: .barrier) { if let record = self.record, let keyID = record.keyID { Logger.log(keyViewOpen: keyID) } -// } - copyButton.setTitle(NSLocalizedString("copyKey", comment: ""), for: .normal) - copyButton.setTitle(NSLocalizedString("copied", comment: "the key has been copied to the clipboard"), for: .disabled) - } - - @IBAction func copyKey(_ sender: AnyObject) { - guard let record = record, let keyId = record.keyID else { - return - } - - let swiftpgp = SwiftPGP() - if let key = swiftpgp.exportKey(id: keyId, isSecretkey: false, autocrypt: false) { - UIPasteboard.general.string = key - copyButton.isEnabled = false - } else { - print("Error while getting key") - } } override func viewDidDisappear(_ animated: Bool) { @@ -83,6 +63,11 @@ extension KeyViewController: UITableViewDataSource { } return 0 } + if toSectionType(section) == .keyActions { + if let isUser = record?.isUser, isUser { //TODO: Change to prefKey???? + return 2 + } + } return 1 } @@ -166,6 +151,30 @@ extension KeyViewController: UITableViewDataSource { cell.textLabel?.text = record?.addressNames[indexPath.row] return cell } + else if toSectionType(indexPath.section) == .keyActions { + var cell: ButtonCell + if let tmpCell = tableView.dequeueReusableCell(withIdentifier: "ButtonCell") as? ButtonCell{ + cell = tmpCell + } else { + tableView.register(UINib.init(nibName: "ButtonCell", bundle: nil), forCellReuseIdentifier: "ButtonCell") + cell = tableView.dequeueReusableCell(withIdentifier: "ButtonCell") as! ButtonCell + } + if indexPath.row == 0 { + // Copy button + cell.button.setTitle("Copy key to clipboard", for: UIControl.State()) + cell.id = KeyActions.Copy.hashValue + cell.listener = self + //TODO OLLI copyButton.setTitle(NSLocalizedString("copyKey", comment: ""), for: .normal) + //copyButton.setTitle(NSLocalizedString("copied", comment: "the key has been copied to the clipboard"), for: .disabled) + } + else if indexPath.row == 1 { + // Change key + cell.button.setTitle("Change prefered key", for: UIControl.State()) + cell.id = KeyActions.Change.hashValue + cell.listener = self + } + return cell + } let cell = tableView.dequeueReusableCell(withIdentifier: "VerifiedCell")! cell.textLabel?.text = NSLocalizedString("KeyNotFound", comment: "there was no key found. Contact developers") @@ -181,7 +190,7 @@ extension KeyViewController: UITableViewDataSource { func numberOfSections(in tableView: UITableView) -> Int { if let key = record?.activeKey { - var sections = 1 + var sections = 2 if key.mailaddresses != nil { sections += 1 } @@ -216,11 +225,16 @@ extension KeyViewController: UITableViewDataSource { func toSectionType(_ sectionNumber: Int) -> KeyViewSectionType { var returnValue: KeyViewSectionType = .noKey - if record?.activeKey != nil { - returnValue = .keyDetails//.KeyID + if let record = record, record.activeKey != nil { + returnValue = .keyDetails //addresses if sectionNumber != 0 { - returnValue = .addresses + returnValue = .keyActions + if sectionNumber == 1 { + if record.addresses.count > 0 { + returnValue = .addresses + } + } } } return returnValue @@ -270,14 +284,42 @@ extension KeyViewController: UITableViewDataSource { } } -extension KeyViewController: UITableViewDelegate { - +extension KeyViewController: ButtonCellHandler { + func touchDown(id: Int) { + if id == KeyActions.Copy.hashValue { + // copy key + guard let record = record, let keyId = record.keyID else { + return + } + + let swiftpgp = SwiftPGP() + if let key = swiftpgp.exportKey(id: keyId, isSecretkey: false, autocrypt: false) { + UIPasteboard.general.string = key + //TODO copyButton.isEnabled = false + } else { + print("Error while getting key") + } + } + else if id == KeyActions.Change.hashValue { + if let secretKeyCon = SecretKeyTableViewController.storyboardInstance() { + self.navigationController?.pushViewController(secretKeyCon, animated: true) + } + else { + // disable button + } + } + } + + } - enum KeyViewSectionType: Int { - case noKey = 0, keyDetails, addresses + case noKey = 0, keyDetails, addresses, keyActions } enum KeyViewRowType: Int { case noKey = 0, keyID, fingerprint, encryptionType, discoveryTime, discoveryMail, verified, revoked } + +enum KeyActions { + case Copy, Change +} diff --git a/enzevalos_iphone/KeyViews.storyboard b/enzevalos_iphone/KeyViews.storyboard new file mode 100644 index 0000000000000000000000000000000000000000..d79070c65596a14e58770ea810b183a17ad36066 --- /dev/null +++ b/enzevalos_iphone/KeyViews.storyboard @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> + <device id="retina4_7" orientation="portrait"> + <adaptation id="fullscreen"/> + </device> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> + </dependencies> + <scenes> + <!--Secret Key Table View Controller--> + <scene sceneID="lfw-yl-FFA"> + <objects> + <tableViewController storyboardIdentifier="secretKeyTable" useStoryboardIdentifierAsRestorationIdentifier="YES" id="fU6-5r-oyh" customClass="SecretKeyTableViewController" customModule="enzevalos_iphone" customModuleProvider="target" sceneMemberID="viewController"> + <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="svb-Mv-YOF"> + <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="custom" customColorSpace="genericGamma22GrayColorSpace"/> + <prototypes> + <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" id="Lv2-vZ-5BE"> + <rect key="frame" x="0.0" y="28" width="375" height="44"/> + <autoresizingMask key="autoresizingMask"/> + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Lv2-vZ-5BE" id="DAm-kl-UmH"> + <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/> + <autoresizingMask key="autoresizingMask"/> + </tableViewCellContentView> + </tableViewCell> + </prototypes> + <connections> + <outlet property="dataSource" destination="fU6-5r-oyh" id="2Gn-mS-0Sh"/> + <outlet property="delegate" destination="fU6-5r-oyh" id="65L-kD-eMs"/> + </connections> + </tableView> + </tableViewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="dc5-2h-hzE" userLabel="First Responder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="-609" y="-361"/> + </scene> + </scenes> +</document> diff --git a/enzevalos_iphone/SecretKeyTableViewController.swift b/enzevalos_iphone/SecretKeyTableViewController.swift new file mode 100644 index 0000000000000000000000000000000000000000..73c06182aebe87b65de3b6083884a2169c451e18 --- /dev/null +++ b/enzevalos_iphone/SecretKeyTableViewController.swift @@ -0,0 +1,142 @@ +// +// SecretKeyTableViewController.swift +// enzevalos_iphone +// +// Created by Oliver Wiese on 09.05.19. +// Copyright © 2019 fu-berlin. All rights reserved. +// + +import Foundation + +class SecretKeyTableViewController: UITableViewController { + static let storyboardID = "secretKeyTable" + + var keys: [SecretKey] = [] + private var prefKeyID: String? { + get { + return DataHandler.handler.prefSecretKey()?.keyID + } + } + var currentPrefKeyRow = IndexPath() + var secretKeyPasswordField: UITextField? = nil + + + static func storyboardInstance() -> SecretKeyTableViewController? { + let storyboard = UIStoryboard(name: "KeyViews", bundle: nil) + if let controller = storyboard.instantiateViewController(withIdentifier: storyboardID) as? SecretKeyTableViewController { + return controller + } + return nil + } + + override func viewDidLoad() { + keys = DataHandler.handler.findSecretKeys() + // Load keys from Itunes + self.title = NSLocalizedString("SecretKeyTable.title", comment: "Title of secret key table") + } + + override func numberOfSections(in tableView: UITableView) -> Int { + return 1 + } + + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return keys.count + } + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + var cell: KeyCell + + if let tmpCell = tableView.dequeueReusableCell(withIdentifier: "KeyCell") as? KeyCell { + cell = tmpCell + } else { + tableView.register(UINib.init(nibName: "KeyCell", bundle: nil), forCellReuseIdentifier: "KeyCell") + cell = tableView.dequeueReusableCell(withIdentifier: "KeyCell") as! KeyCell + } + let item = keys[indexPath.row] + cell.idLabel.text = item.keyID + cell.dateLabel.text = item.importedDate?.description + cell.dateName.text = NSLocalizedString("SecretKeyCell.date", comment: "date") + cell.originLabel.isHidden = true + cell.orignName.text = NSLocalizedString("SecretKeyCell.origin", comment: "origin") + cell.orignName.isHidden = true + if let prefID = prefKeyID, prefID == item.keyID { + currentPrefKeyRow = indexPath + cell.prefIcon.image = NoSecIconStyleKit.imageOfFavorite + cell.prefIcon.isHidden = false + } + return cell + } + + + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + guard tableView.numberOfRows(inSection: indexPath.section) >= 2 else { + // Only one key -> we can not change the prefered key. + tableView.reloadRows(at: [indexPath], with: .none) + return + } + let newPrefKey = keys[indexPath.row] + let pgp = SwiftPGP.init() + if let id = newPrefKey.keyID { + if pgp.checkPasswordFor(secretKeyID: id) { + changePrefKey(tableView: tableView, indexPath: indexPath) + } + else { + // PW input. + inputPassword(first: true, pgp: pgp, id: id, indexPath: indexPath, tableView: tableView) + return + } + } + } + + private func changePrefKey(tableView: UITableView, indexPath: IndexPath) { + let newPrefKey = keys[indexPath.row] + var reloadCells = [IndexPath]() + DataHandler.handler.changePrefKey(newPrefKey: newPrefKey) + if let oldPrefCell = tableView.cellForRow(at: currentPrefKeyRow) as? KeyCell { + oldPrefCell.prefIcon.isHidden = true + oldPrefCell.prefIcon.image = nil + reloadCells.append(currentPrefKeyRow) + } + if let newPrefCell = tableView.cellForRow(at: indexPath) as? KeyCell { + newPrefCell.prefIcon.image = NoSecIconStyleKit.imageOfFavorite + newPrefCell.isHidden = false + reloadCells.append(indexPath) + } + tableView.reloadRows(at: reloadCells, with: .automatic) + } + + private func stopChangePrefKey(tableView: UITableView, indexPath: IndexPath) { + tableView.reloadRows(at: [indexPath], with: .automatic) + } + + + + private func inputPassword(first: Bool, pgp: SwiftPGP, id: String, indexPath: IndexPath, tableView: UITableView) { + var message = String(format: NSLocalizedString("Read.Import.Secret.Body.PW", comment: "NewSecretKeyMessage"), id) + if !first { + message = NSLocalizedString("Read.Import.Secret.Body.Wrong", comment: "NewSecretKeyMessage") + } + let alert = UIAlertController(title: NSLocalizedString("Read.Import.Secret.Title", comment: "NewSecretKeyTitle"), message: message, preferredStyle: UIAlertController.Style.alert) + alert.addAction(UIAlertAction(title: NSLocalizedString("Cancel", comment: "NoSecretKeyImport"), style: UIAlertAction.Style.destructive, handler: { (_: UIAlertAction) -> Void in + return self.stopChangePrefKey(tableView: tableView, indexPath: indexPath) + })) + + alert.addAction(UIAlertAction(title: NSLocalizedString("Read.Import.Secret.Ok", comment: "Import secret Key"), style: UIAlertAction.Style.default, handler: {(_:UIAlertAction) -> Void in + if let pw = self.secretKeyPasswordField?.text, pgp.checkPasswordFor(secretKeyID: id, password: pw) { + self.changePrefKey(tableView: tableView, indexPath: indexPath) + } + else { + self.inputPassword(first: false, pgp: pgp, id: id, indexPath: indexPath, tableView: tableView) + } + })) + alert.addTextField(configurationHandler: newSecretkeyPassword(textField:)) + self.present(alert, animated: true, completion: nil) + } + + private func newSecretkeyPassword(textField: UITextField!) { + if let tField = textField { + tField.isSecureTextEntry = true + secretKeyPasswordField = tField + } + } +} diff --git a/enzevalos_iphone/IconsStyleKit.swift b/enzevalos_iphone/StyleKits/IconsStyleKit.swift similarity index 100% rename from enzevalos_iphone/IconsStyleKit.swift rename to enzevalos_iphone/StyleKits/IconsStyleKit.swift diff --git a/enzevalos_iphone/LabelStyleKit.swift b/enzevalos_iphone/StyleKits/LabelStyleKit.swift similarity index 100% rename from enzevalos_iphone/LabelStyleKit.swift rename to enzevalos_iphone/StyleKits/LabelStyleKit.swift diff --git a/enzevalos_iphone/StyleKits/NoSecIconStyleKit.swift b/enzevalos_iphone/StyleKits/NoSecIconStyleKit.swift new file mode 100644 index 0000000000000000000000000000000000000000..7d619c34b7ff315c46b8a28eca439d3f8567ca3e --- /dev/null +++ b/enzevalos_iphone/StyleKits/NoSecIconStyleKit.swift @@ -0,0 +1,127 @@ +// +// NoSecIconStyleKit.swift +// ProjectName +// +// Created by Oliver Wiese on 13.05.19. +// Copyright © 2019 FU Berlin. All rights reserved. +// +// Generated by PaintCode +// http://www.paintcodeapp.com +// + + + +import UIKit + +public class NoSecIconStyleKit : NSObject { + + //// Cache + + private struct Cache { + static var imageOfFavorite: UIImage? + static var favoriteTargets: [AnyObject]? + } + + //// Drawing Methods + + @objc dynamic public class func drawFavorite(frame targetFrame: CGRect = CGRect(x: 0, y: 0, width: 19, height: 19), resizing: ResizingBehavior = .aspectFit) { + //// General Declarations + let context = UIGraphicsGetCurrentContext()! + + //// Resize to Target Frame + context.saveGState() + let resizedFrame: CGRect = resizing.apply(rect: CGRect(x: 0, y: 0, width: 19, height: 19), target: targetFrame) + context.translateBy(x: resizedFrame.minX, y: resizedFrame.minY) + context.scaleBy(x: resizedFrame.width / 19, y: resizedFrame.height / 19) + + + //// Star Drawing + let starPath = UIBezierPath() + starPath.move(to: CGPoint(x: 10, y: 0.5)) + starPath.addLine(to: CGPoint(x: 11.74, y: 7.42)) + starPath.addLine(to: CGPoint(x: 19.04, y: 6.89)) + starPath.addLine(to: CGPoint(x: 12.82, y: 10.64)) + starPath.addLine(to: CGPoint(x: 15.58, y: 17.23)) + starPath.addLine(to: CGPoint(x: 10, y: 12.64)) + starPath.addLine(to: CGPoint(x: 4.42, y: 17.23)) + starPath.addLine(to: CGPoint(x: 7.18, y: 10.64)) + starPath.addLine(to: CGPoint(x: 0.96, y: 6.89)) + starPath.addLine(to: CGPoint(x: 8.26, y: 7.42)) + starPath.close() + UIColor.black.setFill() + starPath.fill() + + context.restoreGState() + + } + + //// Generated Images + + @objc dynamic public class var imageOfFavorite: UIImage { + if Cache.imageOfFavorite != nil { + return Cache.imageOfFavorite! + } + + UIGraphicsBeginImageContextWithOptions(CGSize(width: 19, height: 19), false, 0) + NoSecIconStyleKit.drawFavorite() + + Cache.imageOfFavorite = UIGraphicsGetImageFromCurrentImageContext()!.resizableImage(withCapInsets: UIEdgeInsets(top: 9, left: 6, bottom: 9, right: 2), resizingMode: .stretch) + UIGraphicsEndImageContext() + + return Cache.imageOfFavorite! + } + + //// Customization Infrastructure + + @objc @IBOutlet dynamic var favoriteTargets: [AnyObject]! { + get { return Cache.favoriteTargets } + set { + Cache.favoriteTargets = newValue + for target: AnyObject in newValue { + let _ = target.perform(NSSelectorFromString("setImage:"), with: NoSecIconStyleKit.imageOfFavorite) + } + } + } + + + + + @objc(NoSecIconStyleKitResizingBehavior) + public enum ResizingBehavior: Int { + case aspectFit /// The content is proportionally resized to fit into the target rectangle. + case aspectFill /// The content is proportionally resized to completely fill the target rectangle. + case stretch /// The content is stretched to match the entire target rectangle. + case center /// The content is centered in the target rectangle, but it is NOT resized. + + public func apply(rect: CGRect, target: CGRect) -> CGRect { + if rect == target || target == CGRect.zero { + return rect + } + + var scales = CGSize.zero + scales.width = abs(target.width / rect.width) + scales.height = abs(target.height / rect.height) + + switch self { + case .aspectFit: + scales.width = min(scales.width, scales.height) + scales.height = scales.width + case .aspectFill: + scales.width = max(scales.width, scales.height) + scales.height = scales.width + case .stretch: + break + case .center: + scales.width = 1 + scales.height = 1 + } + + var result = rect.standardized + result.size.width *= scales.width + result.size.height *= scales.height + result.origin.x = target.minX + (target.width - result.width) / 2 + result.origin.y = target.minY + (target.height - result.height) / 2 + return result + } + } +} diff --git a/enzevalos_iphone/SwiftPGP.swift b/enzevalos_iphone/SwiftPGP.swift index f9e9add1b6a52d41ef63063a97ea1e212c5a1e6d..6fb98af0e8ba1190ba00dcd00bbfed772e61aea8 100644 --- a/enzevalos_iphone/SwiftPGP.swift +++ b/enzevalos_iphone/SwiftPGP.swift @@ -680,6 +680,19 @@ class SwiftPGP: Encryption { } return [] } + func checkPasswordFor(secretKeyID: String?, password: String? = nil) -> Bool { + guard let id = secretKeyID, let key = loadKey(id: id) else { + return false + } + if let pw = password { + pwKeyChain[key.keyID.longIdentifier] = pw + } + + if let data = Data.init(base64Encoded: "Test"), let _ = try? ObjectivePGP.sign(data, detached: true, using: [key], passphraseForKey: loadPassword) { + return true + } + return false + } /* encrypt a array of strings with one password. Returns encrypted strings and the password for decryption */ diff --git a/enzevalos_iphone/de.lproj/Localizable.strings b/enzevalos_iphone/de.lproj/Localizable.strings index f45dcc0c7cd1c8c99d2cf6740c58c9c25a2e14c4..e081f6ccada08f85c12831c72b517a107a22fa19 100644 --- a/enzevalos_iphone/de.lproj/Localizable.strings +++ b/enzevalos_iphone/de.lproj/Localizable.strings @@ -271,3 +271,7 @@ "Read.Import.Secret.No" = "Kein Import"; "Read.Import.Secret.Ok" = "Ok"; "Read.Import.Secret.Body.Wrong" = "Falsches Passwort! Bitte gib das Passwort um das neue Geheimnis zu importieren erneut ein."; +"SecretKeyTable.title" = "Deine geheimen Schlüssel"; +"SecretKeyCell.date" = "Bekannt seit "; +"SecretKeyCell.origin" = "Impotiert aus "; +"SecretKeyCell.generated" = "Auf diesem Gerät erzeugt."; diff --git a/enzevalos_iphone/en.lproj/Localizable.strings b/enzevalos_iphone/en.lproj/Localizable.strings index 8d732c1838f4e3501441a633ee0571fc0ed94520..c6860553b27f54715edb5b5b3ef58680ca0a075b 100644 --- a/enzevalos_iphone/en.lproj/Localizable.strings +++ b/enzevalos_iphone/en.lproj/Localizable.strings @@ -241,3 +241,7 @@ "Read.Import.Secret.No" = "No import"; "Read.Import.Secret.Ok" = "Ok"; "Read.Import.Secret.Body.Wrong" = "Wrong password! Please, enter the password to import the new secret again."; +"SecretKeyTable.title" = "Your secret keys"; +"SecretKeyCell.date" = "Known since "; +"SecretKeyCell.origin" = "Imported using "; +"SecretKeyCell.generated" = "Generated on this device.";