Implement new widget API (#1201)
* Implement new widget API This allows clients to see who provisioned which widgets. * Update to make state_key the wid * Update to latest API * Only show widgets which have required fields * Don't constantly show apps dialog * Fix example to include data key
This commit is contained in:
parent
5c89d3303b
commit
cf158530f5
4 changed files with 82 additions and 100 deletions
|
@ -275,8 +275,14 @@ module.exports = React.createClass({
|
|||
},
|
||||
|
||||
_shouldShowApps: function(room) {
|
||||
const appsStateEvents = room.currentState.getStateEvents('im.vector.modular.widgets', '');
|
||||
return appsStateEvents && Object.keys(appsStateEvents.getContent()).length > 0;
|
||||
const appsStateEvents = room.currentState.getStateEvents('im.vector.modular.widgets');
|
||||
// any valid widget = show apps
|
||||
for (let i = 0; i < appsStateEvents.length; i++) {
|
||||
if (appsStateEvents[i].getContent().type && appsStateEvents[i].getContent().url) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
componentDidMount: function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue