Fix others flavors

This commit is contained in:
Milos Kozak 2020-04-03 12:09:57 +02:00
parent ff67c44e8f
commit aeb18e0b7c
7 changed files with 20 additions and 24 deletions

View file

@ -167,7 +167,7 @@ abstract class PluginsModule {
abstract fun bindMDIPlugin(plugin: MDIPlugin): PluginBase abstract fun bindMDIPlugin(plugin: MDIPlugin): PluginBase
@Binds @Binds
@NotNSClient @AllConfigs
@IntoMap @IntoMap
@IntKey(180) @IntKey(180)
abstract fun bindVirtualPumpPlugin(plugin: VirtualPumpPlugin): PluginBase abstract fun bindVirtualPumpPlugin(plugin: VirtualPumpPlugin): PluginBase

View file

@ -17,6 +17,7 @@ import info.nightscout.androidaps.activities.PreferencesActivity
import info.nightscout.androidaps.events.EventRebuildTabs import info.nightscout.androidaps.events.EventRebuildTabs
import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.interfaces.*
import info.nightscout.androidaps.plugins.bus.RxBusWrapper 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.FabricPrivacy
import info.nightscout.androidaps.utils.extensions.plusAssign import info.nightscout.androidaps.utils.extensions.plusAssign
import info.nightscout.androidaps.utils.protection.ProtectionCheck import info.nightscout.androidaps.utils.protection.ProtectionCheck

View file

@ -9,7 +9,6 @@ import java.util.ArrayList;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import dagger.Lazy;
import dagger.android.HasAndroidInjector; import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.events.EventAppInitialized; 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.APSInterface;
import info.nightscout.androidaps.interfaces.ActivePluginProvider; import info.nightscout.androidaps.interfaces.ActivePluginProvider;
import info.nightscout.androidaps.interfaces.BgSourceInterface; import info.nightscout.androidaps.interfaces.BgSourceInterface;
import info.nightscout.androidaps.interfaces.CommandQueueProvider;
import info.nightscout.androidaps.interfaces.InsulinInterface; import info.nightscout.androidaps.interfaces.InsulinInterface;
import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.PluginDescription; 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.AAPSLogger;
import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper; import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.insulin.InsulinOrefRapidActingPlugin; import info.nightscout.androidaps.plugins.configBuilder.events.EventConfigBuilderUpdateGui;
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.utils.OKDialog; import info.nightscout.androidaps.utils.OKDialog;
import info.nightscout.androidaps.utils.resources.ResourceHelper; import info.nightscout.androidaps.utils.resources.ResourceHelper;
import info.nightscout.androidaps.utils.sharedPreferences.SP; import info.nightscout.androidaps.utils.sharedPreferences.SP;

View file

@ -1,12 +1,11 @@
package info.nightscout.androidaps.plugins.configBuilder package info.nightscout.androidaps.plugins.configBuilder
import info.nightscout.androidaps.Config
import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.interfaces.*
import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag import info.nightscout.androidaps.logging.LTag
import java.util.*
import javax.inject.Inject import javax.inject.Inject
import javax.inject.Singleton import javax.inject.Singleton
import kotlin.collections.ArrayList
@Singleton @Singleton
class PluginStore @Inject constructor( class PluginStore @Inject constructor(
@ -27,6 +26,7 @@ class PluginStore @Inject constructor(
return pluginStore!! return pluginStore!!
} }
} }
lateinit var plugins: List<@JvmSuppressWildcards PluginBase> lateinit var plugins: List<@JvmSuppressWildcards PluginBase>
private var activeBgSource: BgSourceInterface? = null private var activeBgSource: BgSourceInterface? = null
@ -83,6 +83,7 @@ class PluginStore @Inject constructor(
var pluginsInCategory: ArrayList<PluginBase>? var pluginsInCategory: ArrayList<PluginBase>?
// PluginType.APS // PluginType.APS
if (!Config.NSCLIENT && !Config.PUMPCONTROL) {
pluginsInCategory = getSpecificPluginsList(PluginType.APS) pluginsInCategory = getSpecificPluginsList(PluginType.APS)
activeAPS = getTheOneEnabledInArray(pluginsInCategory, PluginType.APS) as APSInterface? activeAPS = getTheOneEnabledInArray(pluginsInCategory, PluginType.APS) as APSInterface?
if (activeAPS == null) { if (activeAPS == null) {
@ -91,6 +92,7 @@ class PluginStore @Inject constructor(
aapsLogger.debug(LTag.CONFIGBUILDER, "Defaulting APSInterface") aapsLogger.debug(LTag.CONFIGBUILDER, "Defaulting APSInterface")
} }
setFragmentVisiblities((activeAPS as PluginBase).name, pluginsInCategory, PluginType.APS) setFragmentVisiblities((activeAPS as PluginBase).name, pluginsInCategory, PluginType.APS)
}
// PluginType.INSULIN // PluginType.INSULIN
pluginsInCategory = getSpecificPluginsList(PluginType.INSULIN) pluginsInCategory = getSpecificPluginsList(PluginType.INSULIN)

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.configBuilder package info.nightscout.androidaps.plugins.configBuilder.events
import info.nightscout.androidaps.events.EventUpdateGui import info.nightscout.androidaps.events.EventUpdateGui

View file

@ -98,13 +98,12 @@ class KeepAliveReceiver : DaggerBroadcastReceiver() {
// if there is no BG available, we have to upload anyway to have correct // if there is no BG available, we have to upload anyway to have correct
// IOB displayed in NS // IOB displayed in NS
private fun checkAPS() { private fun checkAPS() {
val usedAPS = activePlugin.activeAPS
var shouldUploadStatus = false var shouldUploadStatus = false
if (Config.NSCLIENT) return if (Config.NSCLIENT) return
if (Config.PUMPCONTROL) shouldUploadStatus = true if (Config.PUMPCONTROL) shouldUploadStatus = true
if (!loopPlugin.isEnabled() || iobCobCalculatorPlugin.actualBg() == null) else if (!loopPlugin.isEnabled() || iobCobCalculatorPlugin.actualBg() == null)
shouldUploadStatus = true 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) { if (DateUtil.isOlderThan(lastIobUpload, IOB_UPDATE_FREQUENCY) && shouldUploadStatus) {
lastIobUpload = DateUtil.now() lastIobUpload = DateUtil.now()
NSUpload.uploadDeviceStatus(loopPlugin, iobCobCalculatorPlugin, profileFunction, activePlugin.activePump) NSUpload.uploadDeviceStatus(loopPlugin, iobCobCalculatorPlugin, profileFunction, activePlugin.activePump)

View file

@ -4,6 +4,7 @@ import android.os.Bundle
import com.crashlytics.android.Crashlytics import com.crashlytics.android.Crashlytics
import com.google.firebase.analytics.FirebaseAnalytics import com.google.firebase.analytics.FirebaseAnalytics
import info.nightscout.androidaps.BuildConfig import info.nightscout.androidaps.BuildConfig
import info.nightscout.androidaps.Config
import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.interfaces.ActivePluginProvider
@ -132,6 +133,7 @@ class FabricPrivacy @Inject constructor(
val hashes: List<String> = signatureVerifierPlugin.shortHashes() val hashes: List<String> = signatureVerifierPlugin.shortHashes()
if (hashes.isNotEmpty()) mainApp.firebaseAnalytics.setUserProperty("Hash", hashes[0]) if (hashes.isNotEmpty()) mainApp.firebaseAnalytics.setUserProperty("Hash", hashes[0])
activePlugin.activePump.let { mainApp.firebaseAnalytics.setUserProperty("Pump", it::class.java.simpleName) } activePlugin.activePump.let { mainApp.firebaseAnalytics.setUserProperty("Pump", it::class.java.simpleName) }
if (!Config.NSCLIENT && !Config.PUMPCONTROL)
activePlugin.activeAPS.let { mainApp.firebaseAnalytics.setUserProperty("Aps", it::class.java.simpleName) } activePlugin.activeAPS.let { mainApp.firebaseAnalytics.setUserProperty("Aps", it::class.java.simpleName) }
activePlugin.activeBgSource.let { mainApp.firebaseAnalytics.setUserProperty("BgSource", it::class.java.simpleName) } activePlugin.activeBgSource.let { mainApp.firebaseAnalytics.setUserProperty("BgSource", it::class.java.simpleName) }
mainApp.firebaseAnalytics.setUserProperty("Profile", activePlugin.activeProfileInterface.javaClass.simpleName) mainApp.firebaseAnalytics.setUserProperty("Profile", activePlugin.activeProfileInterface.javaClass.simpleName)