diff --git a/ChattoAdditions/Source/Chat Items/BaseMessage/Views/BaseMessageCollectionViewCellDefaultStyle.swift b/ChattoAdditions/Source/Chat Items/BaseMessage/Views/BaseMessageCollectionViewCellDefaultStyle.swift index 5a2d91a..acec852 100644 --- a/ChattoAdditions/Source/Chat Items/BaseMessage/Views/BaseMessageCollectionViewCellDefaultStyle.swift +++ b/ChattoAdditions/Source/Chat Items/BaseMessage/Views/BaseMessageCollectionViewCellDefaultStyle.swift @@ -77,6 +77,8 @@ public class BaseMessageCollectionViewCellDefaultStyle: BaseMessageCollectionVie } } + // Override this method to provide a size of avatarImage, so avatar image will be displayed if there is any in the viewModel + // if no image, then no avatar will be displayed, and a blank space will placehold at the position public func getAvatarImageSize(messageViewModel: MessageViewModelProtocol) -> CGSize { return CGSize.zero } diff --git a/ChattoApp/ChattoApp/Source/BaseMessageCollectionViewCellAvatarStyle.swift b/ChattoApp/ChattoApp/Source/BaseMessageCollectionViewCellAvatarStyle.swift index 6d854d6..3f49537 100644 --- a/ChattoApp/ChattoApp/Source/BaseMessageCollectionViewCellAvatarStyle.swift +++ b/ChattoApp/ChattoApp/Source/BaseMessageCollectionViewCellAvatarStyle.swift @@ -11,6 +11,11 @@ import ChattoAdditions class BaseMessageCollectionViewCellAvatarStyle: BaseMessageCollectionViewCellDefaultStyle { override func getAvatarImageSize(messageViewModel: MessageViewModelProtocol) -> CGSize { - return CGSize(width: 35, height: 35) + if messageViewModel.isIncoming { + // Only display avatar for incoming message + return CGSize(width: 35, height: 35) + } else { + return CGSize.zero + } } }