Widget postMessage API: Refactor to avoid to play with internal event.data._id field

This commit is contained in:
manuroe
2018-05-07 15:33:37 +02:00
parent b1d7617d05
commit 1834a90108
3 changed files with 118 additions and 109 deletions
@@ -50,48 +50,49 @@
This method can be overidden to implement a specific API between the matrix client
and widget.
@param @TODO
@param requestId the id of the widget request.
@param requestData the request data.
*/
- (void)onMessage:(NSDictionary*)JSData;
- (void)onPostMessageRequest:(NSString*)requestId data:(NSDictionary*)requestData;
/**
Send a boolean response to a request from the widget.
@param response the response to send.
@param @TODO
@param requestId the id of the widget request.
*/
- (void)sendBoolResponse:(BOOL)response toEvent:(NSDictionary*)eventData;
- (void)sendBoolResponse:(BOOL)response toRequest:(NSString*)requestId;
/**
Send an integer response to a request from the widget.
@param response the response to send.
@param @TODO
@param requestId the id of the widget request.
*/
- (void)sendIntegerResponse:(NSUInteger)response toEvent:(NSDictionary*)eventData;
- (void)sendIntegerResponse:(NSUInteger)response toRequest:(NSString*)requestId;
/**
Send a serialiable object response to a request the widget.
@param response the response to send.
@param @TODO
@param requestId the id of the widget request.
*/
- (void)sendNSObjectResponse:(NSObject*)response toEvent:(NSDictionary*)eventData;
- (void)sendNSObjectResponse:(NSObject*)response toRequest:(NSString*)requestId;
/**
Send a message error to a request from the widget.
@param message the error message.
@param @TODO
@param requestId the id of the widget request.
*/
- (void)sendError:(NSString*)message toEvent:(NSDictionary*)eventData;
- (void)sendError:(NSString*)message toRequest:(NSString*)requestId;
/**
Send a localised message error to a request from the widget.
@param errorKey the string id of the message error.
@param @TODO
@param requestId the id of the widget request.
*/
- (void)sendLocalisedError:(NSString*)errorKey toEvent:(NSDictionary*)eventData;
- (void)sendLocalisedError:(NSString*)errorKey toRequest:(NSString*)requestId;
@end