mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-29 07:42:40 +00:00
PostMessage API: Add support of integration_manager_open
This commit is contained in:
parent
55f627c659
commit
0b3fa2bad0
1 changed files with 32 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
|||
#import "WidgetViewController.h"
|
||||
|
||||
#import "AppDelegate.h"
|
||||
#import "IntegrationManagerViewController.h"
|
||||
|
||||
NSString *const kJavascriptSendResponseToPostMessageAPI = @"riotIOS.sendResponse('%@', %@);";
|
||||
|
||||
|
@ -214,6 +215,37 @@ NSString *const kJavascriptSendResponseToPostMessageAPI = @"riotIOS.sendResponse
|
|||
// Consider we are done with the sticker picker widget
|
||||
[self withdrawViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
else if ([@"integration_manager_open" isEqualToString:action])
|
||||
{
|
||||
NSDictionary *widgetData;
|
||||
NSString *integType, *integId;
|
||||
MXJSONModelSetDictionary(widgetData, requestData[@"widgetData"]);
|
||||
if (widgetData)
|
||||
{
|
||||
MXJSONModelSetString(integType, widgetData[@"integType"]);
|
||||
MXJSONModelSetString(integId, widgetData[@"integId"]);
|
||||
}
|
||||
|
||||
if (integType && integId)
|
||||
{
|
||||
// Open the integration manager requested page
|
||||
IntegrationManagerViewController *modularVC = [[IntegrationManagerViewController alloc]
|
||||
initForMXSession:self.roomDataSource.mxSession
|
||||
inRoom:self.roomDataSource.roomId
|
||||
screen:[IntegrationManagerViewController screenForWidget:integType]
|
||||
widgetId:integId];
|
||||
|
||||
[self presentViewController:modularVC animated:NO completion:nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"[WidgetVC] onPostMessageRequest: ERROR: Invalid content for integration_manager_open: %@", requestData);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"[WidgetVC] onPostMessageRequest: ERROR: Unsupported action: %@: %@", action, requestData);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)sendBoolResponse:(BOOL)response toRequest:(NSString*)requestId
|
||||
|
|
Loading…
Reference in a new issue