Commit 899126bd authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Kateryna Kostiuk

contact requests: clean image data handle invalid images

- Cleans cell's image data prior to usage/reusage.

- Only sets the contact request item cell's UIImage and hides the
  fallback avatar if it the image data exists and is correctly
  formed.

Change-Id: I3cd4c703ac33cee17157f2ccc86f6c54dc090a7e
Reviewed-by: Kateryna Kostiuk's avatarKateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
parent 778b262c
......@@ -95,9 +95,12 @@ class ContactRequestsViewController: UIViewController, StoryboardBased, ViewMode
})
.disposed(by: cell.disposeBag)
// Set image if any
cell.fallbackAvatar.isHidden = false
cell.profileImageView.image = nil
if let imageData = item.profileImageData {
cell.profileImageView.image = UIImage(data: imageData)
if !imageData.isEmpty {
if let image = UIImage(data: imageData) {
cell.profileImageView.image = image
cell.fallbackAvatar.isHidden = true
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment