Skip to content

Commit

Permalink
fix: add confirmation modal pre video call
Browse files Browse the repository at this point in the history
  • Loading branch information
arjita-mitra committed May 15, 2023
1 parent 6f01dd9 commit 9f7a23f
Showing 1 changed file with 26 additions and 22 deletions.
48 changes: 26 additions & 22 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,34 +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: {
htmlMessage: `<div class="modal-description">
${t('groupCallConfirmationModalTitle', memberCount)}
</div>`,
closeBtnLabel: t('groupCallModalCloseBtnLabel'),
},
});
} else {
await startCall(conversationEntity, CALL_TYPE.NORMAL);
}
handleCallAction(conversationEntity, CALL_TYPE.NORMAL);
}
},
startVideo: async (conversationEntity: Conversation) => {
if (conversationEntity.isGroup() && !this.teamState.isConferenceCallingEnabled()) {
this.showRestrictedConferenceCallingModal();
} else {
await startCall(conversationEntity, CALL_TYPE.VIDEO);
handleCallAction(conversationEntity, CALL_TYPE.VIDEO);
}
},
switchCameraInput: (call: Call, deviceId: string) => {
Expand Down

0 comments on commit 9f7a23f

Please sign in to comment.