         box.fill()
     }
 
-    fileprivate func drawProgress(at origin: CGPoint, size:CGSize) {
+    private func drawProgress(at origin: CGPoint, size:CGSize) {
         guard let progress = progress else {
             return
         }

                
                strongSelf.isFetchingImage = false
                strongSelf.lastRequestedURL = nil
                strongSelf.invalidateLayout(inTextContainer: textContainer)
            })
    }
    
    fileprivate func invalidateLayout(inTextContainer textContainer: NSTextContainer?) {
        textContainer?.layoutManager?.invalidateLayout(for: self)
    }
}

        }
    }


    // MARK: - Position and size calculation

    func xPosition(forContainerWidth containerWidth: CGFloat) -> CGFloat {
        return 0
    }

    func onScreenHeight(_ containerWidth: CGFloat) -> CGFloat {
        guard let image = image else {
            return 0
        }

        let targetWidth = onScreenWidth(containerWidth)
        let scale = targetWidth / image.size.width

        return floor(image.size.height * scale) + (imageMargin * 2)
    }

    func onScreenWidth(_ containerWidth: CGFloat) -> CGFloat {
        guard let image = image else {
            return 0
        }

        return floor(min(image.size.width, containerWidth))
    }


    // MARK: - NSTextAttachmentContainer

    override open func image(forBounds imageBounds: CGRect, textContainer: NSTextContainer?, characterIndex charIndex: Int) -> UIImage? {
        
        updateImage(in: textContainer)

        guard let image = image else {
            return delegate!.mediaAttachmentPlaceholderImageFor(attachment: self)
