-
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
Conversation
Current coverage is
|
@@ -49,6 +49,7 @@ public protocol MessageViewModelProtocol: class { // why class? https://gist.git | |||
var showsFailedIcon: Bool { get } | |||
var date: String { get } | |||
var status: MessageViewModelStatus { get } | |||
var avatarImage: UIImage? { set get } |
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.
Can you make this Observable<UIImage?>. That would allow to start with a placeholder if the avatar needs to be downloaded and then update the cell when the download finishes without triggering a CollectionView update.
@zwang This is amazing! So exciting to see such a nice contribution from the community 😍. Hopefully you can address some of my comments. Thank you very much again! |
@diegosanchezr thanks for the review and notes. I will revisit them this weekend and update the PR then. Thanks again :) |
Also allow user to override layoutConstants in BaseMessageCollectionViewCell and allow user to specify VerticalAlignment of avatar: Top, Bottom or Center
@diegosanchezr thanks a lot for the review and feedback again. It all makes sense. I am hesitate to change based on the last note as I commented above. So I will leave it there for now and get more familiar with the code first. Other than the last note, I should have resolved all issues in all the other notes. And also I add two new small features: 1. Allow user to subclass the basestyle to specify Thanks again for you help. Have a good one! Cheers! :) PS: I will resolve other |
@zwang thank you very much again! merging! |
Adds support for user avatars
@diegosanchezr Thank you. :) |
@zwang Hi and thanks for your effort in this feature. I have a couple questions. I downloaded the dev branch and the Avatars seems to be only next to text typed messages but not image typed ones. Is this a design choice or are you still working on adding them to all message types? Since there is a I really believe Group chat is a vital part of chat and it should be present in this beautiful Library:) Last question will be about the avatar views. Are they just Thanks to all of you who are keeping this Library alive:) |
Hi @aytunch First, the feature only supports adding avatar to messages. Not related to group chat. But should work in group chat too. It is just a matter of setting the avatar image for each message. With this said, it allow you to put avatar image next to photo messages too. I just didn't do it in the demo app. You can checkout You definitely can display different avatar image according to senderId. What I did in the demo app is just an example, you can set the Regarding the sender name under avatar, I think you can do the same extension as I did for avatar view. I would not recommend to have name bound together with avatar view. They can stay together, but they should not be bound together. So the avatar view is just an Hope my answer helps. :) |
Demo app updated to show avatar image only for text messages by modifying the viewModelBuilder, Presenter is probably best place to set avatar image based on viewmodel and decoration attributes, but this is highly case by case.
By default, the avatar is at the bottom of the collection view cell. No way to customize it unless changing code.
Screenshot of demo app as below: