IOS-1511 rename from getXY to xy IOS-1511
authorAlejandro Gelos <agp@pep.security>
Wed, 08 May 2019 15:12:53 +0200
branchIOS-1511
changeset 853672606d234305
parent 8528 9efff090c789
child 8537 9f4a44339f80
IOS-1511 rename from getXY to xy
pEpForiOS/UI/Compose/Cells/AttachmentCell/AttachmentViewModel.swift
pEpForiOS/UI/Compose/Util/DocumentAttachmentPickerViewController/DocumentAttachmentPickerViewModel.swift
pEpForiOS/UI/Compose/Util/MediaAttachmentPickerProvider/MediaAttachmentPickerProviderViewModel.swift
pEpForiOS/UI/EmailDisplay/Stuff that is named Compose but is used only in EmailView/ComposeDataSource.swift
pEpForiOS/UI/EmailDisplay/Util/AttachmentsViewHelper.swift
pEpForiOS/Util/Extensions/NSAttributedString+pEp.swift
pEpForiOSTests/MiscTests.swift
pEpForiOSTests/URL+MIME.swift
     1.1 --- a/pEpForiOS/UI/Compose/Cells/AttachmentCell/AttachmentViewModel.swift	Wed May 08 14:15:44 2019 +0200
     1.2 +++ b/pEpForiOS/UI/Compose/Cells/AttachmentCell/AttachmentViewModel.swift	Wed May 08 15:12:53 2019 +0200
     1.3 @@ -24,6 +24,6 @@
     1.4      }
     1.5  
     1.6      public var fileExtension: String {
     1.7 -        return mimeTypeUtils?.getFileExtension(attachment.mimeType) ?? ""
     1.8 +        return mimeTypeUtils?.fileExtension(fromMimeType: attachment.mimeType) ?? ""
     1.9      }
    1.10  }
     2.1 --- a/pEpForiOS/UI/Compose/Util/DocumentAttachmentPickerViewController/DocumentAttachmentPickerViewModel.swift	Wed May 08 14:15:44 2019 +0200
     2.2 +++ b/pEpForiOS/UI/Compose/Util/DocumentAttachmentPickerViewController/DocumentAttachmentPickerViewModel.swift	Wed May 08 15:12:53 2019 +0200
     2.3 @@ -68,7 +68,7 @@
     2.4                  completion(nil)
     2.5                  return
     2.6              }
     2.7 -            let mimeType = self?.mimeUtils?.getMimeType(resourceUrl) ??
     2.8 +            let mimeType = self?.mimeUtils?.mimeType(fromURL: resourceUrl) ??
     2.9                  MimeTypeUtils.MimesType.defaultMimeType
    2.10              let filename = resourceUrl.fileName(includingExtension: true)
    2.11              let attachment = Attachment.create(data: resourceData,
     3.1 --- a/pEpForiOS/UI/Compose/Util/MediaAttachmentPickerProvider/MediaAttachmentPickerProviderViewModel.swift	Wed May 08 14:15:44 2019 +0200
     3.2 +++ b/pEpForiOS/UI/Compose/Util/MediaAttachmentPickerProvider/MediaAttachmentPickerProviderViewModel.swift	Wed May 08 15:12:53 2019 +0200
     3.3 @@ -92,7 +92,7 @@
     3.4                  completion(nil)
     3.5                  return
     3.6              }
     3.7 -            let mimeType = self.mimeTypeUtils?.getMimeType(resourceUrl) ??
     3.8 +            let mimeType = self.mimeTypeUtils?.mimeType(fromURL: resourceUrl) ??
     3.9                  MimeTypeUtils.MimesType.defaultMimeType
    3.10              let filename = self.fileName(forVideoAt: resourceUrl)
    3.11              let attachment =  Attachment.create(data: resourceData,
    3.12 @@ -114,7 +114,7 @@
    3.13      }
    3.14  
    3.15      private func createAttachment(forAssetWithUrl assetUrl: URL, image: UIImage) -> Attachment {
    3.16 -        let mimeType = mimeTypeUtils?.getMimeType(assetUrl) ?? MimeTypeUtils.MimesType.defaultMimeType
    3.17 +        let mimeType = mimeTypeUtils?.mimeType(fromURL: assetUrl) ?? MimeTypeUtils.MimesType.defaultMimeType
    3.18          return Attachment.createFromAsset(mimeType: mimeType,
    3.19                                            assetUrl: assetUrl,
    3.20                                            image: image,
     4.1 --- a/pEpForiOS/UI/EmailDisplay/Stuff that is named Compose but is used only in EmailView/ComposeDataSource.swift	Wed May 08 14:15:44 2019 +0200
     4.2 +++ b/pEpForiOS/UI/EmailDisplay/Stuff that is named Compose but is used only in EmailView/ComposeDataSource.swift	Wed May 08 15:12:53 2019 +0200
     4.3 @@ -79,7 +79,7 @@
     4.4              }
     4.5              let attachment = attachments[index]
     4.6              return Row(fileName: attachment.fileName,
     4.7 -                       fileExtesion: mimeTypeUtils?.getFileExtension(attachment.mimeType) ?? "")
     4.8 +                       fileExtesion: mimeTypeUtils?.fileExtension(fromMimeType: attachment.mimeType) ?? "")
     4.9          }
    4.10  
    4.11          /// Adds an attachment to the data source and returns the index it has been inserted in.
     5.1 --- a/pEpForiOS/UI/EmailDisplay/Util/AttachmentsViewHelper.swift	Wed May 08 14:15:44 2019 +0200
     5.2 +++ b/pEpForiOS/UI/EmailDisplay/Util/AttachmentsViewHelper.swift	Wed May 08 15:12:53 2019 +0200
     5.3 @@ -46,7 +46,7 @@
     5.4              attachment.fileName?.splitFileExtension() ?? (Constants.defaultFileName, nil)
     5.5          return AttachmentSummaryView.AttachmentInfo(
     5.6              filename: name.extractFileNameOrCid(),
     5.7 -            theExtension: ext ?? mimeTypes?.getFileExtension(attachment.mimeType))
     5.8 +            theExtension: ext ?? mimeTypes?.fileExtension(fromMimeType: attachment.mimeType))
     5.9      }
    5.10  
    5.11      func opFinished(theBuildOp: AttachmentsViewOperation) {
     6.1 --- a/pEpForiOS/Util/Extensions/NSAttributedString+pEp.swift	Wed May 08 14:15:44 2019 +0200
     6.2 +++ b/pEpForiOS/Util/Extensions/NSAttributedString+pEp.swift	Wed May 08 15:12:53 2019 +0200
     6.3 @@ -22,7 +22,7 @@
     6.4              let count = attachments.count
     6.5  
     6.6              let theID = MessageID.generateUUID()
     6.7 -            let theExt = mimeUtils?.getFileExtension(theAttachment.mimeType) ?? "jpg"
     6.8 +            let theExt = mimeUtils?.fileExtension(fromMimeType: theAttachment.mimeType) ?? "jpg"
     6.9              let cidBase = "attached-inline-image-\(count)-\(theExt)-\(theID)"
    6.10              let cidSrc = "cid:\(cidBase)"
    6.11              let cidUrl = "cid://\(cidBase)"
     7.1 --- a/pEpForiOSTests/MiscTests.swift	Wed May 08 14:15:44 2019 +0200
     7.2 +++ b/pEpForiOSTests/MiscTests.swift	Wed May 08 15:12:53 2019 +0200
     7.3 @@ -34,7 +34,7 @@
     7.4  
     7.5      func testMimeTypeJson() {
     7.6          let mimeTypeController = MimeTypeUtils()
     7.7 -        let s = mimeTypeController?.getMimeType("pdf")
     7.8 +        let s = mimeTypeController?.mimeType(fromFileExtension: "pdf")
     7.9          XCTAssertEqual(s, MimeTypeUtils.MimesType.pdf)
    7.10      }
    7.11  
     8.1 --- a/pEpForiOSTests/URL+MIME.swift	Wed May 08 14:15:44 2019 +0200
     8.2 +++ b/pEpForiOSTests/URL+MIME.swift	Wed May 08 15:12:53 2019 +0200
     8.3 @@ -19,8 +19,8 @@
     8.4      func testJpg() {
     8.5          let jpgExt = "jpg"
     8.6          let url = urlWithExtension(ext: jpgExt)
     8.7 -        let testee = mimeUtils?.getMimeType(url)
     8.8 -        let expected = mimeUtils?.getMimeType(jpgExt)
     8.9 +        let testee = mimeUtils?.mimeType(fromURL: url)
    8.10 +        let expected = mimeUtils?.mimeType(fromFileExtension: jpgExt)
    8.11          XCTAssertEqual(testee, expected)
    8.12      }
    8.13