IOS-1542 Type-safe ConnectionTransport from Server.Transport. IOS-1542
authorDirk Zimmermann <dz@pep.security>
Mon, 15 Apr 2019 16:17:33 +0200
branchIOS-1542
changeset 8237e23c7448bc16
parent 8236 21266fc95bca
child 8238 4caa515a4fc8
IOS-1542 Type-safe ConnectionTransport from Server.Transport.
pEpForiOS.xcodeproj/project.pbxproj
pEpForiOSTests/TestUtils/ConnectionTransport+Transport.swift
     1.1 --- a/pEpForiOS.xcodeproj/project.pbxproj	Mon Apr 15 16:17:33 2019 +0200
     1.2 +++ b/pEpForiOS.xcodeproj/project.pbxproj	Mon Apr 15 16:17:33 2019 +0200
     1.3 @@ -313,6 +313,7 @@
     1.4  		43A384812153E4BF006AC8F8 /* 8B691AD204E22FD1BF018E0D6C9EAD5A798018D1_pub_sec.txt in Resources */ = {isa = PBXBuildFile; fileRef = 43A384802153E4BF006AC8F8 /* 8B691AD204E22FD1BF018E0D6C9EAD5A798018D1_pub_sec.txt */; };
     1.5  		43A469FA21513B10002E1036 /* PEPSwipeTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43A469F921513B10002E1036 /* PEPSwipeTableViewCell.swift */; };
     1.6  		43A5DE381D631D49001153AF /* UnencryptedHTMLMail.txt in Resources */ = {isa = PBXBuildFile; fileRef = 43A5DE371D631D49001153AF /* UnencryptedHTMLMail.txt */; };
     1.7 +		43A60116226467410099B45C /* ConnectionTransport+Transport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43A60115226467410099B45C /* ConnectionTransport+Transport.swift */; };
     1.8  		43A6E04B1E5726C8005BEE69 /* ReevaluateMessageRatingOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43A6E04A1E5726C8005BEE69 /* ReevaluateMessageRatingOperation.swift */; };
     1.9  		43A6E0581E57400E005BEE69 /* RatingReEvaluator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43A6E0571E57400E005BEE69 /* RatingReEvaluator.swift */; };
    1.10  		43AA825B1E9BC5FF00ABD5A8 /* AttachmentViewContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43AA825A1E9BC5FF00ABD5A8 /* AttachmentViewContainer.swift */; };
    1.11 @@ -831,6 +832,7 @@
    1.12  		43A384802153E4BF006AC8F8 /* 8B691AD204E22FD1BF018E0D6C9EAD5A798018D1_pub_sec.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = 8B691AD204E22FD1BF018E0D6C9EAD5A798018D1_pub_sec.txt; sourceTree = "<group>"; };
    1.13  		43A469F921513B10002E1036 /* PEPSwipeTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PEPSwipeTableViewCell.swift; sourceTree = "<group>"; };
    1.14  		43A5DE371D631D49001153AF /* UnencryptedHTMLMail.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = UnencryptedHTMLMail.txt; sourceTree = "<group>"; };
    1.15 +		43A60115226467410099B45C /* ConnectionTransport+Transport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ConnectionTransport+Transport.swift"; sourceTree = "<group>"; };
    1.16  		43A6E04A1E5726C8005BEE69 /* ReevaluateMessageRatingOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReevaluateMessageRatingOperation.swift; sourceTree = "<group>"; };
    1.17  		43A6E0571E57400E005BEE69 /* RatingReEvaluator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RatingReEvaluator.swift; sourceTree = "<group>"; };
    1.18  		43AA825A1E9BC5FF00ABD5A8 /* AttachmentViewContainer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AttachmentViewContainer.swift; sourceTree = "<group>"; };
    1.19 @@ -1089,6 +1091,7 @@
    1.20  				15D439A6216FB77600EB3933 /* UnitTestUtils.swift */,
    1.21  				15410D1E2199CA1100BBF65F /* XCTTestCase+Utils.swift */,
    1.22  				437027A022315B5700A77AEC /* PEPAppUtilWrappers.swift */,
    1.23 +				43A60115226467410099B45C /* ConnectionTransport+Transport.swift */,
    1.24  			);
    1.25  			path = TestUtils;
    1.26  			sourceTree = "<group>";
    1.27 @@ -3072,6 +3075,7 @@
    1.28  				00172F462163C2EE0079B189 /* SettingsSectionViewModelTest.swift in Sources */,
    1.29  				00172F432163AC110079B189 /* SettingsViewModelTest.swift in Sources */,
    1.30  				438281831E891B7E00087343 /* DateTests.swift in Sources */,
    1.31 +				43A60116226467410099B45C /* ConnectionTransport+Transport.swift in Sources */,
    1.32  				15B483DB1F28E2FC000FB2CF /* SpecialUseMailboxesTest.swift in Sources */,
    1.33  				151F71FB202A06760057C74D /* MockBackgrounder.swift in Sources */,
    1.34  				43D51E891DD5D902008B77A8 /* SimpleOperationsTest.swift in Sources */,
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/pEpForiOSTests/TestUtils/ConnectionTransport+Transport.swift	Mon Apr 15 16:17:33 2019 +0200
     2.3 @@ -0,0 +1,25 @@
     2.4 +//
     2.5 +//  ConnectionTransport+Transport.swift
     2.6 +//  pEpForiOSTests
     2.7 +//
     2.8 +//  Created by Dirk Zimmermann on 15.04.19.
     2.9 +//  Copyright © 2019 p≡p Security S.A. All rights reserved.
    2.10 +//
    2.11 +
    2.12 +import Foundation
    2.13 +
    2.14 +import PantomimeFramework
    2.15 +import MessageModel
    2.16 +
    2.17 +extension ConnectionTransport {
    2.18 +    init(transport: Server.Transport) {
    2.19 +        switch transport {
    2.20 +        case .plain:
    2.21 +            self = .plain
    2.22 +        case .startTls:
    2.23 +            self = .startTLS
    2.24 +        case .tls:
    2.25 +            self = .TLS
    2.26 +        }
    2.27 +    }
    2.28 +}