github jessesquires/JSQMessagesViewController 6.0.0
Version 6.0.0

latest releases: 7.3.5, 7.3.4, 7.3.3...
9 years ago

This project has reached another exciting milestone! This release includes a lot of refactoring, optimizing, bug fixes, and most notably — media message support. 🎉

Find additional details about this release at issue #476.

See the complete list of closed issues at the 6.0 milestone.

Documentation

You can find the latest documentation here.

Also see the Getting Started guide in the README.

The demo project as also been updated, please use this as a guide.

What's new

Media Messages! 🎉
By far, this has been the most-requested feature for this library. The JSQMessage class has been updated to support media messages. This comes in the form of updates to the JSQMessageData protocol and the addition of a new protocol, JSQMessageMediaData. Additionally, there are 3 built-in media types: photo, video, and location. These are represented by the following 3 classes: JSQPhotoMediaItem, JSQVideoMediaItem, JSQLocationMediaItem. See the corresponding docs for more details.

Further, the library supports asynchronous loading of media. You can use JSQMessagesMediaPlaceholderView to display media items that are "loading".

Also see the JSQMessagesMediaViewBubbleImageMasker for masking custom media item views as bubble images. The built-in media types have an appliesMediaViewMaskAsOutgoing property to specify if the media view is incoming or outgoing.

NOTE: The media message model is extremely and easily extensible. You can easily provide your own custom media items by simply conforming to the JSQMessageMediaData protocol. For instance, you could create a new model object, MyContactMediaItem, that represents a contact (name, phone, address, email, etc.). All you need to do is conform to JSQMessageMediaData and pass this object to a JSQMessage object during initialization. The library will do the rest.

A Refined Model
The JSQMessageData protocol has been updated to include a senderId and senderDisplayName. (This was previously only sender.)

All model objects have been refined and updated, they are:

  • JSQMessage <JSQMessageData> : represents message objects
  • JSQMediaItem <JSQMessageMediaData> : base class for media objects
  • JSQPhotoMediaItem <JSQMessageMediaData> : represents photo attachments
  • JSQLocationMediaItem <JSQMessageMediaData> : represents location attachments
  • JSQVideoMediaItem <JSQMessageMediaData> : represents video attachments
  • JSQMessagesAvatarImage <JSQMessageAvatarImageDataSource> : represents avatars
  • JSQMessagesBubbleImage <JSQMessageBubbleImageDataSource> : represents message bubbles

NOTE: Each of the built-in model classes simply conforms to a specific protocol in the library. This means you can use your existing model objects as long as they conform to the necessary protocols.

JSQMessageBubbleImageDataSource Protocol
This new data source protocol replaces the use of imageView objects for message bubble image views. The messageBubbleImageView of a JSQMessagesCollectionViewCell is now part of the cell prototype. This change is reflected in JSQMessagesCollectionViewDataSource as well as JSQMessagesBubbleImageFactory.

// Changes in JSQMessagesCollectionViewDataSource

// OLD
- (UIImageView *)collectionView:(JSQMessagesCollectionView *)collectionView bubbleImageViewForItemAtIndexPath:(NSIndexPath *)indexPath;

// NEW
- (id<JSQMessageBubbleImageDataSource>)collectionView:(JSQMessagesCollectionView *)collectionView messageBubbleImageDataForItemAtIndexPath:(NSIndexPath *)indexPath;

JSQMessagesBubbleImageFactory
You can now supply your own message bubble images and the factory class now generates JSQMessagesBubbleImage objects using those images. (You can also use the default bubble images.)

JSQMessageAvatarImageDataSource
This new data source protocol replaces the use of imageView objects for avatar image views. The avatarImageView of a JSQMessagesCollectionViewCell is now part of the cell prototype. This change is reflected in JSQMessagesCollectionViewDataSource as well as JSQMessagesAvatarImageFactory.

// Changes in JSQMessagesCollectionViewDataSource

// OLD
- (UIImageView *)collectionView:(JSQMessagesCollectionView *)collectionView avatarImageViewForItemAtIndexPath:(NSIndexPath *)indexPath;

// NEW
- (id<JSQMessageAvatarImageDataSource>)collectionView:(JSQMessagesCollectionView *)collectionView avatarImageDataForItemAtIndexPath:(NSIndexPath *)indexPath;

JSQMessagesAvatarImageFactory
Previously named JSQMessagesAvatarFactory. This factory class now generates JSQMessageAvatarImage objects.

TypingIndicator and LoadEarlierMessagesHeader
The properties how have more customization options. The typingIndicatorColor has been removed from JSQMessagesViewController.

New properties on JSQMessagesCollectionView:

  • typingIndicatorDisplaysOnLeft
  • typingIndicatorMessageBubbleColor
  • typingIndicatorEllipsisColor
  • loadEarlierMessagesHeaderTextColor

JSQMessagesCollectionViewCell
Now has a mediaView property and mediaCellReuseIdentifier.

JSQMessagesViewController
Now has outgoingMediaCellIdentifier and incomingMediaCellIdentifier properties. As before, you may still provide custom cells with custom identifiers. See the docs for more details.

Bug fixes!
See the complete list of bug fixes for details. 🎉

Localization

The library is now localized in 14 languages!

Localization includes the "Send", "New Message", and "Load Earlier Messages" strings. Need a language that isn't supported? Please submit a PR!

This feature was truly a community effort. Thanks to all who contributed! See #237 for details.

Donate

Do you use this library? Are you interesting in contributing or supporting it? Consider donating!

Donations buy me ☕ to work hard and 🍺 to celebrate releases.

Interoperability with Swift

This library uses uses modern Objective-C and follows current best practices to facilitate Swift interoperability. You should not have any issues using this library with Swift, but if you do please open a new issue. Simply add the JSQMessages.h umbrella header to your bridging header for Swift.

Fun stats

As of this release:

  • This library is over 1.5 years old!
  • 433 issues closed
  • 48 releases
  • 1,126 commits
  • 32 contributors

Don't miss a new JSQMessagesViewController release

NewReleases is sending notifications on new releases.