merges default IOS-647
authorbuff <andreas@pep-project.org>
Mon, 07 Jan 2019 10:44:27 +0100
branchIOS-647
changeset 74387bf0a6623aa1
parent 7437 cedf77176fc1
parent 7434 1f367c99fbbd
child 7439 1306a841b8b6
merges default
pEpForiOS.xcodeproj/project.pbxproj
     1.1 --- a/pEpForiOS.xcodeproj/project.pbxproj	Thu Dec 13 19:59:43 2018 +0100
     1.2 +++ b/pEpForiOS.xcodeproj/project.pbxproj	Mon Jan 07 10:44:27 2019 +0100
     1.3 @@ -411,6 +411,7 @@
     1.4  		438F4EE1215F9CB300168B5E /* SimplifiedKeyImport_Harry_To_Rick_with_Leon.txt in Resources */ = {isa = PBXBuildFile; fileRef = 438F4EE0215F9CB300168B5E /* SimplifiedKeyImport_Harry_To_Rick_with_Leon.txt */; };
     1.5  		438F4EE5215FAD0500168B5E /* Harry Bryant iostest002@peptest.ch (0x5716EA2D9AE32468) pub-sec.asc in Resources */ = {isa = PBXBuildFile; fileRef = 438F4EE4215FAD0500168B5E /* Harry Bryant iostest002@peptest.ch (0x5716EA2D9AE32468) pub-sec.asc */; };
     1.6  		438F4EE9215FB99400168B5E /* Leon Kowalski (19B9EE3B) – Private.asc in Resources */ = {isa = PBXBuildFile; fileRef = 438F4EE8215FB99400168B5E /* Leon Kowalski (19B9EE3B) – Private.asc */; };
     1.7 +		4393673921C26F3D00FF8BB4 /* LogTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4393673821C26F3D00FF8BB4 /* LogTest.swift */; };
     1.8  		4395CDEC20AAB2E9003FC5F1 /* UIImage+GIF.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4395CDEB20AAB2E9003FC5F1 /* UIImage+GIF.swift */; };
     1.9  		4395CDEE20AAC909003FC5F1 /* UIImageExtensionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4395CDED20AAC909003FC5F1 /* UIImageExtensionsTests.swift */; };
    1.10  		4395CDF020AAD0D7003FC5F1 /* icon_001.gif in Resources */ = {isa = PBXBuildFile; fileRef = 4395CDEF20AAD0D6003FC5F1 /* icon_001.gif */; };
    1.11 @@ -459,6 +460,8 @@
    1.12  		43BB86941DB4E76D00980267 /* CdAccount+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43BB86931DB4E76D00980267 /* CdAccount+Extension.swift */; };
    1.13  		43BBB5E71E267A3800104070 /* EncryptAndSendOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43BBB5E61E267A3800104070 /* EncryptAndSendOperation.swift */; };
    1.14  		43C046BF1CF48EA500BD0D9D /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 43C046BE1CF48EA500BD0D9D /* AddressBook.framework */; };
    1.15 +		43C273DB21C8F96D002EB4C8 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43C273DA21C8F96D002EB4C8 /* Logger.swift */; };
    1.16 +		43C273DD21C9024A002EB4C8 /* LoggerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43C273DC21C9024A002EB4C8 /* LoggerTest.swift */; };
    1.17  		43C322051EA89EED005073FB /* HandshakePartnerTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43C322041EA89EED005073FB /* HandshakePartnerTableViewCell.swift */; };
    1.18  		43C322071EA8E7AD005073FB /* UIButton+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43C322061EA8E7AD005073FB /* UIButton+Extension.swift */; };
    1.19  		43C322091EA90192005073FB /* PEP+UI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43C322081EA90192005073FB /* PEP+UI.swift */; };
    1.20 @@ -1052,6 +1055,7 @@
    1.21  		438F4EE0215F9CB300168B5E /* SimplifiedKeyImport_Harry_To_Rick_with_Leon.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SimplifiedKeyImport_Harry_To_Rick_with_Leon.txt; sourceTree = "<group>"; };
    1.22  		438F4EE4215FAD0500168B5E /* Harry Bryant iostest002@peptest.ch (0x5716EA2D9AE32468) pub-sec.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Harry Bryant iostest002@peptest.ch (0x5716EA2D9AE32468) pub-sec.asc"; sourceTree = "<group>"; };
    1.23  		438F4EE8215FB99400168B5E /* Leon Kowalski (19B9EE3B) – Private.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Leon Kowalski (19B9EE3B) – Private.asc"; sourceTree = "<group>"; };
    1.24 +		4393673821C26F3D00FF8BB4 /* LogTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogTest.swift; sourceTree = "<group>"; };
    1.25  		4395CDEB20AAB2E9003FC5F1 /* UIImage+GIF.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+GIF.swift"; sourceTree = "<group>"; };
    1.26  		4395CDED20AAC909003FC5F1 /* UIImageExtensionsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIImageExtensionsTests.swift; sourceTree = "<group>"; };
    1.27  		4395CDEF20AAD0D6003FC5F1 /* icon_001.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = icon_001.gif; sourceTree = "<group>"; };
    1.28 @@ -1108,6 +1112,8 @@
    1.29  		43BB86931DB4E76D00980267 /* CdAccount+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CdAccount+Extension.swift"; sourceTree = "<group>"; };
    1.30  		43BBB5E61E267A3800104070 /* EncryptAndSendOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EncryptAndSendOperation.swift; sourceTree = "<group>"; };
    1.31  		43C046BE1CF48EA500BD0D9D /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; };
    1.32 +		43C273DA21C8F96D002EB4C8 /* Logger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = "<group>"; };
    1.33 +		43C273DC21C9024A002EB4C8 /* LoggerTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoggerTest.swift; sourceTree = "<group>"; };
    1.34  		43C322041EA89EED005073FB /* HandshakePartnerTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HandshakePartnerTableViewCell.swift; sourceTree = "<group>"; };
    1.35  		43C322061EA8E7AD005073FB /* UIButton+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIButton+Extension.swift"; sourceTree = "<group>"; };
    1.36  		43C322081EA90192005073FB /* PEP+UI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "PEP+UI.swift"; sourceTree = "<group>"; };
    1.37 @@ -2319,6 +2325,8 @@
    1.38  				4395CDED20AAC909003FC5F1 /* UIImageExtensionsTests.swift */,
    1.39  				434DDC2A20D10F9A00755F44 /* EncryptionTests.swift */,
    1.40  				438BA0F4214F89CC001A4A82 /* MailParsingTests.swift */,
    1.41 +				4393673821C26F3D00FF8BB4 /* LogTest.swift */,
    1.42 +				43C273DC21C9024A002EB4C8 /* LoggerTest.swift */,
    1.43  			);
    1.44  			path = pEpForiOSTests;
    1.45  			sourceTree = "<group>";
    1.46 @@ -2361,6 +2369,7 @@
    1.47  				A1B50A811CD26FF100B1A997 /* Constants.swift */,
    1.48  				439D40791CC79423009A4E7C /* GCD.swift */,
    1.49  				43980EDF1CBD24B000A7FC3C /* Log.swift */,
    1.50 +				43C273DA21C8F96D002EB4C8 /* Logger.swift */,
    1.51  				435B42401D211E5900119048 /* MiscUtil.swift */,
    1.52  				5D039A9B1D0EE7F900AD59EC /* PEPUtil.swift */,
    1.53  				431798761CF87FE6007DD655 /* ReferenceCounter.swift */,
    1.54 @@ -3598,6 +3607,7 @@
    1.55  				49228A5520D4035100A51E9D /* DetailCellSegue.swift in Sources */,
    1.56  				43497B38211C62DE00AC42B0 /* MessageIdentitfying.swift in Sources */,
    1.57  				4307C4701ED81F3100A276A4 /* DefaultImapSyncDelegate.swift in Sources */,
    1.58 +				43C273DB21C8F96D002EB4C8 /* Logger.swift in Sources */,
    1.59  				00FD0CE82102014C00BA0C56 /* PrimarySplitViewcontroller+ScreenComposerProtocol.swift in Sources */,
    1.60  				434E5A1B20DB9C4600D7F88A /* EmailListViewModel+MessageFolderDelegate.swift in Sources */,
    1.61  				431E58F61ED57F6500EFA77F /* AccountVerificationServiceProtocol.swift in Sources */,
    1.62 @@ -3689,6 +3699,7 @@
    1.63  				F73E4F72217F238300CCFFED /* FolderSectionViewModelTests.swift in Sources */,
    1.64  				15A763D11F72D68000670313 /* KeyChainTest.swift in Sources */,
    1.65  				43EC75B32164E97800048CFE /* DecryptionUtil.swift in Sources */,
    1.66 +				4393673921C26F3D00FF8BB4 /* LogTest.swift in Sources */,
    1.67  				43C7B9D11CEC4DDF007A612F /* MiscTests.swift in Sources */,
    1.68  				434DDC2B20D10F9A00755F44 /* EncryptionTests.swift in Sources */,
    1.69  				151F71FA202A06760057C74D /* DecryptionAttemptCounterDelegate.swift in Sources */,
    1.70 @@ -3751,6 +3762,7 @@
    1.71  				150707DC21006CD000AA213F /* ComposeUtilTest.swift in Sources */,
    1.72  				15D439A5216F7E0E00EB3933 /* AccountPickerViewModelTest.swift in Sources */,
    1.73  				1574D07D2114696B00FEDC93 /* URL+MailToTest.swift in Sources */,
    1.74 +				43C273DD21C9024A002EB4C8 /* LoggerTest.swift in Sources */,
    1.75  				4335002E212D9A6A00BD5F2A /* EmailListViewModeTests+Threading_12_Messages.swift in Sources */,
    1.76  				4356FFEC21356CB600804089 /* ReplyAllPossibleCheckerTest.swift in Sources */,
    1.77  				430C80E01D0EADC200CD4582 /* PepAdapterTests.swift in Sources */,
     2.1 --- a/pEpForiOS/Base.lproj/AccountCreation.storyboard	Thu Dec 13 19:59:43 2018 +0100
     2.2 +++ b/pEpForiOS/Base.lproj/AccountCreation.storyboard	Mon Jan 07 10:44:27 2019 +0100
     2.3 @@ -1,12 +1,11 @@
     2.4  <?xml version="1.0" encoding="UTF-8"?>
     2.5 -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="n6h-PU-h88">
     2.6 +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="n6h-PU-h88">
     2.7      <device id="retina5_5" orientation="landscape">
     2.8          <adaptation id="fullscreen"/>
     2.9      </device>
    2.10      <dependencies>
    2.11          <deployment identifier="iOS"/>
    2.12 -        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
    2.13 -        <capability name="Constraints to layout margins" minToolsVersion="6.0"/>
    2.14 +        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
    2.15          <capability name="Safe area layout guides" minToolsVersion="9.0"/>
    2.16          <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
    2.17      </dependencies>
    2.18 @@ -39,7 +38,7 @@
    2.19                                                      <nil key="highlightedColor"/>
    2.20                                                  </label>
    2.21                                                  <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Rick Deckard" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="g9y-3s-qnK">
    2.22 -                                                    <rect key="frame" x="75" y="20" width="641" height="17"/>
    2.23 +                                                    <rect key="frame" x="75" y="20.666666666666668" width="641" height="17.000000000000004"/>
    2.24                                                      <accessibility key="accessibilityConfiguration" identifier="nameOfTheUser" label="Name"/>
    2.25                                                      <fontDescription key="fontDescription" type="system" pointSize="14"/>
    2.26                                                      <textInputTraits key="textInputTraits" autocorrectionType="no" returnKeyType="next"/>
    2.27 @@ -75,7 +74,7 @@
    2.28                                                      <nil key="highlightedColor"/>
    2.29                                                  </label>
    2.30                                                  <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="rick.deckard@pep.li" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="TPZ-TM-PaG">
    2.31 -                                                    <rect key="frame" x="71" y="20" width="645" height="17"/>
    2.32 +                                                    <rect key="frame" x="71" y="20.666666666666668" width="645" height="17.000000000000004"/>
    2.33                                                      <accessibility key="accessibilityConfiguration" identifier="email" label="Email"/>
    2.34                                                      <fontDescription key="fontDescription" type="system" pointSize="14"/>
    2.35                                                      <textInputTraits key="textInputTraits" autocorrectionType="no" keyboardType="emailAddress" returnKeyType="next"/>
    2.36 @@ -111,7 +110,7 @@
    2.37                                                      <nil key="highlightedColor"/>
    2.38                                                  </label>
    2.39                                                  <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="rick.deckard" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="5Mt-BZ-h4K">
    2.40 -                                                    <rect key="frame" x="109" y="20" width="607" height="17"/>
    2.41 +                                                    <rect key="frame" x="109" y="20.666666666666668" width="607" height="17.000000000000004"/>
    2.42                                                      <accessibility key="accessibilityConfiguration" identifier="username" label="Username"/>
    2.43                                                      <fontDescription key="fontDescription" type="system" pointSize="14"/>
    2.44                                                      <textInputTraits key="textInputTraits" autocorrectionType="no" returnKeyType="next"/>
    2.45 @@ -150,7 +149,7 @@
    2.46                                                      <nil key="highlightedColor"/>
    2.47                                                  </label>
    2.48                                                  <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="electricsheep23" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="91l-1l-FuW">
    2.49 -                                                    <rect key="frame" x="104" y="19" width="612" height="17"/>
    2.50 +                                                    <rect key="frame" x="104" y="19.333333333333332" width="612" height="16.999999999999996"/>
    2.51                                                      <accessibility key="accessibilityConfiguration" identifier="password" label="Password"/>
    2.52                                                      <fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="14"/>
    2.53                                                      <textInputTraits key="textInputTraits" autocorrectionType="no" secureTextEntry="YES"/>
    2.54 @@ -244,7 +243,7 @@
    2.55                                                      <nil key="highlightedColor"/>
    2.56                                                  </label>
    2.57                                                  <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="mail.pep.li" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="HOb-bu-iVh">
    2.58 -                                                    <rect key="frame" x="80" y="20" width="636" height="17"/>
    2.59 +                                                    <rect key="frame" x="80" y="20.666666666666668" width="636" height="17.000000000000004"/>
    2.60                                                      <accessibility key="accessibilityConfiguration" identifier="imapServer" label="IMAP Server"/>
    2.61                                                      <fontDescription key="fontDescription" type="system" pointSize="14"/>
    2.62                                                      <textInputTraits key="textInputTraits" autocorrectionType="no" returnKeyType="next"/>
    2.63 @@ -280,7 +279,7 @@
    2.64                                                      <nil key="highlightedColor"/>
    2.65                                                  </label>
    2.66                                                  <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="993" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="lZX-n9-ibu">
    2.67 -                                                    <rect key="frame" x="63" y="20" width="653" height="17"/>
    2.68 +                                                    <rect key="frame" x="63" y="20.666666666666668" width="653" height="17.000000000000004"/>
    2.69                                                      <accessibility key="accessibilityConfiguration" identifier="imapPort" label="IMAP Port"/>
    2.70                                                      <fontDescription key="fontDescription" type="system" pointSize="14"/>
    2.71                                                      <textInputTraits key="textInputTraits" autocorrectionType="no" keyboardType="numberPad"/>
    2.72 @@ -307,7 +306,7 @@
    2.73                                              <autoresizingMask key="autoresizingMask"/>
    2.74                                              <subviews>
    2.75                                                  <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="H6H-wM-1tb">
    2.76 -                                                    <rect key="frame" x="168" y="14" width="548" height="29"/>
    2.77 +                                                    <rect key="frame" x="168" y="14.666666666666664" width="548" height="29"/>
    2.78                                                      <accessibility key="accessibilityConfiguration" identifier="imapTransportSecurity" label="Transport Security"/>
    2.79                                                      <fontDescription key="fontDescription" type="system" pointSize="14"/>
    2.80                                                      <state key="normal" title="Plain &gt;">
    2.81 @@ -377,7 +376,7 @@
    2.82                          <rect key="frame" x="0.0" y="0.0" width="736" height="414"/>
    2.83                          <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
    2.84                          <color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
    2.85 -                        <activityIndicatorView key="tableFooterView" hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" misplaced="YES" hidesWhenStopped="YES" style="whiteLarge" id="c3w-UO-9n8">
    2.86 +                        <activityIndicatorView key="tableFooterView" hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="whiteLarge" id="c3w-UO-9n8">
    2.87                              <rect key="frame" x="0.0" y="200" width="736" height="37"/>
    2.88                              <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
    2.89                              <color key="color" red="0.33329343795776367" green="0.33335629105567932" blue="0.33328947424888611" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
    2.90 @@ -402,7 +401,7 @@
    2.91                                                      <nil key="highlightedColor"/>
    2.92                                                  </label>
    2.93                                                  <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="smtp.pep.li" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="HIi-Wv-jJs">
    2.94 -                                                    <rect key="frame" x="80" y="20" width="636" height="17"/>
    2.95 +                                                    <rect key="frame" x="80" y="20.666666666666668" width="636" height="17.000000000000004"/>
    2.96                                                      <accessibility key="accessibilityConfiguration" identifier="smtpServer" label="SMTP Server"/>
    2.97                                                      <fontDescription key="fontDescription" type="system" pointSize="14"/>
    2.98                                                      <textInputTraits key="textInputTraits" autocorrectionType="no" returnKeyType="next"/>
    2.99 @@ -438,7 +437,7 @@
   2.100                                                      <nil key="highlightedColor"/>
   2.101                                                  </label>
   2.102                                                  <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="587" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="LfP-KG-Zok">
   2.103 -                                                    <rect key="frame" x="63" y="20" width="653" height="17"/>
   2.104 +                                                    <rect key="frame" x="63" y="20.666666666666668" width="653" height="17.000000000000004"/>
   2.105                                                      <accessibility key="accessibilityConfiguration" identifier="smtpPort" label="SMTP Port"/>
   2.106                                                      <fontDescription key="fontDescription" type="system" pointSize="14"/>
   2.107                                                      <textInputTraits key="textInputTraits" autocorrectionType="no" keyboardType="numberPad"/>
   2.108 @@ -474,7 +473,7 @@
   2.109                                                      <nil key="highlightedColor"/>
   2.110                                                  </label>
   2.111                                                  <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Cjb-ue-OdU">
   2.112 -                                                    <rect key="frame" x="168" y="14" width="548" height="29"/>
   2.113 +                                                    <rect key="frame" x="168" y="14.666666666666664" width="548" height="29"/>
   2.114                                                      <accessibility key="accessibilityConfiguration" identifier="smtpTransportSecurity" label="Transport Security"/>
   2.115                                                      <fontDescription key="fontDescription" type="system" pointSize="14"/>
   2.116                                                      <state key="normal" title="Plain &gt;">
   2.117 @@ -617,7 +616,7 @@
   2.118                                                              <action selector="emailChanged:" destination="clh-8B-z2B" eventType="editingChanged" id="hsV-YG-JFW"/>
   2.119                                                          </connections>
   2.120                                                      </textField>
   2.121 -                                                    <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="line" placeholder="Password" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="3wB-RC-5fz" customClass="CredentialTextField" customModule="pEpForiOS" customModuleProvider="target">
   2.122 +                                                    <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="line" placeholder="Password" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="3wB-RC-5fz" customClass="CredentialTextField" customModule="pEpForiOS" customModuleProvider="target">
   2.123                                                          <rect key="frame" x="0.0" y="124" width="250" height="28"/>
   2.124                                                          <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
   2.125                                                          <accessibility key="accessibilityConfiguration" identifier="password"/>
   2.126 @@ -707,7 +706,7 @@
   2.127                                              <constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="O4c-eF-dJT" secondAttribute="bottom" constant="46" id="rrf-8k-elt">
   2.128                                                  <variation key="heightClass=compact" constant="8"/>
   2.129                                              </constraint>
   2.130 -                                            <constraint firstItem="lTY-gw-zK9" firstAttribute="top" relation="greaterThanOrEqual" secondItem="7IS-Mp-8VB" secondAttribute="bottom" constant="50" id="sAa-Hc-jVc"/>
   2.131 +                                            <constraint firstItem="lTY-gw-zK9" firstAttribute="top" relation="greaterThanOrEqual" secondItem="7IS-Mp-8VB" secondAttribute="bottom" priority="999" constant="50" id="sAa-Hc-jVc"/>
   2.132                                              <constraint firstItem="lTY-gw-zK9" firstAttribute="top" secondItem="7IS-Mp-8VB" secondAttribute="bottom" priority="750" constant="50" id="y1H-ee-3d9"/>
   2.133                                          </constraints>
   2.134                                          <viewLayoutGuide key="safeArea" id="8XY-h6-v7E"/>
   2.135 @@ -781,6 +780,7 @@
   2.136                          <outlet property="loginButton" destination="lTY-gw-zK9" id="Mfx-D4-xzW"/>
   2.137                          <outlet property="manualConfigButton" destination="O4c-eF-dJT" id="vnZ-WA-mrK"/>
   2.138                          <outlet property="password" destination="3wB-RC-5fz" id="nje-PL-ldq"/>
   2.139 +                        <outlet property="textFieldsContainerView" destination="7IS-Mp-8VB" id="JVB-4D-vlA"/>
   2.140                          <outlet property="user" destination="mKi-gF-bu9" id="UKH-Mf-Jwf"/>
   2.141                      </connections>
   2.142                  </viewController>
     3.1 --- a/pEpForiOS/Base.lproj/Main.storyboard	Thu Dec 13 19:59:43 2018 +0100
     3.2 +++ b/pEpForiOS/Base.lproj/Main.storyboard	Mon Jan 07 10:44:27 2019 +0100
     3.3 @@ -110,6 +110,7 @@
     3.4                                              <rect key="frame" x="56" y="50" width="20" height="20"/>
     3.5                                              <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
     3.6                                              <constraints>
     3.7 +                                                <constraint firstAttribute="width" constant="20" id="Kc3-zI-6iP"/>
     3.8                                                  <constraint firstAttribute="width" secondItem="m0u-Jn-mQU" secondAttribute="height" multiplier="1:1" id="fnp-Yy-49g"/>
     3.9                                              </constraints>
    3.10                                          </imageView>
     4.1 --- a/pEpForiOS/Error/DisplayUserError.swift	Thu Dec 13 19:59:43 2018 +0100
     4.2 +++ b/pEpForiOS/Error/DisplayUserError.swift	Mon Jan 07 10:44:27 2019 +0100
     4.3 @@ -69,6 +69,10 @@
     4.4      /// errors differentelly or even ignore certain types.
     4.5      let type:ErrorType
     4.6  
     4.7 +    /// Some error types have extra info to be used
     4.8 +    var extraInfo: String?
     4.9 +
    4.10 +
    4.11      /// Creates a user friendly error to present in an alert or such. I case the error type is not
    4.12      /// suitable to display to the user (should fail silently), nil is returned.
    4.13      ///
    4.14 @@ -76,12 +80,45 @@
    4.15      /// - Returns:  nil if you should not bother the user with this kind of error,
    4.16      ///             user friendly error otherwize.
    4.17      init?(withError error: Error) {
    4.18 +        extraInfo = nil
    4.19          if let displayUserError = error as? DisplayUserError {
    4.20              self = displayUserError
    4.21          } else if let smtpError = error as? SmtpSendError {
    4.22              type = DisplayUserError.type(forError: smtpError)
    4.23 +            switch smtpError {
    4.24 +            case .authenticationFailed( _, let account):
    4.25 +                extraInfo = account
    4.26 +            case .illegalState(_):
    4.27 +                break
    4.28 +            case .connectionLost(_):
    4.29 +                break
    4.30 +            case .connectionTerminated(_):
    4.31 +                break
    4.32 +            case .connectionTimedOut(_):
    4.33 +                break
    4.34 +            case .badResponse(_):
    4.35 +                break
    4.36 +            }
    4.37          } else if let imapError = error as? ImapSyncError {
    4.38              type = DisplayUserError.type(forError: imapError)
    4.39 +            switch imapError {
    4.40 +            case .authenticationFailed(_, let account):
    4.41 +                extraInfo = account
    4.42 +            case .illegalState(_):
    4.43 +                break
    4.44 +            case .connectionLost(_):
    4.45 +                break
    4.46 +            case .connectionTerminated(_):
    4.47 +                break
    4.48 +            case .connectionTimedOut(_):
    4.49 +                break
    4.50 +            case .folderAppendFailed:
    4.51 +                break
    4.52 +            case .badResponse(_):
    4.53 +                break
    4.54 +            case .actionFailed:
    4.55 +                break
    4.56 +            }
    4.57          } else if let oauthInternalError = error as? OAuth2AuthViewModelError {
    4.58              type = DisplayUserError.type(forError: oauthInternalError)
    4.59          } else if let oauthError = error as? OAuth2AuthorizationError {
    4.60 @@ -297,8 +334,14 @@
    4.61      public var errorDescription: String? {
    4.62          switch type {
    4.63          case .authenticationFailed:
    4.64 +            var textToShow = ""
    4.65 +            if let account = extraInfo {
    4.66 +                textToShow = "It was impossible to login to \(String(describing: account)). Username or password is wrong."
    4.67 +            } else {
    4.68 +                textToShow = "It was impossible to login to the server. Username or password is wrong."
    4.69 +            }
    4.70              return NSLocalizedString(
    4.71 -                "It was impossible to login to the server. Username or password is wrong.",
    4.72 +                textToShow,
    4.73                  comment:
    4.74                  "Error message shown to the user in case the authentication to IMAP or SMTP server failed.")
    4.75          case .messageNotSent:
     5.1 --- a/pEpForiOS/Network/DefaultImapSyncDelegate.swift	Thu Dec 13 19:59:43 2018 +0100
     5.2 +++ b/pEpForiOS/Network/DefaultImapSyncDelegate.swift	Mon Jan 07 10:44:27 2019 +0100
     5.3 @@ -43,7 +43,7 @@
     5.4      }
     5.5  
     5.6      public func authenticationFailed(_ sync: ImapSync, notification: Notification?) {
     5.7 -        forceErrorDelegate().handle(error: ImapSyncError.authenticationFailed(#function))
     5.8 +        forceErrorDelegate().handle(error: ImapSyncError.authenticationFailed(#function, sync.connectInfo.account.user.address))
     5.9      }
    5.10  
    5.11      public func connectionLost(_ sync: ImapSync, notification: Notification?) {
     6.1 --- a/pEpForiOS/Network/ImapSyncError.swift	Thu Dec 13 19:59:43 2018 +0100
     6.2 +++ b/pEpForiOS/Network/ImapSyncError.swift	Mon Jan 07 10:44:27 2019 +0100
     6.3 @@ -12,7 +12,7 @@
     6.4       */
     6.5      case illegalState(FunctionName)
     6.6  
     6.7 -    case authenticationFailed(FunctionName)
     6.8 +    case authenticationFailed(FunctionName, String)
     6.9      case connectionLost(FunctionName)
    6.10      case connectionTerminated(FunctionName)
    6.11      case connectionTimedOut(FunctionName)
     7.1 --- a/pEpForiOS/Network/Service/LoginSmtpOperation.swift	Thu Dec 13 19:59:43 2018 +0100
     7.2 +++ b/pEpForiOS/Network/Service/LoginSmtpOperation.swift	Mon Jan 07 10:44:27 2019 +0100
     7.3 @@ -46,7 +46,7 @@
     7.4      }
     7.5  
     7.6      public func authenticationFailed(_ smtp: SmtpSend, theNotification: Notification?) {
     7.7 -        addError(SmtpSendError.authenticationFailed(#function))
     7.8 +        addError(SmtpSendError.authenticationFailed(#function, smtp.connectInfo.account.user.address))
     7.9          markAsFinished()
    7.10      }
    7.11  
     8.1 --- a/pEpForiOS/Network/SmtpSendError.swift	Thu Dec 13 19:59:43 2018 +0100
     8.2 +++ b/pEpForiOS/Network/SmtpSendError.swift	Mon Jan 07 10:44:27 2019 +0100
     8.3 @@ -12,7 +12,7 @@
     8.4       */
     8.5      case illegalState(FunctionName)
     8.6  
     8.7 -    case authenticationFailed(FunctionName)
     8.8 +    case authenticationFailed(FunctionName, String)
     8.9      case connectionLost(FunctionName)
    8.10      case connectionTerminated(FunctionName)
    8.11      case connectionTimedOut(FunctionName)
     9.1 --- a/pEpForiOS/UI/Login/LoginViewController+Keyboard.swift	Thu Dec 13 19:59:43 2018 +0100
     9.2 +++ b/pEpForiOS/UI/Login/LoginViewController+Keyboard.swift	Mon Jan 07 10:44:27 2019 +0100
     9.3 @@ -12,15 +12,15 @@
     9.4  extension LoginViewController: UIScrollViewDelegate {
     9.5  
     9.6      func configureKeyboardAwareness() {
     9.7 -        NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow), name:NSNotification.Name.UIKeyboardWillShow, object: nil)
     9.8 +        NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillChangeFrame), name: NSNotification.Name.UIKeyboardWillChangeFrame, object: nil)
     9.9          NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide), name:NSNotification.Name.UIKeyboardWillHide, object: nil)
    9.10      }
    9.11  
    9.12 -    @objc func keyboardWillShow(notification:NSNotification){
    9.13 -
    9.14 +    
    9.15 +    @objc func keyboardWillChangeFrame(notification: NSNotification) {
    9.16          guard let keyboardFrame = (notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue)?
    9.17              .cgRectValue else {
    9.18 -            return
    9.19 +                return
    9.20          }
    9.21          if UIDevice.current.userInterfaceIdiom == .pad && self.traitCollection.verticalSizeClass == .regular {
    9.22              var loginButtonUnderSpace = loginButton.frame.maxY
    9.23 @@ -35,7 +35,25 @@
    9.24              biggerLoginButtonFrame.size = CGSize(width: loginButton.frame.width, height: loginButton.frame.height + 20)
    9.25              contentScrollView.scrollRectToVisible(biggerLoginButtonFrame, animated: true)
    9.26              contentScrollView.isScrollEnabled = false
    9.27 +            
    9.28 +        }
    9.29 +        else if self.traitCollection.verticalSizeClass == .compact {
    9.30 +            var contentInset:UIEdgeInsets = contentScrollView.contentInset
    9.31 +            contentInset.bottom = keyboardFrame.size.height
    9.32 +            contentScrollView.contentInset = contentInset
    9.33 +            contentScrollView.scrollIndicatorInsets = contentInset
    9.34 +            self.contentScrollView.delegate = self
    9.35  
    9.36 +            if self.password.isFirstResponder {
    9.37 +                contentScrollView.isScrollEnabled = true
    9.38 +                var textFieldsFrame = self.textFieldsContainerView.frame
    9.39 +                textFieldsFrame.size = CGSize(width: textFieldsContainerView.frame.width, height: textFieldsContainerView.frame.height + 20)
    9.40 +                self.contentScrollView.scrollRectToVisible(textFieldsFrame, animated: false)
    9.41 +            }
    9.42 +            else {
    9.43 +                self.contentScrollView.scrollRectToVisible(self.loginButton.frame, animated: false)
    9.44 +            }
    9.45 +            
    9.46          }
    9.47          else {
    9.48              var contentInset:UIEdgeInsets = contentScrollView.contentInset
    9.49 @@ -43,9 +61,8 @@
    9.50              contentScrollView.contentInset = contentInset
    9.51              contentScrollView.scrollIndicatorInsets = contentInset
    9.52              self.contentScrollView.delegate = self
    9.53 -            self.contentScrollView.scrollRectToVisible(self.loginButton.frame, animated: true)
    9.54 +            self.contentScrollView.scrollRectToVisible(self.loginButton.frame, animated: false)
    9.55          }
    9.56 -
    9.57      }
    9.58  
    9.59      @objc func keyboardWillHide(notification:NSNotification){
    10.1 --- a/pEpForiOS/UI/Login/LoginViewController.swift	Thu Dec 13 19:59:43 2018 +0100
    10.2 +++ b/pEpForiOS/UI/Login/LoginViewController.swift	Mon Jan 07 10:44:27 2019 +0100
    10.3 @@ -65,6 +65,7 @@
    10.4      @IBOutlet var user: UITextField!
    10.5      @IBOutlet var activityIndicatorView: UIActivityIndicatorView!
    10.6  
    10.7 +    @IBOutlet var textFieldsContainerView: UIView!
    10.8      @IBOutlet var contentScrollView: UIScrollView!
    10.9  
   10.10      var isCurrentlyVerifying = false {
   10.11 @@ -136,9 +137,6 @@
   10.12          self.navigationController?.navigationBar.isTranslucent = true
   10.13          self.navigationController?.navigationBar.backgroundColor = UIColor.clear
   10.14          
   10.15 -        NotificationCenter.default.addObserver(forName: NSNotification.Name.UIKeyboardWillShow, object: self, queue: nil) { (notification) in
   10.16 -            print("hola")
   10.17 -        }
   10.18      }
   10.19  
   10.20      @objc func backButton() {
    11.1 --- a/pEpForiOS/UI/Login/ViewModel/LoginViewModel.swift	Thu Dec 13 19:59:43 2018 +0100
    11.2 +++ b/pEpForiOS/UI/Login/ViewModel/LoginViewModel.swift	Mon Jan 07 10:44:27 2019 +0100
    11.3 @@ -192,6 +192,8 @@
    11.4                    service: AccountVerificationServiceProtocol,
    11.5                    result: AccountVerificationResult) {
    11.6          if result == .ok {
    11.7 +            Log.info(component: String.bug1442, content: "Account: \(account.user.address) is stored for first time")
    11.8 +            //remove obsolete code on EmailListViewController
    11.9              MessageModel.performAndWait {
   11.10                  account.save()
   11.11              }
    12.1 --- a/pEpForiOS/UI/Settings/SettingsTableViewController.swift	Thu Dec 13 19:59:43 2018 +0100
    12.2 +++ b/pEpForiOS/UI/Settings/SettingsTableViewController.swift	Mon Jan 07 10:44:27 2019 +0100
    12.3 @@ -121,6 +121,12 @@
    12.4  
    12.5      private func deleteRowAt(_ indexPath: IndexPath) {
    12.6          self.viewModel.delete(section: indexPath.section, cell: indexPath.row)
    12.7 +
    12.8 +        if let position =  navigationController?.viewControllers.count, let previousVc = navigationController?.viewControllers[position - 1] as? EmailViewController {
    12.9 +            if viewModel.canBeShown(Message: previousVc.message) {
   12.10 +                navigationController?.viewControllers.remove(at: position-1)
   12.11 +            }
   12.12 +        }
   12.13          if self.viewModel.noAccounts() {
   12.14              self.performSegue(withIdentifier: "noAccounts", sender: nil)
   12.15          }
    13.1 --- a/pEpForiOS/UI/Settings/ViewModel/SettingsViewModel.swift	Thu Dec 13 19:59:43 2018 +0100
    13.2 +++ b/pEpForiOS/UI/Settings/ViewModel/SettingsViewModel.swift	Mon Jan 07 10:44:27 2019 +0100
    13.3 @@ -33,6 +33,11 @@
    13.4          }
    13.5      }
    13.6  
    13.7 +    //temporal stub
    13.8 +    func canBeShown(Message: Message? ) -> Bool{
    13.9 +        return false
   13.10 +    }
   13.11 +
   13.12      func rowType(for indexPath: IndexPath) -> SettingsCellViewModel.SettingType? {
   13.13          guard let model = self[indexPath.section][indexPath.row] as?
   13.14              ComplexSettingCellViewModelProtocol else {
    14.1 --- a/pEpForiOS/UI/Util/BaseTableViewController.swift	Thu Dec 13 19:59:43 2018 +0100
    14.2 +++ b/pEpForiOS/UI/Util/BaseTableViewController.swift	Mon Jan 07 10:44:27 2019 +0100
    14.3 @@ -65,9 +65,65 @@
    14.4  
    14.5      func error(propagator: ErrorPropagator, error: Error) {
    14.6          if shouldHandleErrors {
    14.7 -            UIUtils.show(error: error, inViewController: self)
    14.8 +            if error is SmtpSendError || error is ImapSyncError {
    14.9 +                smtpOrImapAuthError(error: error)
   14.10 +            } else {
   14.11 +                UIUtils.show(error: error, inViewController: self)
   14.12 +            }
   14.13          }
   14.14      }
   14.15 +
   14.16 +    func smtpOrImapAuthError(error: Error) {
   14.17 +        var extraInfo = ""
   14.18 +
   14.19 +        if let smtpError = error as? SmtpSendError {
   14.20 +            switch smtpError {
   14.21 +            case .authenticationFailed( _, let account):
   14.22 +                extraInfo = account
   14.23 +            case .illegalState(_):
   14.24 +                break
   14.25 +            case .connectionLost(_):
   14.26 +                break
   14.27 +            case .connectionTerminated(_):
   14.28 +                break
   14.29 +            case .connectionTimedOut(_):
   14.30 +                break
   14.31 +            case .badResponse(_):
   14.32 +                break
   14.33 +            }
   14.34 +        } else if let imapError = error as? ImapSyncError {
   14.35 +            switch imapError {
   14.36 +            case .authenticationFailed(_, let account):
   14.37 +                extraInfo = account
   14.38 +            case .illegalState(_):
   14.39 +                break
   14.40 +            case .connectionLost(_):
   14.41 +                break
   14.42 +            case .connectionTerminated(_):
   14.43 +                break
   14.44 +            case .connectionTimedOut(_):
   14.45 +                break
   14.46 +            case .folderAppendFailed:
   14.47 +                break
   14.48 +            case .badResponse(_):
   14.49 +                break
   14.50 +            case .actionFailed:
   14.51 +                break
   14.52 +            }
   14.53 +        }
   14.54 +        let showed = appConfig.showedAccountsError[extraInfo]
   14.55 +        if let swd = showed, swd  {
   14.56 +            //this error must not be shown
   14.57 +        } else {
   14.58 +            UIUtils.show(error: error, inViewController: self)
   14.59 +            if showed == nil {
   14.60 +                appConfig.showedAccountsError[extraInfo] = false
   14.61 +            } else if showed == false {
   14.62 +                appConfig.showedAccountsError[extraInfo] = true
   14.63 +            }
   14.64 +        }
   14.65 +    }
   14.66 +
   14.67  }
   14.68  
   14.69  extension BaseTableViewController: KickOffMySelfProtocol {
    15.1 --- a/pEpForiOS/UI/Util/BaseViewController.swift	Thu Dec 13 19:59:43 2018 +0100
    15.2 +++ b/pEpForiOS/UI/Util/BaseViewController.swift	Mon Jan 07 10:44:27 2019 +0100
    15.3 @@ -39,7 +39,62 @@
    15.4  
    15.5      func error(propagator: ErrorPropagator, error: Error) {
    15.6          if shouldHandleErrors {
    15.7 +            if error is SmtpSendError || error is ImapSyncError {
    15.8 +                smtpOrImapAuthError(error: error)
    15.9 +            } else {
   15.10 +                UIUtils.show(error: error, inViewController: self)
   15.11 +            }
   15.12 +        }
   15.13 +    }
   15.14 +
   15.15 +    func smtpOrImapAuthError(error: Error) {
   15.16 +        var extraInfo = ""
   15.17 +
   15.18 +        if let smtpError = error as? SmtpSendError {
   15.19 +            switch smtpError {
   15.20 +            case .authenticationFailed( _, let account):
   15.21 +                extraInfo = account
   15.22 +            case .illegalState(_):
   15.23 +                break
   15.24 +            case .connectionLost(_):
   15.25 +                break
   15.26 +            case .connectionTerminated(_):
   15.27 +                break
   15.28 +            case .connectionTimedOut(_):
   15.29 +                break
   15.30 +            case .badResponse(_):
   15.31 +                break
   15.32 +            }
   15.33 +        } else if let imapError = error as? ImapSyncError {
   15.34 +            switch imapError {
   15.35 +            case .authenticationFailed(_, let account):
   15.36 +                extraInfo = account
   15.37 +            case .illegalState(_):
   15.38 +                break
   15.39 +            case .connectionLost(_):
   15.40 +                break
   15.41 +            case .connectionTerminated(_):
   15.42 +                break
   15.43 +            case .connectionTimedOut(_):
   15.44 +                break
   15.45 +            case .folderAppendFailed:
   15.46 +                break
   15.47 +            case .badResponse(_):
   15.48 +                break
   15.49 +            case .actionFailed:
   15.50 +                break
   15.51 +            }
   15.52 +        }
   15.53 +        let showed = appConfig.showedAccountsError[extraInfo]
   15.54 +        if let swd = showed, swd  {
   15.55 +            //this error must not be shown
   15.56 +        } else {
   15.57              UIUtils.show(error: error, inViewController: self)
   15.58 +            if showed == nil {
   15.59 +                appConfig.showedAccountsError[extraInfo] = false
   15.60 +            } else if showed == false {
   15.61 +                appConfig.showedAccountsError[extraInfo] = true
   15.62 +            }
   15.63          }
   15.64      }
   15.65  }
    16.1 --- a/pEpForiOS/Util/AppConfig.swift	Thu Dec 13 19:59:43 2018 +0100
    16.2 +++ b/pEpForiOS/Util/AppConfig.swift	Mon Jan 07 10:44:27 2019 +0100
    16.3 @@ -14,6 +14,8 @@
    16.4  class AppConfig {
    16.5      let messageSyncService: MessageSyncServiceProtocol
    16.6  
    16.7 +    var showedAccountsError: [String:Bool]
    16.8 +
    16.9      let errorPropagator : ErrorPropagator
   16.10  
   16.11      /**
   16.12 @@ -34,5 +36,6 @@
   16.13          self.mySelfer = mySelfer
   16.14          self.errorPropagator = errorPropagator
   16.15          self.oauth2AuthorizationFactory = oauth2AuthorizationFactory
   16.16 +        self.showedAccountsError = [:]
   16.17      }
   16.18  }
    17.1 --- a/pEpForiOS/Util/Extensions/String+Extensions.swift	Thu Dec 13 19:59:43 2018 +0100
    17.2 +++ b/pEpForiOS/Util/Extensions/String+Extensions.swift	Mon Jan 07 10:44:27 2019 +0100
    17.3 @@ -9,6 +9,8 @@
    17.4  import UIKit
    17.5  
    17.6  public extension String {
    17.7 +
    17.8 +    static let bug1442 = "bug1442"
    17.9      static let returnKey = "\n"
   17.10      static let space = " "
   17.11  
    18.1 --- a/pEpForiOS/Util/Log.swift	Thu Dec 13 19:59:43 2018 +0100
    18.2 +++ b/pEpForiOS/Util/Log.swift	Mon Jan 07 10:44:27 2019 +0100
    18.3 @@ -6,6 +6,8 @@
    18.4  //  Copyright © 2016 p≡p Security S.A. All rights reserved.
    18.5  //
    18.6  
    18.7 +import os.log
    18.8 +
    18.9  import MessageModel
   18.10  
   18.11  enum LoggingSeverity {
   18.12 @@ -15,6 +17,42 @@
   18.13      case error
   18.14  }
   18.15  
   18.16 +public func zlog(_ message: StaticString,
   18.17 +                 function: String = #function,
   18.18 +                 filePath: String = #file,
   18.19 +                 fileLine: Int = #line,
   18.20 +                 _ args: CVarArg...) {
   18.21 +    if #available(iOS 10.0, macOS 10.12, tvOS 10.0, watchOS 3.0, *) {
   18.22 +        os_log("%@:%d %@:", filePath, fileLine, function)
   18.23 +        switch args.count {
   18.24 +        case 1:
   18.25 +            os_log(message, args[0])
   18.26 +        case 2:
   18.27 +            os_log(message, args[0], args[1])
   18.28 +        case 3:
   18.29 +            os_log(message, args[0], args[1], args[2])
   18.30 +        case 4:
   18.31 +            os_log(message, args[0], args[1], args[2], args[3])
   18.32 +        case 5:
   18.33 +            os_log(message, args[0], args[1], args[2], args[3], args[4])
   18.34 +        case 6:
   18.35 +            os_log(message, args[0], args[1], args[2], args[3], args[4], args[5])
   18.36 +        case 7:
   18.37 +            os_log(message, args[0], args[1], args[2], args[3], args[4], args[5], args[6])
   18.38 +        case 8:
   18.39 +            os_log(message, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7])
   18.40 +        case 9:
   18.41 +            os_log(message, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7],
   18.42 +                   args[8])
   18.43 +        case 10:
   18.44 +            os_log(message, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7],
   18.45 +                   args[8], args[9])
   18.46 +        default:
   18.47 +            os_log(message, args)
   18.48 +        }
   18.49 +    }
   18.50 +}
   18.51 +
   18.52  /**
   18.53   Handling the actual logging.
   18.54   */
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/pEpForiOS/Util/Logger.swift	Mon Jan 07 10:44:27 2019 +0100
    19.3 @@ -0,0 +1,345 @@
    19.4 +//
    19.5 +//  Logger.swift
    19.6 +//  pEp
    19.7 +//
    19.8 +//  Created by Dirk Zimmermann on 18.12.18.
    19.9 +//  Copyright © 2018 p≡p Security S.A. All rights reserved.
   19.10 +//
   19.11 +
   19.12 +import Foundation
   19.13 +import os.log
   19.14 +
   19.15 +public class Logger {
   19.16 +    public enum Severity {
   19.17 +        /**
   19.18 +         OSLog.default
   19.19 +         */
   19.20 +        case `default`
   19.21 +        case info
   19.22 +        case debug
   19.23 +        case error
   19.24 +        case fault
   19.25 +
   19.26 +        @available(iOS 10.0, macOS 10.12, tvOS 10.0, watchOS 3.0, *)
   19.27 +        public func osLogType() -> OSLogType {
   19.28 +            switch self {
   19.29 +            case .default:
   19.30 +                return .default
   19.31 +            case .info:
   19.32 +                return .info
   19.33 +            case .debug:
   19.34 +                return .debug
   19.35 +            case .error:
   19.36 +                return .error
   19.37 +            case .fault:
   19.38 +                return .fault
   19.39 +            }
   19.40 +        }
   19.41 +
   19.42 +        /**
   19.43 +         Maps the internal criticality of a log  message into a subsystem of ASL levels.
   19.44 +
   19.45 +         ASL has the following:
   19.46 +         * ASL_LEVEL_EMERG
   19.47 +         * ASL_LEVEL_ALERT
   19.48 +         * ASL_LEVEL_CRIT
   19.49 +         * ASL_LEVEL_ERR
   19.50 +         * ASL_LEVEL_WARNING
   19.51 +         * ASL_LEVEL_NOTICE
   19.52 +         * ASL_LEVEL_INFO
   19.53 +         * ASL_LEVEL_DEBUG
   19.54 +         */
   19.55 +        public func aslLevelString() -> String {
   19.56 +            switch self {
   19.57 +            case .default:
   19.58 +                return "ASL_LEVEL_NOTICE"
   19.59 +            case .info:
   19.60 +                return "ASL_LEVEL_INFO"
   19.61 +            case .debug:
   19.62 +                return "ASL_LEVEL_DEBUG"
   19.63 +            case .error:
   19.64 +                return "ASL_LEVEL_ERR"
   19.65 +            case .fault:
   19.66 +                return "ASL_LEVEL_CRIT"
   19.67 +            }
   19.68 +        }
   19.69 +    }
   19.70 +
   19.71 +    public init(subsystem: String, category: String) {
   19.72 +        self.subsystem = subsystem
   19.73 +        self.category = category
   19.74 +        if #available(iOS 10.0, macOS 10.12, tvOS 10.0, watchOS 3.0, *) {
   19.75 +            osLogger = OSLog(subsystem: subsystem, category: category)
   19.76 +        } else {
   19.77 +            osLogger = nil
   19.78 +        }
   19.79 +    }
   19.80 +
   19.81 +    /**
   19.82 +     Logs to default.
   19.83 +     */
   19.84 +    public func log(function: String = #function,
   19.85 +                    filePath: String = #file,
   19.86 +                    fileLine: Int = #line,
   19.87 +                    _ message: StaticString,
   19.88 +                    _ args: CVarArg...) {
   19.89 +        saveLog(message: message,
   19.90 +                severity: .default,
   19.91 +                function: function,
   19.92 +                filePath: filePath,
   19.93 +                fileLine: fileLine,
   19.94 +                args: args)
   19.95 +    }
   19.96 +
   19.97 +    /**
   19.98 +     Logs to info.
   19.99 +     */
  19.100 +    public func info(function: String = #function,
  19.101 +                     filePath: String = #file,
  19.102 +                     fileLine: Int = #line,
  19.103 +                     _ message: StaticString,
  19.104 +                     _ args: CVarArg...) {
  19.105 +        saveLog(message: message,
  19.106 +                severity: .info,
  19.107 +                function: function,
  19.108 +                filePath: filePath,
  19.109 +                fileLine: fileLine,
  19.110 +                args: args)
  19.111 +    }
  19.112 +
  19.113 +    /**
  19.114 +     Logs to debug.
  19.115 +     */
  19.116 +    public func debug(function: String = #function,
  19.117 +                      filePath: String = #file,
  19.118 +                      fileLine: Int = #line,
  19.119 +                      _ message: StaticString,
  19.120 +                      _ args: CVarArg...) {
  19.121 +        saveLog(message: message,
  19.122 +                severity: .debug,
  19.123 +                function: function,
  19.124 +                filePath: filePath,
  19.125 +                fileLine: fileLine,
  19.126 +                args: args)
  19.127 +    }
  19.128 +
  19.129 +    /**
  19.130 +     Logs to error.
  19.131 +     */
  19.132 +    public func error(function: String = #function,
  19.133 +                      filePath: String = #file,
  19.134 +                      fileLine: Int = #line,
  19.135 +                      _ message: StaticString,
  19.136 +                      _ args: CVarArg...) {
  19.137 +        saveLog(message: message,
  19.138 +                severity: .error,
  19.139 +                function: function,
  19.140 +                filePath: filePath,
  19.141 +                fileLine: fileLine,
  19.142 +                args: args)
  19.143 +    }
  19.144 +
  19.145 +    /**
  19.146 +     Logs to fault.
  19.147 +     */
  19.148 +    public func fault(function: String = #function,
  19.149 +                      filePath: String = #file,
  19.150 +                      fileLine: Int = #line,
  19.151 +                      _ message: StaticString,
  19.152 +                      _ args: CVarArg...) {
  19.153 +        saveLog(message: message,
  19.154 +                severity: .fault,
  19.155 +                function: function,
  19.156 +                filePath: filePath,
  19.157 +                fileLine: fileLine,
  19.158 +                args: args)
  19.159 +    }
  19.160 +
  19.161 +    /**
  19.162 +     Testing only. If you want to test the fallback to ASL logging you may have to call
  19.163 +     this, as all the logging is deferred to a serial queue.
  19.164 +     */
  19.165 +    public func testFlush() {
  19.166 +        if #available(iOS 10.0, macOS 10.12, tvOS 10.0, watchOS 3.0, *) {
  19.167 +            // no sense on these versions
  19.168 +        } else {
  19.169 +            aslLogQueue.sync {
  19.170 +                // nothing
  19.171 +            }
  19.172 +        }
  19.173 +    }
  19.174 +
  19.175 +    private let subsystem: String
  19.176 +    private let category: String
  19.177 +
  19.178 +    private let osLogger: Any?
  19.179 +
  19.180 +    private func saveLog(message: StaticString,
  19.181 +                         severity: Severity,
  19.182 +                         function: String = #function,
  19.183 +                         filePath: String = #file,
  19.184 +                         fileLine: Int = #line,
  19.185 +                         args: [CVarArg]) {
  19.186 +        if #available(iOS 10.0, macOS 10.12, tvOS 10.0, watchOS 3.0, *) {
  19.187 +            osLog(message: message,
  19.188 +                  severity: severity,
  19.189 +                  function: function,
  19.190 +                  filePath: filePath,
  19.191 +                  fileLine: fileLine,
  19.192 +                  args: args)
  19.193 +        } else {
  19.194 +            aslLog(message: message,
  19.195 +                   severity: severity,
  19.196 +                   function: function,
  19.197 +                   filePath: filePath,
  19.198 +                   fileLine: fileLine,
  19.199 +                   args: args)
  19.200 +        }
  19.201 +    }
  19.202 +
  19.203 +    @available(iOS 10.0, macOS 10.12, tvOS 10.0, watchOS 3.0, *)
  19.204 +    private func osLog(message: StaticString,
  19.205 +                       severity: Severity,
  19.206 +                       function: String = #function,
  19.207 +                       filePath: String = #file,
  19.208 +                       fileLine: Int = #line,
  19.209 +                       args: [CVarArg]) {
  19.210 +        let theLog = osLogger as! OSLog
  19.211 +        let theType = severity.osLogType()
  19.212 +        os_log("%@:%d %@:",
  19.213 +               log: theLog,
  19.214 +               type: theType,
  19.215 +               filePath,
  19.216 +               fileLine,
  19.217 +               function)
  19.218 +        switch args.count {
  19.219 +        case 0:
  19.220 +            os_log(message,
  19.221 +                   log: theLog,
  19.222 +                   type: theType)
  19.223 +        case 1:
  19.224 +            os_log(message,
  19.225 +                   log: theLog,
  19.226 +                   type: theType,
  19.227 +                   args[0])
  19.228 +        case 2:
  19.229 +            os_log(message,
  19.230 +                   log: theLog,
  19.231 +                   type: theType,
  19.232 +                   args[0], args[1])
  19.233 +        case 3:
  19.234 +            os_log(message,
  19.235 +                   log: theLog,
  19.236 +                   type: theType,
  19.237 +                   args[0], args[1], args[2])
  19.238 +        case 4:
  19.239 +            os_log(message,
  19.240 +                   log: theLog,
  19.241 +                   type: theType,
  19.242 +                   args[0], args[1], args[2], args[3])
  19.243 +        case 5:
  19.244 +            os_log(message,
  19.245 +                   log: theLog,
  19.246 +                   type: theType,
  19.247 +                   args[0], args[1], args[2], args[3], args[4])
  19.248 +        case 6:
  19.249 +            os_log(message,
  19.250 +                   log: theLog,
  19.251 +                   type: theType,
  19.252 +                   args[0], args[1], args[2], args[3], args[4], args[5])
  19.253 +        case 7:
  19.254 +            os_log(message,
  19.255 +                   log: theLog,
  19.256 +                   type: theType,
  19.257 +                   args[0], args[1], args[2], args[3], args[4], args[5], args[6])
  19.258 +        case 8:
  19.259 +            os_log(message,
  19.260 +                   log: theLog,
  19.261 +                   type: theType,
  19.262 +                   args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7])
  19.263 +        case 9:
  19.264 +            os_log(message,
  19.265 +                   log: theLog,
  19.266 +                   type: theType,
  19.267 +                   args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7],
  19.268 +                   args[8])
  19.269 +        case 10:
  19.270 +            os_log(message,
  19.271 +                   log: theLog,
  19.272 +                   type: theType,
  19.273 +                   args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7],
  19.274 +                   args[8], args[9])
  19.275 +        default:
  19.276 +            os_log("Using more than 10 parameters",
  19.277 +                   log: theLog,
  19.278 +                   type: theType)
  19.279 +            os_log(message,
  19.280 +                   log: theLog,
  19.281 +                   type: theType,
  19.282 +                   args)
  19.283 +        }
  19.284 +    }
  19.285 +
  19.286 +    private func aslLog(message: StaticString,
  19.287 +                        severity: Severity,
  19.288 +                        function: String = #function,
  19.289 +                        filePath: String = #file,
  19.290 +                        fileLine: Int = #line,
  19.291 +                        args: [CVarArg]) {
  19.292 +        aslLogQueue.async { [weak self] in
  19.293 +            if let theSelf = self {
  19.294 +                let logMessage = asl_new(UInt32(ASL_TYPE_MSG))
  19.295 +
  19.296 +                theSelf.checkASLSuccess(asl_set(logMessage, ASL_KEY_SENDER, theSelf.subsystem))
  19.297 +
  19.298 +                theSelf.checkASLSuccess(asl_set(logMessage, ASL_KEY_FACILITY, theSelf.category))
  19.299 +
  19.300 +                theSelf.checkASLSuccess(asl_set(
  19.301 +                    logMessage,
  19.302 +                    ASL_KEY_MSG,
  19.303 +                    "\(filePath):\(fileLine) \(function): \(message) \(args)"))
  19.304 +
  19.305 +                theSelf.checkASLSuccess(asl_set(logMessage, ASL_KEY_LEVEL, "ASL_LEVEL_ERROR"))
  19.306 +
  19.307 +                let nowDate = Date()
  19.308 +                let dateString = "\(Int(nowDate.timeIntervalSince1970))"
  19.309 +                theSelf.checkASLSuccess(asl_set(logMessage, ASL_KEY_TIME, dateString))
  19.310 +
  19.311 +                theSelf.checkASLSuccess(asl_set(logMessage, ASL_KEY_READ_UID, "-1"))
  19.312 +
  19.313 +                theSelf.checkASLSuccess(asl_send(theSelf.consoleLogger(), logMessage))
  19.314 +
  19.315 +                asl_free(logMessage)
  19.316 +            }
  19.317 +        }
  19.318 +    }
  19.319 +
  19.320 +    private var consoleClient: aslclient?
  19.321 +
  19.322 +    private lazy var aslLogQueue = DispatchQueue(label: "security.pEp.asl.log")
  19.323 +
  19.324 +    private let sender = "security.pEp.app.iOS"
  19.325 +
  19.326 +    private func createConsoleLogger() -> asl_object_t {
  19.327 +        return asl_open(self.sender, subsystem, 0)
  19.328 +    }
  19.329 +
  19.330 +    private func consoleLogger() -> aslclient? {
  19.331 +        if consoleClient == nil {
  19.332 +            consoleClient = createConsoleLogger()
  19.333 +        }
  19.334 +        return consoleClient
  19.335 +    }
  19.336 +
  19.337 +    deinit {
  19.338 +        if consoleClient != nil {
  19.339 +            asl_free(consoleClient)
  19.340 +        }
  19.341 +    }
  19.342 +
  19.343 +    private func checkASLSuccess(_ result: Int32, comment: String = "no comment") {
  19.344 +        if result != 0 {
  19.345 +            print("*** error: \(comment)")
  19.346 +        }
  19.347 +    }
  19.348 +}
    20.1 --- a/pEpForiOSTests/Error/DisplayUserErrorTest.swift	Thu Dec 13 19:59:43 2018 +0100
    20.2 +++ b/pEpForiOSTests/Error/DisplayUserErrorTest.swift	Mon Jan 07 10:44:27 2019 +0100
    20.3 @@ -12,13 +12,13 @@
    20.4  
    20.5  class DisplayUserErrorTest: XCTestCase {
    20.6      let smtpSentErrors: [SmtpSendError] = [.illegalState(#function),
    20.7 -                                           .authenticationFailed(#function),
    20.8 +                                           .authenticationFailed(#function, "unknown"),
    20.9                                             .connectionLost(#function),
   20.10                                             .connectionTerminated(#function),
   20.11                                             .connectionTimedOut(#function),
   20.12                                             .badResponse(#function)]
   20.13      let imapSyncErrors: [ImapSyncError] = [.illegalState(#function),
   20.14 -                                           .authenticationFailed(#function),
   20.15 +                                           .authenticationFailed(#function, "unknown"),
   20.16                                             .connectionLost(#function),
   20.17                                             .connectionTerminated(#function),
   20.18                                             .connectionTimedOut(#function),
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/pEpForiOSTests/LogTest.swift	Mon Jan 07 10:44:27 2019 +0100
    21.3 @@ -0,0 +1,23 @@
    21.4 +//
    21.5 +//  LogTest.swift
    21.6 +//  pEpForiOSTests
    21.7 +//
    21.8 +//  Created by Dirk Zimmermann on 13.12.18.
    21.9 +//  Copyright © 2018 p≡p Security S.A. All rights reserved.
   21.10 +//
   21.11 +
   21.12 +import XCTest
   21.13 +import os.log
   21.14 +
   21.15 +@testable import pEpForiOS
   21.16 +@testable import MessageModel
   21.17 +
   21.18 +class LogTest: XCTestCase {
   21.19 +    func testSimple() {
   21.20 +        zlog("zlog simple message")
   21.21 +        zlog("%d %@", 1, "zlog blah")
   21.22 +        if #available(iOS 10.0, macOS 10.12, tvOS 10.0, watchOS 3.0, *) {
   21.23 +            os_log("%d %@", 1, "direct blah")
   21.24 +        }
   21.25 +    }
   21.26 +}
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/pEpForiOSTests/LoggerTest.swift	Mon Jan 07 10:44:27 2019 +0100
    22.3 @@ -0,0 +1,22 @@
    22.4 +//
    22.5 +//  LoggerTest.swift
    22.6 +//  pEpForiOSTests
    22.7 +//
    22.8 +//  Created by Dirk Zimmermann on 18.12.18.
    22.9 +//  Copyright © 2018 p≡p Security S.A. All rights reserved.
   22.10 +//
   22.11 +
   22.12 +import XCTest
   22.13 +
   22.14 +@testable import pEpForiOS
   22.15 +@testable import MessageModel
   22.16 +
   22.17 +class LoggerTest: XCTestCase {
   22.18 +    func testSimple() {
   22.19 +        let log1 = Logger(subsystem: "sys1", category: "cat1")
   22.20 +        log1.log("1 hi (standalone)")
   22.21 +        log1.log("2 hi (one number): %d", 2)
   22.22 +        log1.log("3 hi (one number plus string): %d %@", 2, "parameters")
   22.23 +        log1.testFlush() // wait for completion on iOS < 10
   22.24 +    }
   22.25 +}