@@ -5,7 +5,7 @@ import LiveKit
55@MainActor
66class ConnectionManager {
77 private var _room : Room ?
8-
8+
99 private var readyDelegate : ReadyDelegate ?
1010
1111 var onAgentReady : ( ( ) -> Void ) ?
@@ -21,7 +21,7 @@ class ConnectionManager {
2121 onReady: { [ weak self] in self ? . onAgentReady ? ( ) } ,
2222 onDisconnected: { [ weak self] in self ? . onAgentDisconnected ? ( ) }
2323 )
24- readyDelegate = rd // Keep strong reference
24+ readyDelegate = rd // Keep strong reference
2525 room. add ( delegate: rd)
2626
2727 let ( _, continuation) = AsyncStream< Data> . makeStream( )
@@ -38,7 +38,7 @@ class ConnectionManager {
3838 func disconnect( ) async {
3939 await _room? . disconnect ( )
4040 _room = nil
41- readyDelegate = nil // Clean up delegate reference
41+ readyDelegate = nil // Clean up delegate reference
4242 }
4343
4444 func dataEventsStream( ) -> AsyncStream < Data > {
@@ -64,32 +64,30 @@ class ConnectionManager {
6464 private var agentConnected = false
6565 private let onReady : ( ) -> Void
6666 private let onDisconnected : ( ) -> Void
67-
68- init ( onReady: @escaping ( ) -> Void , onDisconnected: @escaping ( ) -> Void ) {
67+
68+ init ( onReady: @escaping ( ) -> Void , onDisconnected: @escaping ( ) -> Void ) {
6969 self . onReady = onReady
7070 self . onDisconnected = onDisconnected
7171 }
7272
73- func room( _ room : Room , participantDidConnect participant : RemoteParticipant ) {
74- guard !agentConnected else {
75- return
73+ func room( _: Room , participantDidConnect _ : RemoteParticipant ) {
74+ guard !agentConnected else {
75+ return
7676 }
7777 agentConnected = true
7878 onReady ( )
7979 }
80-
81- func room( _ room: Room , participantDidDisconnect participant : RemoteParticipant ) {
82- if agentConnected && room. remoteParticipants. isEmpty {
80+
81+ func room( _ room: Room , participantDidDisconnect _ : RemoteParticipant ) {
82+ if agentConnected, room. remoteParticipants. isEmpty {
8383 agentConnected = false
8484 onDisconnected ( )
8585 }
8686 }
87-
88- func roomDidConnect( _ room: Room ) {
89- }
90-
91- func room( _ room: Room , didUpdate connectionState: ConnectionState , from previousState: ConnectionState ) {
92- }
87+
88+ func roomDidConnect( _: Room ) { }
89+
90+ func room( _: Room , didUpdate _: ConnectionState , from _: ConnectionState ) { }
9391 }
9492}
9593
0 commit comments