respect silence switch for incoming ringing

// FREEBIE
pull/1/head
Michael Kirk 9 years ago committed by Matthew Chen
parent 57ad7a2808
commit 602a5953f2

@ -57,15 +57,29 @@ import PromiseKit
private func handleLocalRinging() {
Logger.debug("\(TAG) \(#function)")
audioManager.setAudioEnabled(true)
audioManager.handleInboundRing()
do {
// Respect silent switch.
try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategorySoloAmbient)
Logger.debug("\(TAG) set audio category to SoloAmbient")
} catch {
Logger.error("\(TAG) failed to change audio category to soloAmbient in \(#function)")
}
vibrateTimer = Timer.scheduledTimer(timeInterval: vibrateRepeatDuration, target: self, selector: #selector(vibrate), userInfo: nil, repeats: true)
}
private func handleConnected() {
Logger.debug("\(TAG) \(#function)")
stopRinging()
do {
// Start recording
try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord)
Logger.debug("\(TAG) set audio category to PlayAndRecord")
} catch {
Logger.error("\(TAG) failed to change audio category to soloAmbient in \(#function)")
}
}
private func handleLocalFailure() {

Loading…
Cancel
Save