You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-07 10:46:24 +03:00
Move destroyPersistentWidget to store
This commit is contained in:
@@ -66,15 +66,21 @@ class ActiveWidgetStore extends EventEmitter {
|
||||
if (ev.getType() !== 'im.vector.modular.widgets') return;
|
||||
|
||||
if (ev.getStateKey() === this._persistentWidgetId) {
|
||||
const PersistedElement = sdk.getComponent("elements.PersistedElement");
|
||||
PersistedElement.destroyElement('widget_' + ev.getStateKey());
|
||||
this.setWidgetPersistence(ev.getStateKey(), false);
|
||||
this.delWidgetMessaging(ev.getStateKey());
|
||||
this.delWidgetCapabilities(ev.getStateKey());
|
||||
this.delRoomId(ev.getStateKey());
|
||||
this.destroyPersistentWidget();
|
||||
}
|
||||
}
|
||||
|
||||
destroyPersistentWidget() {
|
||||
const toDeleteId = this._persistentWidgetId;
|
||||
|
||||
const PersistedElement = sdk.getComponent("elements.PersistedElement");
|
||||
PersistedElement.destroyElement('widget_' + toDeleteId);
|
||||
this.setWidgetPersistence(toDeleteId, false);
|
||||
this.delWidgetMessaging(toDeleteId);
|
||||
this.delWidgetCapabilities(toDeleteId);
|
||||
this.delRoomId(toDeleteId);
|
||||
}
|
||||
|
||||
setWidgetPersistence(widgetId, val) {
|
||||
if (this._persistentWidgetId === widgetId && !val) {
|
||||
this._persistentWidgetId = null;
|
||||
|
||||
Reference in New Issue
Block a user