Add comments about how to display avatar

This commit is contained in:
Zhao Wang 2016-03-10 00:01:24 -08:00
parent 139c56e793
commit 15dea4cfc6
2 changed files with 8 additions and 1 deletions

View File

@ -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
}

View File

@ -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
}
}
}