Commit graph

11 commits

Author SHA1 Message Date
Travis Ralston
f2b7042a33 misc cleanup 2019-04-04 09:30:15 -06:00
Travis Ralston
10369170ed Use a static prop on Stickerpicker to track the current widget 2019-04-03 17:16:56 -06:00
Travis Ralston
51750cf153 General cleanup of handling for WidgetMessaging instances
When setting, delete the old one. Because delete checks if it exists first, we can safely call this.

The change in FromWidgetPostMessageApi is just something noticed while debugging.
2019-04-01 19:50:05 -06:00
Travis Ralston
a4f76670c4 Don't re-init the stickerpicker unless something actually changes
Fixes https://github.com/vector-im/riot-web/issues/9354

https://github.com/matrix-org/matrix-react-sdk/pull/2801 introduced a change which tried to make sure that when the widget URL was changed that the picker would be re-mounted, however it accidentally introduced a regression. While it effectively did the task it wanted to, it failed to keep the previously-mounted sticker picker alive. This is because the Stickerpicker component is remounted when opened, and the _updateWidget function is called. This results in this.state not having the "current" widget, meaning a URL change is always detected when the component is remounted (room changes, open sticker picker). 

Instead of remounting always, we'll instead track which sticker picker widget is being used out of band. This therefore means that whenever the Stickerpicker component is mounted it doesn't create a whole new widget, and the existing (background) picker can be used. This also fixes the loading screen that people would see when opening the sticker picker after switching rooms, something which the persistent widget stuff is supposed to solve.
2019-04-01 19:48:05 -06:00
David Baker
e3643bd74c Lint 2018-08-17 09:42:23 +01:00
David Baker
7875d37c8e Destroy non-persistent widgets when switching room 2018-08-01 15:01:11 +01:00
David Baker
cdd73e6e1f Check matrix client exists when stopping 2018-07-24 16:55:45 +01:00
David Baker
7044410a13 Move destroyPersistentWidget to store 2018-07-24 16:50:34 +01:00
David Baker
ec4c7ffb71 Make ActiveWidgetStore clear persistent widgets
ActiveWidgetStore is now reponsible for removing the current
persistent widget from the store if it's been removed from whatever
room it was in. As per comment, this leaves us with the store updating
itself in this case but in all other cases, views call setters on the
store to update its state. We should make it so the store keeps itself
up to date and views aren't responsible for keeping the store up to date.

The store now emits events so it can notify PersistentApp when it changes.

Fixes https://github.com/vector-im/riot-web/issues/7076
2018-07-24 16:21:43 +01:00
David Baker
e56feea9ec Put always-on-screen widgets in top left
always-on-screen widgets now appear in the top-left where the
call preview normally is if you're not in the room that they're in.

Fixes https://github.com/vector-im/riot-web/issues/7007
Based off https://github.com/matrix-org/matrix-react-sdk/pull/2053
2018-07-12 18:43:49 +01:00
David Baker
8f10ee01c6 Implement always-on-screen capability for widgets
As per https://github.com/matrix-org/matrix-doc/issues/1354

This is whitelisted to only jitsi widgets for now as per comment,
mostly because any widget that we may make always-on-screen we need
to preemptively put in a PersistedElement container, which is
unnecessary for any other widget.

Apologies that this does a bunch of refactoring which could have
been split out separately: I only discovered what needed to be
refactored in the process of doing this.

Fixes https://github.com/vector-im/riot-web/issues/6984
2018-07-11 18:07:32 +01:00