-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Improve performance: new bubbleImage and avatarImage dataSource #319
Comments
Please consider the solution I suggested earlier and give users the freedom to set/update avatars in any convenient way :-) You propose to reload visible cells where you just need to update In the chat app I develop an approach similar (though it is used with table views) to the one I outlined is used and here is how it works:
The other issue I'm concerned with is extensibility. We are doing a redesign of the app (that's the reason for switching to this library) and among other things we need different kind of messages: |
@erysaj - i'm still not 100% clear on what you are suggesting. reloading only visible cells should not be a huge issue, and this will only happen once for each avatar once it is downloaded. (unless you are clever about this and reload only when all avatars have finished downloading) Firstly, this library is not concerned with anything regarding networking. It does not (and will not) do anything with downloading, caching, async loading, etc. It will only provide the hooks you need to display your data.
I don't understand what you mean. Maybe my proposal wasn't clear, but the data source will not change. To reiterate the flow:
This would basically function like my demo project -- which keeps all the avatars in a dictionary. It is similar to @kenn's code sample but would be wrapped in a better, more robust API. Does that make sense? What are the potential issues you see with this in your use-case? Also, can you provide some more concrete examples/code explaining what you are suggesting? |
I meant the underlying 'messages data source'. I can receive new messages from server, so if I
I completely agree to that point and suggest to move it further: do not make any unnecessary decisions for the library's user. For example, currently you have a restriction on how does message I can provide some code snippets if needed, but that'll be later --- it's pretty late in my timezone |
@erysaj - ah! i got it. my proposal does not keep track the indexPath. it doesn't care. maybe i should begin this on a new branch to give a better example.
I think it is very customizable right now. You can adjust all the things you mentioned. Also, you can provide your own bubble images, or not use images at all.
This is not supported, but will be eventually. See #223
Can't you use one of the cell labels for this? Overall, it sounds like you have some really specific use-cases. I think the way this library is built works perfectly for 80% of the people using it. :) which is the goal. |
No need for that, it is clear. I developed the index path theme after pointing out that re-creating all visible cell instead updating a few image views seem to much
I know, I listed the things that can be customised (maybe not all) just to point out that despite being very customisable cell is still restricting --- you can't display an "image" message for instance :)
That's a dirty hack. It breaks a data model --- 'system' message is no worse than any other and besides there could be a few of them in a row.
I wouldn't say so. Exchanging photos/video seems to be in trend of modern chat apps (hence 'image' messages) and having group conversations is a common feature --- skype has it for years (hence 'system')
why not raise to 85%? especially considering the fact that newcomers will be forced to fix existing bugs :) |
Like I said, media messages is on the ToDo list, and high priority. See #172 and #76 for some background on this control, v4.0 had an even more restricting implementation. v5.0 was a complete re-write that solved all of the issues with v4.0.
This is 100% supported. RE: system messages
Fair enough and makes sense. Sounds like a feature request! #321 opened. This should actually be a simple addition, the framework is modular enough to easily adapt to something like this. When I mentioned that you had specific use-cases, I was referring to the system messages. I don't think most people want/need this feature. Of course, everyone wants media messages. I am very aware of this. But this is non-trivial to design well.
Let's not forget that I have spent enormous amounts of my time building this library for free and making it open-source which gives you the opportunity to fix bugs. |
I appreciate that and you have my thanks for the great library. BTW, earlier you mentioned plans to make some refactoring according to "lighter view controllers". |
@erysaj 👍 see the objc.io issue on lighter view controllers. what i want to do is refactor out the data source object like you see there. |
…arImage. slight refactor of both, remove size property. update tests. #319
…AvatarImage. refactor JSQMessagesAvatarImageFactory. add avatarImageView to cell prototype. update unit tests. updates docs. ref #319
Completed and set for 6.0 release. See branch release-6.0. |
hey @jessesquires why did you remove the stroked bubbles from the 6.0 beta1 release mate? ;( |
@marcoscurvello - I didn't think they were being used! Sorry, I'll add them back. |
@jessesquires thanks so much dude, I've just tested the beta2 loving these changes ;) |
Bubble images
bubbleImageView
part of the cell prototypeJSQMessageBubbleImageDataSource
(instead of usingUIImageView
)JSQMessagesBubbleImage
class that conforms to new protocolJSQMessagesBubbleImageFactory
to returnJSQMessagesBubbleImage
objectsAvatar images
avatarImageView
part of the cell prototypeJSQMessageAvatarImageDataSource
(instead of usingUIImageView
)JSQMessagesAvatarImage
class that conforms to new protocolJSQMessagesAvatarFactory
to returnJSQMessagesAvatarImage
objectsPer discussion in #313
This will prevent the need to continually add/remove subviews and update constraints in cells during configuration.
This will also provide a better solution for those wishing to do async avatar loading.
Other relevant issues: #306, #281
The text was updated successfully, but these errors were encountered: