Send Stickers: WidgetManager: add userWidgets

and show them in the widget picker and within the list of installed widgets of the integration manager

#1860
This commit is contained in:
manuroe
2018-05-07 11:15:18 +02:00
parent acf230465b
commit 6a04301926
5 changed files with 58 additions and 12 deletions
@@ -551,20 +551,24 @@ NSString *const kJavascriptSendResponseToModular = @"riotIOS.sendResponse('%@',
- (void)getWidgets:(NSDictionary*)eventData
{
MXRoom *room = [self roomCheckWithEvent:eventData];
NSMutableArray<NSDictionary*> *widgetStateEvents = [NSMutableArray array];
if (room)
{
NSArray<Widget*> *widgets = [[WidgetManager sharedManager] widgetsInRoom:room];
NSMutableArray<NSDictionary*> *widgetStateEvents = [NSMutableArray arrayWithCapacity:widgets.count];
for (Widget *widget in widgets)
{
[widgetStateEvents addObject:widget.widgetEvent.JSONDictionary];
}
[self sendNSObjectResponse:widgetStateEvents toEvent:eventData];
}
// Add user widgets (not linked to a specific room)
for (Widget *widget in [[WidgetManager sharedManager] userWidgets:mxSession])
{
[widgetStateEvents addObject:widget.widgetEvent.JSONDictionary];
}
[self sendNSObjectResponse:widgetStateEvents toEvent:eventData];
}
- (void)canSendEvent:(NSDictionary*)eventData