SDK versions < 6.0.0
Inbox class is named Inbox.
Inbox object
Once the device has been successfully registered, you can start making Inbox requests. The following characteristics of the Inbox must be taken into account, which are optionally configurable.
Inbox Properties
The notifications of the Inbox will have the following states of the class InboxStatus:
- Sent : The notification has been sent to the client, whether or not they could read it.
- Click: have clicked on the notification displayed in the Inbox.
- Delete: The Inbox notification has been deleted by the customer.
The notifications will also come with a 'read' status, to help differentiate those status.
Each notification will be assigned with an integer and unique sendingId, to be able to differentiate them and use them for some of the functionalities.
Get notifications
As explained above, to obtain the notifications the following method is used:
INInbox.getInboxWithSuccess({ (inbox) in
//DO SOMETHING
}) { (error) in
//LOG ERROR
}
[INInbox getInboxWithSuccess:^(INInbox * _Nonnull inbox) {
//DO SOMETHING
} onError:^(INError * _Nonnull error) {
//LOG ERROR
}];
Inbox next page
Once the Inbox instance is obtained, we will use it to request the next page, which is made with the following method, in the event that there are no more pages it will indicate it in the error with code 410:
inbox.getNextPage(success: { (inbox, newNotifications) in
//DO SOMETHING
}) { (error) in
if (error.statusCode == 3011){
//LOG NO MORE PAGES
}else{
//LOG ERROR
}
}
[inbox getNextPageWithSuccess:^(INInbox * _Nonnull inbox, NSArray<INInboxNotification *>* newNotifications) {
//DO SOMETHING
} onError:^(INError * _Nonnull error) {
if (error.statusCode == 410){
//LOG NO MORE PAGES
}
//LOG ERROR
}];
Take into account that the Inbox callback, apart from returning the updated Inbox, returns an array called newNotifications , in which the new notifications to be added to the Inbox will be displayed, so that, if necessary, be able to use said array to move between the pages without depending on the Inbox calls.