WMTInbox is responsible for managing messages in the Inbox. The inbox is a simple one-way delivery system that allows you to deliver messages to the user.
Note: Before using WMTInbox, you need to have a PowerAuth object available and initialized with a valid activation. Without a valid PowerAuth activation, the service will return an error.
WMTInbox communicates with the Mobile Token API.
The instance of the WMTInbox can be accessed after creating the main object of the SDK:
final mtoken = await powerAuthInstance.createMobileToken();
final inbox = mtoken.inbox;To get the number of unread messages, use the following code:
final countUnread = await mtoken.inbox.getUnreadCount();Get a paged list of messages:
// Get page 0 of size 50, do not exclude unread messages
final messageList = await mtoken.inbox.getMessageList(0, 50, false);Each message has its unique identifier. To get the body of the message, use the following code:
final messageId = messageList[0].id;
final detail = await mtoken.inbox.getMessageDetail(messageId);To mark the message as read by the user, use the following code:
final messageId = messageList[0].id;
await mtoken.inbox.markRead(messageId);Alternatively, you can mark all messages as read:
await mtoken.inbox.markAllRead();