mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
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:
committed by
Cody Henthorne
parent
e024541b8a
commit
88b895f5ea
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user