Added Storyboard Composer UI
authoryves <yves@pep-project.org>
Thu, 08 Dec 2016 16:42:07 +0100
changeset 1278c3bc82cbfbe3
parent 1277 a40b665b3f35
child 1279 c86f1628ba1e
Added Storyboard Composer UI
pEp.entitlements
pEpForiOS.xcodeproj/project.pbxproj
pEpForiOS/Base.lproj/Main.storyboard
pEpForiOS/UI/Compose/ComposeTableViewController.swift
pEpForiOS/UI/EmailDisplay/EmailListViewController.swift
     1.1 --- a/pEp.entitlements	Fri Dec 09 09:43:28 2016 +0100
     1.2 +++ b/pEp.entitlements	Thu Dec 08 16:42:07 2016 +0100
     1.3 @@ -2,6 +2,10 @@
     1.4  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
     1.5  <plist version="1.0">
     1.6  <dict>
     1.7 +	<key>com.apple.developer.icloud-container-identifiers</key>
     1.8 +	<array/>
     1.9 +	<key>com.apple.developer.ubiquity-kvstore-identifier</key>
    1.10 +	<string>$(TeamIdentifierPrefix)$(CFBundleIdentifier)</string>
    1.11  	<key>keychain-access-groups</key>
    1.12  	<array>
    1.13  		<string>$(AppIdentifierPrefix)net.pep-security.apps.pEpAlpha</string>
     2.1 --- a/pEpForiOS.xcodeproj/project.pbxproj	Fri Dec 09 09:43:28 2016 +0100
     2.2 +++ b/pEpForiOS.xcodeproj/project.pbxproj	Thu Dec 08 16:42:07 2016 +0100
     2.3 @@ -22,6 +22,7 @@
     2.4  		222B357E1DF97675007A1F82 /* SuggestTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 222B357D1DF97675007A1F82 /* SuggestTableView.swift */; };
     2.5  		222B35831DF97A44007A1F82 /* ComposeData.plist in Resources */ = {isa = PBXBuildFile; fileRef = 222B35811DF97A44007A1F82 /* ComposeData.plist */; };
     2.6  		222B35861DF97A44007A1F82 /* ComposeDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 222B35821DF97A44007A1F82 /* ComposeDataSource.swift */; };
     2.7 +		222B358A1DF99C48007A1F82 /* Actionsheet+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 222B35891DF99C48007A1F82 /* Actionsheet+Extension.swift */; };
     2.8  		228038681DC9DE6D00F1CB45 /* TextfieldResponder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 228038671DC9DE6D00F1CB45 /* TextfieldResponder.swift */; };
     2.9  		2280386A1DC9DE6D00F1CB45 /* TextfieldResponder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 228038671DC9DE6D00F1CB45 /* TextfieldResponder.swift */; };
    2.10  		22DA56D81DC3747B00BD1EC4 /* pEpSettings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 22DA56D71DC3747B00BD1EC4 /* pEpSettings.bundle */; };
    2.11 @@ -275,6 +276,7 @@
    2.12  		222B357D1DF97675007A1F82 /* SuggestTableView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SuggestTableView.swift; sourceTree = "<group>"; };
    2.13  		222B35811DF97A44007A1F82 /* ComposeData.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = ComposeData.plist; sourceTree = "<group>"; };
    2.14  		222B35821DF97A44007A1F82 /* ComposeDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ComposeDataSource.swift; sourceTree = "<group>"; };
    2.15 +		222B35891DF99C48007A1F82 /* Actionsheet+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Actionsheet+Extension.swift"; sourceTree = "<group>"; };
    2.16  		228038671DC9DE6D00F1CB45 /* TextfieldResponder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextfieldResponder.swift; sourceTree = "<group>"; };
    2.17  		22DA56D71DC3747B00BD1EC4 /* pEpSettings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = pEpSettings.bundle; sourceTree = "<group>"; };
    2.18  		43001F791D91860A00306BF0 /* FetchTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchTableViewController.swift; sourceTree = "<group>"; };
    2.19 @@ -478,6 +480,7 @@
    2.20  				43F7BEAF1DC8DFC5009048D6 /* OperationQueue+Extension.swift */,
    2.21  				4380F7EE1D1C1C7300326F62 /* PEPSession+Extensions.swift */,
    2.22  				436F8E0F1D367039007E9829 /* StringExtensions.swift */,
    2.23 +				222B35891DF99C48007A1F82 /* Actionsheet+Extension.swift */,
    2.24  			);
    2.25  			name = Extensions;
    2.26  			sourceTree = "<group>";
    2.27 @@ -952,6 +955,9 @@
    2.28  							com.apple.Keychain = {
    2.29  								enabled = 1;
    2.30  							};
    2.31 +							com.apple.iCloud = {
    2.32 +								enabled = 1;
    2.33 +							};
    2.34  						};
    2.35  					};
    2.36  					43980E391CBD0BCA00A7FC3C = {
    2.37 @@ -1145,6 +1151,7 @@
    2.38  				4382E6431CC600FF00AA27EA /* PersistentImapFolder.swift in Sources */,
    2.39  				43CE63CF1DE8845E00FAC505 /* CdAttachment+pEp.swift in Sources */,
    2.40  				43B7154D1CECAADA0027861A /* ViewWidthsAligner.swift in Sources */,
    2.41 +				222B358A1DF99C48007A1F82 /* Actionsheet+Extension.swift in Sources */,
    2.42  				43A0E73E1D16C99900159F41 /* NSLayoutConstraint+PureLayout.m in Sources */,
    2.43  				43122B1A1DF5B48B00610253 /* ImapService.swift in Sources */,
    2.44  				222B35651DF96A9C007A1F82 /* ComposeCellProtocols.swift in Sources */,
     3.1 --- a/pEpForiOS/Base.lproj/Main.storyboard	Fri Dec 09 09:43:28 2016 +0100
     3.2 +++ b/pEpForiOS/Base.lproj/Main.storyboard	Thu Dec 08 16:42:07 2016 +0100
     3.3 @@ -1,12 +1,11 @@
     3.4 -<?xml version="1.0" encoding="UTF-8" standalone="no"?>
     3.5 -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11542" systemVersion="15G1108" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="MkG-yt-QmY">
     3.6 +<?xml version="1.0" encoding="UTF-8"?>
     3.7 +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2555" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="MkG-yt-QmY">
     3.8      <device id="retina4_7" orientation="portrait">
     3.9          <adaptation id="fullscreen"/>
    3.10      </device>
    3.11      <dependencies>
    3.12          <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/>
    3.13          <capability name="Constraints to layout margins" minToolsVersion="6.0"/>
    3.14 -        <capability name="Navigation items with more than one left or right bar item" minToolsVersion="7.0"/>
    3.15          <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
    3.16      </dependencies>
    3.17      <scenes>
    3.18 @@ -23,7 +22,7 @@
    3.19                                  <rect key="frame" x="0.0" y="28" width="375" height="111"/>
    3.20                                  <autoresizingMask key="autoresizingMask"/>
    3.21                                  <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="uhL-VL-48i" id="jgQ-nZ-h1r">
    3.22 -                                    <rect key="frame" x="0.0" y="0.0" width="375" height="111"/>
    3.23 +                                    <rect key="frame" x="0.0" y="0.0" width="375" height="110.5"/>
    3.24                                      <autoresizingMask key="autoresizingMask"/>
    3.25                                      <subviews>
    3.26                                          <label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalCompressionResistancePriority="1000" text="Sender" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tWZ-jW-sUg">
    3.27 @@ -135,7 +134,7 @@
    3.28                          <barButtonItem style="plain" systemItem="flexibleSpace" id="e6L-xz-NU2"/>
    3.29                          <barButtonItem systemItem="compose" id="u8o-KA-6lO">
    3.30                              <connections>
    3.31 -                                <segue destination="8bt-7R-jDE" kind="show" identifier="segueCompose" id="TnR-me-YgK"/>
    3.32 +                                <segue destination="NY2-HI-4ou" kind="presentation" identifier="segueCompose" id="TnR-me-YgK"/>
    3.33                              </connections>
    3.34                          </barButtonItem>
    3.35                      </toolbarItems>
    3.36 @@ -148,144 +147,151 @@
    3.37              </objects>
    3.38              <point key="canvasLocation" x="5505" y="1176"/>
    3.39          </scene>
    3.40 -        <!--Compose View Controller-->
    3.41 +        <!--New Email-->
    3.42          <scene sceneID="YkL-8B-UDO">
    3.43              <objects>
    3.44 -                <tableViewController id="8bt-7R-jDE" customClass="ComposeViewController" customModule="pEpForiOS" customModuleProvider="target" sceneMemberID="viewController">
    3.45 +                <tableViewController id="8bt-7R-jDE" customClass="ComposeTableViewController" customModule="pEpForiOS" customModuleProvider="target" sceneMemberID="viewController">
    3.46                      <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="K3w-ql-tda">
    3.47                          <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
    3.48                          <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
    3.49                          <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
    3.50                          <prototypes>
    3.51 -                            <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="ContactTableViewCell" id="Oat-5x-SrF" customClass="ContactTableViewCell" customModule="pEpForiOS" customModuleProvider="target">
    3.52 -                                <rect key="frame" x="0.0" y="28" width="375" height="44"/>
    3.53 +                            <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="recipientCell" rowHeight="58" id="Epo-ru-S9d" customClass="RecipientCell" customModule="pEpForiOS" customModuleProvider="target">
    3.54 +                                <rect key="frame" x="0.0" y="28" width="375" height="58"/>
    3.55                                  <autoresizingMask key="autoresizingMask"/>
    3.56 -                                <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Oat-5x-SrF" id="yAo-eZ-vhj">
    3.57 -                                    <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
    3.58 +                                <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Epo-ru-S9d" id="KqB-b6-IoI">
    3.59 +                                    <rect key="frame" x="0.0" y="0.0" width="375" height="57"/>
    3.60                                      <autoresizingMask key="autoresizingMask"/>
    3.61                                      <subviews>
    3.62 -                                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="spU-Ny-si1">
    3.63 -                                            <rect key="frame" x="8" y="8" width="359" height="27.5"/>
    3.64 -                                            <fontDescription key="fontDescription" type="system" pointSize="11"/>
    3.65 -                                            <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
    3.66 +                                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="To:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lwf-Sw-cKo">
    3.67 +                                            <rect key="frame" x="8" y="17" width="23" height="20"/>
    3.68 +                                            <fontDescription key="fontDescription" type="system" pointSize="16"/>
    3.69 +                                            <color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
    3.70                                              <nil key="highlightedColor"/>
    3.71                                          </label>
    3.72 +                                        <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" scrollEnabled="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Anc-8J-vDp" customClass="ComposeTextView" customModule="pEpForiOS" customModuleProvider="target">
    3.73 +                                            <rect key="frame" x="39" y="10" width="286" height="40"/>
    3.74 +                                            <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
    3.75 +                                            <fontDescription key="fontDescription" type="system" pointSize="14"/>
    3.76 +                                            <textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" returnKeyType="next" enablesReturnKeyAutomatically="YES"/>
    3.77 +                                            <connections>
    3.78 +                                                <outlet property="delegate" destination="Epo-ru-S9d" id="Mlo-a9-pVX"/>
    3.79 +                                            </connections>
    3.80 +                                        </textView>
    3.81 +                                        <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Vj4-L8-0TL">
    3.82 +                                            <rect key="frame" x="343" y="16" width="22" height="22"/>
    3.83 +                                            <state key="normal" image="button-add"/>
    3.84 +                                            <connections>
    3.85 +                                                <action selector="openAdressbook:" destination="Epo-ru-S9d" eventType="touchUpInside" id="Zsh-6N-zOs"/>
    3.86 +                                            </connections>
    3.87 +                                        </button>
    3.88                                      </subviews>
    3.89                                      <constraints>
    3.90 -                                        <constraint firstAttribute="trailingMargin" secondItem="spU-Ny-si1" secondAttribute="trailing" id="2W6-1V-6rl"/>
    3.91 -                                        <constraint firstItem="spU-Ny-si1" firstAttribute="top" secondItem="yAo-eZ-vhj" secondAttribute="topMargin" id="F19-Yp-oOi"/>
    3.92 -                                        <constraint firstAttribute="bottomMargin" secondItem="spU-Ny-si1" secondAttribute="bottom" id="KbH-iw-vQO"/>
    3.93 -                                        <constraint firstItem="spU-Ny-si1" firstAttribute="leading" secondItem="yAo-eZ-vhj" secondAttribute="leadingMargin" id="nEX-bN-UDI"/>
    3.94 +                                        <constraint firstItem="lwf-Sw-cKo" firstAttribute="leading" secondItem="KqB-b6-IoI" secondAttribute="leading" constant="8" id="2HN-3E-FxZ"/>
    3.95 +                                        <constraint firstItem="Anc-8J-vDp" firstAttribute="top" secondItem="KqB-b6-IoI" secondAttribute="top" constant="10" id="9Vj-75-oUR"/>
    3.96 +                                        <constraint firstAttribute="trailing" secondItem="Vj4-L8-0TL" secondAttribute="trailing" constant="10" id="Ckl-3C-ClW"/>
    3.97 +                                        <constraint firstItem="Anc-8J-vDp" firstAttribute="leading" secondItem="lwf-Sw-cKo" secondAttribute="trailing" constant="7.5" id="DAd-Gp-wwF"/>
    3.98 +                                        <constraint firstItem="lwf-Sw-cKo" firstAttribute="top" secondItem="KqB-b6-IoI" secondAttribute="top" constant="17" id="KT9-to-rrM"/>
    3.99 +                                        <constraint firstItem="Vj4-L8-0TL" firstAttribute="top" secondItem="KqB-b6-IoI" secondAttribute="top" constant="16" id="LF7-8i-5AK"/>
   3.100 +                                        <constraint firstAttribute="bottom" secondItem="Anc-8J-vDp" secondAttribute="bottom" constant="8" id="WUm-BF-ifd"/>
   3.101 +                                        <constraint firstItem="Vj4-L8-0TL" firstAttribute="leading" secondItem="Anc-8J-vDp" secondAttribute="trailing" constant="18" id="geX-Fh-d0G"/>
   3.102 +                                        <constraint firstAttribute="trailing" secondItem="Anc-8J-vDp" secondAttribute="trailing" constant="50" id="qAV-qc-JnG"/>
   3.103                                      </constraints>
   3.104                                  </tableViewCellContentView>
   3.105                                  <connections>
   3.106 -                                    <outlet property="labelContactDisplayName" destination="spU-Ny-si1" id="svX-dc-Wcn"/>
   3.107 +                                    <outlet property="addButton" destination="Vj4-L8-0TL" id="zem-oa-2OY"/>
   3.108 +                                    <outlet property="textView" destination="Anc-8J-vDp" id="sI6-8y-0jR"/>
   3.109 +                                    <outlet property="titleLabel" destination="lwf-Sw-cKo" id="csc-XT-CoJ"/>
   3.110                                  </connections>
   3.111                              </tableViewCell>
   3.112 -                            <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="RecipientCell" id="WQx-T2-rJ2" customClass="RecipientCell" customModule="pEpForiOS" customModuleProvider="target">
   3.113 -                                <rect key="frame" x="0.0" y="72" width="375" height="44"/>
   3.114 +                            <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="subjectCell" rowHeight="58" id="BXJ-Ko-ZUm" customClass="ComposeCell" customModule="pEpForiOS" customModuleProvider="target">
   3.115 +                                <rect key="frame" x="0.0" y="86" width="375" height="58"/>
   3.116                                  <autoresizingMask key="autoresizingMask"/>
   3.117 -                                <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="WQx-T2-rJ2" id="5Vs-0n-XCD">
   3.118 -                                    <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
   3.119 +                                <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="BXJ-Ko-ZUm" id="Pc9-7u-OeC">
   3.120 +                                    <rect key="frame" x="0.0" y="0.0" width="375" height="57"/>
   3.121                                      <autoresizingMask key="autoresizingMask"/>
   3.122                                      <subviews>
   3.123 -                                        <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" scrollEnabled="NO" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="yQo-H9-ejL">
   3.124 -                                            <rect key="frame" x="8" y="8" width="359" height="27.5"/>
   3.125 -                                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
   3.126 +                                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Subject:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DWr-lq-DOL">
   3.127 +                                            <rect key="frame" x="8" y="17" width="60" height="20"/>
   3.128                                              <fontDescription key="fontDescription" type="system" pointSize="16"/>
   3.129 -                                            <textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" keyboardType="emailAddress"/>
   3.130 +                                            <color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
   3.131 +                                            <nil key="highlightedColor"/>
   3.132 +                                        </label>
   3.133 +                                        <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" scrollEnabled="NO" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="8ci-S4-tmv" customClass="ComposeTextView" customModule="pEpForiOS" customModuleProvider="target">
   3.134 +                                            <rect key="frame" x="76" y="10" width="289" height="40"/>
   3.135 +                                            <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
   3.136 +                                            <fontDescription key="fontDescription" type="system" pointSize="14"/>
   3.137 +                                            <textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" enablesReturnKeyAutomatically="YES"/>
   3.138 +                                            <connections>
   3.139 +                                                <outlet property="delegate" destination="BXJ-Ko-ZUm" id="j3k-Xu-6uH"/>
   3.140 +                                            </connections>
   3.141                                          </textView>
   3.142                                      </subviews>
   3.143                                      <constraints>
   3.144 -                                        <constraint firstItem="yQo-H9-ejL" firstAttribute="top" secondItem="5Vs-0n-XCD" secondAttribute="topMargin" id="36k-Qz-pBy"/>
   3.145 -                                        <constraint firstAttribute="trailingMargin" secondItem="yQo-H9-ejL" secondAttribute="trailing" id="5Jf-tz-yB5"/>
   3.146 -                                        <constraint firstItem="yQo-H9-ejL" firstAttribute="leading" secondItem="5Vs-0n-XCD" secondAttribute="leadingMargin" id="fHs-Tf-VtC"/>
   3.147 -                                        <constraint firstAttribute="bottomMargin" secondItem="yQo-H9-ejL" secondAttribute="bottom" id="zN5-4b-6Of"/>
   3.148 +                                        <constraint firstItem="DWr-lq-DOL" firstAttribute="leading" secondItem="Pc9-7u-OeC" secondAttribute="leading" constant="8" id="1oz-z7-XY2"/>
   3.149 +                                        <constraint firstItem="8ci-S4-tmv" firstAttribute="leading" secondItem="DWr-lq-DOL" secondAttribute="trailing" constant="7.5" id="LTc-ZR-6av"/>
   3.150 +                                        <constraint firstAttribute="bottom" secondItem="8ci-S4-tmv" secondAttribute="bottom" constant="8" id="Xr8-4B-LTG"/>
   3.151 +                                        <constraint firstItem="DWr-lq-DOL" firstAttribute="top" secondItem="Pc9-7u-OeC" secondAttribute="top" constant="17" id="d9b-lI-XLD"/>
   3.152 +                                        <constraint firstAttribute="trailing" secondItem="8ci-S4-tmv" secondAttribute="trailing" constant="10" id="fTK-ZJ-z9Q"/>
   3.153 +                                        <constraint firstItem="8ci-S4-tmv" firstAttribute="top" secondItem="Pc9-7u-OeC" secondAttribute="top" constant="10" id="p5Q-5J-esL"/>
   3.154                                      </constraints>
   3.155                                  </tableViewCellContentView>
   3.156 -                                <accessibility key="accessibilityConfiguration">
   3.157 -                                    <accessibilityTraits key="traits" notEnabled="YES"/>
   3.158 -                                </accessibility>
   3.159                                  <connections>
   3.160 -                                    <outlet property="recipientTextView" destination="yQo-H9-ejL" id="P12-a4-mVn"/>
   3.161 +                                    <outlet property="textView" destination="8ci-S4-tmv" id="P9X-gc-rad"/>
   3.162 +                                    <outlet property="titleLabel" destination="DWr-lq-DOL" id="Vbu-6N-VWY"/>
   3.163                                  </connections>
   3.164                              </tableViewCell>
   3.165 -                            <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="SubjectTableViewCell" id="Tlh-rm-oK1" customClass="SubjectTableViewCell" customModule="pEpForiOS" customModuleProvider="target">
   3.166 -                                <rect key="frame" x="0.0" y="116" width="375" height="44"/>
   3.167 +                            <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" shouldIndentWhileEditing="NO" reuseIdentifier="composeCell" rowHeight="260" id="xhW-oS-ri3" userLabel="Content Table View Cell" customClass="MessageBodyCell" customModule="pEpForiOS" customModuleProvider="target">
   3.168 +                                <rect key="frame" x="0.0" y="144" width="375" height="260"/>
   3.169                                  <autoresizingMask key="autoresizingMask"/>
   3.170 -                                <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Tlh-rm-oK1" id="vMd-wF-7Ft">
   3.171 -                                    <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
   3.172 +                                <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="xhW-oS-ri3" id="doY-9c-uKA">
   3.173 +                                    <rect key="frame" x="0.0" y="0.0" width="375" height="259"/>
   3.174                                      <autoresizingMask key="autoresizingMask"/>
   3.175                                      <subviews>
   3.176 -                                        <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Subject" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="J53-pV-HVD">
   3.177 -                                            <rect key="frame" x="8" y="18" width="359" height="7.5"/>
   3.178 -                                            <fontDescription key="fontDescription" type="system" pointSize="14"/>
   3.179 -                                            <textInputTraits key="textInputTraits"/>
   3.180 -                                        </textField>
   3.181 -                                    </subviews>
   3.182 -                                    <constraints>
   3.183 -                                        <constraint firstAttribute="trailingMargin" secondItem="J53-pV-HVD" secondAttribute="trailing" id="Mkk-e8-eQX"/>
   3.184 -                                        <constraint firstItem="J53-pV-HVD" firstAttribute="top" relation="greaterThanOrEqual" secondItem="vMd-wF-7Ft" secondAttribute="topMargin" constant="10" id="Uhx-qn-RpK"/>
   3.185 -                                        <constraint firstItem="J53-pV-HVD" firstAttribute="leading" secondItem="vMd-wF-7Ft" secondAttribute="leadingMargin" id="neX-pe-IhC"/>
   3.186 -                                        <constraint firstAttribute="bottomMargin" relation="greaterThanOrEqual" secondItem="J53-pV-HVD" secondAttribute="bottom" constant="10" id="sAe-to-NgW"/>
   3.187 -                                    </constraints>
   3.188 -                                </tableViewCellContentView>
   3.189 -                                <accessibility key="accessibilityConfiguration">
   3.190 -                                    <accessibilityTraits key="traits" notEnabled="YES"/>
   3.191 -                                </accessibility>
   3.192 -                                <connections>
   3.193 -                                    <outlet property="subjectTextField" destination="J53-pV-HVD" id="os5-gb-ZEP"/>
   3.194 -                                </connections>
   3.195 -                            </tableViewCell>
   3.196 -                            <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="MessageBodyCell" id="lDN-Hh-Smf" customClass="MessageBodyCell" customModule="pEpForiOS" customModuleProvider="target">
   3.197 -                                <rect key="frame" x="0.0" y="160" width="375" height="44"/>
   3.198 -                                <autoresizingMask key="autoresizingMask"/>
   3.199 -                                <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="lDN-Hh-Smf" id="cFr-N0-CDs">
   3.200 -                                    <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
   3.201 -                                    <autoresizingMask key="autoresizingMask"/>
   3.202 -                                    <subviews>
   3.203 -                                        <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" verticalCompressionResistancePriority="1000" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" usesAttributedText="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hqv-cv-ye5">
   3.204 -                                            <rect key="frame" x="8" y="8" width="359" height="27.5"/>
   3.205 -                                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
   3.206 -                                            <attributedString key="attributedText"/>
   3.207 +                                        <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" scrollEnabled="NO" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="bVM-o9-45O" customClass="ComposeTextView" customModule="pEpForiOS" customModuleProvider="target">
   3.208 +                                            <rect key="frame" x="4" y="8" width="361" height="232"/>
   3.209 +                                            <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
   3.210 +                                            <fontDescription key="fontDescription" type="system" pointSize="15"/>
   3.211                                              <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
   3.212 +                                            <connections>
   3.213 +                                                <outlet property="delegate" destination="xhW-oS-ri3" id="8mj-6x-nI3"/>
   3.214 +                                            </connections>
   3.215                                          </textView>
   3.216                                      </subviews>
   3.217                                      <constraints>
   3.218 -                                        <constraint firstAttribute="bottomMargin" secondItem="hqv-cv-ye5" secondAttribute="bottom" id="10S-O7-NY1"/>
   3.219 -                                        <constraint firstAttribute="trailingMargin" secondItem="hqv-cv-ye5" secondAttribute="trailing" id="2uW-Rj-DQG"/>
   3.220 -                                        <constraint firstItem="hqv-cv-ye5" firstAttribute="leading" secondItem="cFr-N0-CDs" secondAttribute="leadingMargin" id="PzR-WU-Sdf"/>
   3.221 -                                        <constraint firstItem="hqv-cv-ye5" firstAttribute="top" secondItem="cFr-N0-CDs" secondAttribute="topMargin" id="dLp-VO-ht4"/>
   3.222 +                                        <constraint firstAttribute="trailing" secondItem="bVM-o9-45O" secondAttribute="trailing" constant="10" id="Qhb-Yx-WWx"/>
   3.223 +                                        <constraint firstItem="bVM-o9-45O" firstAttribute="leading" secondItem="doY-9c-uKA" secondAttribute="leading" constant="4" id="jca-Yq-kxx"/>
   3.224 +                                        <constraint firstItem="bVM-o9-45O" firstAttribute="top" secondItem="doY-9c-uKA" secondAttribute="top" constant="8" id="l5n-HY-3V8"/>
   3.225 +                                        <constraint firstAttribute="bottom" secondItem="bVM-o9-45O" secondAttribute="bottom" constant="20" id="vap-jQ-CJ7"/>
   3.226                                      </constraints>
   3.227                                  </tableViewCellContentView>
   3.228                                  <connections>
   3.229 -                                    <outlet property="bodyTextView" destination="hqv-cv-ye5" id="5bw-Zg-TOT"/>
   3.230 +                                    <outlet property="textView" destination="bVM-o9-45O" id="KYm-Xp-jJp"/>
   3.231                                  </connections>
   3.232                              </tableViewCell>
   3.233                          </prototypes>
   3.234                          <sections/>
   3.235                          <connections>
   3.236 -                            <outlet property="dataSource" destination="8bt-7R-jDE" id="IEu-Jb-a80"/>
   3.237 -                            <outlet property="delegate" destination="8bt-7R-jDE" id="nI8-aG-Qxq"/>
   3.238 +                            <outlet property="dataSource" destination="8bt-7R-jDE" id="2JS-Vc-zfR"/>
   3.239 +                            <outlet property="delegate" destination="8bt-7R-jDE" id="c6g-z2-vIx"/>
   3.240                          </connections>
   3.241                      </tableView>
   3.242                      <toolbarItems/>
   3.243 -                    <navigationItem key="navigationItem" id="VPF-Wy-8RY">
   3.244 -                        <rightBarButtonItems>
   3.245 -                            <barButtonItem title="Send" id="whn-9f-Amb">
   3.246 -                                <connections>
   3.247 -                                    <action selector="sendButtonTapped:" destination="8bt-7R-jDE" id="nvY-gc-nB5"/>
   3.248 -                                </connections>
   3.249 -                            </barButtonItem>
   3.250 -                            <barButtonItem systemItem="add" id="kiC-d0-eOT">
   3.251 -                                <connections>
   3.252 -                                    <action selector="attachedField:" destination="8bt-7R-jDE" id="41M-lg-8lC"/>
   3.253 -                                </connections>
   3.254 -                            </barButtonItem>
   3.255 -                        </rightBarButtonItems>
   3.256 +                    <navigationItem key="navigationItem" title="New Email" id="VPF-Wy-8RY">
   3.257 +                        <barButtonItem key="leftBarButtonItem" title="Cancel" id="RnR-fE-Pxv">
   3.258 +                            <connections>
   3.259 +                                <action selector="cancel" destination="8bt-7R-jDE" id="G86-1m-bjq"/>
   3.260 +                            </connections>
   3.261 +                        </barButtonItem>
   3.262 +                        <barButtonItem key="rightBarButtonItem" title="Send" id="whn-9f-Amb">
   3.263 +                            <connections>
   3.264 +                                <action selector="send" destination="8bt-7R-jDE" id="KJN-9D-1ef"/>
   3.265 +                            </connections>
   3.266 +                        </barButtonItem>
   3.267                      </navigationItem>
   3.268                      <connections>
   3.269 -                        <outlet property="sendButton" destination="whn-9f-Amb" id="12l-JN-IwB"/>
   3.270 +                        <outlet property="dismissButton" destination="RnR-fE-Pxv" id="Fbo-FG-i5y"/>
   3.271 +                        <outlet property="view" destination="K3w-ql-tda" id="t7n-G3-sO0"/>
   3.272                          <segue destination="PzE-hl-iFq" kind="unwind" identifier="unwindToEmailListMailSentSegue" unwindAction="mailSentSegue:" id="jKc-5d-Jge"/>
   3.273                          <segue destination="PzE-hl-iFq" kind="unwind" identifier="unwindToEmailListSegue" unwindAction="backFromComposeWithoutSavingDraftSegue:" id="RTG-gc-Hlt"/>
   3.274                          <segue destination="PzE-hl-iFq" kind="unwind" identifier="unwindToEmailListSaveDraftSegue" unwindAction="backFromComposeSaveDraftSegue:" id="3H9-Ws-0qN"/>
   3.275 @@ -294,7 +300,7 @@
   3.276                  <placeholder placeholderIdentifier="IBFirstResponder" id="28t-ga-UrZ" userLabel="First Responder" sceneMemberID="firstResponder"/>
   3.277                  <exit id="PzE-hl-iFq" userLabel="Exit" sceneMemberID="exit"/>
   3.278              </objects>
   3.279 -            <point key="canvasLocation" x="5920" y="2029"/>
   3.280 +            <point key="canvasLocation" x="6711" y="2029"/>
   3.281          </scene>
   3.282          <!--New Account-->
   3.283          <scene sceneID="hJo-oO-Yib">
   3.284 @@ -311,7 +317,7 @@
   3.285                                          <rect key="frame" x="0.0" y="35" width="375" height="49"/>
   3.286                                          <autoresizingMask key="autoresizingMask"/>
   3.287                                          <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="ixi-Mt-3kg" id="wqB-dm-pDx">
   3.288 -                                            <rect key="frame" x="0.0" y="0.0" width="375" height="49"/>
   3.289 +                                            <rect key="frame" x="0.0" y="0.0" width="375" height="48.5"/>
   3.290                                              <autoresizingMask key="autoresizingMask"/>
   3.291                                              <subviews>
   3.292                                                  <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hUQ-RI-kfE">
   3.293 @@ -347,7 +353,7 @@
   3.294                                          <rect key="frame" x="0.0" y="84" width="375" height="49"/>
   3.295                                          <autoresizingMask key="autoresizingMask"/>
   3.296                                          <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Muc-p7-eLR" id="ALh-ce-psL">
   3.297 -                                            <rect key="frame" x="0.0" y="0.0" width="375" height="49"/>
   3.298 +                                            <rect key="frame" x="0.0" y="0.0" width="375" height="48.5"/>
   3.299                                              <autoresizingMask key="autoresizingMask"/>
   3.300                                              <subviews>
   3.301                                                  <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Email" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SCr-eb-mdn">
   3.302 @@ -383,7 +389,7 @@
   3.303                                          <rect key="frame" x="0.0" y="133" width="375" height="49"/>
   3.304                                          <autoresizingMask key="autoresizingMask"/>
   3.305                                          <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="wzw-Ix-clS" id="iw0-fF-fSh">
   3.306 -                                            <rect key="frame" x="0.0" y="0.0" width="375" height="49"/>
   3.307 +                                            <rect key="frame" x="0.0" y="0.0" width="375" height="48.5"/>
   3.308                                              <autoresizingMask key="autoresizingMask"/>
   3.309                                              <subviews>
   3.310                                                  <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Username" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3ti-b6-5l8">
   3.311 @@ -422,7 +428,7 @@
   3.312                                          <rect key="frame" x="0.0" y="182" width="375" height="49"/>
   3.313                                          <autoresizingMask key="autoresizingMask"/>
   3.314                                          <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="x9C-Hc-Hvk" id="Tc7-0e-d7T">
   3.315 -                                            <rect key="frame" x="0.0" y="0.0" width="375" height="49"/>
   3.316 +                                            <rect key="frame" x="0.0" y="0.0" width="375" height="48.5"/>
   3.317                                              <autoresizingMask key="autoresizingMask"/>
   3.318                                              <subviews>
   3.319                                                  <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Password" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xbE-mW-hjW">
   3.320 @@ -511,7 +517,7 @@
   3.321                                  <rect key="frame" x="0.0" y="28" width="375" height="44"/>
   3.322                                  <autoresizingMask key="autoresizingMask"/>
   3.323                                  <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="qrl-EG-Khc" id="tKl-fS-UuG">
   3.324 -                                    <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
   3.325 +                                    <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
   3.326                                      <autoresizingMask key="autoresizingMask"/>
   3.327                                  </tableViewCellContentView>
   3.328                              </tableViewCell>
   3.329 @@ -547,8 +553,8 @@
   3.330                          </barButtonItem>
   3.331                      </toolbarItems>
   3.332                      <connections>
   3.333 -                        <segue destination="8bt-7R-jDE" kind="show" identifier="segueReplyFrom" id="GPW-U8-tyH"/>
   3.334 -                        <segue destination="8bt-7R-jDE" kind="show" identifier="segueForward" id="E2j-Ld-4K8"/>
   3.335 +                        <segue destination="NY2-HI-4ou" kind="presentation" identifier="segueReplyFrom" id="GPW-U8-tyH"/>
   3.336 +                        <segue destination="NY2-HI-4ou" kind="presentation" identifier="segueForward" id="E2j-Ld-4K8"/>
   3.337                      </connections>
   3.338                  </tableViewController>
   3.339                  <placeholder placeholderIdentifier="IBFirstResponder" id="lmA-rc-hEc" userLabel="First Responder" sceneMemberID="firstResponder"/>
   3.340 @@ -568,7 +574,7 @@
   3.341                                  <rect key="frame" x="0.0" y="28" width="375" height="44"/>
   3.342                                  <autoresizingMask key="autoresizingMask"/>
   3.343                                  <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="9jg-K9-g2Q" id="Wky-08-VfS">
   3.344 -                                    <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
   3.345 +                                    <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
   3.346                                      <autoresizingMask key="autoresizingMask"/>
   3.347                                      <subviews>
   3.348                                          <label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Security tittle" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="x1d-Md-75b">
   3.349 @@ -619,7 +625,7 @@
   3.350                                  <rect key="frame" x="0.0" y="72" width="375" height="44"/>
   3.351                                  <autoresizingMask key="autoresizingMask"/>
   3.352                                  <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="sQl-io-CjQ" id="rRf-0n-OEF">
   3.353 -                                    <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
   3.354 +                                    <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
   3.355                                      <autoresizingMask key="autoresizingMask"/>
   3.356                                      <subviews>
   3.357                                          <textView clipsSubviews="YES" multipleTouchEnabled="YES" userInteractionEnabled="NO" contentMode="scaleToFill" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" editable="NO" usesAttributedText="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Ges-7V-rhw">
   3.358 @@ -654,7 +660,7 @@
   3.359                                  <rect key="frame" x="0.0" y="116" width="375" height="44"/>
   3.360                                  <autoresizingMask key="autoresizingMask"/>
   3.361                                  <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="NUY-Vz-tpg" id="Aqd-T5-1MR">
   3.362 -                                    <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
   3.363 +                                    <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
   3.364                                      <autoresizingMask key="autoresizingMask"/>
   3.365                                      <subviews>
   3.366                                          <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="irB-0r-1CK">
   3.367 @@ -735,7 +741,7 @@
   3.368                                  <rect key="frame" x="0.0" y="28" width="375" height="44"/>
   3.369                                  <autoresizingMask key="autoresizingMask"/>
   3.370                                  <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="TEd-c8-lcR" id="iTO-wm-jHy">
   3.371 -                                    <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
   3.372 +                                    <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
   3.373                                      <autoresizingMask key="autoresizingMask"/>
   3.374                                      <subviews>
   3.375                                          <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vMR-75-Xgn">
   3.376 @@ -758,7 +764,7 @@
   3.377                                  <rect key="frame" x="0.0" y="72" width="375" height="44"/>
   3.378                                  <autoresizingMask key="autoresizingMask"/>
   3.379                                  <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="CaC-tZ-Vd5" id="dqb-4y-aM1">
   3.380 -                                    <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
   3.381 +                                    <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
   3.382                                      <autoresizingMask key="autoresizingMask"/>
   3.383                                      <subviews>
   3.384                                          <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" scrollEnabled="NO" editable="NO" text="TextView" textAlignment="natural" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rC4-w0-03O">
   3.385 @@ -784,7 +790,7 @@
   3.386                                  <rect key="frame" x="0.0" y="116" width="375" height="44"/>
   3.387                                  <autoresizingMask key="autoresizingMask"/>
   3.388                                  <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="p7C-sA-VWH" id="exZ-9t-tMI">
   3.389 -                                    <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
   3.390 +                                    <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
   3.391                                      <autoresizingMask key="autoresizingMask"/>
   3.392                                      <subviews>
   3.393                                          <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Di1-jI-BSU">
   3.394 @@ -869,7 +875,7 @@
   3.395                                          <rect key="frame" x="0.0" y="35" width="375" height="49"/>
   3.396                                          <autoresizingMask key="autoresizingMask"/>
   3.397                                          <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="yEs-RC-FK5" id="Kbm-32-bnt">
   3.398 -                                            <rect key="frame" x="0.0" y="0.0" width="375" height="49"/>
   3.399 +                                            <rect key="frame" x="0.0" y="0.0" width="375" height="48.5"/>
   3.400                                              <autoresizingMask key="autoresizingMask"/>
   3.401                                              <subviews>
   3.402                                                  <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Server" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TQX-jQ-6wQ">
   3.403 @@ -905,7 +911,7 @@
   3.404                                          <rect key="frame" x="0.0" y="84" width="375" height="49"/>
   3.405                                          <autoresizingMask key="autoresizingMask"/>
   3.406                                          <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Xpq-Fu-Dd3" id="Luz-CL-ptS">
   3.407 -                                            <rect key="frame" x="0.0" y="0.0" width="375" height="49"/>
   3.408 +                                            <rect key="frame" x="0.0" y="0.0" width="375" height="48.5"/>
   3.409                                              <autoresizingMask key="autoresizingMask"/>
   3.410                                              <subviews>
   3.411                                                  <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Port" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="miu-ep-BRp">
   3.412 @@ -941,7 +947,7 @@
   3.413                                          <rect key="frame" x="0.0" y="133" width="375" height="49"/>
   3.414                                          <autoresizingMask key="autoresizingMask"/>
   3.415                                          <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="057-Jd-AD3" id="VC6-Uj-uQb">
   3.416 -                                            <rect key="frame" x="0.0" y="0.0" width="375" height="49"/>
   3.417 +                                            <rect key="frame" x="0.0" y="0.0" width="375" height="48.5"/>
   3.418                                              <autoresizingMask key="autoresizingMask"/>
   3.419                                              <subviews>
   3.420                                                  <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="H6H-wM-1tb">
   3.421 @@ -1027,7 +1033,7 @@
   3.422                                          <rect key="frame" x="0.0" y="35" width="375" height="49"/>
   3.423                                          <autoresizingMask key="autoresizingMask"/>
   3.424                                          <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="6kU-ew-kCV" id="eXm-f1-cNo">
   3.425 -                                            <rect key="frame" x="0.0" y="0.0" width="375" height="49"/>
   3.426 +                                            <rect key="frame" x="0.0" y="0.0" width="375" height="48.5"/>
   3.427                                              <autoresizingMask key="autoresizingMask"/>
   3.428                                              <subviews>
   3.429                                                  <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Server" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VW4-JJ-HKV">
   3.430 @@ -1063,7 +1069,7 @@
   3.431                                          <rect key="frame" x="0.0" y="84" width="375" height="49"/>
   3.432                                          <autoresizingMask key="autoresizingMask"/>
   3.433                                          <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="XL7-h6-uwJ" id="e4c-NT-9NK">
   3.434 -                                            <rect key="frame" x="0.0" y="0.0" width="375" height="49"/>
   3.435 +                                            <rect key="frame" x="0.0" y="0.0" width="375" height="48.5"/>
   3.436                                              <autoresizingMask key="autoresizingMask"/>
   3.437                                              <subviews>
   3.438                                                  <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Port" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="N1c-o2-ebQ">
   3.439 @@ -1099,7 +1105,7 @@
   3.440                                          <rect key="frame" x="0.0" y="133" width="375" height="49"/>
   3.441                                          <autoresizingMask key="autoresizingMask"/>
   3.442                                          <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="xIb-rc-iWj" id="mpo-zI-aeT">
   3.443 -                                            <rect key="frame" x="0.0" y="0.0" width="375" height="49"/>
   3.444 +                                            <rect key="frame" x="0.0" y="0.0" width="375" height="48.5"/>
   3.445                                              <autoresizingMask key="autoresizingMask"/>
   3.446                                              <subviews>
   3.447                                                  <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="TransportSecurity" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HKb-4V-2g6">
   3.448 @@ -1177,10 +1183,10 @@
   3.449                          <color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
   3.450                          <prototypes>
   3.451                              <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="prototipe" id="03J-Ut-4Ls" userLabel="Account">
   3.452 -                                <rect key="frame" x="0.0" y="56" width="375" height="44"/>
   3.453 +                                <rect key="frame" x="0.0" y="55.5" width="375" height="44"/>
   3.454                                  <autoresizingMask key="autoresizingMask"/>
   3.455                                  <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="03J-Ut-4Ls" id="dVc-Gs-baq">
   3.456 -                                    <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
   3.457 +                                    <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
   3.458                                      <autoresizingMask key="autoresizingMask"/>
   3.459                                  </tableViewCellContentView>
   3.460                              </tableViewCell>
   3.461 @@ -1248,8 +1254,75 @@
   3.462              </objects>
   3.463              <point key="canvasLocation" x="6244" y="-395"/>
   3.464          </scene>
   3.465 +        <!--Navigation Controller-->
   3.466 +        <scene sceneID="pH2-0g-XGV">
   3.467 +            <objects>
   3.468 +                <navigationController automaticallyAdjustsScrollViewInsets="NO" id="NY2-HI-4ou" sceneMemberID="viewController">
   3.469 +                    <toolbarItems/>
   3.470 +                    <navigationBar key="navigationBar" contentMode="scaleToFill" id="e88-09-apM">
   3.471 +                        <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
   3.472 +                        <autoresizingMask key="autoresizingMask"/>
   3.473 +                    </navigationBar>
   3.474 +                    <nil name="viewControllers"/>
   3.475 +                    <connections>
   3.476 +                        <segue destination="8bt-7R-jDE" kind="relationship" relationship="rootViewController" id="5Eg-pH-22R"/>
   3.477 +                    </connections>
   3.478 +                </navigationController>
   3.479 +                <placeholder placeholderIdentifier="IBFirstResponder" id="aWP-YW-F6w" userLabel="First Responder" sceneMemberID="firstResponder"/>
   3.480 +            </objects>
   3.481 +            <point key="canvasLocation" x="5919.1999999999998" y="2028.9355322338831"/>
   3.482 +        </scene>
   3.483 +        <!--Table View Controller-->
   3.484 +        <scene sceneID="CA5-x5-bU5">
   3.485 +            <objects>
   3.486 +                <tableViewController storyboardIdentifier="contactSuggestionTable" useStoryboardIdentifierAsRestorationIdentifier="YES" id="tKb-b9-qGd" sceneMemberID="viewController">
   3.487 +                    <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="KkR-5p-iJB" customClass="SuggestTableView" customModule="pEpForiOS" customModuleProvider="target">
   3.488 +                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
   3.489 +                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
   3.490 +                        <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
   3.491 +                        <prototypes>
   3.492 +                            <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="contactCell" rowHeight="50" id="ilb-cY-EMj" customClass="ContactCell" customModule="pEpForiOS" customModuleProvider="target">
   3.493 +                                <rect key="frame" x="0.0" y="28" width="375" height="50"/>
   3.494 +                                <autoresizingMask key="autoresizingMask"/>
   3.495 +                                <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="ilb-cY-EMj" id="rLG-jZ-OQD">
   3.496 +                                    <rect key="frame" x="0.0" y="0.0" width="375" height="49"/>
   3.497 +                                    <autoresizingMask key="autoresizingMask"/>
   3.498 +                                    <subviews>
   3.499 +                                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KgX-uf-geh">
   3.500 +                                            <rect key="frame" x="14" y="5" width="353" height="21"/>
   3.501 +                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
   3.502 +                                            <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
   3.503 +                                            <nil key="textColor"/>
   3.504 +                                            <nil key="highlightedColor"/>
   3.505 +                                        </label>
   3.506 +                                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="E-Mail" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jI7-eY-w2B">
   3.507 +                                            <rect key="frame" x="14" y="24" width="353" height="21"/>
   3.508 +                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
   3.509 +                                            <fontDescription key="fontDescription" type="system" pointSize="13"/>
   3.510 +                                            <color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
   3.511 +                                            <nil key="highlightedColor"/>
   3.512 +                                        </label>
   3.513 +                                    </subviews>
   3.514 +                                </tableViewCellContentView>
   3.515 +                                <connections>
   3.516 +                                    <outlet property="emailLabel" destination="jI7-eY-w2B" id="VL5-OY-e5a"/>
   3.517 +                                    <outlet property="nameLabel" destination="KgX-uf-geh" id="SHp-bV-J9I"/>
   3.518 +                                </connections>
   3.519 +                            </tableViewCell>
   3.520 +                        </prototypes>
   3.521 +                        <connections>
   3.522 +                            <outlet property="dataSource" destination="tKb-b9-qGd" id="RyM-TN-SZI"/>
   3.523 +                            <outlet property="delegate" destination="tKb-b9-qGd" id="xRG-0o-3vH"/>
   3.524 +                        </connections>
   3.525 +                    </tableView>
   3.526 +                </tableViewController>
   3.527 +                <placeholder placeholderIdentifier="IBFirstResponder" id="1Bo-Mb-Gy6" userLabel="First Responder" sceneMemberID="firstResponder"/>
   3.528 +            </objects>
   3.529 +            <point key="canvasLocation" x="7457" y="2029"/>
   3.530 +        </scene>
   3.531      </scenes>
   3.532      <resources>
   3.533 +        <image name="button-add" width="22" height="22"/>
   3.534          <image name="unread-icon" width="22" height="22"/>
   3.535      </resources>
   3.536      <inferredMetricsTieBreakers>
     4.1 --- a/pEpForiOS/UI/Compose/ComposeTableViewController.swift	Fri Dec 09 09:43:28 2016 +0100
     4.2 +++ b/pEpForiOS/UI/Compose/ComposeTableViewController.swift	Thu Dec 08 16:42:07 2016 +0100
     4.3 @@ -78,7 +78,7 @@
     4.4      }
     4.5      
     4.6      private final func prepareFields()  {
     4.7 -        if let path = Bundle.main.path(forResource: "ComposeMail", ofType: "plist") {
     4.8 +        if let path = Bundle.main.path(forResource: "ComposeData", ofType: "plist") {
     4.9              tableDict = NSDictionary(contentsOfFile: path)
    4.10          }
    4.11          
    4.12 @@ -169,24 +169,83 @@
    4.13          present(documentPicker, animated: true, completion: nil)
    4.14      }
    4.15      
    4.16 +    // MARK: - Table view data source
    4.17 +    
    4.18 +    override func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
    4.19 +        guard let row = tableData?.getRow(at: indexPath.row) else { return UITableViewAutomaticDimension }
    4.20 +        return row.height
    4.21 +    }
    4.22 +    
    4.23 +    override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
    4.24 +        guard let row = tableData?.getRow(at: indexPath.row) else { return UITableViewAutomaticDimension }
    4.25 +        guard let cell = tableView.cellForRow(at: indexPath) as? ComposeCell else { return row.height }
    4.26 +        
    4.27 +        let height = cell.textView.fieldHeight
    4.28 +        if cell.fieldModel?.display == .conditional {
    4.29 +            if ccEnabled {
    4.30 +                if height <= row.height { return row.height }
    4.31 +                return height
    4.32 +            } else {
    4.33 +                return 0
    4.34 +            }
    4.35 +        }
    4.36 +        
    4.37 +        if height <= row.height {
    4.38 +            return row.height
    4.39 +        }
    4.40 +        
    4.41 +        return height
    4.42 +    }
    4.43 +    
    4.44 +    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    4.45 +        return tableData?.numberOfRows() ?? 0
    4.46 +    }
    4.47 +    
    4.48 +    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    4.49 +        guard let row = tableData?.getRow(at: indexPath.row) else { return UITableViewCell() }
    4.50 +        
    4.51 +        let cell = tableView.dequeueReusableCell(withIdentifier: row.identifier, for: indexPath) as! ComposeCell
    4.52 +        cell.updateCell(row, indexPath)
    4.53 +        cell.delegate = self
    4.54 +        
    4.55 +        if !allCells.contains(cell) {
    4.56 +            allCells.append(cell)
    4.57 +        }
    4.58 +        
    4.59 +        return cell
    4.60 +    }
    4.61 +    
    4.62 +    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    4.63 +        if tableView is SuggestTableView {
    4.64 +            let contact = suggestTableView.didSelectContact(index: indexPath)
    4.65 +            
    4.66 +            guard let cell = self.tableView.cellForRow(at: currentCell) as? RecipientCell else { return }
    4.67 +            cell.addContact(contact!)
    4.68 +            cell.textView.scrollToTop()
    4.69 +            
    4.70 +            self.tableView.updateSize()
    4.71 +        }
    4.72 +    }
    4.73 +    
    4.74      // MARK: - IBActions
    4.75      
    4.76 -    @IBAction func draft() {
    4.77 -//        let alertCtrl = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
    4.78 -//        
    4.79 -//        alertCtrl.addAction(alertCtrl.remove {
    4.80 -//            self.dissmiss()
    4.81 -//        })
    4.82 -//        alertCtrl.addAction(alertCtrl.draft {
    4.83 -//            // TODO: - DRAFT HERE!!!
    4.84 -//            self.dissmiss()
    4.85 -//        })
    4.86 -//        alertCtrl.addAction(alertCtrl.cancel())
    4.87 -//        
    4.88 -//        present(alertCtrl, animated: true, completion: nil)
    4.89 +    @IBAction func cancel() {
    4.90 +        let alertCtrl = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
    4.91 +        
    4.92 +        alertCtrl.addAction(alertCtrl.action("MailComp.Action.Cancel", .cancel, {}))
    4.93 +        
    4.94 +        alertCtrl.addAction(alertCtrl.action("MailComp.Action.Delete", .destructive, {
    4.95 +            self.dismiss()
    4.96 +        }))
    4.97 +        
    4.98 +        alertCtrl.addAction(alertCtrl.action("MailComp.Action.Save", .default, {
    4.99 +            // Save Daft action here!
   4.100 +        }))
   4.101 +        
   4.102 +        present(alertCtrl, animated: true, completion: nil)
   4.103      }
   4.104      
   4.105 -    @IBAction func cancel() {
   4.106 +    @IBAction func dismiss() {
   4.107          dismiss(animated: true, completion: nil)
   4.108      }
   4.109      
   4.110 @@ -195,802 +254,8 @@
   4.111          
   4.112          dismiss(animated: true, completion: nil)
   4.113      }
   4.114 -
   4.115 -//
   4.116 -//    override open func viewWillAppear(_ animated: Bool) {
   4.117 -//        super.viewWillAppear(animated)
   4.118 -//        if let forwardedMessage = forwardedMessage() {
   4.119 -//            // If we forward a message, add its contents as data
   4.120 -//            let op = MessageToAttachmentOperation(message: forwardedMessage)
   4.121 -//            op.completionBlock = {
   4.122 -//                GCD.onMain() {
   4.123 -//                    if let attch = op.attachment {
   4.124 -//                        self.model.attachments.append(attch)
   4.125 -//                        // TODO: Update attachment display!
   4.126 -//                    }
   4.127 -//                }
   4.128 -//            }
   4.129 -//            operationQueue.addOperation(op)
   4.130 -//        }
   4.131 -//
   4.132 -//        overrideBackButton()
   4.133 -//        updateViewFromRecipients()
   4.134 -//    }
   4.135 -//
   4.136 -//    open override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
   4.137 -//        if segue.identifier == unwindToEmailListSaveDraftSegue {
   4.138 -//            guard let vc = segue.destination as? EmailListViewController else {
   4.139 -//                return
   4.140 -//            }
   4.141 -//            vc.draftMessageToStore = messageForSending()
   4.142 -//        } else if segue.identifier == unwindToEmailListSegue {
   4.143 -//        }
   4.144 -//    }
   4.145 -//
   4.146 -//    func overrideBackButton() {
   4.147 -//        let barButton = UIBarButtonItem(
   4.148 -//            title: NSLocalizedString("Cancel", comment: "Abort the message composition"),
   4.149 -//            style: .plain, target: self, action: #selector(handleSaveDraftQuery))
   4.150 -//        navigationItem.leftBarButtonItem = barButton
   4.151 -//    }
   4.152 -//
   4.153 -//    func handleSaveDraftQuery() {
   4.154 -//        if model.isDirty {
   4.155 -//            let alert = UIAlertController(
   4.156 -//                title: nil, message: nil, preferredStyle: .actionSheet)
   4.157 -//
   4.158 -//            let actionDelete = UIAlertAction(
   4.159 -//                title: NSLocalizedString(
   4.160 -//                    "Delete Draft", comment: "Cancel message composition without save"),
   4.161 -//                style: .destructive, handler: { alert in
   4.162 -//                    self.performSegue(withIdentifier: self.unwindToEmailListSegue,
   4.163 -//                        sender: nil)
   4.164 -//            })
   4.165 -//            alert.addAction(actionDelete)
   4.166 -//
   4.167 -//            let actionSave = UIAlertAction(
   4.168 -//                title: NSLocalizedString(
   4.169 -//                    "Save Draft", comment: "Save draft message"),
   4.170 -//                style: .default, handler: { alert in
   4.171 -//                    self.performSegue(withIdentifier: self.unwindToEmailListSaveDraftSegue,
   4.172 -//                        sender: nil)
   4.173 -//            })
   4.174 -//            alert.addAction(actionSave)
   4.175 -//
   4.176 -//            let actionCancel = UIAlertAction(
   4.177 -//                title: NSLocalizedString(
   4.178 -//                    "Cancel", comment: "Abort the abort of message composition :)"),
   4.179 -//                style: .cancel, handler: nil)
   4.180 -//            alert.addAction(actionCancel)
   4.181 -//
   4.182 -//            present(alert, animated: true, completion: nil)
   4.183 -//        } else {
   4.184 -//            self.performSegue(withIdentifier: self.unwindToEmailListSegue, sender: nil)
   4.185 -//        }
   4.186 -//    }
   4.187 -//
   4.188 -//    func updateContacts() {
   4.189 -//        if let snippet = model.searchSnippet {
   4.190 -//            model.contacts = Identity.by(snippet: snippet)
   4.191 -//            self.tableView.reloadData()
   4.192 -//        }
   4.193 -//    }
   4.194 -//
   4.195 -//    func resetTableViewToNormal() {
   4.196 -//        model.searchSnippet = ""
   4.197 -//        model.tableMode = .normal
   4.198 -//        model.contacts = []
   4.199 -//        tableView.reloadData()
   4.200 -//    }
   4.201 -//
   4.202 -//    /**
   4.203 -//     Checks all recipient fields for validity, and updates the Send button accordingly.
   4.204 -//     - Returns: A Bool whether the send button was enabled or not.
   4.205 -//     */
   4.206 -//    func updateSendButtonFromView() -> Bool {
   4.207 -//        var allEmpty = true
   4.208 -//        var allCorrect = true
   4.209 -//        for (_, cell) in recipientCells {
   4.210 -//            let tf = cell.recipientTextView
   4.211 -//            if let text = tf?.text {
   4.212 -//                let trailingRemoved = text.removeTrailingPattern(trailingPattern)
   4.213 -//                let leadingRemoved = trailingRemoved.removeLeadingPattern(leadingPattern)
   4.214 -//                if !leadingRemoved.isOnlyWhiteSpace() {
   4.215 -//                    allEmpty = false
   4.216 -//                    if !leadingRemoved.isProbablyValidEmailListSeparatedBy(
   4.217 -//                        recipientStringDelimiter) {
   4.218 -//                        allCorrect = false
   4.219 -//                    }
   4.220 -//                }
   4.221 -//            }
   4.222 -//        }
   4.223 -//        sendButton.isEnabled = !allEmpty && allCorrect
   4.224 -//        if !sendButton.isEnabled {
   4.225 -//            setPrivacyColor(PEP_color_no_color, toSendButton: sendButton)
   4.226 -//        }
   4.227 -//        return sendButton.isEnabled
   4.228 -//    }
   4.229 -//
   4.230 -//    func setPrivacyColor(_ color: PEP_color, toSendButton: UIBarButtonItem) {
   4.231 -//        var image: UIImage?
   4.232 -//        if let uiColor = UIHelper.sendButtonBackgroundColorFromPepColor(color) {
   4.233 -//            image = UIHelper.imageFromColor(uiColor)
   4.234 -//        }
   4.235 -//        toSendButton.setBackgroundImage(image, for: UIControlState(),
   4.236 -//                                        barMetrics: UIBarMetrics.default)
   4.237 -//    }
   4.238 -//
   4.239 -//    /**
   4.240 -//     Whenever one of the recipients field changes, call this to validate them,
   4.241 -//     update colors, etc.
   4.242 -//     */
   4.243 -//    func updateViewFromRecipients() {
   4.244 -//        // Checking mail color only makes sense if you can actually send that mail,
   4.245 -//        // hence the if.
   4.246 -//        if updateSendButtonFromView() {
   4.247 -//            if operationQueue.operationCount > 0 {
   4.248 -//                // We have an existing ops, let's cancel them and don't do anything else
   4.249 -//                operationQueue.cancelAllOperations()
   4.250 -//                Log.warn(component: comp, "Won't check outgoing color, already one in operation")
   4.251 -//                return
   4.252 -//            }
   4.253 -//            if let msg = ComposeViewHelper.pepMailFromViewForCheckingRating(self) {
   4.254 -//                let pepColor = session.outgoingMessageColor(msg)
   4.255 -//                let color = PEPUtil.pEpColor(pEpRating: pepColor)
   4.256 -//                self.setPrivacyColor(color, toSendButton: self.sendButton)
   4.257 -//            }
   4.258 -//        }
   4.259 -//    }
   4.260 -//
   4.261 -//    /**
   4.262 -//     If there is network activity, show it.
   4.263 -//     */
   4.264 -//    func updateNetworkActivity() {
   4.265 -//        if model.networkActivity {
   4.266 -//            UIApplication.shared.isNetworkActivityIndicatorVisible = true
   4.267 -//            if originalRightBarButtonItem == nil {
   4.268 -//                // save the origignal
   4.269 -//                originalRightBarButtonItem = navigationItem.rightBarButtonItem
   4.270 -//            }
   4.271 -//            activityIndicator.startAnimating()
   4.272 -//            let barButtonWithActivity = UIBarButtonItem(customView: activityIndicator)
   4.273 -//            navigationItem.rightBarButtonItem = barButtonWithActivity
   4.274 -//        } else {
   4.275 -//            UIApplication.shared.isNetworkActivityIndicatorVisible = false
   4.276 -//            // restore the original
   4.277 -//            navigationItem.rightBarButtonItem = originalRightBarButtonItem
   4.278 -//            activityIndicator.stopAnimating()
   4.279 -//        }
   4.280 -//    }
   4.281 -//
   4.282 -//    /**
   4.283 -//     Updates the given message with data from the view.
   4.284 -//     */
   4.285 -//    func populate(message: Message, account: Account) {
   4.286 -//        // reset
   4.287 -//        message.to = []
   4.288 -//        message.cc = []
   4.289 -//        message.bcc = []
   4.290 -//
   4.291 -//        message.shortMessage = nil
   4.292 -//        message.longMessage = nil
   4.293 -//        message.longMessageFormatted = nil
   4.294 -//
   4.295 -//        message.references = []
   4.296 -//
   4.297 -//        // from
   4.298 -//        message.from = account.user
   4.299 -//
   4.300 -//        // recipients
   4.301 -//        for (_, cell) in recipientCells {
   4.302 -//            let tf = cell.recipientTextView
   4.303 -//            if var text = tf?.text {
   4.304 -//                text = text.removeLeadingPattern(leadingPattern)
   4.305 -//                if !text.isOnlyWhiteSpace() {
   4.306 -//                    let mailStrings1 = text.components(separatedBy: recipientStringDelimiter).map() {
   4.307 -//                        $0.trimmedWhiteSpace()
   4.308 -//                    }
   4.309 -//                    let mailStrings2 = mailStrings1.filter() {
   4.310 -//                        !$0.isOnlyWhiteSpace()
   4.311 -//                    }
   4.312 -//                    let contacts: [Identity] = mailStrings2.map() {
   4.313 -//                        return Identity.create(address: $0)
   4.314 -//                    }
   4.315 -//                    if contacts.count > 0, let rt = cell.recipientType {
   4.316 -//                        switch rt {
   4.317 -//                        case .to:
   4.318 -//                            message.to = contacts
   4.319 -//                        case .cc:
   4.320 -//                            message.cc = contacts
   4.321 -//                        case .bcc:
   4.322 -//                            message.bcc = contacts
   4.323 -//                        }
   4.324 -//                    }
   4.325 -//                }
   4.326 -//            }
   4.327 -//        }
   4.328 -//
   4.329 -//        if let subjectText = subjectTextField?.text {
   4.330 -//            message.shortMessage = subjectText
   4.331 -//        }
   4.332 -//
   4.333 -//        if let bodyText = longBodyMessageTextView?.text {
   4.334 -//            message.longMessage = bodyText
   4.335 -//        }
   4.336 -//    }
   4.337 -//
   4.338 -//    /**
   4.339 -//     Updates the given message with data from the original message,
   4.340 -//     if it exists (e.g., reply)
   4.341 -//     */
   4.342 -//    func populateWithReplyData(message: Message) {
   4.343 -//        guard let om = replyFromMessage() else {
   4.344 -//            return
   4.345 -//        }
   4.346 -//        setupMessageReferences(parent: om, message: message)
   4.347 -//    }
   4.348 -//
   4.349 -//    /**
   4.350 -//     Sets up the references between a parent message (i.e., a message replied to),
   4.351 -//     and a child message (i.e., the message containing the reply).
   4.352 -//     See https://cr.yp.to/immhf/thread.html for general strategy.
   4.353 -//     */
   4.354 -//    func setupMessageReferences(parent: Message, message: Message) {
   4.355 -//        // Inherit all references from the parent
   4.356 -//        message.references = parent.references
   4.357 -//
   4.358 -//        // Add the parent to the references
   4.359 -//        message.references.append(parent.messageID)
   4.360 -//    }
   4.361 -//
   4.362 -//    /**
   4.363 -//     Updates the given message with data from the forwarded message,
   4.364 -//     if it exists.
   4.365 -//     - Note: The forwarded mail attachment was already added to the model,
   4.366 -//     it will be handled by the general attachment handling in another function.
   4.367 -//     */
   4.368 -//    func populateWithForwardedData(message: Message) {
   4.369 -//        guard let _ = forwardedMessage() else {
   4.370 -//            return
   4.371 -//        }
   4.372 -//    }
   4.373 -//
   4.374 -//    func populate(message: Message, withAttachmentsFromTextView theTextView: UITextView?) {
   4.375 -//        guard let textView = theTextView else {
   4.376 -//            Log.warn(component: comp, "Trying to get attachments, but no text view")
   4.377 -//            return
   4.378 -//        }
   4.379 -//        let text = textView.attributedText
   4.380 -//        text?.enumerateAttribute(
   4.381 -//        NSAttachmentAttributeName, in: (text?.wholeRange())!, options: []) {
   4.382 -//            value, range, stop in
   4.383 -//            guard let _ = value as? NSTextAttachment else {
   4.384 -//                return
   4.385 -//            }
   4.386 -//        }
   4.387 -//    }
   4.388 -//
   4.389 -//    func messageForSending() -> Message? {
   4.390 -//        guard let appC = appConfig else {
   4.391 -//            Log.warn(component: 
   4.392 -//                comp, "Really need a non-nil appConfig for creating send message")
   4.393 -//            return nil
   4.394 -//        }
   4.395 -//        guard let account = appC.currentAccount else {
   4.396 -//            Log.warn(component: comp, "Really need a non-nil currentAccount")
   4.397 -//            return nil
   4.398 -//        }
   4.399 -//
   4.400 -//        if messageToSend == nil {
   4.401 -//            messageToSend = Message.create(uuid: "")
   4.402 -//            // TODO: IOS-222: Take account into consideration
   4.403 -//        }
   4.404 -//
   4.405 -//        guard let msg = messageToSend else {
   4.406 -//            Log.warn(component: comp, "Really need a non-nil messageToSend")
   4.407 -//            return nil
   4.408 -//        }
   4.409 -//
   4.410 -//        populate(message: msg, account: account)
   4.411 -//        populateWithReplyData(message: msg)
   4.412 -//        populateWithForwardedData(message: msg)
   4.413 -//        populate(message: msg, withAttachmentsFromTextView: longBodyMessageTextView)
   4.414 -//
   4.415 -//        return msg
   4.416 -//    }
   4.417 -//
   4.418 -//    // MARK: -- Actions
   4.419 -//
   4.420 -//    @IBAction func sendButtonTapped(_ sender: UIBarButtonItem) {
   4.421 -//        model.networkActivity = true
   4.422 -//        updateNetworkActivity()
   4.423 -//
   4.424 -//        guard let appC = appConfig else {
   4.425 -//            Log.warn(component: comp, "Really need a non-nil appConfig for sending mail")
   4.426 -//            return
   4.427 -//        }
   4.428 -//        guard let _ = appC.currentAccount else {
   4.429 -//            Log.warn(component: comp, "Really need a non-nil currentAccount for sending mail")
   4.430 -//            return
   4.431 -//        }
   4.432 -//        guard let _ = messageForSending() else {
   4.433 -//            return
   4.434 -//        }
   4.435 -//
   4.436 -//        // TODO: IOS 222: Store message so that it will be sent
   4.437 -//    }
   4.438 -//
   4.439 -//    @IBAction func attachedField(_ sender: AnyObject) {
   4.440 -//        let attachedAlertView = UIAlertController()
   4.441 -//        attachedAlertView.title = NSLocalizedString("AttachedFiles",
   4.442 -//                          comment: "Title for attached files alert view")
   4.443 -//        attachedAlertView.message = NSLocalizedString("Choose one option",
   4.444 -//        comment: "Message for attached alert view")
   4.445 -//
   4.446 -//        let photosAction = UIAlertAction(title: NSLocalizedString(
   4.447 -//            "Photos / Videos",
   4.448 -//            comment: "Title for photos/videos action in attached files alert view"),
   4.449 -//            style: UIAlertActionStyle.default) {
   4.450 -//            UIAlertAction in
   4.451 -//                
   4.452 -//                let status = PHPhotoLibrary.authorizationStatus()
   4.453 -//                switch status {
   4.454 -//                case .authorized:
   4.455 -//                    self.presentImagePicker()
   4.456 -//                case .denied, .restricted :
   4.457 -//                    self.presentImagePicker()
   4.458 -//                case .notDetermined:
   4.459 -//                    self.requestAuth()
   4.460 -//                }
   4.461 -//        }
   4.462 -//        attachedAlertView.addAction(photosAction)
   4.463 -//        let cancelAction = UIAlertAction(
   4.464 -//            title: NSLocalizedString("Cancel",
   4.465 -//                comment: "Cancel button text for email actions menu (reply, forward etc.)"),
   4.466 -//            style: .cancel) { (action) in }
   4.467 -//
   4.468 -//        attachedAlertView.addAction(cancelAction)
   4.469 -//        present(attachedAlertView, animated: true, completion: nil)
   4.470 -//    }
   4.471 -//    
   4.472 -//    func presentImagePicker() {
   4.473 -//        let possibleAttachedImages = UIImagePickerController()
   4.474 -//        possibleAttachedImages.modalPresentationStyle = UIModalPresentationStyle.currentContext
   4.475 -//        possibleAttachedImages.delegate = self
   4.476 -//        possibleAttachedImages.allowsEditing = false
   4.477 -//        possibleAttachedImages.sourceType = .photoLibrary
   4.478 -//        if let mediaTypes = UIImagePickerController.availableMediaTypes(
   4.479 -//            for: .photoLibrary) {
   4.480 -//            possibleAttachedImages.mediaTypes = mediaTypes
   4.481 -//        } else {
   4.482 -//            possibleAttachedImages.mediaTypes = [kUTTypeImage as String,
   4.483 -//                                                 kUTTypeMovie as String]
   4.484 -//        }
   4.485 -//        OperationQueue.main.addOperation {
   4.486 -//        self.present(possibleAttachedImages, animated: true, completion: nil)
   4.487 -//        }
   4.488 -//    }
   4.489 -//    
   4.490 -//    func requestAuth() {
   4.491 -//        PHPhotoLibrary.requestAuthorization() { status in
   4.492 -//            switch status {
   4.493 -//            case .authorized:
   4.494 -//                self.presentImagePicker()
   4.495 -//            case .denied, .restricted:
   4.496 -//                self.dismiss(animated: true, completion: nil)
   4.497 -//            case .notDetermined: break
   4.498 -//                // won't happen but still
   4.499 -//            }
   4.500 -//        }
   4.501 -//    }
   4.502 -//
   4.503 -//    // MARK: -- UITableViewDelegate
   4.504 -//
   4.505 -//    override open func tableView(_ tableView: UITableView,
   4.506 -//                            heightForHeaderInSection section: Int) -> CGFloat {
   4.507 -//        if model.tableMode == UIModel.Mode.search {
   4.508 -//            if let cell = model.recipientCell {
   4.509 -//                return cell.bounds.height
   4.510 -//            }
   4.511 -//        }
   4.512 -//        return 0
   4.513 -//    }
   4.514 -//
   4.515 -//    override open func tableView(_ tableView: UITableView,
   4.516 -//                            viewForHeaderInSection section: Int) -> UIView? {
   4.517 -//        if model.tableMode == UIModel.Mode.search && section == 0 {
   4.518 -//            // We are reusing an ordinary cell as a header, this might lead to:
   4.519 -//            // "no index path for table cell being reused".
   4.520 -//            // Can probably ignored.
   4.521 -//            return model.recipientCell
   4.522 -//        }
   4.523 -//        return nil
   4.524 -//    }
   4.525 -//
   4.526 -//    override open func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView,
   4.527 -//                   forSection section: Int) {
   4.528 -//        if model.tableMode == UIModel.Mode.search && section == 0 {
   4.529 -//            model.recipientCell?.recipientTextView.becomeFirstResponder()
   4.530 -//        }
   4.531 -//    }
   4.532 -//
   4.533 -//    override open func tableView(_ tableView: UITableView,
   4.534 -//                            didSelectRowAt indexPath: IndexPath) {
   4.535 -//        if model.tableMode == UIModel.Mode.search {
   4.536 -//            if let cell = model.recipientCell {
   4.537 -//                let c = model.contacts[(indexPath as NSIndexPath).row]
   4.538 -//                if let r = ComposeViewHelper.currentRecipientRangeFromText(
   4.539 -//                    cell.recipientTextView.text as NSString,
   4.540 -//                    aroundCaretPosition: cell.recipientTextView.selectedRange.location) {
   4.541 -//                    let newString = cell.recipientTextView.text.stringByReplacingCharactersInRange(
   4.542 -//                        r, withString: " \(c.address)")
   4.543 -//                    let replacement = "\(newString)\(delimiterWithSpace)"
   4.544 -//                    cell.recipientTextView.text = replacement
   4.545 -//                    colorRecipients(cell.recipientTextView)
   4.546 -//                }
   4.547 -//            }
   4.548 -//            updateViewFromRecipients()
   4.549 -//            resetTableViewToNormal()
   4.550 -//        }
   4.551 -//    }
   4.552 -//
   4.553 -//    override open func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell,
   4.554 -//                            forRowAt indexPath: IndexPath) {
   4.555 -//        if model.tableMode == UIModel.Mode.normal {
   4.556 -//            if let cell = model.recipientCell {
   4.557 -//                cell.recipientTextView.becomeFirstResponder()
   4.558 -//            }
   4.559 -//            if (indexPath as NSIndexPath).row == bodyTextRowNumber {
   4.560 -//                cell.separatorInset = UIEdgeInsets(top: 0,left: cell.bounds.size.width/2,
   4.561 -//                                                        bottom: 0,right: cell.bounds.size.width/2)
   4.562 -//
   4.563 -//            }
   4.564 -//        }
   4.565 -//    }
   4.566 -//
   4.567 -//    // MARK: -- UITableViewDataSource
   4.568 -//
   4.569 -//    override open func numberOfSections(in tableView: UITableView) -> Int {
   4.570 -//        return 1
   4.571 -//    }
   4.572 -//
   4.573 -//    override open func tableView(_ tableView: UITableView,
   4.574 -//                            numberOfRowsInSection section: Int) -> Int {
   4.575 -//        if model.tableMode == UIModel.Mode.normal {
   4.576 -//            return bodyTextRowNumber + 1
   4.577 -//        } else {
   4.578 -//            return model.contacts.count
   4.579 -//        }
   4.580 -//    }
   4.581 -//
   4.582 -//    /**
   4.583 -//     - Returns: The original message to be replied on, if it's a reply.
   4.584 -//     */
   4.585 -//    func replyFromMessage() -> Message? {
   4.586 -//        if composeMode == .replyFrom {
   4.587 -//            if let om = originalMessage {
   4.588 -//                return om
   4.589 -//            }
   4.590 -//        }
   4.591 -//        return nil
   4.592 -//    }
   4.593 -//
   4.594 -//    /**
   4.595 -//     - Returns: The message that has to be forwarded.
   4.596 -//     */
   4.597 -//    func forwardedMessage() -> Message? {
   4.598 -//        if composeMode == .forward {
   4.599 -//            if let om = originalMessage {
   4.600 -//                return om
   4.601 -//            }
   4.602 -//        }
   4.603 -//        return nil
   4.604 -//    }
   4.605 -//
   4.606 -//    /**
   4.607 -//     - Returns: The draft message that should be used as a base for the compose.
   4.608 -//     */
   4.609 -//    func composeFromDraftMessage() -> Message? {
   4.610 -//        if composeMode == .composeDraft {
   4.611 -//            if let om = originalMessage {
   4.612 -//                return om
   4.613 -//            }
   4.614 -//        }
   4.615 -//        return nil
   4.616 -//    }
   4.617 -//
   4.618 -//    override open func tableView(_ tableView: UITableView,
   4.619 -//                            cellForRowAt indexPath: IndexPath) -> UITableViewCell {
   4.620 -//        let recipientCellID = "RecipientCell"
   4.621 -//        let subjectTableViewCellID = "SubjectTableViewCell"
   4.622 -//        let messageBodyCellID = "MessageBodyCell"
   4.623 -//        let contactTableViewCellID = "ContactTableViewCell"
   4.624 -//
   4.625 -//        if model.tableMode == UIModel.Mode.normal {
   4.626 -//            // Normal mode
   4.627 -//            if (indexPath as NSIndexPath).row < subjectRowNumber {
   4.628 -//                // Recipient cell
   4.629 -//                let cell = tableView.dequeueReusableCell(
   4.630 -//                    withIdentifier: recipientCellID, for: indexPath) as! RecipientCell
   4.631 -//
   4.632 -//                if cell.recipientType == nil {
   4.633 -//                    cell.recipientType = RecipientType.fromRawValue((indexPath as NSIndexPath).row + 1)
   4.634 -//                    cell.recipientTextView.delegate = self
   4.635 -//
   4.636 -//                    // Cache the cell for later use
   4.637 -//                    recipientCellsByTextView[cell.recipientTextView] = cell
   4.638 -//                    recipientCells[(indexPath as NSIndexPath).row] = cell
   4.639 -//
   4.640 -//                    cell.recipientTextView.font = UIFont.preferredFont(
   4.641 -//                        forTextStyle: UIFontTextStyle.body)
   4.642 -//
   4.643 -//                    var changedRecipients = false
   4.644 -//
   4.645 -//                    // Handle message compose for all recipient fields
   4.646 -//                    if let composeMessage = composeFromDraftMessage() {
   4.647 -//                        let contacts = ComposeViewHelper.contactsForRecipientType(
   4.648 -//                            cell.recipientType, fromMessage: composeMessage)
   4.649 -//                        if contacts.count > 0 {
   4.650 -//                            changedRecipients = true
   4.651 -//                        }
   4.652 -//                        ComposeViewHelper.transfer(
   4.653 -//                            identities: contacts, toTextField: cell.recipientTextView,
   4.654 -//                            titleText: cell.titleText)
   4.655 -//                    }
   4.656 -//
   4.657 -//                    // Handle reply to for .To
   4.658 -//                    if cell.recipientType == .to {
   4.659 -//                        if let om = replyFromMessage() {
   4.660 -//                            if let from = om.from {
   4.661 -//                                ComposeViewHelper.transfer(
   4.662 -//                                    identities: [from], toTextField: cell.recipientTextView,
   4.663 -//                                    titleText: cell.titleText)
   4.664 -//                                changedRecipients = true
   4.665 -//                            }
   4.666 -//                        } else {
   4.667 -//                            // First time the cell got created, give it focus
   4.668 -//                            cell.recipientTextView.becomeFirstResponder()
   4.669 -//                        }
   4.670 -//                    }
   4.671 -//
   4.672 -//                    if recipientTextAttributes == nil {
   4.673 -//                        var attributeRange: NSRange = NSMakeRange(0, 1)
   4.674 -//                        recipientTextAttributes =
   4.675 -//                            cell.recipientTextView.attributedText.attributes(
   4.676 -//                                at: 0, longestEffectiveRange: &attributeRange,
   4.677 -//                                in: NSRange(location: 0, length: 1)) as [String : AnyObject]?
   4.678 -//                    }
   4.679 -//
   4.680 -//                    if changedRecipients {
   4.681 -//                        updateViewFromRecipients()
   4.682 -//                        colorRecipients(cell.recipientTextView)
   4.683 -//                    }
   4.684 -//                }
   4.685 -//
   4.686 -//                return cell
   4.687 -//            } else if (indexPath as NSIndexPath).row == subjectRowNumber {
   4.688 -//                // subject cell
   4.689 -//                let cell = tableView.dequeueReusableCell(
   4.690 -//                    withIdentifier: subjectTableViewCellID, for: indexPath) as! SubjectTableViewCell
   4.691 -//                // Store for later access
   4.692 -//                subjectTextField = cell.subjectTextField
   4.693 -//
   4.694 -//                cell.subjectTextField.font = UIFont.preferredFont(forTextStyle: UIFontTextStyle.body)
   4.695 -//
   4.696 -//                cell.subjectTextField.delegate = self
   4.697 -//
   4.698 -//                if let m = replyFromMessage() {
   4.699 -//                    subjectTextField?.text = ReplyUtil.replySubjectForMessage(m)
   4.700 -//                }
   4.701 -//
   4.702 -//                if let m = composeFromDraftMessage() {
   4.703 -//                    subjectTextField?.text = m.shortMessage
   4.704 -//                }
   4.705 -//
   4.706 -//                return cell
   4.707 -//            } else { // if indexPath.row == bodyTextRowNumber
   4.708 -//                // Body message cell
   4.709 -//                let cell = tableView.dequeueReusableCell(
   4.710 -//                    withIdentifier: messageBodyCellID, for: indexPath) as! MessageBodyCell
   4.711 -//                cell.bodyTextView.delegate = self
   4.712 -//
   4.713 -//                // Store the body text field for later access
   4.714 -//                longBodyMessageTextView = cell.bodyTextView
   4.715 -//
   4.716 -//                cell.bodyTextView.font = UIFont.preferredFont(forTextStyle: UIFontTextStyle.body)
   4.717 -//
   4.718 -//                let replyAll = composeMode == .replyAll
   4.719 -//                if let om = replyFromMessage() {
   4.720 -//                    let text = ReplyUtil.quotedMessageTextForMessage(om, replyAll: replyAll)
   4.721 -//                    cell.bodyTextView.text = text
   4.722 -//                    cell.bodyTextView.selectedRange = NSRange(location: 0, length: 0)
   4.723 -//                } else {
   4.724 -//                    cell.bodyTextView.text = "\n\n\(ReplyUtil.footer())"
   4.725 -//                    cell.bodyTextView.selectedRange = NSRange(location: 0, length: 0)
   4.726 -//                }
   4.727 -//
   4.728 -//                if let om = composeFromDraftMessage() {
   4.729 -//                    cell.bodyTextView.text = om.longMessage
   4.730 -//                }
   4.731 -//
   4.732 -//                // Give it the focus, if it's not a reply. For non-replies, the to text
   4.733 -//                // field will get the focus.
   4.734 -//                if composeMode == .replyFrom || composeMode == .replyAll {
   4.735 -//                    cell.bodyTextView.becomeFirstResponder()
   4.736 -//                }
   4.737 -//
   4.738 -//                return cell
   4.739 -//            }
   4.740 -//        } else {
   4.741 -//            // Search mode
   4.742 -//            let contactIndex = (indexPath as NSIndexPath).row
   4.743 -//            let contact = model.contacts[contactIndex]
   4.744 -//            let cell = tableView.dequeueReusableCell(
   4.745 -//                withIdentifier: contactTableViewCellID, for: indexPath) as! ContactTableViewCell
   4.746 -//            cell.contact = contact
   4.747 -//            return cell
   4.748 -//        }
   4.749 -//    }
   4.750 -//
   4.751 -//    // MARK: -- Handling recipient text input
   4.752 -//
   4.753 -//    /**
   4.754 -//     Gives contacts in the given text view the pEp color rating.
   4.755 -//     */
   4.756 -//    func colorRecipients(_ textView: UITextView) {
   4.757 -//        let parts = textView.text.components(separatedBy: delimiterChars)
   4.758 -//        if parts.count == 0 {
   4.759 -//            return
   4.760 -//        }
   4.761 -//
   4.762 -//        guard let origAttributes = recipientTextAttributes else {
   4.763 -//            return
   4.764 -//        }
   4.765 -//
   4.766 -//        Record.Context.background.perform() {
   4.767 -//            let recipientText = NSMutableAttributedString()
   4.768 -//            let session = PEPSession()
   4.769 -//            var firstPart = true
   4.770 -//            for p in parts {
   4.771 -//                let thePart = p.trimmedWhiteSpace()
   4.772 -//                if thePart.isEmpty {
   4.773 -//                    firstPart = false
   4.774 -//                    continue
   4.775 -//                }
   4.776 -//                if firstPart {
   4.777 -//                    firstPart = false
   4.778 -//                    let attributed = NSAttributedString(string: thePart,
   4.779 -//                        attributes: origAttributes)
   4.780 -//                    recipientText.append(attributed)
   4.781 -//                    recipientText.append(NSAttributedString(string: ": ",
   4.782 -//                        attributes: origAttributes))
   4.783 -//                } else {
   4.784 -//                    var attributes = origAttributes
   4.785 -//                    if let c = Identity.by(address: thePart) {
   4.786 -//                        let color = PEPUtil.pEpColor(identity: c, session: session)
   4.787 -//                        if let uiColor = UIHelper.textBackgroundUIColorFromPrivacyColor(color) {
   4.788 -//                            attributes[NSBackgroundColorAttributeName] = uiColor
   4.789 -//                        }
   4.790 -//                    }
   4.791 -//                    let attributed = NSAttributedString(string: thePart,
   4.792 -//                        attributes: attributes)
   4.793 -//                    recipientText.append(attributed)
   4.794 -//                    recipientText.append(NSAttributedString(
   4.795 -//                        string: self.delimiterWithSpace,
   4.796 -//                        attributes: origAttributes))
   4.797 -//                }
   4.798 -//            }
   4.799 -//            GCD.onMain() {
   4.800 -//                textView.attributedText = recipientText
   4.801 -//            }
   4.802 -//        }
   4.803 -//    }
   4.804 -//
   4.805 -//    func updateSearch(_ textView: UITextView) {
   4.806 -//        if let searchSnippet = ComposeViewHelper.extractRecipientFromText(
   4.807 -//            textView.text as NSString, aroundCaretPosition: textView.selectedRange.location) {
   4.808 -//            model.searchSnippet = searchSnippet
   4.809 -//            model.tableMode  = .search
   4.810 -//            model.recipientCell = recipientCellsByTextView[textView]
   4.811 -//            updateContacts()
   4.812 -//        }
   4.813 -//    }
   4.814 -//
   4.815 -//    // MARK: -- Util
   4.816 -//
   4.817 -//    /**
   4.818 -//     This has to be called whenever the body text changes, so the table view resizes that cell.
   4.819 -//     */
   4.820 -//    func resizeTableView() {
   4.821 -//        let currentOffset = tableView.contentOffset
   4.822 -//        UIView.setAnimationsEnabled(false)
   4.823 -//        tableView.beginUpdates()
   4.824 -//        tableView.endUpdates()
   4.825 -//        UIView.setAnimationsEnabled(true)
   4.826 -//        tableView.setContentOffset(currentOffset, animated: false)
   4.827 -//    }
   4.828  }
   4.829  
   4.830 -// MARK: -- UIImagePickerControllerDelegate
   4.831 -
   4.832 -//extension ComposeViewController: UIImagePickerControllerDelegate {
   4.833 -//    public func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo
   4.834 -//        info: [String : Any]) {
   4.835 -//        guard let attachedImage = info[UIImagePickerControllerOriginalImage] as? UIImage else {
   4.836 -//            return
   4.837 -//        }
   4.838 -//
   4.839 -//        let photoAttachment = PhotoAttachment(image: attachedImage)
   4.840 -//
   4.841 -//        insert(imageAttachment: photoAttachment)
   4.842 -//
   4.843 -//        dismiss(animated: true, completion: nil)
   4.844 -//    }
   4.845 -//
   4.846 -//    func insert(imageAttachment: PhotoAttachment) {
   4.847 -//        guard let textView = longBodyMessageTextView else {
   4.848 -//            return
   4.849 -//        }
   4.850 -//
   4.851 -//        let textAttachment = NSTextAttachment()
   4.852 -//        textAttachment.image = imageAttachment.image
   4.853 -//        let imageString = NSAttributedString(attachment:textAttachment)
   4.854 -//
   4.855 -//        textAttachment.bounds = obtainContainerToMaintainRatio(
   4.856 -//            textView.bounds.width, rectangle: imageAttachment.image.size)
   4.857 -//
   4.858 -//        let selectedRange = textView.selectedRange
   4.859 -//        let attrText = NSMutableAttributedString(attributedString: textView.attributedText)
   4.860 -//        attrText.replaceCharacters(in: selectedRange, with: imageString)
   4.861 -//        textView.attributedText = attrText
   4.862 -//
   4.863 -//        resizeTableView()
   4.864 -//    }
   4.865 -//}
   4.866 -//
   4.867 -//// MARK: -- UITextViewDelegate
   4.868 -//
   4.869 -//extension ComposeViewController: UITextViewDelegate {
   4.870 -//    public func textViewDidChange(_ textView: UITextView) {
   4.871 -//        if textView == longBodyMessageTextView {
   4.872 -//            resizeTableView()
   4.873 -//        } else if let _ = recipientCellsByTextView[textView] {
   4.874 -//            updateSearch(textView)
   4.875 -//        }
   4.876 -//        model.isDirty = true
   4.877 -//    }
   4.878 -//
   4.879 -//    public func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange,
   4.880 -//                  replacementText text: String) -> Bool {
   4.881 -//        if let recipientCell = recipientCellsByTextView[textView] {
   4.882 -//            // Disallow if check is infringing on the "readonly" part, like "To: "
   4.883 -//            if range.location < recipientCell.minimumCaretLocation {
   4.884 -//                updateViewFromRecipients()
   4.885 -//                return false
   4.886 -//            }
   4.887 -//            if text == newline {
   4.888 -//                resetTableViewToNormal()
   4.889 -//                let newString = textView.text.stringByReplacingCharactersInRange(
   4.890 -//                    range, withString: delimiterWithSpace)
   4.891 -//                textView.text = newString
   4.892 -//                colorRecipients(textView)
   4.893 -//                updateViewFromRecipients()
   4.894 -//
   4.895 -//                // Email was modified.
   4.896 -//                // Set this here because in this case textViewDidChange won't catch it.
   4.897 -//                model.isDirty = true
   4.898 -//
   4.899 -//                return false
   4.900 -//            }
   4.901 -//            updateViewFromRecipients()
   4.902 -//        }
   4.903 -//        // setting the model to dirty will be handled by textViewDidChange
   4.904 -//        return true
   4.905 -//    }
   4.906 -//}
   4.907 -//
   4.908 -
   4.909 -
   4.910  // MARK: - Extensions
   4.911  
   4.912  extension ComposeTableViewController: ComposeCellDelegate {
     5.1 --- a/pEpForiOS/UI/EmailDisplay/EmailListViewController.swift	Fri Dec 09 09:43:28 2016 +0100
     5.2 +++ b/pEpForiOS/UI/EmailDisplay/EmailListViewController.swift	Thu Dec 08 16:42:07 2016 +0100
     5.3 @@ -199,15 +199,14 @@
     5.4          config.appConfig.currentAccount = config.account
     5.5  
     5.6          if segue.identifier == segueCompose {
     5.7 -            let destination = segue.destination
     5.8 -                as! ComposeTableViewController
     5.9 -            destination.appConfig = config.appConfig
    5.10 -            if let draft = draftMessageToCompose {
    5.11 -                draft.imapFlags?.seen = true
    5.12 -
    5.13 -                destination.originalMessage = draft
    5.14 -                destination.composeMode = .draft
    5.15 -            }
    5.16 +            //let destination = segue.destination as! ComposeTableViewController
    5.17 +            // destination.appConfig = config.appConfig
    5.18 +//            if let draft = draftMessageToCompose {
    5.19 +//                draft.imapFlags?.seen = true
    5.20 +//
    5.21 +//                destination.originalMessage = draft
    5.22 +//                destination.composeMode = .draft
    5.23 +//            }
    5.24          } else if segue.identifier == segueShowEmail {
    5.25              guard
    5.26                  let vc = segue.destination as? EmailViewController,