Widget: Support new "m.widget" state event type but keep using "im.vector.modular.widgets" for operations

while the move is not fully done (https://docs.google.com/document/d/1uPF7XWY_dXTKVKV7jZQ2KmsI19wn9-kFRgQ1tFQP7wQ/edit?usp=sharing)
This commit is contained in:
manuroe
2018-05-07 10:12:02 +02:00
parent ce3f22740f
commit d9d3d1deeb
5 changed files with 35 additions and 17 deletions
+8 -4
View File
@@ -39,10 +39,10 @@
- (NSAttributedString *)attributedStringFromEvent:(MXEvent *)event withRoomState:(MXRoomState *)roomState error:(MXKEventFormatterError *)error
{
// Build strings for modular widget events
// TODO: At the moment, we support only jitsi widgets
// Build strings for widget events
if (event.eventType == MXEventTypeCustom
&& [event.type isEqualToString:kWidgetEventTypeString])
&& ([event.type isEqualToString:kWidgetMatrixEventTypeString]
|| [event.type isEqualToString:kWidgetModularEventTypeString]))
{
NSString *displayText;
@@ -71,7 +71,11 @@
// This is a closed widget
// Check if it corresponds to a jitsi widget by looking at other state events for
// this jitsi widget (widget id = event.stateKey).
for (MXEvent *widgetStateEvent in [roomState stateEventsWithType:kWidgetEventTypeString])
// Get all widgets state events in the room
NSMutableArray<MXEvent*> *widgetStateEvents = [NSMutableArray arrayWithArray:[roomState stateEventsWithType:kWidgetMatrixEventTypeString]];
[widgetStateEvents addObjectsFromArray:[roomState stateEventsWithType:kWidgetModularEventTypeString]];
for (MXEvent *widgetStateEvent in widgetStateEvents)
{
if ([widgetStateEvent.stateKey isEqualToString:widget.widgetId])
{