Skip to content

Commit

Permalink
Repair style violations
Browse files Browse the repository at this point in the history
  • Loading branch information
chipsnyder committed Feb 7, 2020
1 parent c82aaed commit 41e457d
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class GutenbergStockPhotos {
}

extension GutenbergStockPhotos: StockPhotosPickerDelegate {

func stockPhotosPicker(_ picker: StockPhotosPicker, didFinishPicking assets: [StockPhotosMedia]) {
defer {
mediaPickerCallback = nil
Expand All @@ -38,13 +38,9 @@ extension GutenbergStockPhotos: StockPhotosPickerDelegate {

// For blocks that support multiple uploads this will upload all images.
// If multiple uploads are not supported then it will seperate them out to Image Blocks.
if (multipleSelection) {
insertOnBlock(with: assets)
} else {
insertSingleImages(assets)
}
multipleSelection ? insertOnBlock(with: assets) : insertSingleImages(assets)
}

/// Adds the given image object to the requesting block and seperates multiple images to seperate image blocks
/// - Parameter asset: Stock Media object to add.
func insertSingleImages(_ assets: [StockPhotosMedia]) {
Expand All @@ -63,15 +59,15 @@ extension GutenbergStockPhotos: StockPhotosPickerDelegate {
guard let callback = mediaPickerCallback else {
return assertionFailure("Image picked without callback")
}

let mediaInfo = assets.compactMap({ (asset) -> MediaInfo? in
guard let media = self.mediaInserter.insert(exportableAsset: asset, source: .giphy) else {
return nil
}
let mediaUploadID = media.gutenbergUploadID
return MediaInfo(id: mediaUploadID, url: asset.URL.absoluteString, type: media.mediaTypeString)
})

callback(mediaInfo)
}

Expand Down

0 comments on commit 41e457d

Please sign in to comment.