MessageCollection

@objc(SBDMessageCollection)
public class MessageCollection : BaseCollection
extension MessageCollection: GroupChannelDelegate
extension MessageCollection: ConnectionDelegate

An object that accesses the cache for the messages.

Since

3.1.0
  • Undocumented

    Declaration

    Swift

    @objc
    public weak var delegate: MessageCollectionDelegate? { get set }
  • Message collection delegate.

    Declaration

    Swift

    @objc
    public internal(set) var startingPoint: Int64 { get }
  • If true, there may be the messages on the next page.

    Declaration

    Swift

    @objc
    public internal(set) var hasNext: Bool { get }
  • If true, there may be the messages on the previous page.

    Declaration

    Swift

    @objc
    public internal(set) var hasPrevious: Bool { get }
  • Returns the succeeded messages that are already loaded in memory.

    Declaration

    Swift

    @objc
    public var succeededMessages: [BaseMessage] { get }
  • Returns the pending messages that are already loaded in memory.

    Declaration

    Swift

    @objc
    public var pendingMessages: [BaseMessage] { get }
  • Returns the failed messages that are already loaded in memory.

    Declaration

    Swift

    @objc
    public var failedMessages: [BaseMessage] { get }
  • Starts the message collection with the policy. The result of the

    Declaration

    Swift

    @objc
    public func startCollection(
        initPolicy: MessageCollectionInitPolicy,
        cacheResultHandler: MessageListHandler?,
        apiResultHandler: MessageListHandler?
    )

    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.

  • Invalidates the object.

    Declaration

    Swift

    @objc
    public func dispose()
  • Loads messages of the next page.

    Declaration

    Swift

    @objc
    public func loadNext(completionHandler: @escaping MessageListHandler)
  • Loads messages of the previous page.

    Declaration

    Swift

    @objc
    public func loadPrevious(completionHandler: @escaping MessageListHandler)
  • Removes failed messages from DB.

    Declaration

    Swift

    @objc
    public func removeFailed(messages: [BaseMessage], completionHandler: MessageRequestIdsHandler?)
  • Removes all failed messages.

    Declaration

    Swift

    @objc
    public func removeAllFailed(completionHandler: SBErrorHandler?)

ChannelEventDelegate

ConnectionDelegate