forked from mirrors/linphone-iphone
Added call back when bluetooth device is added or removed
This commit is contained in:
parent
82289f4523
commit
e8c2e92fc9
2 changed files with 9 additions and 0 deletions
|
|
@ -30,6 +30,7 @@ class ControlsViewModel {
|
|||
let isMicrophoneMuted = MutableLiveData<Bool>()
|
||||
let isMuteMicrophoneEnabled = MutableLiveData<Bool>()
|
||||
let isBluetoothHeadsetSelected = MutableLiveData<Bool>()
|
||||
let isBluetoothHeadsetAvailable = MutableLiveData<Bool>()
|
||||
let nonEarpieceOutputAudioDevice = MutableLiveData<Bool>()
|
||||
let audioRoutesSelected = MutableLiveData<Bool>()
|
||||
let audioRoutesEnabled = MutableLiveData<Bool>()
|
||||
|
|
@ -71,6 +72,9 @@ class ControlsViewModel {
|
|||
self.nonEarpieceOutputAudioDevice.value = audioDevice.type != AudioDeviceType.Microphone // on iOS Earpiece = Microphone
|
||||
self.updateSpeakerState()
|
||||
self.updateBluetoothHeadsetState()
|
||||
},
|
||||
onAudioDevicesListUpdated : { (core: Core) -> Void in
|
||||
self.isBluetoothHeadsetAvailable.value = !core.audioDevices.filter { [.Bluetooth,.BluetoothA2DP].contains($0.type)}.isEmpty
|
||||
}
|
||||
)
|
||||
Core.get().addDelegate(delegate: coreDelegate!)
|
||||
|
|
|
|||
|
|
@ -67,6 +67,11 @@ class ControlsView: UIStackView {
|
|||
routes.isHidden = !speaker.isHidden
|
||||
}
|
||||
|
||||
controlsViewModel.isBluetoothHeadsetAvailable.readCurrentAndObserve { available in
|
||||
speaker.isHidden = available == true
|
||||
routes.isHidden = !speaker.isHidden
|
||||
}
|
||||
|
||||
// Video
|
||||
if (showVideo) {
|
||||
let video = CallControlButton(buttonTheme: VoipTheme.call_video, onClickAction: {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue