I've encountered an issue where im trying to imple...
# kotlin-native
m
I've encountered an issue where im trying to implement a delegateProtocol on kotlin side but the methods never get's called and the same code works on swift . i create an insance of the delegate in the class i will add the delegate to and calls addDelegate initially also tried to log the delegates of that class in ios side and it was added also i tried some other solutions but none of them worked. did anyone face the same problem or is something missing would appreciate help?
Copy code
@OptIn(ExperimentalForeignApi::class)
class IosRoom() : RoomWrapper {


    private val scope = CoroutineScope(
        SupervisorJob() + Dispatchers.Main + CoroutineName("IosRoomCoroutine")
    )

    private val delegate = IosRoomDelegate()


    private val room: Room = Room().apply {
        println("will add the room delegate")
        addDelegate(delegate)
    }


    override val localParticipant: LocalParticipantWrapper
        get() = IosLocalParticipant(
            liveKitLocalParticipant = room.localParticipant(),
            scope = scope,
        )

    override val remoteParticipants = MutableSharedFlow<List<RemoteParticipantWrapper>>()


    override val activeSpeakers: Flow<List<ParticipantWrapper>> = flow {
        // 
        //
    }

    override suspend fun connect(url: String, token: String) {
        //    
        //        
    }

    override fun disconnect() {
        room.disconnectWithCompletionHandler(completionHandler = {})
    }

    fun updateRemoteParticipants() {
       //
    }
}


@OptIn(ExperimentalForeignApi::class)
class IosRoomDelegate : NSObject(), RoomDelegateProtocol {

    override fun room(room: Room, participantDidConnect: RemoteParticipant) {
        println("remote participantDidConnect called")
    }

    override fun room(room: Room, participant: Participant, didUpdatePermissions: ParticipantPermissions) {
        println("didUpdatePermissions called")
    }


    override fun room(room: Room, localParticipant: LocalParticipant, didPublishTrack: LocalTrackPublication) {
        println("didPublishTrack called")
    }


    override fun room(room: Room, participant: Participant, didUpdateConnectionQuality: ConnectionQuality) {
        println("connection quality updated")
    }

    override fun roomDidConnect(room: Room) {
        println("delegate room did connect")
    }

}