diff --git a/app/src/main/kotlin/top/fatweb/oxygen/toolbox/data/lib/DepDataSource.kt b/app/src/main/kotlin/top/fatweb/oxygen/toolbox/data/lib/DepDataSource.kt index 024f702..2e48645 100644 --- a/app/src/main/kotlin/top/fatweb/oxygen/toolbox/data/lib/DepDataSource.kt +++ b/app/src/main/kotlin/top/fatweb/oxygen/toolbox/data/lib/DepDataSource.kt @@ -1,6 +1,7 @@ package top.fatweb.oxygen.toolbox.data.lib import android.content.Context +import dagger.hilt.android.qualifiers.ApplicationContext import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOn @@ -12,7 +13,7 @@ import top.fatweb.oxygen.toolbox.network.OxygenDispatchers import javax.inject.Inject class DepDataSource @Inject constructor( - private val context: Context, + @ApplicationContext private val context: Context, @Dispatcher(OxygenDispatchers.IO) private val ioDispatcher: CoroutineDispatcher ) { private val json = Json { ignoreUnknownKeys = true } diff --git a/app/src/main/kotlin/top/fatweb/oxygen/toolbox/data/tool/ToolDataSource.kt b/app/src/main/kotlin/top/fatweb/oxygen/toolbox/data/tool/ToolDataSource.kt index 70bd6f5..6ca7daa 100644 --- a/app/src/main/kotlin/top/fatweb/oxygen/toolbox/data/tool/ToolDataSource.kt +++ b/app/src/main/kotlin/top/fatweb/oxygen/toolbox/data/tool/ToolDataSource.kt @@ -1,6 +1,7 @@ package top.fatweb.oxygen.toolbox.data.tool import android.content.Context +import dagger.hilt.android.qualifiers.ApplicationContext import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOn @@ -9,7 +10,7 @@ import top.fatweb.oxygen.toolbox.network.OxygenDispatchers import javax.inject.Inject class ToolDataSource @Inject constructor( - private val context: Context, + @ApplicationContext private val context: Context, @Dispatcher(OxygenDispatchers.IO) private val ioDispatcher: CoroutineDispatcher ) { val toolViewTemplate = flow { diff --git a/app/src/main/kotlin/top/fatweb/oxygen/toolbox/di/AppModule.kt b/app/src/main/kotlin/top/fatweb/oxygen/toolbox/di/AppModule.kt deleted file mode 100644 index a95990b..0000000 --- a/app/src/main/kotlin/top/fatweb/oxygen/toolbox/di/AppModule.kt +++ /dev/null @@ -1,15 +0,0 @@ -package top.fatweb.oxygen.toolbox.di - -import android.app.Application -import android.content.Context -import dagger.Module -import dagger.Provides -import dagger.hilt.InstallIn -import dagger.hilt.components.SingletonComponent - -@Module -@InstallIn(SingletonComponent::class) -object AppModule { - @Provides - fun provideContext(app: Application): Context = app.applicationContext -} \ No newline at end of file