@@ -660,7 +660,7 @@ export class ElementCall extends Call {
660660 ) : void {
661661 const room = client . getRoom ( roomId ) ;
662662 if ( ! room ) {
663- // If the room isn't known, or the room is a video room then skip setting an intent.
663+ // If the room isn't known then skip setting an intent.
664664 return ;
665665 } else if ( isVideoRoom ( room ) ) {
666666 // Video rooms already exist, so just treat as if we're joining a group call.
@@ -669,35 +669,27 @@ export class ElementCall extends Call {
669669 params . append ( "returnToLobby" , "true" ) ;
670670 // Never skip the lobby, we always want to give the caller a chance to explicitly join.
671671 params . append ( "skipLobby" , "false" ) ;
672- // Never preload, as per below warning.
673- params . append ( "preload" , "false" ) ;
674672 return ;
675673 }
674+
676675 const isDM = ! ! DMRoomMap . shared ( ) . getUserIdForRoomId ( room . roomId ) ;
677676 const oldestCallMember = client . matrixRTC . getRoomSession ( room ) . getOldestMembership ( ) ;
678677 const hasCallStarted = ! ! oldestCallMember && oldestCallMember . sender !== client . getSafeUserId ( ) ;
679- // XXX: @element -hq/element-call-embedded <= 0.15.0 sets the wrong parameter for
680- // preload by default so we override here. This can be removed when that package
681- // is released and upgraded.
682678 if ( isDM ) {
683679 if ( hasCallStarted ) {
684680 params . append (
685681 "intent" ,
686682 voiceOnly ? ElementCallIntent . JoinExistingDMVoice : ElementCallIntent . JoinExistingDM ,
687683 ) ;
688- params . append ( "preload" , "false" ) ;
689684 } else {
690685 params . append ( "intent" , voiceOnly ? ElementCallIntent . StartCallDMVoice : ElementCallIntent . StartCallDM ) ;
691- params . append ( "preload" , "false" ) ;
692686 }
693687 } else {
694688 // Group chats do not have a voice option.
695689 if ( hasCallStarted ) {
696690 params . append ( "intent" , ElementCallIntent . JoinExisting ) ;
697- params . append ( "preload" , "false" ) ;
698691 } else {
699692 params . append ( "intent" , ElementCallIntent . StartCall ) ;
700- params . append ( "preload" , "false" ) ;
701693 }
702694 }
703695 }
@@ -836,58 +828,18 @@ export class ElementCall extends Call {
836828 ) ;
837829 }
838830
839- /**
840- * Get the correct intent for a widget, so that Element Call presents the correct
841- * default config.
842- * @param client The matrix client.
843- * @param roomId
844- * @param voiceOnly Should the call be voice-only, or video (default).
845- */
846- public static getWidgetIntent ( client : MatrixClient , roomId : string , voiceOnly ?: boolean ) : ElementCallIntent {
847- const room = client . getRoom ( roomId ) ;
848- if ( room !== null && ! isVideoRoom ( room ) ) {
849- const isDM = ! ! DMRoomMap . shared ( ) . getUserIdForRoomId ( room . roomId ) ;
850- const oldestCallMember = client . matrixRTC . getRoomSession ( room ) . getOldestMembership ( ) ;
851- const hasCallStarted = ! ! oldestCallMember && oldestCallMember . sender !== client . getSafeUserId ( ) ;
852- if ( isDM ) {
853- if ( hasCallStarted ) {
854- return voiceOnly ? ElementCallIntent . JoinExistingDMVoice : ElementCallIntent . JoinExistingDM ;
855- } else {
856- return voiceOnly ? ElementCallIntent . StartCallDMVoice : ElementCallIntent . StartCallDM ;
857- }
858- } else {
859- if ( hasCallStarted ) {
860- return ElementCallIntent . JoinExisting ;
861- } else {
862- return ElementCallIntent . StartCall ;
863- }
864- }
865- }
866- // If unknown, default to joining an existing call.
867- return ElementCallIntent . JoinExisting ;
868- }
869-
870831 private static getWidgetData (
871832 client : MatrixClient ,
872833 roomId : string ,
873834 currentData : IWidgetData ,
874835 overwriteData : IWidgetData ,
875- voiceOnly ?: boolean ,
876836 ) : IWidgetData {
877- let perParticipantE2EE = false ;
878- if (
879- client . getRoom ( roomId ) ?. hasEncryptionStateEvent ( ) &&
880- ! SettingsStore . getValue ( "feature_disable_call_per_sender_encryption" )
881- )
882- perParticipantE2EE = true ;
883-
884- const intent = ElementCall . getWidgetIntent ( client , roomId , voiceOnly ) ;
885-
886837 return {
887838 ...currentData ,
888839 ...overwriteData ,
889- intent,
890- perParticipantE2EE,
840+ perParticipantE2EE :
841+ client . getRoom ( roomId ) ?. hasEncryptionStateEvent ( ) &&
842+ ! SettingsStore . getValue ( "feature_disable_call_per_sender_encryption" ) ,
891843 } ;
892844 }
893845
0 commit comments