ISHCustomiseHandler Protocol Reference
Conforms to | NSObject |
---|---|
Declared in | ISHCustomiseHandler.h |
– shRawJsonCallbackWithTitle:withMessage:withJson:
Streethawk calls [ISHCustomiseHandler shRawJsonCallbackWithTitle:withMessage:withJson:] function when a customized notification code 8049 arrives at device. Customer is responsible to handle this message by their own code:
- (void)shRawJsonCallbackWithTitle:(NSString *)title withMessage:(NSString *)message withJson:(NSString *)json
Parameters
title |
Title of the payload. |
---|---|
message |
Message of the payload. |
json |
Json string, usually parse to NSDicationary. Use system API |
Discussion
- Customer App create class (assume named
MyHandler
) inherit fromISHCustomiseHandler
and implement this function. - Customer App call
[StreetHawk shSetCustomiseHandler:<instance_MyHandler>
to register the observer. - When StreetHawk sends 8049, customer’s implementation is triggered.
Declared In
ISHCustomiseHandler.h
– onReceive:clickButton:
Streethawk calls [ISHCustomiseHandler onReceive:clickButton:] function when needs to display confirm dialog UI. Default it will display a UIAlertView, and customer is capable to override this confirm dialog UI with their own code:
- (BOOL)onReceive:(PushDataForApplication *)pushData clickButton:(ClickButtonHandler)handler
Parameters
pushData |
Information from notification. Customer developer can use the information to create their own confirm dialog. |
---|---|
handler |
After click button call this to let StreetHawk continue process. |
Return Value
If this push can be handled by one callback, return YES; if not handle this push, return NO. For example, customer handler may handle one action, so return YES for this action and return NO for others to let StreetHawk handle the rest.
Discussion
- Customer App create class (assume named
MyHandler
) inherit fromISHCustomiseHandler
and implement this function. pushData
contains notification information, such as title, message, data etc. Customer can show their own dialog using these information.- After showing customer confirm dialog UI, if still wish to use StreetHawk functions, call
handler
and let StreetHawk to handle the rest automatically. - If not use StreetHawk function, not call
handler
and implement by your own. Remember to call[PushDataForApplication sendPushResult]
to send result to server. - Customer App call
[StreetHawk shSetCustomiseHandler:<instance_MyHandler>
to register the callback.
Declared In
ISHCustomiseHandler.h
– onReceiveResult:withResult:
Streethawk calls [ISHCustomiseHandler onReceiveResult:withResult:] function when sending push result to server, customer App can implement this to do some action. For example, if user choose SHResult_Decline
it can pop up feedback dialog asking why. Note: this can happen both FG and BG, check pushData.isAppOnForeground
to know the status, if in BG it cannot do UI stuff.
- (void)onReceiveResult:(PushDataForApplication *)pushData withResult:(SHResult)result
Parameters
pushData |
Information from notification. Customer developer can use the information to know what notification is handled. |
---|---|
result |
The result user decides for this notification. |
Declared In
ISHCustomiseHandler.h