Live location sharing - update beacon tile with latest location (#8265)

* add useBeacon hook

Signed-off-by: Kerry Archibald <kerrya@element.io>

* update message tile types to work with function comp with ref

Signed-off-by: Kerry Archibald <kerrya@element.io>

* use beacon hook in beacon body

Signed-off-by: Kerry Archibald <kerrya@element.io>

* update beacon body with (textual) latest locations, test

Signed-off-by: Kerry Archibald <kerrya@element.io>

* language in comment

Signed-off-by: Kerry Archibald <kerrya@element.io>

* comments

Signed-off-by: Kerry Archibald <kerrya@element.io>

* copyright

Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
Kerry 2022-04-11 11:16:32 +02:00 committed by GitHub
parent 7ba991cd8c
commit aecd71ad15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 424 additions and 29 deletions

View file

@ -94,7 +94,7 @@ export default class MessageEvent extends React.Component<IProps> implements IMe
};
}
private get evTypes(): Record<string, typeof React.Component> {
private get evTypes(): Record<string, React.ComponentType<Partial<IBodyProps>>> {
return {
[EventType.Sticker]: MStickerBody,
[M_POLL_START.name]: MPollBody,
@ -122,7 +122,7 @@ export default class MessageEvent extends React.Component<IProps> implements IMe
const content = this.props.mxEvent.getContent();
const type = this.props.mxEvent.getType();
const msgtype = content.msgtype;
let BodyType: typeof React.Component | ReactAnyComponent = RedactedBody;
let BodyType: React.ComponentType<Partial<IBodyProps>> | ReactAnyComponent = RedactedBody;
if (!this.props.mxEvent.isRedacted()) {
// only resolve BodyType if event is not redacted
if (type && this.evTypes[type]) {