Minor touchups to the dialog
parent
ddd8bdc00e
commit
21663314ee
|
@ -31,6 +31,7 @@ import {
|
|||
ModalButtonKind,
|
||||
Widget,
|
||||
WidgetApiFromWidgetAction,
|
||||
WidgetKind,
|
||||
} from "matrix-widget-api";
|
||||
import {StopGapWidgetDriver} from "../../../stores/widgets/StopGapWidgetDriver";
|
||||
import {MatrixClientPeg} from "../../../MatrixClientPeg";
|
||||
|
@ -72,7 +73,7 @@ export default class ModalWidgetDialog extends React.PureComponent<IProps, IStat
|
|||
}
|
||||
|
||||
public componentDidMount() {
|
||||
const driver = new StopGapWidgetDriver( [], this.widget.type);
|
||||
const driver = new StopGapWidgetDriver( [], this.widget, WidgetKind.Modal);
|
||||
const messaging = new ClientWidgetApi(this.widget, this.appFrame.current, driver);
|
||||
this.setState({messaging});
|
||||
}
|
||||
|
|
|
@ -569,7 +569,7 @@
|
|||
"%(names)s and %(count)s others are typing …|other": "%(names)s and %(count)s others are typing …",
|
||||
"%(names)s and %(count)s others are typing …|one": "%(names)s and one other is typing …",
|
||||
"%(names)s and %(lastPerson)s are typing …": "%(names)s and %(lastPerson)s are typing …",
|
||||
"Remain on your screen when you leave this room (when running)": "Remain on your screen when you leave this room (when running)",
|
||||
"Remain on your screen when viewing another room, when running": "Remain on your screen when viewing another room, when running",
|
||||
"Remain on your screen while running": "Remain on your screen while running",
|
||||
"Send stickers into this room": "Send stickers into this room",
|
||||
"Send stickers into your active room": "Send stickers into your active room",
|
||||
|
|
|
@ -34,6 +34,7 @@ import {
|
|||
WidgetApiFromWidgetAction,
|
||||
IModalWidgetOpenRequest,
|
||||
IWidgetApiErrorResponseData,
|
||||
WidgetKind,
|
||||
} from "matrix-widget-api";
|
||||
import { StopGapWidgetDriver } from "./StopGapWidgetDriver";
|
||||
import { EventEmitter } from "events";
|
||||
|
@ -152,6 +153,7 @@ export class StopGapWidget extends EventEmitter {
|
|||
private mockWidget: ElementWidget;
|
||||
private scalarToken: string;
|
||||
private roomId?: string;
|
||||
private kind: WidgetKind;
|
||||
|
||||
constructor(private appTileProps: IAppTileProps) {
|
||||
super();
|
||||
|
@ -165,6 +167,7 @@ export class StopGapWidget extends EventEmitter {
|
|||
|
||||
this.mockWidget = new ElementWidget(app);
|
||||
this.roomId = appTileProps.room?.roomId;
|
||||
this.kind = appTileProps.userWidget ? WidgetKind.Account : WidgetKind.Room; // probably
|
||||
}
|
||||
|
||||
private get eventListenerRoomId(): string {
|
||||
|
@ -303,7 +306,7 @@ export class StopGapWidget extends EventEmitter {
|
|||
public start(iframe: HTMLIFrameElement) {
|
||||
if (this.started) return;
|
||||
const allowedCapabilities = this.appTileProps.whitelistCapabilities || [];
|
||||
const driver = new StopGapWidgetDriver( allowedCapabilities, this.mockWidget);
|
||||
const driver = new StopGapWidgetDriver( allowedCapabilities, this.mockWidget, this.kind);
|
||||
this.messaging = new ClientWidgetApi(this.mockWidget, iframe, driver);
|
||||
this.messaging.on("preparing", () => this.emit("preparing"));
|
||||
this.messaging.on("ready", () => this.emit("ready"));
|
||||
|
|
|
@ -17,8 +17,10 @@
|
|||
import {
|
||||
Capability,
|
||||
ISendEventDetails,
|
||||
MatrixCapabilities, Widget,
|
||||
MatrixCapabilities,
|
||||
Widget,
|
||||
WidgetDriver,
|
||||
WidgetKind,
|
||||
} from "matrix-widget-api";
|
||||
import { iterableDiff, iterableUnion } from "../../utils/iterables";
|
||||
import { MatrixClientPeg } from "../../MatrixClientPeg";
|
||||
|
@ -31,7 +33,8 @@ import WidgetCapabilitiesPromptDialog, { getRememberedCapabilitiesForWidget } fr
|
|||
export class StopGapWidgetDriver extends WidgetDriver {
|
||||
private allowedCapabilities: Set<Capability>;
|
||||
|
||||
constructor(allowedCapabilities: Capability[], private forWidget: Widget) {
|
||||
// TODO: Refactor widgetKind into the Widget class
|
||||
constructor(allowedCapabilities: Capability[], private forWidget: Widget, private forWidgetKind: WidgetKind) {
|
||||
super();
|
||||
|
||||
// Always allow screenshots to be taken because it's a client-induced flow. The widget can't
|
||||
|
@ -57,6 +60,7 @@ export class StopGapWidgetDriver extends WidgetDriver {
|
|||
{
|
||||
requestedCapabilities: missing,
|
||||
widget: this.forWidget,
|
||||
widgetKind: this.forWidgetKind,
|
||||
}).finished;
|
||||
(result.approved || []).forEach(cap => allowedSoFar.add(cap));
|
||||
} catch (e) {
|
||||
|
|
|
@ -50,7 +50,7 @@ export interface TranslatedCapabilityText {
|
|||
export class CapabilityText {
|
||||
private static simpleCaps: IStaticCapText = {
|
||||
[MatrixCapabilities.AlwaysOnScreen]: {
|
||||
[WidgetKind.Room]: _td("Remain on your screen when you leave this room (when running)"),
|
||||
[WidgetKind.Room]: _td("Remain on your screen when viewing another room, when running"),
|
||||
[GENERIC_WIDGET_KIND]: _td("Remain on your screen while running"),
|
||||
},
|
||||
[MatrixCapabilities.StickerSending]: {
|
||||
|
|
Loading…
Reference in New Issue