Skip to content
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.

Improvements to avatar default, user scrolling, add subtitle support #49

Merged
merged 5 commits into from
Oct 20, 2013
Merged

Conversation

alecgorge
Copy link
Contributor

First of all, thanks for this great starting point for any messaging application. My use case for this control is for group chat so most of my changes make my use case possible. This PR does a few things:

  • The avatar delegate and datasource methods are now optional and if they are not implemented, it is assumed that you don't want them.
  • A new JSMessagesViewAvatarPolicy has been added: JSMessagesViewAvatarPolicyOutgoingOnly. This should be self explanatory.
  • When the avatar related methods are implemented, avatarImageForIncomingMessageAtIndexPath: should now be used in place of avatarImageForIncomingMessage, etc. This allows for different avatars depending on the message.
  • A new property was added to JSMessagesViewController: preventScrollToBottomWhileUserScrolling. When this is set to YES, the tableview won't automatically scroll to the bottom when scrollToBottom is called if the user is scrolling the view. This is very useful in busy group chat cases so that users can place their thumb on the screen to read that their own pace instead of constantly being jumped to the bottom.
  • In conjunction with the point above, a new public method has been added scrollToRowAtIndexPath:atScrollPosition:animated:. This method respects the property above so that you can continue to program scrolls and still allow the user to read at his/her own pace.
  • You can now place a subtitle below the bubbles. This is useful for showing someone's name in a group chat. It is optional per cell via hasSubtitleForRowAtIndexPath: and subtitleForRowAtIndexPath:. You can see a screenshot below.
  • The documentation has been updated to reflect these changes.

I have also taken the liberty of bumping the podspec version to 2.1.0 and tagging the repo (I'm not sure if the tag merges though).

I hope you guys find these changes as useful as I do.

screenshot 2013 08 13 00 44 35 copy

@lastquestion
Copy link

👍 I merged this into my fork.

However, you have a bug. Specifically, I think you're always displaying subtitles or always NOT displaying subtitles for rows, right?

I dynamically decide if I want to or not.

You need to add the subtitle type to the cellidentifier, so that if a row loses its subtitle, it gets the right object type dequeued.

@jessesquires
Copy link
Owner

This looks pretty good! Very busy for now, but I will get to this as soon as I can. Thanks!

-- Jesse

@suparjitoteo
Copy link

@alecgorge when avatar is implemented, position of the subtitles messed up. other than that, it works great!

@alecgorge
Copy link
Contributor Author

@lastquestion I am glad you enjoy the changes. I see you have made some changes on your own fork. Have you implemented the proper fixes for the bugs mine has?

jessesquires added a commit that referenced this pull request Oct 20, 2013
Improvements to avatar default, user scrolling, add subtitle support
@jessesquires jessesquires merged commit 0642f34 into jessesquires:master Oct 20, 2013
@renevdkooi
Copy link

@jessesquires - Great code you made here, really good.. i was able to make the bubble images load asynchronously by changing some code and adding async loading, but i'm having a really hard time getting the avatars to load without having to wait on it.
Assuming avatars are not loaded from disk but remotely...

any suggestion?
THanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants