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