diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/PluginsModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/PluginsModule.kt index 928fed610c..cc3694874f 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/PluginsModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/PluginsModule.kt @@ -167,7 +167,7 @@ abstract class PluginsModule { abstract fun bindMDIPlugin(plugin: MDIPlugin): PluginBase @Binds - @NotNSClient + @AllConfigs @IntoMap @IntKey(180) abstract fun bindVirtualPumpPlugin(plugin: VirtualPumpPlugin): PluginBase diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderFragment.kt index f9cba58951..c864313b27 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderFragment.kt @@ -17,6 +17,7 @@ import info.nightscout.androidaps.activities.PreferencesActivity import info.nightscout.androidaps.events.EventRebuildTabs import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.plugins.bus.RxBusWrapper +import info.nightscout.androidaps.plugins.configBuilder.events.EventConfigBuilderUpdateGui import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.extensions.plusAssign import info.nightscout.androidaps.utils.protection.ProtectionCheck diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.java index b779943cdb..a6608b07c0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderPlugin.java @@ -9,7 +9,6 @@ import java.util.ArrayList; import javax.inject.Inject; import javax.inject.Singleton; -import dagger.Lazy; import dagger.android.HasAndroidInjector; import info.nightscout.androidaps.R; import info.nightscout.androidaps.events.EventAppInitialized; @@ -18,7 +17,6 @@ import info.nightscout.androidaps.events.EventRebuildTabs; import info.nightscout.androidaps.interfaces.APSInterface; import info.nightscout.androidaps.interfaces.ActivePluginProvider; import info.nightscout.androidaps.interfaces.BgSourceInterface; -import info.nightscout.androidaps.interfaces.CommandQueueProvider; import info.nightscout.androidaps.interfaces.InsulinInterface; import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginDescription; @@ -30,13 +28,7 @@ import info.nightscout.androidaps.interfaces.TreatmentsInterface; import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.plugins.bus.RxBusWrapper; -import info.nightscout.androidaps.plugins.insulin.InsulinOrefRapidActingPlugin; -import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin; -import info.nightscout.androidaps.plugins.profile.ns.NSProfilePlugin; -import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin; -import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref0Plugin; -import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin; -import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; +import info.nightscout.androidaps.plugins.configBuilder.events.EventConfigBuilderUpdateGui; import info.nightscout.androidaps.utils.OKDialog; import info.nightscout.androidaps.utils.resources.ResourceHelper; import info.nightscout.androidaps.utils.sharedPreferences.SP; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/PluginStore.kt b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/PluginStore.kt index 31692b93bb..558e23df2b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/PluginStore.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/PluginStore.kt @@ -1,12 +1,11 @@ package info.nightscout.androidaps.plugins.configBuilder +import info.nightscout.androidaps.Config import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.logging.AAPSLogger 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( @@ -27,6 +26,7 @@ class PluginStore @Inject constructor( return pluginStore!! } } + lateinit var plugins: List<@JvmSuppressWildcards PluginBase> private var activeBgSource: BgSourceInterface? = null @@ -83,14 +83,16 @@ class PluginStore @Inject constructor( var pluginsInCategory: ArrayList? // PluginType.APS - pluginsInCategory = getSpecificPluginsList(PluginType.APS) - activeAPS = getTheOneEnabledInArray(pluginsInCategory, PluginType.APS) as APSInterface? - if (activeAPS == null) { - activeAPS = getDefaultPlugin(PluginType.APS) as APSInterface - (activeAPS as PluginBase).setPluginEnabled(PluginType.APS, true) - aapsLogger.debug(LTag.CONFIGBUILDER, "Defaulting APSInterface") + if (!Config.NSCLIENT && !Config.PUMPCONTROL) { + pluginsInCategory = getSpecificPluginsList(PluginType.APS) + activeAPS = getTheOneEnabledInArray(pluginsInCategory, PluginType.APS) as APSInterface? + if (activeAPS == null) { + activeAPS = getDefaultPlugin(PluginType.APS) as APSInterface + (activeAPS as PluginBase).setPluginEnabled(PluginType.APS, true) + aapsLogger.debug(LTag.CONFIGBUILDER, "Defaulting APSInterface") + } + setFragmentVisiblities((activeAPS as PluginBase).name, pluginsInCategory, PluginType.APS) } - setFragmentVisiblities((activeAPS as PluginBase).name, pluginsInCategory, PluginType.APS) // PluginType.INSULIN pluginsInCategory = getSpecificPluginsList(PluginType.INSULIN) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/EventConfigBuilderUpdateGui.kt b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/events/EventConfigBuilderUpdateGui.kt similarity index 64% rename from app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/EventConfigBuilderUpdateGui.kt rename to app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/events/EventConfigBuilderUpdateGui.kt index e57fd79983..26904127dd 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/EventConfigBuilderUpdateGui.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/events/EventConfigBuilderUpdateGui.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.configBuilder +package info.nightscout.androidaps.plugins.configBuilder.events import info.nightscout.androidaps.events.EventUpdateGui diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.kt b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.kt index a7d2e4e145..521537e2d4 100644 --- a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.kt +++ b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.kt @@ -98,13 +98,12 @@ class KeepAliveReceiver : DaggerBroadcastReceiver() { // if there is no BG available, we have to upload anyway to have correct // IOB displayed in NS private fun checkAPS() { - val usedAPS = activePlugin.activeAPS var shouldUploadStatus = false if (Config.NSCLIENT) return if (Config.PUMPCONTROL) shouldUploadStatus = true - if (!loopPlugin.isEnabled() || iobCobCalculatorPlugin.actualBg() == null) + else if (!loopPlugin.isEnabled() || iobCobCalculatorPlugin.actualBg() == null) shouldUploadStatus = true - else if (DateUtil.isOlderThan(usedAPS.lastAPSRun, 5)) shouldUploadStatus = true + else if (DateUtil.isOlderThan(activePlugin.activeAPS.lastAPSRun, 5)) shouldUploadStatus = true if (DateUtil.isOlderThan(lastIobUpload, IOB_UPDATE_FREQUENCY) && shouldUploadStatus) { lastIobUpload = DateUtil.now() NSUpload.uploadDeviceStatus(loopPlugin, iobCobCalculatorPlugin, profileFunction, activePlugin.activePump) diff --git a/app/src/main/java/info/nightscout/androidaps/utils/FabricPrivacy.kt b/app/src/main/java/info/nightscout/androidaps/utils/FabricPrivacy.kt index 3ec3f1f451..19d25e008b 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/FabricPrivacy.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/FabricPrivacy.kt @@ -4,6 +4,7 @@ import android.os.Bundle import com.crashlytics.android.Crashlytics import com.google.firebase.analytics.FirebaseAnalytics import info.nightscout.androidaps.BuildConfig +import info.nightscout.androidaps.Config import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.R import info.nightscout.androidaps.interfaces.ActivePluginProvider @@ -132,7 +133,8 @@ class FabricPrivacy @Inject constructor( val hashes: List = signatureVerifierPlugin.shortHashes() if (hashes.isNotEmpty()) mainApp.firebaseAnalytics.setUserProperty("Hash", hashes[0]) activePlugin.activePump.let { mainApp.firebaseAnalytics.setUserProperty("Pump", it::class.java.simpleName) } - activePlugin.activeAPS.let { mainApp.firebaseAnalytics.setUserProperty("Aps", it::class.java.simpleName) } + if (!Config.NSCLIENT && !Config.PUMPCONTROL) + activePlugin.activeAPS.let { mainApp.firebaseAnalytics.setUserProperty("Aps", it::class.java.simpleName) } activePlugin.activeBgSource.let { mainApp.firebaseAnalytics.setUserProperty("BgSource", it::class.java.simpleName) } mainApp.firebaseAnalytics.setUserProperty("Profile", activePlugin.activeProfileInterface.javaClass.simpleName) activePlugin.activeSensitivity.let { mainApp.firebaseAnalytics.setUserProperty("Sensitivity", it::class.java.simpleName) }