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.activities.HistoryBrowseActivity
import info.nightscout.androidaps.activities.PreferencesActivity
import info.nightscout.configuration.activities.SingleFragmentActivity
import info.nightscout.configuration.maintenance.activities.LogSettingActivity
@Module
@Suppress("unused")
abstract class ActivitiesModule {
@ContributesAndroidInjector abstract fun contributesHistoryBrowseActivity(): HistoryBrowseActivity
@ContributesAndroidInjector abstract fun contributesLogSettingActivity(): LogSettingActivity
@ContributesAndroidInjector abstract fun contributesMainActivity(): MainActivity
@ContributesAndroidInjector abstract fun contributesPreferencesActivity(): PreferencesActivity
@ContributesAndroidInjector abstract fun contributesSingleFragmentActivity(): SingleFragmentActivity
}

View file

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

View file

@ -1,16 +1,2 @@
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 dagger.Module
import dagger.Provides
import dagger.android.ContributesAndroidInjector
import info.nightscout.core.services.AlarmSoundService
@Module(
includes = [
CoreDataClassesModule::class,
PreferencesModule::class
PreferencesModule::class,
ServicesModule::class
]
)
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.EditEventDialog
import info.nightscout.automation.dialogs.EditTriggerDialog
import info.nightscout.automation.services.LocationService
import info.nightscout.automation.triggers.Trigger
import info.nightscout.automation.triggers.TriggerAutosensValue
import info.nightscout.automation.triggers.TriggerBTDevice
@ -102,6 +103,7 @@ abstract class AutomationModule {
@ContributesAndroidInjector abstract fun actionStartTempTargetInjector(): ActionStartTempTarget
@ContributesAndroidInjector abstract fun actionStopTempTargetInjector(): ActionStopTempTarget
@ContributesAndroidInjector abstract fun actionDummyInjector(): ActionDummy
@ContributesAndroidInjector abstract fun contributesLocationService(): LocationService
@Module
interface Bindings {

View file

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

View file

@ -5,6 +5,7 @@ import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.interfaces.iob.IobCobCalculator
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.wear.WearFragment
import info.nightscout.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
@ -31,6 +32,7 @@ import info.nightscout.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
abstract class PluginsModule {
@ContributesAndroidInjector abstract fun contributesWearFragment(): WearFragment
@ContributesAndroidInjector abstract fun contributesDummyService(): DummyService
@Module
interface Bindings {