Remove dependency on AppAudioManager

Implement speakerphone toggle directly. Previously we were using
AppAudioManager for several things, but this is that last lingering bit.
Much of the AppAudioManager code is based on RedPhone calling, so by
removing the dependency we pave the way to throw that code away.

// FREEBIE
This commit is contained in:
Michael Kirk 2017-01-18 11:54:13 -05:00
parent 4374e431a2
commit 4c23b5e23f

View file

@ -7,7 +7,6 @@ import Foundation
@objc class CallAudioService: NSObject {
private let TAG = "[CallAudioService]"
private var vibrateTimer: Timer?
private let audioManager = AppAudioManager.sharedInstance()
private let soundPlayer = JSQSystemSoundPlayer.shared()!
enum SoundFilenames: String {
@ -98,16 +97,11 @@ import Foundation
}
private func handleUpdatedSpeakerphone() {
// TODO
// let category = AVAudioSession.sharedInstance().getCategory()
// if isSpeakerphoneEnabled {
// AVAudioSession.sharedInstance().setCategory(category, option: AVAudioSessionCategoryOptionDefaultToSpeaker)
// } else {
// Will this disable speaker?
// AVAudioSession.sharedInstance().setCategory(category)
// }
audioManager.toggleSpeakerPhone(isEnabled: isSpeakerphoneEnabled)
if isSpeakerphoneEnabled {
setAudioSession(category: AVAudioSessionCategoryPlayAndRecord, options: .defaultToSpeaker)
} else {
setAudioSession(category: AVAudioSessionCategoryPlayAndRecord)
}
}
// MARK: Helpers