diff --git a/Ring/Ring/AppDelegate.swift b/Ring/Ring/AppDelegate.swift index eb95b651ed92d60b59b1e4e4560d88f022cdd23d..79bd69153dfba4a0c09a128e6def5def07def8ab 100644 --- a/Ring/Ring/AppDelegate.swift +++ b/Ring/Ring/AppDelegate.swift @@ -119,6 +119,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD // will enumerate and add devices once permission has been granted self.videoService.setupInputs() + self.audioService.connectAudioSignal() + // start monitoring for network changes self.networkService.monitorNetworkType() diff --git a/Ring/Ring/Services/AudioService.swift b/Ring/Ring/Services/AudioService.swift index fe1caf82adbc7f93d98f54ff832e8b5927c66b26..f3c9ce5369ae8266ca218eb925db5adf4ec59834 100644 --- a/Ring/Ring/Services/AudioService.swift +++ b/Ring/Ring/Services/AudioService.swift @@ -44,16 +44,6 @@ class AudioService { init(withAudioAdapter audioAdapter: AudioAdapter) { self.audioAdapter = audioAdapter - let bluetoothConnected = bluetoothAudioConnected() - let headphonesConnected = headphoneAudioConnected() - isHeadsetConnected.value = bluetoothConnected || headphonesConnected - - // Listen for audio route changes - NotificationCenter.default.addObserver( - self, - selector: #selector(audioRouteChangeListener(_:)), - name: AVAudioSession.routeChangeNotification, - object: nil) } @objc private func audioRouteChangeListener(_ notification: Notification) { @@ -68,6 +58,19 @@ class AudioService { overrideAudioRoute() } + func connectAudioSignal() { + let bluetoothConnected = bluetoothAudioConnected() + let headphonesConnected = headphoneAudioConnected() + isHeadsetConnected.value = bluetoothConnected || headphonesConnected + + // Listen for audio route changes + NotificationCenter.default.addObserver( + self, + selector: #selector(audioRouteChangeListener(_:)), + name: AVAudioSession.routeChangeNotification, + object: nil) + } + func overrideAudioRoute() { let bluetoothConnected = bluetoothAudioConnected() let headphonesConnected = headphoneAudioConnected()