IOS-1511 moving all mimeTypes and contentType to same place part 2 IOS-1511
authorAlejandro Gelos <agp@pep.security>
Tue, 07 May 2019 11:19:58 +0200
branchIOS-1511
changeset 8505d5c1397f65dd
parent 8504 92d2c5a38aec
child 8510 edfa54372606
IOS-1511 moving all mimeTypes and contentType to same place part 2
Submodules/pEpIOSToolbox/pEpIOSToolbox/Other/Constants.swift
pEpForiOS/UI/Compose/Cells/AttachmentCell/AttachmentViewModel.swift
pEpForiOS/Util/Constants.swift
pEpForiOSTests/HandshakeTests.swift
pEpForiOSTests/MailParsingTests.swift
pEpForiOSTests/StringHTMLExtensionTests.swift
pEpForiOSTests/TestUtils/TestUtil.swift
subModules/pEpIOSToolbox/pEpIOSToolbox.xcodeproj/project.pbxproj
     1.1 --- a/Submodules/pEpIOSToolbox/pEpIOSToolbox/Other/Constants.swift	Mon May 06 18:09:11 2019 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,16 +0,0 @@
     1.4 -//
     1.5 -//  Constants.swift
     1.6 -//  pEpIOSToolbox
     1.7 -//
     1.8 -//  Created by Dirk Zimmermann on 22.02.19.
     1.9 -//  Copyright © 2019 pEp Security SA. All rights reserved.
    1.10 -//
    1.11 -
    1.12 -import Foundation
    1.13 -
    1.14 -public struct Constants {
    1.15 -    /**
    1.16 -     Protocol for PGP/MIME application/pgp-encrypted.
    1.17 -     */
    1.18 -    public static let protocolPGPEncrypted = "application/pgp-encrypted"
    1.19 -}
     2.1 --- a/pEpForiOS/UI/Compose/Cells/AttachmentCell/AttachmentViewModel.swift	Mon May 06 18:09:11 2019 +0200
     2.2 +++ b/pEpForiOS/UI/Compose/Cells/AttachmentCell/AttachmentViewModel.swift	Tue May 07 11:19:58 2019 +0200
     2.3 @@ -9,8 +9,15 @@
     2.4  import MessageModel
     2.5  
     2.6  class AttachmentViewModel: CellViewModel {
     2.7 +    public let attachment: Attachment
     2.8 +    private let mimeTypeUtil = MimeTypeUtil()
     2.9 +
    2.10 +    init(attachment: Attachment) {
    2.11 +        self.attachment = attachment
    2.12 +    }
    2.13 +
    2.14      static let defaultFileName = NSLocalizedString("unknown",
    2.15 -                                            comment:
    2.16 +                                                   comment:
    2.17          "Displayed attachment filename if unknown")
    2.18      public var fileName: String {
    2.19          return attachment.fileName ?? AttachmentViewModel.defaultFileName
    2.20 @@ -19,11 +26,4 @@
    2.21      public var fileExtension: String {
    2.22          return mimeTypeUtil?.fileExtension(mimeType: attachment.mimeType) ?? ""
    2.23      }
    2.24 -
    2.25 -    public let attachment: Attachment
    2.26 -    private let mimeTypeUtil = MimeTypeUtil()
    2.27 -
    2.28 -    init(attachment: Attachment) {
    2.29 -        self.attachment = attachment
    2.30 -    }
    2.31  }
     3.1 --- a/pEpForiOS/Util/Constants.swift	Mon May 06 18:09:11 2019 +0200
     3.2 +++ b/pEpForiOS/Util/Constants.swift	Tue May 07 11:19:58 2019 +0200
     3.3 @@ -8,7 +8,7 @@
     3.4  
     3.5  import pEpIOSToolbox
     3.6  
     3.7 -extension Constants {
     3.8 +struct Constants {
     3.9      /** Settings key for storing the email of the last used account */
    3.10      static let kSettingLastAccountEmail = "kSettingLastAccountEmail"
    3.11  
     4.1 --- a/pEpForiOSTests/HandshakeTests.swift	Mon May 06 18:09:11 2019 +0200
     4.2 +++ b/pEpForiOSTests/HandshakeTests.swift	Tue May 07 11:19:58 2019 +0200
     4.3 @@ -60,7 +60,7 @@
     4.4  
     4.5          let theAttachments = pEpMessage.attachments ?? []
     4.6          XCTAssertEqual(theAttachments.count, 1)
     4.7 -        XCTAssertEqual(theAttachments[0].mimeType, MimeTypeUtil.contentTypeApplicationPGPKeys)
     4.8 +        XCTAssertEqual(theAttachments[0].mimeType, ContentTypeUtils.ContentType.pgpKeys)
     4.9  
    4.10          guard let optFields = pEpMessage.optionalFields else {
    4.11              XCTFail("expected optional_fields to be defined")
     5.1 --- a/pEpForiOSTests/MailParsingTests.swift	Mon May 06 18:09:11 2019 +0200
     5.2 +++ b/pEpForiOSTests/MailParsingTests.swift	Tue May 07 11:19:58 2019 +0200
     5.3 @@ -60,7 +60,7 @@
     5.4  
     5.5          let theAttachments = pEpMessage.attachments ?? []
     5.6          XCTAssertEqual(theAttachments.count, 1)
     5.7 -        XCTAssertEqual(theAttachments[0].mimeType, MimeTypeUtil.contentTypeApplicationPGPKeys)
     5.8 +        XCTAssertEqual(theAttachments[0].mimeType, ContentTypeUtils.ContentType.pgpKeys)
     5.9  
    5.10          guard let optFields = pEpMessage.optionalFields else {
    5.11              XCTFail("expected optional_fields to be defined")
     6.1 --- a/pEpForiOSTests/StringHTMLExtensionTests.swift	Mon May 06 18:09:11 2019 +0200
     6.2 +++ b/pEpForiOSTests/StringHTMLExtensionTests.swift	Tue May 07 11:19:58 2019 +0200
     6.3 @@ -114,7 +114,7 @@
     6.4          let alt1 = "Attached Image 1 (jpg)"
     6.5  
     6.6          let theData = "Not an image".data(using: .utf8)
     6.7 -        let theMimeType = MimeTypeUtil.jpegMimeType
     6.8 +        let theMimeType = MimeTypeUtil.MimesType.jpeg
     6.9          let attachment = Attachment.create(
    6.10              data: theData, mimeType: theMimeType, fileName: "cid:\(cid1)",
    6.11              size: theData?.count)
     7.1 --- a/pEpForiOSTests/TestUtils/TestUtil.swift	Mon May 06 18:09:11 2019 +0200
     7.2 +++ b/pEpForiOSTests/TestUtils/TestUtil.swift	Tue May 07 11:19:58 2019 +0200
     7.3 @@ -507,7 +507,7 @@
     7.4          let contentDisposition = inlined ? Attachment.ContentDispositionType.inline : .attachment
     7.5  
     7.6          return Attachment.create(data: imageData,
     7.7 -                          mimeType: MimeTypeUtil.jpegMimeType,
     7.8 +                          mimeType: MimeTypeUtil.MimesType.jpeg,
     7.9                            fileName: imageFileName,
    7.10                            contentDisposition: contentDisposition)
    7.11      }
     8.1 --- a/subModules/pEpIOSToolbox/pEpIOSToolbox.xcodeproj/project.pbxproj	Mon May 06 18:09:11 2019 +0200
     8.2 +++ b/subModules/pEpIOSToolbox/pEpIOSToolbox.xcodeproj/project.pbxproj	Tue May 07 11:19:58 2019 +0200
     8.3 @@ -14,7 +14,6 @@
     8.4  		37904565223FA486006DAB3B /* ReachabilityProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37904561223FA486006DAB3B /* ReachabilityProtocol.swift */; };
     8.5  		37904569223FA52B006DAB3B /* NetworkReachibilityMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37904567223FA52B006DAB3B /* NetworkReachibilityMock.swift */; };
     8.6  		3790456A223FA52B006DAB3B /* ReachabilityTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37904568223FA52B006DAB3B /* ReachabilityTests.swift */; };
     8.7 -		435F5129221FF9D7006EB11F /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 435F5128221FF9D7006EB11F /* Constants.swift */; };
     8.8  		B70A3A5522005BD400EDCE61 /* Date+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B70A3A5422005BD400EDCE61 /* Date+Extension.swift */; };
     8.9  		B70A3A5722005BE300EDCE61 /* NSRegularExpression+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B70A3A5622005BE300EDCE61 /* NSRegularExpression+Extension.swift */; };
    8.10  		B70A3A7322006B9F00EDCE61 /* SystemUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = B70A3A7222006B9E00EDCE61 /* SystemUtils.swift */; };
    8.11 @@ -62,7 +61,6 @@
    8.12  		37904561223FA486006DAB3B /* ReachabilityProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReachabilityProtocol.swift; sourceTree = "<group>"; };
    8.13  		37904567223FA52B006DAB3B /* NetworkReachibilityMock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkReachibilityMock.swift; sourceTree = "<group>"; };
    8.14  		37904568223FA52B006DAB3B /* ReachabilityTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReachabilityTests.swift; sourceTree = "<group>"; };
    8.15 -		435F5128221FF9D7006EB11F /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Constants.swift; path = ../../../../Submodules/pEpIOSToolbox/pEpIOSToolbox/Other/Constants.swift; sourceTree = "<group>"; };
    8.16  		B70A3A5422005BD400EDCE61 /* Date+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Date+Extension.swift"; sourceTree = "<group>"; };
    8.17  		B70A3A5622005BE300EDCE61 /* NSRegularExpression+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSRegularExpression+Extension.swift"; sourceTree = "<group>"; };
    8.18  		B70A3A7222006B9E00EDCE61 /* SystemUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SystemUtils.swift; sourceTree = "<group>"; };
    8.19 @@ -249,7 +247,6 @@
    8.20  				B7A46C4F220C1F0C0027CCB5 /* MiscUtil.swift */,
    8.21  				B7DB7F512213120B003968DA /* SortedSet.swift */,
    8.22  				B70A3A7222006B9E00EDCE61 /* SystemUtils.swift */,
    8.23 -				435F5128221FF9D7006EB11F /* Constants.swift */,
    8.24  			);
    8.25  			path = Other;
    8.26  			sourceTree = "<group>";
    8.27 @@ -373,7 +370,6 @@
    8.28  				B7465DE72211E969008A1708 /* CGRect+Util.swift in Sources */,
    8.29  				B7465DCC2211BEEA008A1708 /* Tuple.swift in Sources */,
    8.30  				37904562223FA486006DAB3B /* NetworkReachabilityProtocol.swift in Sources */,
    8.31 -				435F5129221FF9D7006EB11F /* Constants.swift in Sources */,
    8.32  				B7A46C50220C1F0C0027CCB5 /* MiscUtil.swift in Sources */,
    8.33  				B70A3A7322006B9F00EDCE61 /* SystemUtils.swift in Sources */,
    8.34  				B7936E3D220DD8F5003B39E6 /* NSAttributedString+Extensions.swift in Sources */,