mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Convert BugReporter to an interface for testing purpose.
Cannot use `@ContributesBinding(AppScope::class)`, so provide the implementation in AppModule.
This commit is contained in:
@@ -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,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user