Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Remove from MembraneRTC
Browse files Browse the repository at this point in the history
  • Loading branch information
mironiasty committed Apr 23, 2024
1 parent a66cbaa commit c6411e2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ package org.membraneframework.rtc

import android.content.Context
import android.content.Intent
import dagger.assisted.Assisted
import dagger.assisted.AssistedFactory
import dagger.assisted.AssistedInject
import kotlinx.coroutines.*
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
Expand All @@ -28,13 +25,9 @@ import timber.log.Timber
import java.util.*

internal class InternalMembraneRTC
@AssistedInject
constructor(
@Assisted
private val createOptions: CreateOptions,
@Assisted
private val listener: MembraneRTCListener,
@Assisted
private val defaultDispatcher: CoroutineDispatcher,
private val eglBase: EglBase,
private val context: Context,
Expand Down Expand Up @@ -64,7 +57,6 @@ internal class InternalMembraneRTC
}
}

@AssistedFactory
interface Factory {
fun create(
createOptions: CreateOptions,
Expand Down
12 changes: 2 additions & 10 deletions MembraneRTC/src/main/java/org/membraneframework/rtc/MembraneRTC.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.membraneframework.rtc
import android.content.Context
import android.content.Intent
import kotlinx.coroutines.Dispatchers
import org.membraneframework.rtc.dagger.DaggerMembraneRTCComponent
import org.membraneframework.rtc.dagger.RTCModule
import org.membraneframework.rtc.media.*
import org.membraneframework.rtc.models.RTCStats
import org.membraneframework.rtc.utils.Metadata
Expand Down Expand Up @@ -259,15 +259,7 @@ class MembraneRTC
): MembraneRTC {
val ctx = appContext.applicationContext

val component =
DaggerMembraneRTCComponent
.factory()
.create(ctx)

val client =
component
.membraneRTCFactory()
.create(options, listener, Dispatchers.Default)
val client = InternalMembraneRTC(options, listener, Dispatchers.Default, RTCModule.eglBase(), ctx)

return MembraneRTC(client)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,21 @@
package org.membraneframework.rtc.dagger

import android.content.Context
import dagger.BindsInstance
import dagger.Component
import org.membraneframework.rtc.InternalMembraneRTC
import org.webrtc.EglBase
import org.webrtc.audio.AudioDeviceModule
import javax.inject.Singleton

@Singleton
@Component(
modules = [
RTCModule::class
]
)

internal interface MembraneRTCComponent {
fun membraneRTCFactory(): InternalMembraneRTC.Factory
fun membraneRTCFactory(): InternalMembraneRTC

fun eglBase(): EglBase

fun audioDeviceModule(): AudioDeviceModule

@Component.Factory
interface Factory {
fun create(
@BindsInstance appContext: Context
appContext: Context
): MembraneRTCComponent
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
package org.membraneframework.rtc.dagger

import android.content.Context
import dagger.Module
import dagger.Provides
import org.webrtc.*
import org.webrtc.audio.AudioDeviceModule
import org.webrtc.audio.JavaAudioDeviceModule
import timber.log.Timber
import javax.inject.Singleton

@Module
internal object RTCModule {
@Singleton
@Provides
fun eglBase(): EglBase {
return EglBase.create()
}

@Singleton
@Provides
fun audioDeviceModule(appContext: Context): AudioDeviceModule {
val audioRecordErrorCallback =
object : JavaAudioDeviceModule.AudioRecordErrorCallback {
Expand Down

0 comments on commit c6411e2

Please sign in to comment.