@@ -314,18 +314,24 @@ import AutomatticTracks
314314// MARK: - Loading Media object
315315
316316extension ImageLoader {
317- @objc ( loadImageFromMedia: preferredSize: placeholder: success: error: )
317+ @objc ( loadImageFromMedia: preferredSize: placeholder: isBlogAtomic : success: error: )
318318 /// Load an image from the given Media object. If it's a gif, it will animate it.
319319 /// For any other type of media, this will load the corresponding static image.
320320 ///
321321 /// - Parameters:
322322 /// - media: The media object
323323 /// - placeholder: A placeholder to show while the image is loading.
324324 /// - size: The preferred size of the image to load.
325+ /// - isBlogAtomic: Whether the blog associated to the media item is Atomic or not
325326 /// - success: A closure to be called if the image was loaded successfully.
326327 /// - error: A closure to be called if there was an error loading the image.
327328 ///
328- func loadImage( media: Media , preferredSize size: CGSize = . zero, placeholder: UIImage ? , success: ImageLoaderSuccessBlock ? , error: ImageLoaderFailureBlock ? ) {
329+ func loadImage( media: Media ,
330+ preferredSize size: CGSize = . zero,
331+ placeholder: UIImage ? ,
332+ isBlogAtomic: Bool ,
333+ success: ImageLoaderSuccessBlock ? ,
334+ error: ImageLoaderFailureBlock ? ) {
329335 guard let mediaId = media. mediaID? . stringValue else {
330336 let error = createError ( description: " The Media id doesn't exist " )
331337 callErrorHandler ( with: error)
@@ -342,7 +348,7 @@ extension ImageLoader {
342348 if let fetchedMedia = fetchedMedia,
343349 let fetchedMediaId = fetchedMedia. mediaID? . stringValue, fetchedMediaId == mediaId {
344350 DispatchQueue . main. async {
345- self ? . loadImage ( media: fetchedMedia, preferredSize: size, placeholder: placeholder, success: success, error: error)
351+ self ? . loadImage ( media: fetchedMedia, preferredSize: size, placeholder: placeholder, isBlogAtomic : isBlogAtomic , success: success, error: error)
346352 }
347353 } else {
348354 self ? . callErrorHandler ( with: fetchedMediaError)
@@ -357,7 +363,7 @@ extension ImageLoader {
357363 }
358364
359365 if url. isGif {
360- let host = MediaHost ( with: media. blog) { error in
366+ let host = MediaHost ( with: media. blog, isAtomic : isBlogAtomic ) { error in
361367 // We'll log the error, so we know it's there, but we won't halt execution.
362368 WordPressAppDelegate . crashLogging? . logError ( error)
363369 }
0 commit comments