Convert BugReporter to an interface for testing purpose.
Cannot use `@ContributesBinding(AppScope::class)`, so provide the implementation in AppModule.
This commit is contained in:
parent
f03e766657
commit
e2b4056493
5 changed files with 596 additions and 505 deletions
|
|
@ -20,6 +20,10 @@ import android.content.Context
|
|||
import com.squareup.anvil.annotations.ContributesTo
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import io.element.android.features.rageshake.crash.CrashDataStore
|
||||
import io.element.android.features.rageshake.reporter.BugReporter
|
||||
import io.element.android.features.rageshake.reporter.DefaultBugReporter
|
||||
import io.element.android.features.rageshake.screenshot.ScreenshotHolder
|
||||
import io.element.android.libraries.core.coroutine.CoroutineDispatchers
|
||||
import io.element.android.libraries.di.AppScope
|
||||
import io.element.android.libraries.di.ApplicationContext
|
||||
|
|
@ -58,4 +62,19 @@ object AppModule {
|
|||
diffUpdateDispatcher = Executors.newSingleThreadExecutor().asCoroutineDispatcher()
|
||||
)
|
||||
}
|
||||
|
||||
@Provides
|
||||
fun provideBugReporter(
|
||||
@ApplicationContext context: Context,
|
||||
screenshotHolder: ScreenshotHolder,
|
||||
crashDataStore: CrashDataStore,
|
||||
coroutineDispatchers: CoroutineDispatchers,
|
||||
): BugReporter {
|
||||
return DefaultBugReporter(
|
||||
context = context,
|
||||
screenshotHolder = screenshotHolder,
|
||||
crashDataStore = crashDataStore,
|
||||
coroutineDispatchers = coroutineDispatchers,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue