Reduce memory footprint of Hilt (#159)

* Remove @Singleton where it is not needed

* Use @AssistedFactory where possible
This commit is contained in:
Kirill Kamakin
2023-07-04 18:22:16 +02:00
committed by GitHub
parent 2bc2bb76e4
commit 2375be0329
55 changed files with 51 additions and 215 deletions

View File

@@ -3,9 +3,7 @@ package gq.kirmanak.mealient.logging
import android.util.Log
import gq.kirmanak.mealient.architecture.configuration.BuildConfiguration
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
class LogcatAppender @Inject constructor(
private val buildConfiguration: BuildConfiguration,
) : Appender {

View File

@@ -3,9 +3,7 @@ package gq.kirmanak.mealient.logging
import android.util.Log
import java.util.regex.Pattern
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
class LoggerImpl @Inject constructor(
private val appenders: Set<@JvmSuppressWildcards Appender>,
) : Logger {

View File

@@ -5,18 +5,15 @@ import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import dagger.multibindings.IntoSet
import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
interface LoggingModule {
@Binds
@Singleton
fun bindLogger(loggerImpl: LoggerImpl): Logger
@Binds
@Singleton
@IntoSet
fun bindLogcatAppender(logcatAppender: LogcatAppender): Appender
}