UNPKG

@ua/react-native-airship

Version:
106 lines (95 loc) 2.7 kB
"use strict"; /** * Airship Message Center */ export class AirshipMessageCenter { constructor(module) { this.module = module; } /** * Gets the unread count. * @returns A promise with the result. */ getUnreadCount() { return this.module.messageCenterGetUnreadCount(); } /** * Gets the inbox messages. * @returns A promise with the result. */ getMessages() { return this.module.messageCenterGetMessages(); } /** * Marks a message as read. * @param messageId The message Id. * @returns A promise. Will reject if the message is not * found or if takeOff is not called. */ markMessageRead(messageId) { return this.module.messageCenterMarkMessageRead(messageId); } /** * Deletes a message. * @param messageId The message Id. * @returns A promise. Will reject if the message is not * found or if takeOff is not called. */ deleteMessage(messageId) { return this.module.messageCenterDeleteMessage(messageId); } /** * Dismisses the OOTB message center if displayed. * @returns A promise. */ dismiss() { return this.module.messageCenterDismiss(); } /** * Requests to display the Message Center. * * Will either emit an event to display the * Message Center if auto launch message center * is disabled, or display the OOTB message center. * @param messageId Optional message Id. * @returns A promise. */ display(messageId) { return this.module.messageCenterDisplay(messageId); } /** * Overlays the Message Center regardless if auto launch Message Center is enabled or not. * * @param messageId Optional message Id. * @returns A promise. */ showMessageCenter(messageId) { return this.module.messageCenterShowMessageCenter(messageId); } /** * Overlays the message view regardless if auto launch Message Center is enabled or not. * * @param messageId The message Id. * @returns A promise. */ showMessageView(messageId) { return this.module.messageCenterShowMessageView(messageId); } /** * Refreshes the messages. * @returns A promise. Will reject if the list fails to refresh or if * takeOff is not called yet. */ refreshMessages() { return this.module.messageCenterRefresh(); } /** * Enables or disables showing the OOTB UI when requested to display by either * `display` or by a notification with a Message Center action. * @param autoLaunch true to show OOTB UI, false to emit events. */ setAutoLaunchDefaultMessageCenter(autoLaunch) { this.module.messageCenterSetAutoLaunchDefaultMessageCenter(autoLaunch); } } //# sourceMappingURL=AirshipMessageCenter.js.map