Skip to content

Commit

Permalink
Widget: Integrate widget data into widget URL (element-hq/riot-meta#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
manuroe committed Dec 21, 2017
1 parent 3def1d7 commit c65edec
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Riot/Utils/Widgets/Widget.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ - (instancetype)initWithWidgetEvent:(MXEvent *)widgetEvent inMatrixSession:(MXSe
// Some widget can live without scalar token (ex: Jitsi widget)
NSLog(@"[Widget] Note: There is no scalar token for %@", self);
}

// Integrate widget data into widget url
for (NSString *key in _data)
{
NSString *paramKey = [NSString stringWithFormat:@"$%@", key];
NSString *value = [_data[key] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

_url = [_url stringByReplacingOccurrencesOfString:paramKey
withString:value];
}
}
}

Expand Down

0 comments on commit c65edec

Please sign in to comment.