-
Notifications
You must be signed in to change notification settings - Fork 593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add function to show avatar image for messages #55
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
… purpose
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,11 +44,9 @@ public class DemoTextMessageViewModelBuilder: ViewModelBuilderProtocol { | |
public func createViewModel(textMessage: DemoTextMessageModel) -> DemoTextMessageViewModel { | ||
let messageViewModel = self.messageViewModelBuilder.createMessageViewModel(textMessage) | ||
let textMessageViewModel = DemoTextMessageViewModel(textMessage: textMessage, messageViewModel: messageViewModel) | ||
if textMessage.isIncoming { | ||
// Best place to decide whether user having avart might be in the presenter. Here just for demo purpose | ||
// Because we might only want to display avatar when showTail in the nessage bubble | ||
textMessageViewModel.avatarImage = UIImage(named: "userAvatar") | ||
} | ||
// Best place to decide whether user having avart might be in the presenter. Here just for demo purpose | ||
// Because we might only want to display avatar when showTail in the nessage bubble | ||
textMessageViewModel.avatarImage = UIImage(named: "userAvatar") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mmm... Haven't thought of this. You're right, trying to implement some kind of logic in which the avatar is not shown in every cell looks complicated as it is now. I'd rather add a new attribute ChatItemDecorationAttributes.canShowAvatar and replicate what it's done with the tail There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure how adding I think user can also do this by themselves by subclassing However for now, I will suggest to do this in the presenter based on the actual logic of view model and business requirements. User need to create an custom presenter. |
||
return textMessageViewModel | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to remove the if/else