MessageKit / MessageKit

A community-driven replacement for JSQMessagesViewController

Home Page:https://messagekit.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Prerelease] v0.1.0

SD10 opened this issue · comments

[Prerelease] v0.1.0

Hey everyone,
I've released MessageKit v0.1.0. You can download it via CocoaPods or master.

I think this goes without saying that this is a prerelease and not production ready. There is a lot of activity surrounding this project and I'm just trying to put something out there for everyone to work with.

"If you are not embarrassed by the first version of your product, you’ve launched too late."
-Reid Hoffman

How can you help from here?

  • Try the project! Please break it, find bugs, and provide feedback 😃
  • Discuss possible customization points and the API
  • Suggest v0.2.0 features and their priority

See something you can improve?

This project is in its earliest stages so the codebase is changing rather quickly. If you'd like to work on something please discuss it with me first so we can prevent merge conflicts.

Documentation

Currently, we have no documentation for this project. The goal is to auto-generate some with Jazzy and also provide more personalized documentation via markdown files.

However, writing documentation at this stage of the project, considering the unstable API, provides little to no value.

Therefore, if you're looking to get involved, please take a look at the Example Project.

Updates

I've also added a Code of Conduct. This CoC is taken seriously by the project owners.

What about the idea of populating the conversation from the top?

@codeido I'm not sure what you mean. Could you please elaborate?

Imagine that you have this list of messages. The character combination "<-" indicates the vertical offset where the user is positioned.

A
A
A <-
A

and you want to paginate old messages. Then you have to insert 3 messages on top of the list.

B
B
B
A
A
A <-
A

How to make this? And how to maintain the offset to the third cell A? Consider that the cells have dynamic height and the reuse of the cell involve the calculation of the offset.

Hasn't anyone started working on fixing layout changes after screen rotation yet? I'd like to help with something and this seems to me like a good place to begin.

UPD: @pinchih just created a bug for this problem.

@artemsmikh It's definitely a priority. I didn't have as much time as I thought to work on this, this weekend. If you want to take a shot at it I'd review a PR.

Closing in favor of #28. @codeido I'm still looking into your suggestion 👍

Hey @darrarski, you've basically done @codeido's suggestion before here?

@SD10 Yes, I tried to implement pagination, which you can check in my repo. It's not perfect, but I think it works quite well with reversed collection layout I've implemented.

What do you mean "it's not perfect?"? Where can be improved?

@darrarski Thanks!
@codeido I opened an issue for this but seem to be missing the benefit of doing it?
What value does it bring?

Is like Whatsapp, Telegram, Instagram and every chat that I know. You can't download the entire chat (imagine if you have 100+ messages to download) one shot, you need to paginate it.

@codeido there are several known issues, that are probably not that hard to fix. My code is not a one-size-fits-all solution. I developed it more as a R&D and not as a fully reusable solution. It should be a good point to start. Some of the issues are:

  • when you change screen orientation, layout does not update (it's just a collection view flow layout, recalculating it should be enough)
  • when you post new message, and the list is not scrolled to the very bottom it won't scroll to the newly posted message (it will do some scrolling anyway; this should be easy to fix too)

There are probably more issues like this and I think good approach would be to add some tests at this point that defines correct UI behavior.

When it comes to pagination, this is what I've done so far:

  • there is a native pull-to-refresh UI component that loads previous page once you scroll to the top
  • there is a mocked up service that loads previous messages with hardcoded delay (good for manual testing)
  • when you post new message it appears one the screen with activity indicator, the service is called and once success repose is received, the message refreshes using response from the service (imho this is how it should works)

I encourage you to play with my implementation (you can find it here). For me one of the goals was not to use hacks and base on native components as much as possible. In case of any questions or problems, let me know and I till try to help solving them.

@darrarski I played with your implementation and it was very easy to read/understand.
Great work btw 👍 I guess I'm misunderstanding the benefit of reversing the collection view layout.

@codeido I understand that, but I wasn't planning on adding any features for fetching messages to this project. I think it should be the users responsibility to control the number of messages they download and how they paginate 🤔

@SD10 Thanks! I agree that fetching messages should not be part of the the MessageKit implementation. However, it should somehow provide API that allows pagination.

@SD10 I agree with the idea that the pagination is a responsibility of the user, but the reverse CollectionView and the idea of adding old messages are part of the implementation of the library because it changes the layout approach and when a message is added on top of the list, it changes the offset where the user is currently positioned. I don't know if I explained correctly the message that I want to communicate. Adding old messages in a collectionview is not a problem - actually - but the unwanted behavior is that the cell that the user actually sees is moved bottom.