Handle In-app Content (iOS)
If you followed the instruction inside Notification Setup closely, every tap on notification should be leading to a "handleNearContent" method.
You should implement your handleNearContent method, inside it, you would typically check the content type and handle presentation.
In the next chapter you will find a reference for any NearIT content.
Recipe and content objects
When eventWithContent gets called or inside processRecipe callback you will obtain the content and the tracking info as arguments.
In your native fragment, content can have several class types:
NITSimpleNotificationinstance representing the simple notificationNITContentinstance representing the rich content if anyNITCustomJSONinstance representing the custom object if anyNITCouponinstance representig the coupon if anyNITFeedbackinstance representing the feedback request if any
Native content classes
-
NITSimpleNotificationfor the simple notification, with the following attributes:messagereturns the notification message
-
NITContentfor the notification with content, with the following attributes:contentreturns the text content, without processing the htmlvideoLinkreturns the video linkimagesreturns a list of Image object containing the source links for the imagesuploadreturns an Upload object containing a link to a file uploaded on NearIT if anyaudioreturns an Audio object containing a link to an audio file uploaded on NearIT if any
-
NITFeedbackwith the following getters:questionreturns the feedback request string To give a feedback call this method:
// rating must be an integer between 0 and 5, and you can set a comment string.
NITManager.DefaultManager.SendEventWithEvent(feedback, (error) => {
...
});
-
NITCouponwith the following getters:namereturns the coupon namecouponDescriptionreturns the descriptionvaluereturns the value stringexpiresreturns the expiring dateredeemablereturns the redeemable date, it's a start date of when you can reedem the couponiconreturns an Image object containing the source links for the iconclaimsreturns a list of NITClaim which are the actual instances for the current profileNITClaimis composed by:serialNumberthe unique number assigned to the coupon instanceclaimeda date representing when the coupon has been claimedredeemeda date representing when the coupon has ben used
-
NITCustomJSONwith the following getters:contentreturns the json content as a [String: AnyObject] ([NSString*, id] in Objective-C)
NOTE Click here the Handle In-app Content (Bridge) of the Bridge.
Fetch current user coupon
We handle the complete emission and redemption coupon cycle in our platform, and we deliver a coupon content only when a coupon is emitted (you will not be notified of recipes when a profile has already received the coupon, even if the coupon is still valid). You can ask the library to fetch the list of all the user current coupons with the method:
NearBridgeiOS.GetCoupon((coupons) => {
// hanlde the NSArray of NITCoupon
}, (error) => {
// handle the NSError
});
The method will also return already redeemed coupons so you get to decide to filter them if necessary.