diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppModule.kt index 9c78bd5642..548402341b 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppModule.kt @@ -12,8 +12,6 @@ import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.CommandQueueProvider import info.nightscout.androidaps.interfaces.PluginBase import info.nightscout.androidaps.logging.AAPSLogger -import info.nightscout.androidaps.logging.AAPSLoggerProduction -import info.nightscout.androidaps.logging.L import info.nightscout.androidaps.plugins.configBuilder.PluginStore import info.nightscout.androidaps.plugins.configBuilder.ProfileFunction import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctionImplementation @@ -34,10 +32,6 @@ open class AppModule { return ProfileFunctionImplementation(injector, aapsLogger, sp, resourceHelper, activePlugin, fabricPrivacy) } - @Provides - @Singleton - fun provideAAPSLogger(l: L): AAPSLogger = AAPSLoggerProduction(l) - @Provides fun providesPlugins(@PluginsModule.AllConfigs allConfigs: Map<@JvmSuppressWildcards Int, @JvmSuppressWildcards PluginBase>, @PluginsModule.PumpDriver pumpDrivers: Lazy>, @@ -64,10 +58,7 @@ open class AppModule { @Binds fun bindContext(mainApp: MainApp): Context @Binds fun bindInjector(mainApp: MainApp): HasAndroidInjector - - @Binds - fun bindActivePluginProvider(pluginStore: PluginStore): ActivePluginProvider - + @Binds fun bindActivePluginProvider(pluginStore: PluginStore): ActivePluginProvider @Binds fun commandQueueProvider(commandQueue: CommandQueue): CommandQueueProvider } diff --git a/core/build.gradle b/core/build.gradle index 58ed7cbfb3..850732a959 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -51,6 +51,8 @@ dependencies { kapt "com.google.dagger:dagger-android-processor:$dagger_version" kapt "com.google.dagger:dagger-compiler:$dagger_version" + implementation 'org.slf4j:slf4j-api:1.7.30' + testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' diff --git a/core/src/main/java/info/nightscout/androidaps/core/dependencyInjection/CoreModule.kt b/core/src/main/java/info/nightscout/androidaps/core/dependencyInjection/CoreModule.kt index b7ec76d301..19e64742fc 100644 --- a/core/src/main/java/info/nightscout/androidaps/core/dependencyInjection/CoreModule.kt +++ b/core/src/main/java/info/nightscout/androidaps/core/dependencyInjection/CoreModule.kt @@ -4,6 +4,9 @@ import android.content.Context import android.preference.PreferenceManager import dagger.Module import dagger.Provides +import info.nightscout.androidaps.logging.AAPSLogger +import info.nightscout.androidaps.logging.AAPSLoggerProduction +import info.nightscout.androidaps.logging.L import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelperImplementation import info.nightscout.androidaps.utils.sharedPreferences.SP @@ -15,13 +18,14 @@ open class CoreModule { @Provides @Singleton - fun provideResources(context: Context): ResourceHelper { - return ResourceHelperImplementation(context) - } + fun provideResources(context: Context): ResourceHelper = ResourceHelperImplementation(context) @Provides @Singleton - fun provideSharedPreferences(context: Context, resourceHelper: ResourceHelper): SP { - return SPImplementation(PreferenceManager.getDefaultSharedPreferences(context), resourceHelper) - } + fun provideSharedPreferences(context: Context, resourceHelper: ResourceHelper): SP = SPImplementation(PreferenceManager.getDefaultSharedPreferences(context), resourceHelper) + + @Provides + @Singleton + fun provideAAPSLogger(l: L): AAPSLogger = AAPSLoggerProduction(l) + } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/logging/AAPSLogger.kt b/core/src/main/java/info/nightscout/androidaps/logging/AAPSLogger.kt similarity index 100% rename from app/src/main/java/info/nightscout/androidaps/logging/AAPSLogger.kt rename to core/src/main/java/info/nightscout/androidaps/logging/AAPSLogger.kt diff --git a/app/src/main/java/info/nightscout/androidaps/logging/AAPSLoggerProduction.kt b/core/src/main/java/info/nightscout/androidaps/logging/AAPSLoggerProduction.kt similarity index 100% rename from app/src/main/java/info/nightscout/androidaps/logging/AAPSLoggerProduction.kt rename to core/src/main/java/info/nightscout/androidaps/logging/AAPSLoggerProduction.kt diff --git a/app/src/main/java/info/nightscout/androidaps/logging/AAPSLoggerTest.kt b/core/src/main/java/info/nightscout/androidaps/logging/AAPSLoggerTest.kt similarity index 100% rename from app/src/main/java/info/nightscout/androidaps/logging/AAPSLoggerTest.kt rename to core/src/main/java/info/nightscout/androidaps/logging/AAPSLoggerTest.kt diff --git a/app/src/main/java/info/nightscout/androidaps/logging/BundleLogger.java b/core/src/main/java/info/nightscout/androidaps/logging/BundleLogger.java similarity index 100% rename from app/src/main/java/info/nightscout/androidaps/logging/BundleLogger.java rename to core/src/main/java/info/nightscout/androidaps/logging/BundleLogger.java diff --git a/app/src/main/java/info/nightscout/androidaps/logging/L.kt b/core/src/main/java/info/nightscout/androidaps/logging/L.kt similarity index 95% rename from app/src/main/java/info/nightscout/androidaps/logging/L.kt rename to core/src/main/java/info/nightscout/androidaps/logging/L.kt index 5decfceb53..b2156c4080 100644 --- a/app/src/main/java/info/nightscout/androidaps/logging/L.kt +++ b/core/src/main/java/info/nightscout/androidaps/logging/L.kt @@ -1,7 +1,5 @@ package info.nightscout.androidaps.logging -import androidx.preference.PreferenceManager -import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.utils.sharedPreferences.SP import java.util.* import javax.inject.Inject diff --git a/app/src/main/java/info/nightscout/androidaps/logging/LTag.kt b/core/src/main/java/info/nightscout/androidaps/logging/LTag.kt similarity index 100% rename from app/src/main/java/info/nightscout/androidaps/logging/LTag.kt rename to core/src/main/java/info/nightscout/androidaps/logging/LTag.kt diff --git a/app/src/main/java/info/nightscout/androidaps/logging/StacktraceLoggerWrapper.kt b/core/src/main/java/info/nightscout/androidaps/logging/StacktraceLoggerWrapper.kt similarity index 100% rename from app/src/main/java/info/nightscout/androidaps/logging/StacktraceLoggerWrapper.kt rename to core/src/main/java/info/nightscout/androidaps/logging/StacktraceLoggerWrapper.kt