In my previous post I talked about getting the JivePerson object for the user and loading the list of custom streams. In this post I will walk you through the Inbox calls needed to show and manipulate the user's inbox.


To start we need to specify the initial options. Lets start by loading the first 10 unread items:

JiveInboxOptions *unreadInboxOptions = [JiveInboxOptions new];
unreadInboxOptions.unread = YES;
unreadInboxOptions.count = 10;


Then we call the server:

[communityInstance inbox:unreadInboxOptions
              onComplete:^(NSArray *inboxEntries, NSDate *earliestDate, NSDate *latestDate)
  {[self showInboxEntries:inboxEntries from:earliestDate to:latestDate];}
                 onError:^(NSError *error) {[self handleInboxError:error];}];

The inboxEntries are JiveInboxEntry objects. They are sorted by date, but they include a thread id in the entry.jive.collection parameter that can be used to group the entries.


All JiveInboxEntry items include a summary of the full content suitable for display in a compact space.

A JiveInboxEntry can represent 3 types of content: general, acclaim, and notice.

A general item represents a link to viewable content through the contentURL parameter.

An acclaim item represents a grouping of JiveInboxEntry objects. The entryCollectionId parameter is the thread id of the related entries.

Finally, a notice item is just viewable content that does not link to anything else.


You can get the content from a general inbox entry item using this call:

[communityInstance contentFromURL:entryItem.contentURL
                       onComplete:^(JiveContent *content) {[self displayContent:content];}
                          onError:^(NSError *error) {[self handleContentFromURLError:error];}];


Remember to mark the item as read:

[communityInstance markInboxEntries:@[entryItem]
                         onComplete:^{[self inboxEntriesMarkedAsRead];}
                            onError:^(NSError *error)
  {[self handleInboxEntriesMarkedAsReadError:error];}];

You can see that the entryItem is passed to the method in an NSArray. You can use this to implement a batch mark interface. This method can also be used to mark items as unread.


For consistency, you should use the unreadInboxOptions.after or unreadInboxOptions.before parameters to load additional entries. For example if loadedEarliestDate is the earliestDate from the above call:

unreadInboxOptions.before = loadedEarliestDate;
[communityInstance inbox:unreadInboxOptions
              onComplete:^(NSArray *inboxEntries, NSDate *earliestDate, NSDate *latestDate)
{[self showMoreInboxEntries:inboxEntries from:earliestDate to:latestDate];}
                 onError:^(NSError *error) {[self handleInboxError:error];}];

This would load the 10 items previous to the already loaded items.