SBDMessageCollection Class Reference

Inherits from SBDBaseCollection : NSObject
Declared in SBDMessageCollection.h

Overview

An object that accesses the cache for the messages.

  delegate

Message collection delegate.

@property (weak, nullable) id<SBDMessageCollectionDelegate> delegate

Availability

3.1.0

Declared In

SBDMessageCollection.h

  startingPoint

Starting point of the collection.

@property (atomic, readonly) long long startingPoint

Availability

3.1.0

Declared In

SBDMessageCollection.h

  hasNext

If YES, there may be the messages on the next page.

@property (atomic, readonly) BOOL hasNext

Availability

3.1.0

Declared In

SBDMessageCollection.h

  hasPrevious

If YES, there may be the messages on the previous page.

@property (atomic, readonly) BOOL hasPrevious

Availability

3.1.0

Declared In

SBDMessageCollection.h

  params

3.1.0

@property (atomic, nullable, readonly) SBDMessageListParams *params

Availability

3.1.0

Declared In

SBDMessageCollection.h

  channel

The channel object that the message collection has.

@property (strong, nonnull, readonly) SBDGroupChannel *channel

Availability

3.1.0

Declared In

SBDMessageCollection.h

– initWithChannel:startingPoint:params:

Initializes the message collection with the starting point and the parameter.

- (instancetype)initWithChannel:(SBDGroupChannel *)channel startingPoint:(long long)startingPoint params:(SBDMessageListParams *)params

Parameters

channel

Channel object.

startingPoint

Starting point where the message collection loads messages from.

params

Message list parameter.

Availability

3.1.0

Declared In

SBDMessageCollection.h

– startCollectionWithInitPolicy:cacheResultHandler:apiResultHandler:

Starts the message collection with the policy. The result of the

- (void)startCollectionWithInitPolicy:(SBDMessageCollectionInitPolicy)initPolicy cacheResultHandler:(nullable void ( ^ ) ( NSArray<SBDBaseMessage*> *_Nullable messages , SBDError *_Nullable error ))cacheResultHandler apiResultHandler:(nullable void ( ^ ) ( NSArray<SBDBaseMessage*> *_Nullable messages , SBDError *_Nullable error ))apiResultHandler

Parameters

initPolicy

The policy for the message collection.

cacheResultHandler

The callback to call when the messages are loaded from the cache. The messages is the messages that are loaded from the cache. The error will be returned when the loading message failed.

apiResultHandler

The callback to call when the messages are loaded from the server. The messages is the messages that are loaded from the server. The error will be returned when the loading message failed.

Availability

3.1.0

Declared In

SBDMessageCollection.h

– dispose

Invalidates the object.

- (void)dispose

Availability

3.1.0

Declared In

SBDMessageCollection.h

– loadNextWithCompletionHandler:

Loads messages of the next page.

- (void)loadNextWithCompletionHandler:(nullable void ( ^ ) ( NSArray<SBDBaseMessage*> *_Nullable messages , SBDError *_Nullable error ))completionHandler

Parameters

completionHandler

The callback to call when the load is complete. The error will be returned when the loading message failed.

Availability

3.1.0

Declared In

SBDMessageCollection.h

– loadPreviousWithCompletionHandler:

Loads messages of the previous page.

- (void)loadPreviousWithCompletionHandler:(nullable void ( ^ ) ( NSArray<SBDBaseMessage*> *_Nullable messages , SBDError *_Nullable error ))completionHandler

Parameters

completionHandler

The callback to call when the load is complete. The error will be returned when the loading message failed.

Availability

3.1.0

Declared In

SBDMessageCollection.h

– getSucceededMessages

Returns the succeeded messages that are already loaded in memory.

- (nonnull NSArray<SBDBaseMessage*> *)getSucceededMessages

Availability

3.1.0

Declared In

SBDMessageCollection.h

– getPendingMessages

Returns the pending messages that are already loaded in memory.

- (nonnull NSArray<SBDBaseMessage*> *)getPendingMessages

Availability

3.1.0

Declared In

SBDMessageCollection.h

– getFailedMessages

Returns the failed messages that are already loaded in memory.

- (nonnull NSArray<SBDBaseMessage*> *)getFailedMessages

Availability

3.1.0

Declared In

SBDMessageCollection.h

– removeFailedMessages:completionHandler:

Removes failed messages from DB. @params messages The failed messages to be removed from DB.

- (void)removeFailedMessages:(nonnull NSArray<SBDBaseMessage*> *)messages completionHandler:(nullable void ( ^ ) ( NSArray<NSString*> *_Nullable requestIds , SBDError *_Nullable error ))completionHandler

Parameters

completionHandler

The callback to call when the method is complete. The error will be returned when the removing failed messages failed.

Availability

3.1.0

Declared In

SBDMessageCollection.h

– removeAllFailedMessagesWithCompletionHandler:

Removes all failed messages.

- (void)removeAllFailedMessagesWithCompletionHandler:(nullable void ( ^ ) ( SBDError *_Nullable error ))completionHandler

Parameters

completionHandler

The callback to call when the method is complete. The error will be returned when the removing failed messages failed.

Availability

3.1.0

Declared In

SBDMessageCollection.h