UAInboxMessageList

@interface UAInboxMessageList : NSObject

The primary interface to the contents of the inbox. Use this class to asychronously retrieve messges from the server, delete or mark messages as read, retrieve individual messages from the list.

  • The list of messages stored locally as an NSArray.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic)
        NSArray<UAInboxMessage *> *_Nonnull messages;

    Swift

    var messages: [UAInboxMessage] { get }
  • The number of messages that are currently unread or -1 if the message list is not loaded.

    Declaration

    Objective-C

    @property (assign, readwrite, atomic) NSInteger unreadCount;

    Swift

    var unreadCount: Int { get set }
  • YES if retrieving message list is currently in progress. NO otherwise.

    Declaration

    Objective-C

    @property (readonly, atomic) BOOL isRetrieving;

    Swift

    var isRetrieving: Bool { get }
  • YES if message batching is currently in progress. NO otherwise.

    Declaration

    Objective-C

    @property (readonly, atomic) BOOL isBatchUpdating;

    Swift

    var isBatchUpdating: Bool { get }
  • Marks messages read. They will be marked locally as read and synced with Airship on the next message retrieval.

    Declaration

    Objective-C

    - (nullable UADisposable *)markMessagesRead:(nonnull NSArray *)messages
                              completionHandler:
                                  (nullable UAInboxMessageListCallbackBlock)
                                      completionHandler;

    Swift

    func markMessagesRead(_ messages: [Any], completionHandler: UAInboxMessageListCallbackBlock? = nil) -> UADisposable?

    Parameters

    messages

    The array of messages to be marked read.

    completionHandler

    An optional completion handler.

    Return Value

    A UADisposable token which can be used to cancel callback execution, or nil if the array of messages to mark read is empty.

  • Marks messages deleted. They will be marked locally as deleted and synced with Airship on the next message retrieval.

    Declaration

    Objective-C

    - (nullable UADisposable *)markMessagesDeleted:(nonnull NSArray *)messages
                                 completionHandler:
                                     (nullable UAInboxMessageListCallbackBlock)
                                         completionHandler;

    Swift

    func markMessagesDeleted(_ messages: [Any], completionHandler: UAInboxMessageListCallbackBlock? = nil) -> UADisposable?

    Parameters

    messages

    The array of messages to be marked deleted.

    completionHandler

    An optional completion handler.

    Return Value

    A UADisposable token which can be used to cancel callback execution, or nil if the array of messages to mark deleted is empty.

  • Returns the list of messages stored locally as an NSArray, filtered by the supplied predicate.

    Declaration

    Objective-C

    - (nonnull NSArray<UAInboxMessage *> *)messagesFilteredUsingPredicate:
        (nonnull NSPredicate *)predicate;

    Swift

    func messagesFiltered(using predicate: NSPredicate) -> [UAInboxMessage]

    Parameters

    predicate

    The predicate to use as a filter over messages.

  • Returns the number of messages currently in the inbox.

    Declaration

    Objective-C

    - (NSUInteger)messageCount;

    Swift

    func messageCount() -> UInt

    Return Value

    The message count as an integer.

  • Returns the message associated with a particular URL.

    Declaration

    Objective-C

    - (nullable UAInboxMessage *)messageForBodyURL:(nonnull NSURL *)url;

    Swift

    func message(forBodyURL url: URL) -> UAInboxMessage?

    Parameters

    url

    The URL of the message

    Return Value

    The associated UAInboxMessage object or nil if a message was unable to be found.

  • Returns the message associated with a particular ID.

    Declaration

    Objective-C

    - (nullable UAInboxMessage *)messageForID:(nonnull NSString *)messageID;

    Swift

    func message(forID messageID: String) -> UAInboxMessage?

    Parameters

    messageID

    The message ID as an NSString.

    Return Value

    The associated UAInboxMessage object or nil if a message was unable to be found.