Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix case when passcode was lost #4535

Merged
merged 7 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 11 additions & 6 deletions samples/CallWithChat/src/app/views/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ export const HomeScreen = (props: HomeScreenProps): JSX.Element => {
const [meetingLocator, setMeetingLocator] = useState<
TeamsMeetingLinkLocator | /* @conditional-compile-remove(meeting-id) */ TeamsMeetingIdLocator
>();
const [meetingId, setMeetingId] = useState<string>();
const [passcode, setPasscode] = useState<string>();

/* @conditional-compile-remove(PSTN-calls) */
const [alternateCallerId, setAlternateCallerId] = useState<string>();
Expand Down Expand Up @@ -140,7 +142,10 @@ export const HomeScreen = (props: HomeScreenProps): JSX.Element => {
required
placeholder={'Enter a Teams meeting link'}
onChange={(_, newValue) => {
newValue ? setMeetingLocator({ meetingLink: newValue }) : setMeetingLocator(undefined);
setMeetingId(newValue);
newValue
? setMeetingLocator({ meetingId: newValue, passcode: passcode })
: setMeetingLocator(undefined);
}}
/>
)}
Expand All @@ -160,8 +165,7 @@ export const HomeScreen = (props: HomeScreenProps): JSX.Element => {
required
placeholder={'Enter a meeting id'}
onChange={(_, newValue) => {
const passcode =
meetingLocator && 'passcode' in meetingLocator ? meetingLocator.passcode : undefined;
setMeetingId(newValue);
newValue
? setMeetingLocator({ meetingId: newValue, passcode: passcode })
: setMeetingLocator(undefined);
Expand All @@ -177,10 +181,11 @@ export const HomeScreen = (props: HomeScreenProps): JSX.Element => {
label={'Passcode'}
placeholder={'Enter a meeting passcode'}
onChange={(_, newValue) => {
const meetingId = meetingLocator && 'meetingId' in meetingLocator ? meetingLocator.meetingId : '';
const localMeetingId = meetingId ? meetingId : '';
// meeting id is required, but passcode is not
meetingId
? setMeetingLocator({ meetingId: meetingId, passcode: newValue })
setPasscode(newValue);
localMeetingId
? setMeetingLocator({ meetingId: localMeetingId, passcode: newValue })
: setMeetingLocator(undefined);
}}
/>
Expand Down
11 changes: 7 additions & 4 deletions samples/Calling/src/app/views/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ export const HomeScreen = (props: HomeScreenProps): JSX.Element => {
const [callLocator, setCallLocator] = useState<
TeamsMeetingLinkLocator | RoomLocator | /* @conditional-compile-remove(meeting-id) */ TeamsMeetingIdLocator
>();
const [meetingId, setMeetingId] = useState<string>();
const [passcode, setPasscode] = useState<string>();
const [chosenRoomsRoleOption, setRoomsRoleOption] = useState<IChoiceGroupOption>(roomRoleOptions[1]);
/* @conditional-compile-remove(PSTN-calls) */
const [alternateCallerId, setAlternateCallerId] = useState<string>();
Expand Down Expand Up @@ -231,7 +233,7 @@ export const HomeScreen = (props: HomeScreenProps): JSX.Element => {
required
placeholder={'Enter a meeting id'}
onChange={(_, newValue) => {
const passcode = callLocator && 'passcode' in callLocator ? callLocator.passcode : undefined;
setMeetingId(newValue);
newValue ? setCallLocator({ meetingId: newValue, passcode: passcode }) : setCallLocator(undefined);
}}
/>
Expand All @@ -245,10 +247,11 @@ export const HomeScreen = (props: HomeScreenProps): JSX.Element => {
label={'Passcode'}
placeholder={'Enter a meeting passcode'}
onChange={(_, newValue) => {
const meetingId = callLocator && 'meetingId' in callLocator ? callLocator.meetingId : '';
const localMeetingId = meetingId ? meetingId : '';
Copy link
Member

Choose a reason for hiding this comment

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

Is this line needed? meetingId can just be used

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is just undefined check

Copy link
Member

Choose a reason for hiding this comment

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

Right - but why have it? You have the check again below when localMeetingId ? is called

// meeting id is required, but passcode is not
meetingId
? setCallLocator({ meetingId: meetingId, passcode: newValue })
setPasscode(newValue);
localMeetingId
? setCallLocator({ meetingId: localMeetingId, passcode: newValue })
: setCallLocator(undefined);
}}
/>
Expand Down