Skip to content

Conversation

toger5
Copy link
Contributor

@toger5 toger5 commented Sep 9, 2025

Fixes: #30727

This PR adds a couple of new conditions to the IncomingCallToast so that it gets dismissed in the right cases and provides an option to send decline events by pressing a decline button.
Additionally it now is possible to jumpt to the lobby by pressing the toast and joining and skipping the lobby by pressing the join button.

  • This make EW incompatible with the old style notify events.
Before After
Screenshot 2025-09-10 at 13 23 21 Screenshot 2025-09-11 at 17 16 56

Signed-off-by: Timo K [email protected]

Checklist

  • Tests written for new code (and old code if feasible).
  • New or updated public/exported symbols have accurate TSDoc documentation.
  • Linter and other CI checks pass.
  • I have licensed the changes to Element by completing the Contributor License Agreement (CLA)

Copy link
Member

@dbkr dbkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there are quite a lot of visual changes here - any chance of a screenshot or two?

Also, you have some failing lint jobs.

@toger5
Copy link
Contributor Author

toger5 commented Sep 11, 2025

Looks like there are quite a lot of visual changes here - any chance of a screenshot or two?

you are right screenshots would be great. (I even prepared some yesterday...)

@toger5 toger5 force-pushed the toger5/decline-call-notify-event branch from 7e8c5db to 5824840 Compare September 11, 2025 13:28
Copy link
Member

@florianduros florianduros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kind of thinking that this ui should be in the shared components:

Screenshot 2025-09-11 at 16 42 28

@toger5
Copy link
Contributor Author

toger5 commented Sep 11, 2025

I kind of thinking that this ui should be in the shared components:

@florianduros
is this already sth in the compound tokens? or do you mean i should move this into a new shared component?

@Half-Shot Half-Shot self-requested a review September 11, 2025 14:48
@florianduros
Copy link
Member

@toger5 The shared components are not in compound but in src/shared-components folder of EW. They are using CSS modules, storybook and are pure view component. You can take a look at the existing components when launching the EW storybook.

Copy link
Member

@Half-Shot Half-Shot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking pretty good, mostly some FYIs from me and a couple of missing tests?

});

it("should not show toast when calling with non-group call event", () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard to tell with this diff, but are we still testing "should not show toast when calling with non-group call event"?

expect(ToastStore.sharedInstance().addOrReplaceToast).not.toHaveBeenCalled();
spyCallMemberships.mockRestore();
});

it("dismisses call notification when another device answers the call", () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still have a test for "dismisses call notification when another device answers the call"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes all the tests are still there (I hope) but you are right this diff makes it hard to see.
To double check i will try to look for the exact tests myself as a little exercise:

  • this: should not show toast when calling with non-group call event -> has become this should not show toast when calling with a different event type to org.matrix.msc4075.rtc.notification
  • this: dismisses call notification when another device answers the call -> is now part of the toast itself (dismissing is done in the toast) Dismiss toast if user joins with a remote device

@@ -132,7 +210,10 @@ export function IncomingCallToast({ notifyEvent }: Props): JSX.Element {
),
);

const [skipLobbyToggle, setSkipLobbyToggle] = useState(true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

N.B. For the sake of a few lines this could be extended with a Setting that stores the last value. Not going to block and can be followup PR.

@@ -31,8 +35,22 @@ import { type Call, CallEvent } from "../models/Call";
import LegacyCallHandler, { AudioID } from "../LegacyCallHandler";
import { useEventEmitter } from "../hooks/useEventEmitter";
import { CallStore, CallStoreEvent } from "../stores/CallStore";
import LabelledToggleSwitch from "../components/views/elements/LabelledToggleSwitch";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer https://compound.element.io/?path=/docs/compound-web_form-controls-toggle--docs if you can, to reduce our footprint on legacy components :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The labelled one is very convinient... but should be possible to do with the cmpound one as well.

Signed-off-by: Timo K <[email protected]>
Signed-off-by: Timo K <[email protected]>
Signed-off-by: Timo K <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add decline option to the (MatrixRTC) call notify toast
4 participants