mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-07-20 04:51:05 +00:00
removed unused
This commit is contained in:
@@ -236,7 +236,6 @@ struct ActiveCallOverlay: View {
|
||||
@EnvironmentObject var chatModel: ChatModel
|
||||
@ObservedObject var call: Call
|
||||
var client: WebRTCClient
|
||||
let callAudioDeviceManager = CallAudioDeviceManager()
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
@@ -315,12 +314,6 @@ struct ActiveCallOverlay: View {
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.onAppear {
|
||||
callAudioDeviceManager.start()
|
||||
}
|
||||
.onDisappear {
|
||||
callAudioDeviceManager.stop()
|
||||
}
|
||||
}
|
||||
|
||||
private func audioCallInfoView(_ call: Call) -> some View {
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
//
|
||||
// CallAudioDeviceManager.swift
|
||||
// SimpleX (iOS)
|
||||
//
|
||||
// Created by Avently on 23.04.2024.
|
||||
// Copyright © 2024 SimpleX Chat. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
import SimpleXChat
|
||||
import AVKit
|
||||
|
||||
class CallAudioDeviceManager {
|
||||
let audioSession: AVAudioSession
|
||||
let nc = NotificationCenter.default
|
||||
|
||||
@State var devices: [AVAudioSessionPortDescription]
|
||||
@State var currentDevice: AVAudioSessionPortDescription? = nil
|
||||
@State var availableInputs: [AVAudioSessionPortDescription] = []
|
||||
|
||||
|
||||
init(_ audioSession: AVAudioSession? = nil) {
|
||||
self.audioSession = audioSession ?? AVAudioSession.sharedInstance()
|
||||
self.devices = self.audioSession.currentRoute.outputs
|
||||
self.availableInputs = self.audioSession.availableInputs ?? []
|
||||
}
|
||||
|
||||
@objc func audioCallback(notification: Notification) {
|
||||
logger.debug("LALAL CALLED")
|
||||
guard let userInfo = notification.userInfo,
|
||||
let reasonValue = userInfo[AVAudioSessionRouteChangeReasonKey] as? UInt,
|
||||
let reason = AVAudioSession.RouteChangeReason(rawValue: reasonValue) else {
|
||||
return
|
||||
}
|
||||
|
||||
switch reason {
|
||||
case .newDeviceAvailable:
|
||||
devices = audioSession.currentRoute.outputs
|
||||
case .oldDeviceUnavailable:
|
||||
devices = audioSession.currentRoute.outputs
|
||||
case .override:
|
||||
currentDevice = audioSession.currentRoute.outputs.first
|
||||
default: ()
|
||||
}
|
||||
self.availableInputs = audioSession.availableInputs ?? []
|
||||
logger.debug("LALAL inputs \(String(describing: self.availableInputs))")
|
||||
}
|
||||
|
||||
func start() {
|
||||
logger.debug("LALAL START")
|
||||
nc.addObserver(self, selector: #selector(audioCallback), name: AVAudioSession.routeChangeNotification, object: nil)
|
||||
}
|
||||
|
||||
func stop() {
|
||||
logger.debug("LALAL STOP")
|
||||
nc.removeObserver(self, name: AVAudioSession.routeChangeNotification, object: nil)
|
||||
}
|
||||
}
|
||||
@@ -189,7 +189,6 @@
|
||||
8C7D949A2B88952700B7B9E1 /* MigrateToDevice.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C7D94992B88952700B7B9E1 /* MigrateToDevice.swift */; };
|
||||
8C7DF3202B7CDB0A00C886D0 /* MigrateFromDevice.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C7DF31F2B7CDB0A00C886D0 /* MigrateFromDevice.swift */; };
|
||||
8C81482C2BD91CD4002CBEC3 /* AudioDevicePicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C81482B2BD91CD4002CBEC3 /* AudioDevicePicker.swift */; };
|
||||
8CC4ED902BD7B8530078AEE8 /* CallAudioDeviceManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CC4ED8F2BD7B8530078AEE8 /* CallAudioDeviceManager.swift */; };
|
||||
8CC956EE2BC0041000412A11 /* NetworkObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CC956ED2BC0041000412A11 /* NetworkObserver.swift */; };
|
||||
D7197A1829AE89660055C05A /* WebRTC in Frameworks */ = {isa = PBXBuildFile; productRef = D7197A1729AE89660055C05A /* WebRTC */; };
|
||||
D72A9088294BD7A70047C86D /* NativeTextEditor.swift in Sources */ = {isa = PBXBuildFile; fileRef = D72A9087294BD7A70047C86D /* NativeTextEditor.swift */; };
|
||||
@@ -486,7 +485,6 @@
|
||||
8C7D94992B88952700B7B9E1 /* MigrateToDevice.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MigrateToDevice.swift; sourceTree = "<group>"; };
|
||||
8C7DF31F2B7CDB0A00C886D0 /* MigrateFromDevice.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MigrateFromDevice.swift; sourceTree = "<group>"; };
|
||||
8C81482B2BD91CD4002CBEC3 /* AudioDevicePicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioDevicePicker.swift; sourceTree = "<group>"; };
|
||||
8CC4ED8F2BD7B8530078AEE8 /* CallAudioDeviceManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallAudioDeviceManager.swift; sourceTree = "<group>"; };
|
||||
8CC956ED2BC0041000412A11 /* NetworkObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkObserver.swift; sourceTree = "<group>"; };
|
||||
D72A9087294BD7A70047C86D /* NativeTextEditor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NativeTextEditor.swift; sourceTree = "<group>"; };
|
||||
D741547729AF89AF0022400A /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.1.sdk/System/Library/Frameworks/StoreKit.framework; sourceTree = DEVELOPER_DIR; };
|
||||
@@ -553,7 +551,6 @@
|
||||
5C55A922283CEDE600C4E99E /* SoundPlayer.swift */,
|
||||
18415323A4082FC92887F906 /* WebRTCClient.swift */,
|
||||
18415B08031E8FB0F7FC27F9 /* CallViewRenderers.swift */,
|
||||
8CC4ED8F2BD7B8530078AEE8 /* CallAudioDeviceManager.swift */,
|
||||
8C81482B2BD91CD4002CBEC3 /* AudioDevicePicker.swift */,
|
||||
);
|
||||
path = Call;
|
||||
@@ -1273,7 +1270,6 @@
|
||||
18415B0585EB5A9A0A7CA8CD /* PressedButtonStyle.swift in Sources */,
|
||||
1841560FD1CD447955474C1D /* UserProfilesView.swift in Sources */,
|
||||
64C3B0212A0D359700E19930 /* CustomTimePicker.swift in Sources */,
|
||||
8CC4ED902BD7B8530078AEE8 /* CallAudioDeviceManager.swift in Sources */,
|
||||
18415C6C56DBCEC2CBBD2F11 /* WebRTCClient.swift in Sources */,
|
||||
184152CEF68D2336FC2EBCB0 /* CallViewRenderers.swift in Sources */,
|
||||
5CB634AD29E46CF70066AD6B /* LocalAuthView.swift in Sources */,
|
||||
|
||||
Reference in New Issue
Block a user