Reduce memory footprint of Hilt (#159)
* Remove @Singleton where it is not needed * Use @AssistedFactory where possible
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user