Notify when calls start to be routed over cellular data.

Only when the device thinks that it's also connected to a WiFi network.
This commit is contained in:
Rashad Sookram
2022-07-18 18:24:38 -04:00
committed by Cody Henthorne
parent e024541b8a
commit 88b895f5ea
14 changed files with 141 additions and 9 deletions

View File

@@ -7,6 +7,7 @@ import org.thoughtcrime.securesms.recipients.Recipient
import org.thoughtcrime.securesms.recipients.RecipientId
import org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState
import org.thoughtcrime.securesms.webrtc.audio.SignalAudioManager
import org.webrtc.PeerConnection
class WebRtcViewModel(state: WebRtcServiceState) {
@@ -104,6 +105,20 @@ class WebRtcViewModel(state: WebRtcServiceState) {
state.localDeviceState.isMicrophoneEnabled
)
val isCellularConnection: Boolean = when (state.localDeviceState.networkConnectionType) {
PeerConnection.AdapterType.UNKNOWN,
PeerConnection.AdapterType.ETHERNET,
PeerConnection.AdapterType.WIFI,
PeerConnection.AdapterType.VPN,
PeerConnection.AdapterType.LOOPBACK,
PeerConnection.AdapterType.ADAPTER_TYPE_ANY -> false
PeerConnection.AdapterType.CELLULAR,
PeerConnection.AdapterType.CELLULAR_2G,
PeerConnection.AdapterType.CELLULAR_3G,
PeerConnection.AdapterType.CELLULAR_4G,
PeerConnection.AdapterType.CELLULAR_5G -> true
}
val isRemoteVideoEnabled: Boolean
get() = remoteParticipants.any(CallParticipant::isVideoEnabled) || groupState.isNotIdle && remoteParticipants.size > 1