From fefd374a3203d534817b175c7410b9f17e174252 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 19 Oct 2020 14:34:47 +0100 Subject: [PATCH 1/5] Fix case where sublist context menu missed an update Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/rooms/RoomSublist.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/views/rooms/RoomSublist.tsx b/src/components/views/rooms/RoomSublist.tsx index 4056f2fbd4..d93de47d6b 100644 --- a/src/components/views/rooms/RoomSublist.tsx +++ b/src/components/views/rooms/RoomSublist.tsx @@ -399,6 +399,7 @@ export default class RoomSublist extends React.Component { const isUnreadFirst = RoomListStore.instance.getListOrder(this.props.tagId) === ListAlgorithm.Importance; const newAlgorithm = isUnreadFirst ? ListAlgorithm.Natural : ListAlgorithm.Importance; await RoomListStore.instance.setListOrder(this.props.tagId, newAlgorithm); + this.forceUpdate(); // because if the sublist doesn't have any changes then we will miss the list order change }; private onTagSortChanged = async (sort: SortAlgorithm) => { From 45d639d963dc36e7fe911126679828d26bad7699 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 19 Oct 2020 14:56:15 +0100 Subject: [PATCH 2/5] Add analytics to VoIP --- src/CallHandler.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/CallHandler.tsx b/src/CallHandler.tsx index d1ebb15c26..a5b6b20720 100644 --- a/src/CallHandler.tsx +++ b/src/CallHandler.tsx @@ -78,6 +78,7 @@ import WidgetStore from "./stores/WidgetStore"; import { WidgetMessagingStore } from "./stores/widgets/WidgetMessagingStore"; import { ElementWidgetActions } from "./stores/widgets/ElementWidgetActions"; import { MatrixCall, CallErrorCode, CallState, CallEvent, CallParty } from "matrix-js-sdk/lib/webrtc/call"; +import Analytics from './Analytics'; enum AudioID { Ring = 'ringAudio', @@ -191,6 +192,7 @@ export default class CallHandler { call.on(CallEvent.Error, (err) => { if (!this.matchesCallForThisRoom(call)) return; + Analytics.trackEvent('voip', 'callError', 'error', err); console.error("Call error:", err); if ( MatrixClientPeg.get().getTurnServers().length === 0 && @@ -208,6 +210,8 @@ export default class CallHandler { call.on(CallEvent.Hangup, () => { if (!this.matchesCallForThisRoom(call)) return; + Analytics.trackEvent('voip', 'callHangup'); + this.removeCallForRoom(call.roomId); }); call.on(CallEvent.State, (newState: CallState, oldState: CallState) => { @@ -232,6 +236,7 @@ export default class CallHandler { this.play(AudioID.Ringback); break; case CallState.Ended: + Analytics.trackEvent('voip', 'callEnded', "hangupReason", call.hangupReason); this.removeCallForRoom(call.roomId); if (oldState === CallState.InviteSent && ( call.hangupParty === CallParty.Remote || @@ -329,6 +334,7 @@ export default class CallHandler { roomId: string, type: PlaceCallType, localElement: HTMLVideoElement, remoteElement: HTMLVideoElement, ) { + Analytics.trackEvent('voip', 'placeCall', 'type', type); const call = Matrix.createNewMatrixCall(MatrixClientPeg.get(), roomId); this.calls.set(roomId, call); this.setCallListeners(call); @@ -406,6 +412,7 @@ export default class CallHandler { break; case 'place_conference_call': console.info("Place conference call in %s", payload.room_id); + Analytics.trackEvent('voip', 'placeConferenceCall'); this.startCallApp(payload.room_id, payload.type); break; case 'end_conference': @@ -432,6 +439,7 @@ export default class CallHandler { } const call = payload.call as MatrixCall; + Analytics.trackEvent('voip', 'receiveCall', 'type', call.type); this.calls.set(call.roomId, call) this.setCallListeners(call); } From 88b7210f5ca3ffab56553ccfbbaef675e94de582 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 19 Oct 2020 15:04:57 +0100 Subject: [PATCH 3/5] consistent quotes --- src/CallHandler.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CallHandler.tsx b/src/CallHandler.tsx index a5b6b20720..b788ec7da1 100644 --- a/src/CallHandler.tsx +++ b/src/CallHandler.tsx @@ -236,7 +236,7 @@ export default class CallHandler { this.play(AudioID.Ringback); break; case CallState.Ended: - Analytics.trackEvent('voip', 'callEnded', "hangupReason", call.hangupReason); + Analytics.trackEvent('voip', 'callEnded', 'hangupReason', call.hangupReason); this.removeCallForRoom(call.roomId); if (oldState === CallState.InviteSent && ( call.hangupParty === CallParty.Remote || From 7fe98b4e9d118e2932d04db0ca90502de07fa1cd Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 19 Oct 2020 16:42:20 +0100 Subject: [PATCH 4/5] Adjust for new widget messaging APIs As part of changing to the `events` package, the API surface changed slightly. Related to https://github.com/vector-im/element-web/issues/15493 --- src/stores/widgets/StopGapWidget.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/stores/widgets/StopGapWidget.ts b/src/stores/widgets/StopGapWidget.ts index d0a19285dd..17302d0ab9 100644 --- a/src/stores/widgets/StopGapWidget.ts +++ b/src/stores/widgets/StopGapWidget.ts @@ -253,9 +253,9 @@ export class StopGapWidget extends EventEmitter { if (this.started) return; const driver = new StopGapWidgetDriver( this.appTileProps.whitelistCapabilities || []); this.messaging = new ClientWidgetApi(this.mockWidget, iframe, driver); - this.messaging.addEventListener("preparing", () => this.emit("preparing")); - this.messaging.addEventListener("ready", () => this.emit("ready")); - this.messaging.addEventListener(`action:${WidgetApiFromWidgetAction.GetOpenIDCredentials}`, this.onOpenIdReq); + this.messaging.on("preparing", () => this.emit("preparing")); + this.messaging.on("ready", () => this.emit("ready")); + this.messaging.on(`action:${WidgetApiFromWidgetAction.GetOpenIDCredentials}`, this.onOpenIdReq); WidgetMessagingStore.instance.storeMessaging(this.mockWidget, this.messaging); if (!this.appTileProps.userWidget && this.appTileProps.room) { @@ -263,7 +263,7 @@ export class StopGapWidget extends EventEmitter { } if (WidgetType.JITSI.matches(this.mockWidget.type)) { - this.messaging.addEventListener("action:set_always_on_screen", + this.messaging.on("action:set_always_on_screen", (ev: CustomEvent) => { if (this.messaging.hasCapability(MatrixCapabilities.AlwaysOnScreen)) { ActiveWidgetStore.setWidgetPersistence(this.mockWidget.id, ev.detail.data.value); @@ -273,7 +273,7 @@ export class StopGapWidget extends EventEmitter { }, ); } else if (WidgetType.STICKERPICKER.matches(this.mockWidget.type)) { - this.messaging.addEventListener(`action:${ElementWidgetActions.OpenIntegrationManager}`, + this.messaging.on(`action:${ElementWidgetActions.OpenIntegrationManager}`, (ev: CustomEvent) => { // Acknowledge first ev.preventDefault(); @@ -307,7 +307,7 @@ export class StopGapWidget extends EventEmitter { // TODO: Replace this event listener with appropriate driver functionality once the API // establishes a sane way to send events back and forth. - this.messaging.addEventListener(`action:${WidgetApiFromWidgetAction.SendSticker}`, + this.messaging.on(`action:${WidgetApiFromWidgetAction.SendSticker}`, (ev: CustomEvent) => { // Acknowledge first ev.preventDefault(); From d6a166d3bfbb7d6c75880cc5d6b7951e07caeaa4 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 19 Oct 2020 16:56:33 +0100 Subject: [PATCH 5/5] Upgrade widget API --- package.json | 2 +- yarn.lock | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 3f073ce59c..ee4094601a 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "linkifyjs": "^2.1.9", "lodash": "^4.17.19", "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop", - "matrix-widget-api": "^0.1.0-beta.3", + "matrix-widget-api": "^0.1.0-beta.5", "minimist": "^1.2.5", "pako": "^1.0.11", "parse5": "^5.1.1", diff --git a/yarn.lock b/yarn.lock index 1f06fd6130..a06e8bc62d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4155,6 +4155,11 @@ esutils@^2.0.2: resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== +events@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/events/-/events-3.2.0.tgz#93b87c18f8efcd4202a461aec4dfc0556b639379" + integrity sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg== + except@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/except/-/except-0.1.3.tgz#98261c91958551536b44482238e9783fb73d292a" @@ -6527,10 +6532,12 @@ matrix-react-test-utils@^0.2.2: resolved "https://registry.yarnpkg.com/matrix-react-test-utils/-/matrix-react-test-utils-0.2.2.tgz#c87144d3b910c7edc544a6699d13c7c2bf02f853" integrity sha512-49+7gfV6smvBIVbeloql+37IeWMTD+fiywalwCqk8Dnz53zAFjKSltB3rmWHso1uecLtQEcPtCijfhzcLXAxTQ== -matrix-widget-api@^0.1.0-beta.3: - version "0.1.0-beta.3" - resolved "https://registry.yarnpkg.com/matrix-widget-api/-/matrix-widget-api-0.1.0-beta.3.tgz#356965ca357172ee056e3fd86fd96879b059a114" - integrity sha512-j7nxdhLQfdU6snsdBA29KQR0DmT8/vl6otOvGqPCV0OCHpq1312cP79Eg4JzJKIFI3A76Qha3nYx6G9/aapwXg== +matrix-widget-api@^0.1.0-beta.5: + version "0.1.0-beta.5" + resolved "https://registry.yarnpkg.com/matrix-widget-api/-/matrix-widget-api-0.1.0-beta.5.tgz#dd7f24a177aa590d812bd4e92e2c3ac225c5557e" + integrity sha512-J3GBJtVMFuEM/EWFylc0IlkPjdgmWxrkGYPaZ0LSmxp+OlNJxYfnWPR6F6HveW+Z8C1i0vq+BTueofSqKv2zDg== + dependencies: + events "^3.2.0" mdast-util-compact@^1.0.0: version "1.0.4"