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

feat: add confirmation modal pre video call, make style changes local to calling modal #15182

Merged
merged 8 commits into from
May 15, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,7 @@ export const PrimaryModalComponent: FC = () => {
{(messageHtml || messageText) && (
<div className="modal__text" data-uie-name="status-modal-text">
{messageHtml && <p id="modal-description-html" dangerouslySetInnerHTML={{__html: messageHtml}} />}
{messageText && (
<p id="modal-description-text" className="modal-description">
{messageText}
</p>
)}
{messageText && <p id="modal-description-text">{messageText}</p>}
</div>
)}

Expand Down
46 changes: 26 additions & 20 deletions src/script/view_model/CallingViewModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,30 @@ export class CallingViewModel {
}
};

const handleCallAction = async (conversationEntity: Conversation, callType: CALL_TYPE): Promise<void> => {
const memberCount = conversationEntity.participating_user_ets().length;
if (memberCount > maxGroupSize) {
PrimaryModal.show(PrimaryModal.type.WITHOUT_TITLE, {
preventClose: true,
primaryAction: {
action: async () => await startCall(conversationEntity, callType),
text: t('groupCallModalPrimaryBtnName'),
},
secondaryAction: {
text: t('modalConfirmSecondary'),
},
text: {
htmlMessage: `<div class="modal-description">
${t('groupCallConfirmationModalTitle', memberCount)}
</div>`,
closeBtnLabel: t('groupCallModalCloseBtnLabel'),
},
});
} else {
await startCall(conversationEntity, callType);
}
};

//update epoch info when AVS requests new epoch
this.callingRepository.onRequestNewEpochCallback(conversationId => updateEpochInfo(conversationId, true));

Expand Down Expand Up @@ -374,32 +398,14 @@ export class CallingViewModel {
if (conversationEntity.isGroup() && !this.teamState.isConferenceCallingEnabled()) {
this.showRestrictedConferenceCallingModal();
} else {
const memberCount = conversationEntity.participating_user_ets().length;
if (memberCount > maxGroupSize) {
PrimaryModal.show(PrimaryModal.type.WITHOUT_TITLE, {
preventClose: true,
primaryAction: {
action: async () => await startCall(conversationEntity, CALL_TYPE.NORMAL),
text: t('groupCallModalPrimaryBtnName'),
},
secondaryAction: {
text: t('modalConfirmSecondary'),
},
text: {
message: t('groupCallConfirmationModalTitle', memberCount),
closeBtnLabel: t('groupCallModalCloseBtnLabel'),
},
});
} else {
await startCall(conversationEntity, CALL_TYPE.NORMAL);
}
await handleCallAction(conversationEntity, CALL_TYPE.NORMAL);
}
},
startVideo: async (conversationEntity: Conversation) => {
if (conversationEntity.isGroup() && !this.teamState.isConferenceCallingEnabled()) {
this.showRestrictedConferenceCallingModal();
} else {
await startCall(conversationEntity, CALL_TYPE.VIDEO);
await handleCallAction(conversationEntity, CALL_TYPE.VIDEO);
}
},
switchCameraInput: (call: Call, deviceId: string) => {
Expand Down
6 changes: 3 additions & 3 deletions src/style/content/conversation/title-bar.less
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ body.theme-dark {
}

.modal-description {
font-size: 20px;
font-weight: 600;
line-height: 24px;
font-size: var(--font-size-large);
font-weight: var(--font-weight-semibold);
line-height: var(--line-height-lg);
text-align: center;
}