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:
NITSimpleNotification
instance representing the simple notificationNITContent
instance representing the rich content if anyNITCustomJSON
instance representing the custom object if anyNITCoupon
instance representig the coupon if anyNITFeedback
instance representing the feedback request if any
Native content classes
-
NITSimpleNotification
for the simple notification, with the following attributes:message
returns the notification message
-
NITContent
for the notification with content, with the following attributes:content
returns the text content, without processing the htmlvideoLink
returns the video linkimages
returns a list of Image object containing the source links for the imagesupload
returns an Upload object containing a link to a file uploaded on NearIT if anyaudio
returns an Audio object containing a link to an audio file uploaded on NearIT if any
-
NITFeedback
with the following getters:question
returns 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) => {
...
});
-
NITCoupon
with the following getters:name
returns the coupon namecouponDescription
returns the descriptionvalue
returns the value stringexpires
returns the expiring dateredeemable
returns the redeemable date, it's a start date of when you can reedem the couponicon
returns an Image object containing the source links for the iconclaims
returns a list of NITClaim which are the actual instances for the current profileNITClaim
is composed by:serialNumber
the unique number assigned to the coupon instanceclaimed
a date representing when the coupon has been claimedredeemed
a date representing when the coupon has ben used
-
NITCustomJSON
with the following getters:content
returns 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.