mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-10-01 01:05:53 -04:00
34653eb223
The "Join Conference" screen should not be sticky. We also need to make sure we have a widget ID set so that when we say to be stuck on screen or not, the request actually passes.
36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
import { OnDestroy, OnInit } from "@angular/core";
|
|
import { Subscription } from "rxjs/Subscription";
|
|
import { ScalarWidgetApi } from "../shared/services/scalar/scalar-widget.api";
|
|
|
|
export abstract class CapableWidget implements OnInit, OnDestroy {
|
|
|
|
private widgetApiSubscription: Subscription;
|
|
|
|
// The capabilities we support
|
|
protected supportsScreenshots = false;
|
|
protected supportsStickers = false;
|
|
protected supportsAlwaysOnScreen = false;
|
|
|
|
public ngOnInit() {
|
|
this.widgetApiSubscription = ScalarWidgetApi.requestReceived.subscribe(request => {
|
|
if (request.action === "capabilities") {
|
|
const capabilities = [];
|
|
|
|
if (this.supportsScreenshots) capabilities.push("m.capability.screenshot");
|
|
if (this.supportsStickers) capabilities.push("m.sticker");
|
|
if (this.supportsAlwaysOnScreen) capabilities.push("m.always_on_screen");
|
|
|
|
ScalarWidgetApi.replyCapabilities(request, capabilities);
|
|
this.onCapabilitiesSent();
|
|
}
|
|
});
|
|
}
|
|
|
|
public ngOnDestroy() {
|
|
if (this.widgetApiSubscription) this.widgetApiSubscription.unsubscribe();
|
|
}
|
|
|
|
protected onCapabilitiesSent(): void {
|
|
// Nothing to do here.
|
|
}
|
|
} |