Merge branch 'td/deprecateIsBg' into 'main'

chore: deprecate isBackground

See merge request famedly/company/frontend/famedlysdk!1225
This commit is contained in:
td 2023-01-27 13:09:13 +00:00
commit 169ac9c88c
2 changed files with 5 additions and 18 deletions

View File

@ -809,9 +809,7 @@ class CallSession {
if (purpose == SDPStreamMetadataPurpose.Usermedia) {
speakerOn = type == CallType.kVideo;
if (!voip.delegate.isWeb &&
!voip.delegate.isBackgroud &&
stream.getAudioTracks().isNotEmpty) {
if (!voip.delegate.isWeb && stream.getAudioTracks().isNotEmpty) {
final audioTrack = stream.getAudioTracks()[0];
audioTrack.enableSpeakerphone(speakerOn);
}

View File

@ -21,7 +21,6 @@ abstract class WebRTCDelegate {
void handleMissedCall(CallSession session);
void handleNewGroupCall(GroupCall groupCall);
void handleGroupCallEnded(GroupCall groupCall);
bool get isBackgroud;
bool get isWeb;
/// This should be set to false if any calls in the client are in kConnected
@ -252,18 +251,11 @@ class VoIP {
currentCID = callId;
// Popup CallingPage for incoming call.
if (!delegate.isBackgroud && confId == null && !newCall.callHasEnded) {
if (confId == null && !newCall.callHasEnded) {
delegate.handleNewCall(newCall);
}
onIncomingCall.add(newCall);
if (delegate.isBackgroud) {
/// Forced to enable signaling synchronization until the end of the call.
client.backgroundSync = true;
///TODO: notify the callkeep that the call is incoming.
}
}
Future<void> onCallAnswer(
@ -329,9 +321,7 @@ class VoIP {
Future<void> onCallHangup(String roomId, String _ /*senderId unused*/,
Map<String, dynamic> content) async {
// stop play ringtone, if this is an incoming call
if (!delegate.isBackgroud) {
delegate.stopRingtone();
}
delegate.stopRingtone();
Logs().v('[VOIP] onCallHangup => ${content.toString()}');
final String callId = content['call_id'];
final call = calls[callId];
@ -523,6 +513,7 @@ class VoIP {
if (_turnServerCredentials == null) {
return [];
}
return [
{
'username': _turnServerCredentials!.username,
@ -557,9 +548,7 @@ class VoIP {
final newCall = createNewCall(opts);
currentCID = callId;
await newCall.initOutboundCall(type).then((_) {
if (!delegate.isBackgroud) {
delegate.handleNewCall(newCall);
}
delegate.handleNewCall(newCall);
});
currentCID = callId;
return newCall;