Register plugins with Dagger
This commit is contained in:
parent
7b4174afe0
commit
f4b7f642c9
|
@ -25,6 +25,8 @@ import net.danlew.android.joda.JodaTimeAndroid;
|
|||
|
||||
import org.json.JSONException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import dagger.android.AndroidInjector;
|
||||
|
@ -33,65 +35,14 @@ import dagger.android.HasAndroidInjector;
|
|||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||
import info.nightscout.androidaps.dependencyInjection.DaggerAppComponent;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
import info.nightscout.androidaps.logging.LTag;
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
|
||||
import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin;
|
||||
import info.nightscout.androidaps.plugins.aps.openAPSMA.OpenAPSMAPlugin;
|
||||
import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin;
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.configBuilder.PluginStore;
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunction;
|
||||
import info.nightscout.androidaps.plugins.constraints.dstHelper.DstHelperPlugin;
|
||||
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin;
|
||||
import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin;
|
||||
import info.nightscout.androidaps.plugins.constraints.signatureVerifier.SignatureVerifierPlugin;
|
||||
import info.nightscout.androidaps.plugins.constraints.storage.StorageConstraintPlugin;
|
||||
import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerPlugin;
|
||||
import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerUtils;
|
||||
import info.nightscout.androidaps.plugins.general.actions.ActionsPlugin;
|
||||
import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin;
|
||||
import info.nightscout.androidaps.plugins.general.careportal.CareportalPlugin;
|
||||
import info.nightscout.androidaps.plugins.general.dataBroadcaster.DataBroadcastPlugin;
|
||||
import info.nightscout.androidaps.plugins.general.food.FoodPlugin;
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin;
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin;
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
||||
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin;
|
||||
import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin;
|
||||
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin;
|
||||
import info.nightscout.androidaps.plugins.general.tidepool.TidepoolPlugin;
|
||||
import info.nightscout.androidaps.plugins.general.wear.WearPlugin;
|
||||
import info.nightscout.androidaps.plugins.general.xdripStatusline.StatusLinePlugin;
|
||||
import info.nightscout.androidaps.plugins.insulin.InsulinOrefFreePeakPlugin;
|
||||
import info.nightscout.androidaps.plugins.insulin.InsulinOrefRapidActingPlugin;
|
||||
import info.nightscout.androidaps.plugins.insulin.InsulinOrefUltraRapidActingPlugin;
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
|
||||
import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin;
|
||||
import info.nightscout.androidaps.plugins.profile.ns.NSProfilePlugin;
|
||||
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin;
|
||||
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin;
|
||||
import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin;
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.DanaRSPlugin;
|
||||
import info.nightscout.androidaps.plugins.pump.danaRv2.DanaRv2Plugin;
|
||||
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin;
|
||||
import info.nightscout.androidaps.plugins.pump.mdi.MDIPlugin;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin;
|
||||
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin;
|
||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin;
|
||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref0Plugin;
|
||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin;
|
||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin;
|
||||
import info.nightscout.androidaps.plugins.source.DexcomPlugin;
|
||||
import info.nightscout.androidaps.plugins.source.EversensePlugin;
|
||||
import info.nightscout.androidaps.plugins.source.GlimpPlugin;
|
||||
import info.nightscout.androidaps.plugins.source.MM640gPlugin;
|
||||
import info.nightscout.androidaps.plugins.source.NSClientSourcePlugin;
|
||||
import info.nightscout.androidaps.plugins.source.PoctechPlugin;
|
||||
import info.nightscout.androidaps.plugins.source.RandomBgPlugin;
|
||||
import info.nightscout.androidaps.plugins.source.TomatoPlugin;
|
||||
import info.nightscout.androidaps.plugins.source.XdripPlugin;
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||
import info.nightscout.androidaps.receivers.ChargingStateReceiver;
|
||||
import info.nightscout.androidaps.receivers.DataReceiver;
|
||||
import info.nightscout.androidaps.receivers.KeepAliveReceiver;
|
||||
|
@ -130,60 +81,9 @@ public class MainApp extends DaggerApplication {
|
|||
@Inject SP sp;
|
||||
@Inject ProfileFunction profileFunction;
|
||||
|
||||
@Inject ActionsPlugin actionsPlugin;
|
||||
@Inject AutomationPlugin automationPlugin;
|
||||
@Inject ComboPlugin comboPlugin;
|
||||
@Inject CareportalPlugin careportalPlugin;
|
||||
@Inject ConfigBuilderPlugin configBuilderPlugin;
|
||||
@Inject DanaRPlugin danaRPlugin;
|
||||
@Inject DanaRSPlugin danaRSPlugin;
|
||||
@Inject DanaRv2Plugin danaRv2Plugin;
|
||||
@Inject DanaRKoreanPlugin danaRKoreanPlugin;
|
||||
@Inject DataBroadcastPlugin dataBroadcastPlugin;
|
||||
@Inject DstHelperPlugin dstHelperPlugin;
|
||||
@Inject FoodPlugin foodPlugin;
|
||||
@Inject InsulinOrefFreePeakPlugin insulinOrefFreePeakPlugin;
|
||||
@Inject InsulinOrefRapidActingPlugin insulinOrefRapidActingPlugin;
|
||||
@Inject InsulinOrefUltraRapidActingPlugin insulinOrefUltraRapidActingPlugin;
|
||||
@Inject IobCobCalculatorPlugin iobCobCalculatorPlugin;
|
||||
@Inject LocalInsightPlugin localInsightPlugin;
|
||||
@Inject LocalProfilePlugin localProfilePlugin;
|
||||
@Inject LoopPlugin loopPlugin;
|
||||
@Inject MedtronicPumpPlugin medtronicPumpPlugin;
|
||||
@Inject MDIPlugin mdiPlugin;
|
||||
@Inject NSProfilePlugin nsProfilePlugin;
|
||||
@Inject ObjectivesPlugin objectivesPlugin;
|
||||
@Inject SafetyPlugin safetyPlugin;
|
||||
@Inject SmsCommunicatorPlugin smsCommunicatorPlugin;
|
||||
@Inject OpenAPSMAPlugin openAPSMAPlugin;
|
||||
@Inject OpenAPSAMAPlugin openAPSAMAPlugin;
|
||||
@Inject OpenAPSSMBPlugin openAPSSMBPlugin;
|
||||
@Inject OverviewPlugin overviewPlugin;
|
||||
@Inject PersistentNotificationPlugin persistentNotificationPlugin;
|
||||
@Inject RandomBgPlugin randomBgPlugin;
|
||||
@Inject SensitivityOref1Plugin sensitivityOref1Plugin;
|
||||
@Inject SensitivityAAPSPlugin sensitivityAAPSPlugin;
|
||||
@Inject SensitivityOref0Plugin sensitivityOref0Plugin;
|
||||
@Inject SensitivityWeightedAveragePlugin sensitivityWeightedAveragePlugin;
|
||||
@Inject SignatureVerifierPlugin signatureVerifierPlugin;
|
||||
@Inject StorageConstraintPlugin storageConstraintPlugin;
|
||||
@Inject DexcomPlugin dexcomPlugin;
|
||||
@Inject EversensePlugin eversensePlugin;
|
||||
@Inject GlimpPlugin glimpPlugin;
|
||||
@Inject MaintenancePlugin maintenancePlugin;
|
||||
@Inject MM640gPlugin mM640GPlugin;
|
||||
@Inject NSClientPlugin nsClientPlugin;
|
||||
@Inject NSClientSourcePlugin nSClientSourcePlugin;
|
||||
@Inject PoctechPlugin poctechPlugin;
|
||||
@Inject TomatoPlugin tomatoPlugin;
|
||||
@Inject XdripPlugin xdripPlugin;
|
||||
@Inject StatusLinePlugin statusLinePlugin;
|
||||
@Inject TidepoolPlugin tidepoolPlugin;
|
||||
@Inject TreatmentsPlugin treatmentsPlugin;
|
||||
@Inject VirtualPumpPlugin virtualPumpPlugin;
|
||||
@Inject VersionCheckerPlugin versionCheckerPlugin;
|
||||
@Inject WearPlugin wearPlugin;
|
||||
@Inject KeepAliveReceiver.KeepAliveManager keepAliveManager;
|
||||
@Inject List<PluginBase> plugins;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
|
@ -231,62 +131,7 @@ public class MainApp extends DaggerApplication {
|
|||
versionCheckersUtils.triggerCheckVersion();
|
||||
|
||||
// Register all tabs in app here
|
||||
pluginStore.add(overviewPlugin);
|
||||
pluginStore.add(iobCobCalculatorPlugin);
|
||||
if (!Config.NSCLIENT) pluginStore.add(actionsPlugin);
|
||||
pluginStore.add(insulinOrefRapidActingPlugin);
|
||||
pluginStore.add(insulinOrefUltraRapidActingPlugin);
|
||||
pluginStore.add(insulinOrefFreePeakPlugin);
|
||||
pluginStore.add(sensitivityOref0Plugin);
|
||||
pluginStore.add(sensitivityAAPSPlugin);
|
||||
pluginStore.add(sensitivityWeightedAveragePlugin);
|
||||
pluginStore.add(sensitivityOref1Plugin);
|
||||
if (Config.PUMPDRIVERS) pluginStore.add(danaRPlugin);
|
||||
if (Config.PUMPDRIVERS) pluginStore.add(danaRKoreanPlugin);
|
||||
if (Config.PUMPDRIVERS) pluginStore.add(danaRv2Plugin);
|
||||
if (Config.PUMPDRIVERS) pluginStore.add(danaRSPlugin);
|
||||
if (Config.PUMPDRIVERS) pluginStore.add(localInsightPlugin);
|
||||
if (Config.PUMPDRIVERS) pluginStore.add(comboPlugin);
|
||||
if (Config.PUMPDRIVERS) pluginStore.add(medtronicPumpPlugin);
|
||||
if (!Config.NSCLIENT) pluginStore.add(mdiPlugin);
|
||||
if (!Config.NSCLIENT) pluginStore.add(virtualPumpPlugin);
|
||||
if (Config.NSCLIENT) pluginStore.add(careportalPlugin);
|
||||
if (Config.APS) pluginStore.add(loopPlugin);
|
||||
if (Config.APS) pluginStore.add(openAPSMAPlugin);
|
||||
if (Config.APS) pluginStore.add(openAPSAMAPlugin);
|
||||
if (Config.APS) pluginStore.add(openAPSSMBPlugin);
|
||||
pluginStore.add(nsProfilePlugin);
|
||||
if (!Config.NSCLIENT) pluginStore.add(localProfilePlugin);
|
||||
pluginStore.add(treatmentsPlugin);
|
||||
if (!Config.NSCLIENT) pluginStore.add(safetyPlugin);
|
||||
if (!Config.NSCLIENT) pluginStore.add(versionCheckerPlugin);
|
||||
if (Config.APS) pluginStore.add(storageConstraintPlugin);
|
||||
if (Config.APS) pluginStore.add(signatureVerifierPlugin);
|
||||
if (Config.APS) pluginStore.add(objectivesPlugin);
|
||||
pluginStore.add(xdripPlugin);
|
||||
pluginStore.add(nSClientSourcePlugin);
|
||||
pluginStore.add(mM640GPlugin);
|
||||
pluginStore.add(glimpPlugin);
|
||||
pluginStore.add(dexcomPlugin);
|
||||
pluginStore.add(poctechPlugin);
|
||||
pluginStore.add(tomatoPlugin);
|
||||
pluginStore.add(eversensePlugin);
|
||||
pluginStore.add(randomBgPlugin);
|
||||
if (!Config.NSCLIENT) pluginStore.add(smsCommunicatorPlugin);
|
||||
pluginStore.add(foodPlugin);
|
||||
|
||||
pluginStore.add(wearPlugin);
|
||||
pluginStore.add(statusLinePlugin);
|
||||
pluginStore.add(persistentNotificationPlugin);
|
||||
pluginStore.add(nsClientPlugin);
|
||||
// if (engineeringMode) pluginsList.add(tidepoolPlugin);
|
||||
pluginStore.add(maintenancePlugin);
|
||||
pluginStore.add(automationPlugin);
|
||||
pluginStore.add(dstHelperPlugin);
|
||||
pluginStore.add(dataBroadcastPlugin);
|
||||
|
||||
pluginStore.add(configBuilderPlugin);
|
||||
|
||||
pluginStore.setPlugins(plugins);
|
||||
configBuilderPlugin.initialize();
|
||||
|
||||
NSUpload.uploadAppStart();
|
||||
|
|
|
@ -3,10 +3,12 @@ package info.nightscout.androidaps.dependencyInjection
|
|||
import android.content.Context
|
||||
import androidx.preference.PreferenceManager
|
||||
import dagger.Binds
|
||||
import dagger.Lazy
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.Config
|
||||
import info.nightscout.androidaps.MainApp
|
||||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.data.ProfileStore
|
||||
|
@ -15,6 +17,7 @@ import info.nightscout.androidaps.db.BgReading
|
|||
import info.nightscout.androidaps.db.ProfileSwitch
|
||||
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.plugins.aps.loop.APSResult
|
||||
|
@ -55,7 +58,7 @@ import info.nightscout.androidaps.utils.wizard.BolusWizard
|
|||
import info.nightscout.androidaps.utils.wizard.QuickWizardEntry
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module(includes = [AppModule.AppBindings::class])
|
||||
@Module(includes = [AppModule.AppBindings::class, PluginsModule::class])
|
||||
open class AppModule {
|
||||
|
||||
@Provides
|
||||
|
@ -88,6 +91,18 @@ open class AppModule {
|
|||
*/
|
||||
}
|
||||
|
||||
@Provides
|
||||
fun providesPlugins(@PluginsModule.AllConfigs allConfigs: Map<@JvmSuppressWildcards Int, @JvmSuppressWildcards PluginBase>,
|
||||
@PluginsModule.PumpDriver pumpDrivers: Lazy<Map<@JvmSuppressWildcards Int, @JvmSuppressWildcards PluginBase>>,
|
||||
@PluginsModule.NotNSClient notNsClient: Lazy<Map<@JvmSuppressWildcards Int, @JvmSuppressWildcards PluginBase>>,
|
||||
@PluginsModule.APS aps: Lazy<Map<@JvmSuppressWildcards Int, @JvmSuppressWildcards PluginBase>>): List<@JvmSuppressWildcards PluginBase> {
|
||||
val plugins = allConfigs.toMutableMap()
|
||||
if (Config.PUMPDRIVERS) plugins += pumpDrivers.get()
|
||||
if (Config.APS) plugins += aps.get()
|
||||
if (!Config.NSCLIENT) plugins += notNsClient.get()
|
||||
return plugins.toList().sortedBy { it.first }.map { it.second }
|
||||
}
|
||||
|
||||
@Module
|
||||
interface AppBindings {
|
||||
|
||||
|
|
|
@ -0,0 +1,372 @@
|
|||
package info.nightscout.androidaps.dependencyInjection
|
||||
|
||||
import dagger.Binds
|
||||
import dagger.Lazy
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.multibindings.IntKey
|
||||
import dagger.multibindings.IntoMap
|
||||
import dagger.multibindings.IntoSet
|
||||
import info.nightscout.androidaps.Config
|
||||
import info.nightscout.androidaps.interfaces.PluginBase
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
|
||||
import info.nightscout.androidaps.plugins.aps.openAPSMA.OpenAPSMAPlugin
|
||||
import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||
import info.nightscout.androidaps.plugins.constraints.dstHelper.DstHelperPlugin
|
||||
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin
|
||||
import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin
|
||||
import info.nightscout.androidaps.plugins.constraints.signatureVerifier.SignatureVerifierPlugin
|
||||
import info.nightscout.androidaps.plugins.constraints.storage.StorageConstraintPlugin
|
||||
import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerPlugin
|
||||
import info.nightscout.androidaps.plugins.general.actions.ActionsPlugin
|
||||
import info.nightscout.androidaps.plugins.general.careportal.CareportalPlugin
|
||||
import info.nightscout.androidaps.plugins.general.dataBroadcaster.DataBroadcastPlugin
|
||||
import info.nightscout.androidaps.plugins.general.food.FoodPlugin
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin
|
||||
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin
|
||||
import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin
|
||||
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin
|
||||
import info.nightscout.androidaps.plugins.general.wear.WearPlugin
|
||||
import info.nightscout.androidaps.plugins.general.xdripStatusline.StatusLinePlugin
|
||||
import info.nightscout.androidaps.plugins.insulin.InsulinOrefFreePeakPlugin
|
||||
import info.nightscout.androidaps.plugins.insulin.InsulinOrefRapidActingPlugin
|
||||
import info.nightscout.androidaps.plugins.insulin.InsulinOrefUltraRapidActingPlugin
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
||||
import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin
|
||||
import info.nightscout.androidaps.plugins.profile.ns.NSProfilePlugin
|
||||
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.danaRS.DanaRSPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.danaRv2.DanaRv2Plugin
|
||||
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.mdi.MDIPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
|
||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin
|
||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref0Plugin
|
||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin
|
||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin
|
||||
import info.nightscout.androidaps.plugins.source.*
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||
import javax.inject.Qualifier
|
||||
|
||||
@Module
|
||||
abstract class PluginsModule {
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(0)
|
||||
abstract fun bindOverviewPlugin(plugin: OverviewPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(10)
|
||||
abstract fun bindIobCobCalculatorPlugin(plugin: IobCobCalculatorPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@NotNSClient
|
||||
@IntoMap
|
||||
@IntKey(20)
|
||||
abstract fun bindActionsPlugin(plugin: ActionsPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(30)
|
||||
abstract fun bindInsulinOrefRapidActingPlugin(plugin: InsulinOrefRapidActingPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(40)
|
||||
abstract fun bindInsulinOrefUltraRapidActingPlugin(plugin: InsulinOrefUltraRapidActingPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(50)
|
||||
abstract fun bindInsulinOrefFreePeakPlugin(plugin: InsulinOrefFreePeakPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(60)
|
||||
abstract fun bindSensitivityOref0Plugin(plugin: SensitivityOref0Plugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(70)
|
||||
abstract fun bindSensitivityAAPSPlugin(plugin: SensitivityAAPSPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(80)
|
||||
abstract fun bindSensitivityWeightedAveragePlugin(plugin: SensitivityWeightedAveragePlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(90)
|
||||
abstract fun bindSensitivityOref1Plugin(plugin: SensitivityOref1Plugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@PumpDriver
|
||||
@IntoMap
|
||||
@IntKey(100)
|
||||
abstract fun bindDanaRPlugin(plugin: DanaRPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@PumpDriver
|
||||
@IntoMap
|
||||
@IntKey(110)
|
||||
abstract fun bindDanaRKoreanPlugin(plugin: DanaRKoreanPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@PumpDriver
|
||||
@IntoMap
|
||||
@IntKey(120)
|
||||
abstract fun bindDanaRv2Plugin(plugin: DanaRv2Plugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@PumpDriver
|
||||
@IntoMap
|
||||
@IntKey(130)
|
||||
abstract fun bindDanaRSPlugin(plugin: DanaRSPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@PumpDriver
|
||||
@IntoMap
|
||||
@IntKey(140)
|
||||
abstract fun bindLocalInsightPlugin(plugin: LocalInsightPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@PumpDriver
|
||||
@IntoMap
|
||||
@IntKey(150)
|
||||
abstract fun bindComboPlugin(plugin: ComboPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@PumpDriver
|
||||
@IntoMap
|
||||
@IntKey(160)
|
||||
abstract fun bindMedtronicPumpPlugin(plugin: MedtronicPumpPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@NotNSClient
|
||||
@IntoMap
|
||||
@IntKey(170)
|
||||
abstract fun bindMDIPlugin(plugin: MDIPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@NotNSClient
|
||||
@IntoMap
|
||||
@IntKey(180)
|
||||
abstract fun bindVirtualPumpPlugin(plugin: VirtualPumpPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@NotNSClient
|
||||
@IntoMap
|
||||
@IntKey(190)
|
||||
abstract fun bindCareportalPlugin(plugin: CareportalPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@APS
|
||||
@IntoMap
|
||||
@IntKey(200)
|
||||
abstract fun bindLoopPlugin(plugin: LoopPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@APS
|
||||
@IntoMap
|
||||
@IntKey(210)
|
||||
abstract fun bindOpenAPSMAPlugin(plugin: OpenAPSMAPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@APS
|
||||
@IntoMap
|
||||
@IntKey(220)
|
||||
abstract fun bindOpenAPSAMAPlugin(plugin: OpenAPSAMAPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@APS
|
||||
@IntoMap
|
||||
@IntKey(230)
|
||||
abstract fun bindOpenAPSSMBPlugin(plugin: OpenAPSSMBPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(240)
|
||||
abstract fun bindNSProfilePlugin(plugin: NSProfilePlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@NotNSClient
|
||||
@IntoMap
|
||||
@IntKey(250)
|
||||
abstract fun bindLocalProfilePlugin(plugin: LocalProfilePlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(260)
|
||||
abstract fun bindTreatmentsPlugin(plugin: TreatmentsPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@NotNSClient
|
||||
@IntoSet
|
||||
abstract fun bindSafetyPlugin(plugin: SafetyPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@NotNSClient
|
||||
@IntoMap
|
||||
@IntKey(270)
|
||||
abstract fun bindVersionCheckerPlugin(plugin: VersionCheckerPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@NotNSClient
|
||||
@IntoMap
|
||||
@IntKey(280)
|
||||
abstract fun bindSmsCommunicatorPlugin(plugin: SmsCommunicatorPlugin): PluginBase
|
||||
|
||||
|
||||
@Binds
|
||||
@APS
|
||||
@IntoMap
|
||||
@IntKey(290)
|
||||
abstract fun bindStorageConstraintPlugin(plugin: StorageConstraintPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@APS
|
||||
@IntoMap
|
||||
@IntKey(300)
|
||||
abstract fun bindSignatureVerifierPlugin(plugin: SignatureVerifierPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@APS
|
||||
@IntoMap
|
||||
@IntKey(310)
|
||||
abstract fun bindObjectivesPlugin(plugin: ObjectivesPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(320)
|
||||
abstract fun bindFoodPlugin(plugin: FoodPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(330)
|
||||
abstract fun bindWearPlugin(plugin: WearPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(340)
|
||||
abstract fun bindStatusLinePlugin(plugin: StatusLinePlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(350)
|
||||
abstract fun bindPersistentNotificationPlugin(plugin: PersistentNotificationPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(360)
|
||||
abstract fun bindNSClientPlugin(plugin: NSClientPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(370)
|
||||
abstract fun bindMaintenancePlugin(plugin: MaintenancePlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(380)
|
||||
abstract fun bindDstHelperPlugin(plugin: DstHelperPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(390)
|
||||
abstract fun bindDataBroadcastPlugin(plugin: DataBroadcastPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(400)
|
||||
abstract fun bindXdripPlugin(plugin: XdripPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(410)
|
||||
abstract fun bindNSClientSourcePlugin(plugin: NSClientSourcePlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(420)
|
||||
abstract fun bindMM640gPlugin(plugin: MM640gPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(430)
|
||||
abstract fun bindGlimpPlugin(plugin: GlimpPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(440)
|
||||
abstract fun bindDexcomPlugin(plugin: DexcomPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(450)
|
||||
abstract fun bindPoctechPlugin(plugin: PoctechPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(460)
|
||||
abstract fun bindTomatoPlugin(plugin: TomatoPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(470)
|
||||
abstract fun bindRandomBgPlugin(plugin: RandomBgPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
@IntKey(480)
|
||||
abstract fun bindConfigBuilderPlugin(plugin: ConfigBuilderPlugin): PluginBase
|
||||
|
||||
@Qualifier
|
||||
annotation class AllConfigs
|
||||
|
||||
@Qualifier
|
||||
annotation class PumpDriver
|
||||
|
||||
@Qualifier
|
||||
annotation class NotNSClient
|
||||
|
||||
@Qualifier
|
||||
annotation class APS
|
||||
|
||||
}
|
|
@ -6,6 +6,7 @@ import info.nightscout.androidaps.logging.LTag
|
|||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
@Singleton
|
||||
class PluginStore @Inject constructor(
|
||||
|
@ -26,8 +27,7 @@ class PluginStore @Inject constructor(
|
|||
return pluginStore!!
|
||||
}
|
||||
}
|
||||
|
||||
var plugins = ArrayList<PluginBase>()
|
||||
lateinit var plugins: List<@JvmSuppressWildcards PluginBase>
|
||||
|
||||
private var activeBgSource: BgSourceInterface? = null
|
||||
private var activePump: PumpInterface? = null
|
||||
|
@ -41,11 +41,6 @@ class PluginStore @Inject constructor(
|
|||
verifySelectionInCategories()
|
||||
}
|
||||
|
||||
fun add(pluginBase: PluginBase): ActivePluginProvider {
|
||||
plugins.add(pluginBase)
|
||||
return this
|
||||
}
|
||||
|
||||
fun getDefaultPlugin(type: PluginType): PluginBase {
|
||||
for (p in plugins)
|
||||
if (p.getType() == type && p.isDefault()) return p
|
||||
|
@ -243,6 +238,6 @@ class PluginStore @Inject constructor(
|
|||
override fun getActiveTreatments(): TreatmentsInterface =
|
||||
activeTreatments ?: checkNotNull(activeTreatments) { "No treatments selected" }
|
||||
|
||||
override fun getPluginsList(): ArrayList<PluginBase> = plugins
|
||||
override fun getPluginsList(): ArrayList<PluginBase> = ArrayList(plugins)
|
||||
|
||||
}
|
Loading…
Reference in a new issue