From a4856d6425f93dc1e8253cd314f14d13ba27c168 Mon Sep 17 00:00:00 2001 From: Jose Galindo Date: Mon, 21 Sep 2020 20:56:35 -0600 Subject: [PATCH 1/2] Initialize the image in nil so no flicker from the previous image is shown --- .../Collection View/Cells/Media/MSGImageCollectionViewCell.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/MessengerKit/Collection View/Cells/Media/MSGImageCollectionViewCell.swift b/MessengerKit/Collection View/Cells/Media/MSGImageCollectionViewCell.swift index 680f22a0..106409c8 100644 --- a/MessengerKit/Collection View/Cells/Media/MSGImageCollectionViewCell.swift +++ b/MessengerKit/Collection View/Cells/Media/MSGImageCollectionViewCell.swift @@ -20,6 +20,7 @@ class MSGImageCollectionViewCell: MSGMessageCell { return } + imageView.image = nil if case let MSGMessageBody.image(image) = message.body { imageView.image = image } else if case let MSGMessageBody.imageFromUrl(imageUrl) = message.body { From 6a17d64c850fb930ff32115d91ce864ae1dee621 Mon Sep 17 00:00:00 2001 From: Jose Galindo Date: Thu, 12 Nov 2020 09:50:27 -0600 Subject: [PATCH 2/2] Ghost images --- .../Cells/Media/MSGImageCollectionViewCell.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MessengerKit/Collection View/Cells/Media/MSGImageCollectionViewCell.swift b/MessengerKit/Collection View/Cells/Media/MSGImageCollectionViewCell.swift index 106409c8..917f4c21 100644 --- a/MessengerKit/Collection View/Cells/Media/MSGImageCollectionViewCell.swift +++ b/MessengerKit/Collection View/Cells/Media/MSGImageCollectionViewCell.swift @@ -20,7 +20,6 @@ class MSGImageCollectionViewCell: MSGMessageCell { return } - imageView.image = nil if case let MSGMessageBody.image(image) = message.body { imageView.image = image } else if case let MSGMessageBody.imageFromUrl(imageUrl) = message.body { @@ -35,6 +34,7 @@ class MSGImageCollectionViewCell: MSGMessageCell { } private func downloadImage(from url: URL) { + imageView.image = nil print("Download Started") getData(from: url) { data, response, error in guard let data = data, error == nil else { return } @@ -48,7 +48,7 @@ class MSGImageCollectionViewCell: MSGMessageCell { override func awakeFromNib() { super.awakeFromNib() - + imageView.image = nil imageView.layer.cornerRadius = 18 imageView.layer.masksToBounds = true imageView.isUserInteractionEnabled = true