This commit is contained in:
Milos Kozak 2022-12-02 11:34:41 +01:00
parent e6e5c9ed44
commit a55e25bb32
8 changed files with 25 additions and 22 deletions

View file

@ -5,17 +5,13 @@ import dagger.android.ContributesAndroidInjector
import info.nightscout.androidaps.MainActivity import info.nightscout.androidaps.MainActivity
import info.nightscout.androidaps.activities.HistoryBrowseActivity import info.nightscout.androidaps.activities.HistoryBrowseActivity
import info.nightscout.androidaps.activities.PreferencesActivity import info.nightscout.androidaps.activities.PreferencesActivity
import info.nightscout.configuration.activities.SingleFragmentActivity
import info.nightscout.configuration.maintenance.activities.LogSettingActivity
@Module @Module
@Suppress("unused") @Suppress("unused")
abstract class ActivitiesModule { abstract class ActivitiesModule {
@ContributesAndroidInjector abstract fun contributesHistoryBrowseActivity(): HistoryBrowseActivity @ContributesAndroidInjector abstract fun contributesHistoryBrowseActivity(): HistoryBrowseActivity
@ContributesAndroidInjector abstract fun contributesLogSettingActivity(): LogSettingActivity
@ContributesAndroidInjector abstract fun contributesMainActivity(): MainActivity @ContributesAndroidInjector abstract fun contributesMainActivity(): MainActivity
@ContributesAndroidInjector abstract fun contributesPreferencesActivity(): PreferencesActivity @ContributesAndroidInjector abstract fun contributesPreferencesActivity(): PreferencesActivity
@ContributesAndroidInjector abstract fun contributesSingleFragmentActivity(): SingleFragmentActivity
} }

View file

@ -47,8 +47,6 @@ import javax.inject.Singleton
ActivitiesModule::class, ActivitiesModule::class,
FragmentsModule::class, FragmentsModule::class,
ReceiversModule::class, ReceiversModule::class,
ServicesModule::class,
WorkflowModule::class,
// Gradle modules // Gradle modules
AutomationModule::class, AutomationModule::class,
@ -66,6 +64,7 @@ import javax.inject.Singleton
ValidatorsModule::class, ValidatorsModule::class,
PluginsSupportModule::class, PluginsSupportModule::class,
SyncModule::class, SyncModule::class,
WorkflowModule::class,
// pumps // pumps
ComboModule::class, ComboModule::class,
@ -83,7 +82,6 @@ import javax.inject.Singleton
OmnipodErosModule::class, OmnipodErosModule::class,
PumpCommonModule::class, PumpCommonModule::class,
RileyLinkModule::class RileyLinkModule::class
] ]
) )
interface AppComponent : AndroidInjector<MainApp> { interface AppComponent : AndroidInjector<MainApp> {

View file

@ -1,16 +1,2 @@
package info.nightscout.androidaps.di package info.nightscout.androidaps.di
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.plugins.general.persistentNotification.DummyService
import info.nightscout.core.services.AlarmSoundService
import info.nightscout.automation.services.LocationService
@Module
@Suppress("unused")
abstract class ServicesModule {
@ContributesAndroidInjector abstract fun contributesAlarmSoundService(): AlarmSoundService
@ContributesAndroidInjector abstract fun contributesDummyService(): DummyService
@ContributesAndroidInjector abstract fun contributesLocationService(): LocationService
}

View file

@ -5,11 +5,14 @@ import android.os.Build
import android.telephony.SmsManager import android.telephony.SmsManager
import dagger.Module import dagger.Module
import dagger.Provides import dagger.Provides
import dagger.android.ContributesAndroidInjector
import info.nightscout.core.services.AlarmSoundService
@Module( @Module(
includes = [ includes = [
CoreDataClassesModule::class, CoreDataClassesModule::class,
PreferencesModule::class PreferencesModule::class,
ServicesModule::class
] ]
) )
open class CoreModule { open class CoreModule {

View file

@ -0,0 +1,12 @@
package info.nightscout.core.di
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.core.services.AlarmSoundService
@Module
@Suppress("unused")
abstract class ServicesModule {
@ContributesAndroidInjector abstract fun contributesAlarmSoundService(): AlarmSoundService
}

View file

@ -28,6 +28,7 @@ import info.nightscout.automation.dialogs.ChooseTriggerDialog
import info.nightscout.automation.dialogs.EditActionDialog import info.nightscout.automation.dialogs.EditActionDialog
import info.nightscout.automation.dialogs.EditEventDialog import info.nightscout.automation.dialogs.EditEventDialog
import info.nightscout.automation.dialogs.EditTriggerDialog import info.nightscout.automation.dialogs.EditTriggerDialog
import info.nightscout.automation.services.LocationService
import info.nightscout.automation.triggers.Trigger import info.nightscout.automation.triggers.Trigger
import info.nightscout.automation.triggers.TriggerAutosensValue import info.nightscout.automation.triggers.TriggerAutosensValue
import info.nightscout.automation.triggers.TriggerBTDevice import info.nightscout.automation.triggers.TriggerBTDevice
@ -102,6 +103,7 @@ abstract class AutomationModule {
@ContributesAndroidInjector abstract fun actionStartTempTargetInjector(): ActionStartTempTarget @ContributesAndroidInjector abstract fun actionStartTempTargetInjector(): ActionStartTempTarget
@ContributesAndroidInjector abstract fun actionStopTempTargetInjector(): ActionStopTempTarget @ContributesAndroidInjector abstract fun actionStopTempTargetInjector(): ActionStopTempTarget
@ContributesAndroidInjector abstract fun actionDummyInjector(): ActionDummy @ContributesAndroidInjector abstract fun actionDummyInjector(): ActionDummy
@ContributesAndroidInjector abstract fun contributesLocationService(): LocationService
@Module @Module
interface Bindings { interface Bindings {

View file

@ -4,12 +4,14 @@ import dagger.Binds
import dagger.Module import dagger.Module
import dagger.android.ContributesAndroidInjector import dagger.android.ContributesAndroidInjector
import info.nightscout.configuration.AndroidPermissionImpl import info.nightscout.configuration.AndroidPermissionImpl
import info.nightscout.configuration.activities.SingleFragmentActivity
import info.nightscout.configuration.configBuilder.ConfigBuilderFragment import info.nightscout.configuration.configBuilder.ConfigBuilderFragment
import info.nightscout.configuration.configBuilder.ConfigBuilderPlugin import info.nightscout.configuration.configBuilder.ConfigBuilderPlugin
import info.nightscout.configuration.configBuilder.RunningConfigurationImpl import info.nightscout.configuration.configBuilder.RunningConfigurationImpl
import info.nightscout.configuration.maintenance.ImportExportPrefsImpl import info.nightscout.configuration.maintenance.ImportExportPrefsImpl
import info.nightscout.configuration.maintenance.MaintenanceFragment import info.nightscout.configuration.maintenance.MaintenanceFragment
import info.nightscout.configuration.maintenance.PrefFileListProviderImpl import info.nightscout.configuration.maintenance.PrefFileListProviderImpl
import info.nightscout.configuration.maintenance.activities.LogSettingActivity
import info.nightscout.configuration.maintenance.activities.PrefImportListActivity import info.nightscout.configuration.maintenance.activities.PrefImportListActivity
import info.nightscout.configuration.maintenance.formats.EncryptedPrefsFormat import info.nightscout.configuration.maintenance.formats.EncryptedPrefsFormat
import info.nightscout.interfaces.AndroidPermission import info.nightscout.interfaces.AndroidPermission
@ -26,6 +28,8 @@ import info.nightscout.interfaces.maintenance.PrefFileListProvider
) )
abstract class ConfigurationModule { abstract class ConfigurationModule {
@ContributesAndroidInjector abstract fun contributesSingleFragmentActivity(): SingleFragmentActivity
@ContributesAndroidInjector abstract fun contributesLogSettingActivity(): LogSettingActivity
@ContributesAndroidInjector abstract fun contributesMaintenanceFragment(): MaintenanceFragment @ContributesAndroidInjector abstract fun contributesMaintenanceFragment(): MaintenanceFragment
@ContributesAndroidInjector abstract fun contributesConfigBuilderFragment(): ConfigBuilderFragment @ContributesAndroidInjector abstract fun contributesConfigBuilderFragment(): ConfigBuilderFragment
@ContributesAndroidInjector abstract fun contributesCsvExportWorker(): ImportExportPrefsImpl.CsvExportWorker @ContributesAndroidInjector abstract fun contributesCsvExportWorker(): ImportExportPrefsImpl.CsvExportWorker

View file

@ -5,6 +5,7 @@ import dagger.Module
import dagger.android.ContributesAndroidInjector import dagger.android.ContributesAndroidInjector
import info.nightscout.interfaces.iob.IobCobCalculator import info.nightscout.interfaces.iob.IobCobCalculator
import info.nightscout.interfaces.smsCommunicator.SmsCommunicator import info.nightscout.interfaces.smsCommunicator.SmsCommunicator
import info.nightscout.plugins.general.persistentNotification.DummyService
import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin
import info.nightscout.plugins.general.wear.WearFragment import info.nightscout.plugins.general.wear.WearFragment
import info.nightscout.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin import info.nightscout.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
@ -31,6 +32,7 @@ import info.nightscout.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
abstract class PluginsModule { abstract class PluginsModule {
@ContributesAndroidInjector abstract fun contributesWearFragment(): WearFragment @ContributesAndroidInjector abstract fun contributesWearFragment(): WearFragment
@ContributesAndroidInjector abstract fun contributesDummyService(): DummyService
@Module @Module
interface Bindings { interface Bindings {