merge Config & BuildHelper
This commit is contained in:
parent
c847b35138
commit
6fa7877048
|
@ -41,14 +41,12 @@ import info.nightscout.androidaps.setupwizard.SetupWizardActivity
|
|||
import info.nightscout.androidaps.utils.extensions.isRunningRealPumpTest
|
||||
import info.nightscout.androidaps.utils.protection.PasswordCheck
|
||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||
import info.nightscout.ui.tabs.TabPageAdapter
|
||||
import info.nightscout.core.ui.UIRunnable
|
||||
import info.nightscout.core.fabric.FabricPrivacy
|
||||
import info.nightscout.core.ui.UIRunnable
|
||||
import info.nightscout.core.ui.dialogs.OKDialog
|
||||
import info.nightscout.database.entities.UserEntry.Action
|
||||
import info.nightscout.database.entities.UserEntry.Sources
|
||||
import info.nightscout.interfaces.AndroidPermission
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.aps.Loop
|
||||
import info.nightscout.interfaces.constraints.Constraints
|
||||
|
@ -70,6 +68,7 @@ import info.nightscout.shared.sharedPreferences.SP
|
|||
import info.nightscout.ui.activities.ProfileHelperActivity
|
||||
import info.nightscout.ui.activities.StatsActivity
|
||||
import info.nightscout.ui.activities.TreatmentsActivity
|
||||
import info.nightscout.ui.tabs.TabPageAdapter
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||
import java.util.Locale
|
||||
|
@ -87,14 +86,13 @@ class MainActivity : NoSplashAppCompatActivity() {
|
|||
@Inject lateinit var smsCommunicator: SmsCommunicator
|
||||
@Inject lateinit var loop: Loop
|
||||
@Inject lateinit var nsSettingsStatus: NSSettingsStatus
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var activePlugin: ActivePlugin
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||
@Inject lateinit var iconsProvider: IconsProvider
|
||||
@Inject lateinit var constraintChecker: Constraints
|
||||
@Inject lateinit var signatureVerifierPlugin: SignatureVerifierPlugin
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
@Inject lateinit var profileFunction: ProfileFunction
|
||||
@Inject lateinit var passwordCheck: PasswordCheck
|
||||
|
@ -351,7 +349,7 @@ class MainActivity : NoSplashAppCompatActivity() {
|
|||
var message = "Build: ${BuildConfig.BUILDVERSION}\n"
|
||||
message += "Flavor: ${BuildConfig.FLAVOR}${BuildConfig.BUILD_TYPE}\n"
|
||||
message += "${rh.gs(R.string.configbuilder_nightscoutversion_label)} ${nsSettingsStatus.getVersion()}"
|
||||
if (buildHelper.isEngineeringMode()) message += "\n${rh.gs(R.string.engineering_mode_enabled)}"
|
||||
if (config.isEngineeringMode()) message += "\n${rh.gs(R.string.engineering_mode_enabled)}"
|
||||
if (!fabricPrivacy.fabricEnabled()) message += "\n${rh.gs(R.string.fabric_upload_disabled)}"
|
||||
message += rh.gs(R.string.about_link_urls)
|
||||
val messageSpanned = SpannableString(message)
|
||||
|
|
|
@ -32,7 +32,6 @@ import info.nightscout.database.entities.UserEntry
|
|||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.database.impl.transactions.InsertIfNewByTimestampTherapyEventTransaction
|
||||
import info.nightscout.database.impl.transactions.VersionChangeTransaction
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.ConfigBuilder
|
||||
import info.nightscout.interfaces.LocalAlertUtils
|
||||
|
@ -68,7 +67,6 @@ class MainApp : DaggerApplication() {
|
|||
@Inject lateinit var versionCheckersUtils: VersionCheckerUtils
|
||||
@Inject lateinit var sp: SP
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var configBuilder: ConfigBuilder
|
||||
@Inject lateinit var plugins: List<@JvmSuppressWildcards PluginBase>
|
||||
@Inject lateinit var compatDBHelper: CompatDBHelper
|
||||
|
@ -118,7 +116,7 @@ class MainApp : DaggerApplication() {
|
|||
handler.postDelayed(
|
||||
{
|
||||
// check if identification is set
|
||||
if (buildHelper.isDev() && sp.getStringOrNull(R.string.key_email_for_crash_report, null).isNullOrBlank())
|
||||
if (config.isDev() && sp.getStringOrNull(R.string.key_email_for_crash_report, null).isNullOrBlank())
|
||||
notificationStore.add(Notification(Notification.IDENTIFICATION_NOT_SET, rh.get().gs(R.string.identification_not_set), Notification.INFO))
|
||||
// log version
|
||||
disposable += repository.runTransaction(VersionChangeTransaction(BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE, gitRemote, commitHash)).subscribe()
|
||||
|
|
|
@ -20,7 +20,7 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCa
|
|||
import info.nightscout.androidaps.utils.DefaultValueHelper
|
||||
import info.nightscout.androidaps.workflow.CalculationWorkflow
|
||||
import info.nightscout.core.fabric.FabricPrivacy
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||
import info.nightscout.rx.AapsSchedulers
|
||||
import info.nightscout.rx.events.EventAutosensCalculationFinished
|
||||
|
@ -46,7 +46,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
|
|||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var defaultValueHelper: DefaultValueHelper
|
||||
@Inject lateinit var activePlugin: ActivePlugin
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var overviewMenus: OverviewMenus
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
|
@ -291,7 +291,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
|
|||
val menuChartSettings = overviewMenus.setting
|
||||
graphData.addInRangeArea(historyBrowserData.overviewData.fromTime, historyBrowserData.overviewData.endTime, defaultValueHelper.determineLowLine(), defaultValueHelper.determineHighLine())
|
||||
graphData.addBgReadings(menuChartSettings[0][OverviewMenus.CharType.PRE.ordinal], context)
|
||||
if (buildHelper.isDev()) graphData.addBucketedData()
|
||||
if (config.isDev()) graphData.addBucketedData()
|
||||
graphData.addTreatments(context)
|
||||
graphData.addEps(context, 0.95)
|
||||
if (menuChartSettings[0][OverviewMenus.CharType.TREAT.ordinal])
|
||||
|
@ -340,7 +340,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
|
|||
if (menuChartSettings[g + 1][OverviewMenus.CharType.DEV.ordinal]) secondGraphData.addDeviations(useDevForScale, 1.0)
|
||||
if (menuChartSettings[g + 1][OverviewMenus.CharType.BGI.ordinal]) secondGraphData.addMinusBGI(useBGIForScale, if (alignDevBgiScale) 1.0 else 0.8)
|
||||
if (menuChartSettings[g + 1][OverviewMenus.CharType.SEN.ordinal]) secondGraphData.addRatio(useRatioForScale, if (useRatioForScale) 1.0 else 0.8)
|
||||
if (menuChartSettings[g + 1][OverviewMenus.CharType.DEVSLOPE.ordinal] && buildHelper.isDev()) secondGraphData.addDeviationSlope(useDSForScale, 1.0)
|
||||
if (menuChartSettings[g + 1][OverviewMenus.CharType.DEVSLOPE.ordinal] && config.isDev()) secondGraphData.addDeviationSlope(useDSForScale, 1.0)
|
||||
|
||||
// set manual x bounds to have nice steps
|
||||
secondGraphData.formatAxis(historyBrowserData.overviewData.fromTime, historyBrowserData.overviewData.endTime)
|
||||
|
|
|
@ -15,11 +15,8 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
|||
import info.nightscout.androidaps.plugins.configBuilder.PluginStore
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctionImpl
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.ImportExportPrefsImpl
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
||||
import info.nightscout.androidaps.utils.buildHelper.BuildHelperImpl
|
||||
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
|
||||
import info.nightscout.implementation.resources.IconsProviderImplementation
|
||||
import info.nightscout.core.fabric.FabricPrivacy
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.implementation.AndroidPermissionImpl
|
||||
|
@ -32,12 +29,12 @@ import info.nightscout.implementation.androidNotification.NotificationHolderImpl
|
|||
import info.nightscout.implementation.constraints.ConstraintsImpl
|
||||
import info.nightscout.implementation.pump.PumpSyncImplementation
|
||||
import info.nightscout.implementation.queue.CommandQueueImplementation
|
||||
import info.nightscout.implementation.resources.IconsProviderImplementation
|
||||
import info.nightscout.implementation.stats.DexcomTirCalculatorImpl
|
||||
import info.nightscout.implementation.stats.TddCalculatorImpl
|
||||
import info.nightscout.implementation.stats.TirCalculatorImpl
|
||||
import info.nightscout.interfaces.AndroidPermission
|
||||
import info.nightscout.interfaces.BolusTimer
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.CarbTimer
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.ConfigBuilder
|
||||
|
@ -85,7 +82,7 @@ open class AppModule {
|
|||
|
||||
@Provides
|
||||
fun providesPlugins(
|
||||
config: Config, buildHelper: BuildHelper,
|
||||
config: Config,
|
||||
@PluginsListModule.AllConfigs allConfigs: Map<@JvmSuppressWildcards Int, @JvmSuppressWildcards PluginBase>,
|
||||
@PluginsListModule.PumpDriver pumpDrivers: Lazy<Map<@JvmSuppressWildcards Int, @JvmSuppressWildcards PluginBase>>,
|
||||
@PluginsListModule.NotNSClient notNsClient: Lazy<Map<@JvmSuppressWildcards Int, @JvmSuppressWildcards PluginBase>>,
|
||||
|
@ -97,7 +94,7 @@ open class AppModule {
|
|||
if (config.PUMPDRIVERS) plugins += pumpDrivers.get()
|
||||
if (config.APS) plugins += aps.get()
|
||||
if (!config.NSCLIENT) plugins += notNsClient.get()
|
||||
if (buildHelper.isUnfinishedMode()) plugins += unfinished.get()
|
||||
if (config.isUnfinishedMode()) plugins += unfinished.get()
|
||||
return plugins.toList().sortedBy { it.first }.map { it.second }
|
||||
}
|
||||
|
||||
|
@ -105,10 +102,6 @@ open class AppModule {
|
|||
@Singleton
|
||||
fun provideStorage(): Storage = FileStorage()
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideBuildHelper(config: Config, fileListProvider: PrefFileListProvider): BuildHelper = BuildHelperImpl(config, fileListProvider)
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideProfileFunction(
|
||||
|
|
|
@ -23,7 +23,6 @@ import info.nightscout.androidaps.plugins.configBuilder.events.EventConfigBuilde
|
|||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.PREFERENCES
|
||||
import info.nightscout.core.fabric.FabricPrivacy
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||
import info.nightscout.interfaces.plugin.PluginBase
|
||||
|
@ -47,7 +46,6 @@ class ConfigBuilderFragment : DaggerFragment() {
|
|||
@Inject lateinit var activePlugin: ActivePlugin
|
||||
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var ctx: Context
|
||||
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
|
@ -101,13 +99,13 @@ class ConfigBuilderFragment : DaggerFragment() {
|
|||
private fun updateGUI() {
|
||||
binding.categories.removeAllViews()
|
||||
createViewsForPlugins(R.string.configbuilder_profile, R.string.configbuilder_profile_description, PluginType.PROFILE, activePlugin.getSpecificPluginsVisibleInList(PluginType.PROFILE))
|
||||
if (config.APS || config.PUMPCONTROL || buildHelper.isEngineeringMode())
|
||||
if (config.APS || config.PUMPCONTROL || config.isEngineeringMode())
|
||||
createViewsForPlugins(R.string.configbuilder_insulin, R.string.configbuilder_insulin_description, PluginType.INSULIN, activePlugin.getSpecificPluginsVisibleInList(PluginType.INSULIN))
|
||||
if (!config.NSCLIENT) {
|
||||
createViewsForPlugins(R.string.configbuilder_bgsource, R.string.configbuilder_bgsource_description, PluginType.BGSOURCE, activePlugin.getSpecificPluginsVisibleInList(PluginType.BGSOURCE))
|
||||
createViewsForPlugins(R.string.configbuilder_pump, R.string.configbuilder_pump_description, PluginType.PUMP, activePlugin.getSpecificPluginsVisibleInList(PluginType.PUMP))
|
||||
}
|
||||
if (config.APS || config.PUMPCONTROL || buildHelper.isEngineeringMode())
|
||||
if (config.APS || config.PUMPCONTROL || config.isEngineeringMode())
|
||||
createViewsForPlugins(R.string.configbuilder_sensitivity, R.string.configbuilder_sensitivity_description, PluginType.SENSITIVITY, activePlugin.getSpecificPluginsVisibleInList(PluginType.SENSITIVITY))
|
||||
if (config.APS) {
|
||||
createViewsForPlugins(R.string.configbuilder_aps, R.string.configbuilder_aps_description, PluginType.APS, activePlugin.getSpecificPluginsVisibleInList(PluginType.APS))
|
||||
|
|
|
@ -27,7 +27,6 @@ import info.nightscout.androidaps.activities.PreferencesActivity
|
|||
import info.nightscout.androidaps.diaconn.events.EventDiaconnG8PumpLogReset
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.formats.EncryptedPrefsFormat
|
||||
import info.nightscout.ui.alertDialogs.PrefImportSummaryDialog
|
||||
import info.nightscout.androidaps.utils.protection.PasswordCheck
|
||||
import info.nightscout.androidaps.utils.userEntry.UserEntryPresentationHelper
|
||||
import info.nightscout.core.ui.dialogs.OKDialog
|
||||
|
@ -38,7 +37,6 @@ import info.nightscout.database.entities.UserEntry.Action
|
|||
import info.nightscout.database.entities.UserEntry.Sources
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.interfaces.AndroidPermission
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.maintenance.ImportExportPrefs
|
||||
import info.nightscout.interfaces.maintenance.PrefFileNotFoundError
|
||||
|
@ -59,6 +57,7 @@ import info.nightscout.shared.interfaces.ResourceHelper
|
|||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import info.nightscout.shared.utils.DateUtil
|
||||
import info.nightscout.shared.utils.T
|
||||
import info.nightscout.ui.alertDialogs.PrefImportSummaryDialog
|
||||
import java.io.File
|
||||
import java.io.FileNotFoundException
|
||||
import java.io.IOException
|
||||
|
@ -75,10 +74,9 @@ class ImportExportPrefsImpl @Inject constructor(
|
|||
private var log: AAPSLogger,
|
||||
private val rh: ResourceHelper,
|
||||
private val sp: SP,
|
||||
private val buildHelper: BuildHelper,
|
||||
private val config: Config,
|
||||
private val rxBus: RxBus,
|
||||
private val passwordCheck: PasswordCheck,
|
||||
private val config: Config,
|
||||
private val androidPermission: AndroidPermission,
|
||||
private val encryptedPrefsFormat: EncryptedPrefsFormat,
|
||||
private val prefFileList: PrefFileListProvider,
|
||||
|
@ -313,7 +311,7 @@ class ImportExportPrefsImpl @Inject constructor(
|
|||
promptForDecryptionPasswordIfNeeded(activity, prefsAttempted, importOkAttempted, format, importFile) { prefs, importOk ->
|
||||
|
||||
// if at end we allow to import preferences
|
||||
val importPossible = (importOk || buildHelper.isEngineeringMode()) && (prefs.values.isNotEmpty())
|
||||
val importPossible = (importOk || config.isEngineeringMode()) && (prefs.values.isNotEmpty())
|
||||
|
||||
PrefImportSummaryDialog.showSummary(activity, importOk, importPossible, prefs, {
|
||||
if (importPossible) {
|
||||
|
|
|
@ -7,7 +7,6 @@ import androidx.core.content.FileProvider
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.BuildConfig
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.logging.LoggerUtils
|
||||
import info.nightscout.interfaces.plugin.PluginBase
|
||||
|
@ -37,7 +36,6 @@ class MaintenancePlugin @Inject constructor(
|
|||
private val sp: SP,
|
||||
private val nsSettingsStatus: NSSettingsStatus,
|
||||
aapsLogger: AAPSLogger,
|
||||
private val buildHelper: BuildHelper,
|
||||
private val config: Config,
|
||||
private val fileListProvider: PrefFileListProvider,
|
||||
private val loggerUtils: LoggerUtils
|
||||
|
@ -192,7 +190,7 @@ class MaintenancePlugin @Inject constructor(
|
|||
builder.append("Remote: " + BuildConfig.REMOTE + System.lineSeparator())
|
||||
builder.append("Flavor: " + BuildConfig.FLAVOR + BuildConfig.BUILD_TYPE + System.lineSeparator())
|
||||
builder.append(rh.gs(R.string.configbuilder_nightscoutversion_label) + " " + nsSettingsStatus.getVersion() + System.lineSeparator())
|
||||
if (buildHelper.isEngineeringMode()) builder.append(rh.gs(R.string.engineering_mode_enabled))
|
||||
if (config.isEngineeringMode()) builder.append(rh.gs(R.string.engineering_mode_enabled))
|
||||
return sendMail(attachmentUri, recipient, subject, builder.toString())
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ import info.nightscout.androidaps.events.EventNewBG
|
|||
import info.nightscout.androidaps.extensions.directionToIcon
|
||||
import info.nightscout.androidaps.extensions.valueToUnitsString
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.plugins.aps.loop.events.EventNewOpenLoopNotification
|
||||
import info.nightscout.androidaps.plugins.general.overview.activities.QuickWizardListActivity
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOverviewCalcProgress
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOverviewGraph
|
||||
|
@ -60,7 +59,6 @@ import info.nightscout.database.entities.UserEntry.Action
|
|||
import info.nightscout.database.entities.UserEntry.Sources
|
||||
import info.nightscout.database.entities.interfaces.end
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.Constants
|
||||
import info.nightscout.interfaces.GlucoseUnit
|
||||
|
@ -76,6 +74,7 @@ import info.nightscout.interfaces.pump.defs.PumpType
|
|||
import info.nightscout.interfaces.ui.ActivityNames
|
||||
import info.nightscout.interfaces.utils.JsonHelper
|
||||
import info.nightscout.interfaces.utils.TrendCalculator
|
||||
import info.nightscout.plugins.aps.loop.events.EventNewOpenLoopNotification
|
||||
import info.nightscout.plugins.constraints.bgQualityCheck.BgQualityCheckPlugin
|
||||
import info.nightscout.plugins.databinding.OverviewFragmentBinding
|
||||
import info.nightscout.plugins.general.overview.notifications.NotificationStore
|
||||
|
@ -142,13 +141,12 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
@Inject lateinit var xdripPlugin: XdripPlugin
|
||||
@Inject lateinit var notificationStore: NotificationStore
|
||||
@Inject lateinit var quickWizard: QuickWizard
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var overviewMenus: OverviewMenus
|
||||
@Inject lateinit var skinProvider: SkinProvider
|
||||
@Inject lateinit var trendCalculator: TrendCalculator
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
@Inject lateinit var repository: AppRepository
|
||||
|
@ -939,7 +937,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
private fun updateIobCob() {
|
||||
val iobText = overviewData.iobText(iobCobCalculator)
|
||||
val iobDialogText = overviewData.iobDialogText(iobCobCalculator)
|
||||
val displayText = overviewData.cobInfo(iobCobCalculator).displayText(rh, dateUtil, buildHelper.isEngineeringMode())
|
||||
val displayText = overviewData.cobInfo(iobCobCalculator).displayText(rh, dateUtil, config.isEngineeringMode())
|
||||
val lastCarbsTime = overviewData.lastCarbsTime
|
||||
runOnUiThread {
|
||||
_binding ?: return@runOnUiThread
|
||||
|
@ -1023,7 +1021,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
if (menuChartSettings.isEmpty()) return
|
||||
graphData.addInRangeArea(overviewData.fromTime, overviewData.endTime, defaultValueHelper.determineLowLine(), defaultValueHelper.determineHighLine())
|
||||
graphData.addBgReadings(menuChartSettings[0][OverviewMenus.CharType.PRE.ordinal], context)
|
||||
if (buildHelper.isDev()) graphData.addBucketedData()
|
||||
if (config.isDev()) graphData.addBucketedData()
|
||||
graphData.addTreatments(context)
|
||||
graphData.addEps(context, 0.95)
|
||||
if (menuChartSettings[0][OverviewMenus.CharType.TREAT.ordinal])
|
||||
|
@ -1072,7 +1070,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
if (menuChartSettings[g + 1][OverviewMenus.CharType.DEV.ordinal]) secondGraphData.addDeviations(useDevForScale, 1.0)
|
||||
if (menuChartSettings[g + 1][OverviewMenus.CharType.BGI.ordinal]) secondGraphData.addMinusBGI(useBGIForScale, if (alignDevBgiScale) 1.0 else 0.8)
|
||||
if (menuChartSettings[g + 1][OverviewMenus.CharType.SEN.ordinal]) secondGraphData.addRatio(useRatioForScale, if (useRatioForScale) 1.0 else 0.8)
|
||||
if (menuChartSettings[g + 1][OverviewMenus.CharType.DEVSLOPE.ordinal] && buildHelper.isDev()) secondGraphData.addDeviationSlope(
|
||||
if (menuChartSettings[g + 1][OverviewMenus.CharType.DEVSLOPE.ordinal] && config.isDev()) secondGraphData.addDeviationSlope(
|
||||
useDSForScale,
|
||||
if (useDSForScale) 1.0 else 0.8,
|
||||
useRatioForScale
|
||||
|
|
|
@ -13,7 +13,6 @@ import androidx.appcompat.widget.PopupMenu
|
|||
import com.google.gson.Gson
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.core.fabric.FabricPrivacy
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.aps.Loop
|
||||
import info.nightscout.rx.bus.RxBus
|
||||
|
@ -31,9 +30,8 @@ class OverviewMenus @Inject constructor(
|
|||
private val rh: ResourceHelper,
|
||||
private val sp: SP,
|
||||
private val rxBus: RxBus,
|
||||
private val buildHelper: BuildHelper,
|
||||
private val loop: Loop,
|
||||
private val config: Config,
|
||||
private val loop: Loop,
|
||||
private val fabricPrivacy: FabricPrivacy
|
||||
) {
|
||||
|
||||
|
@ -127,7 +125,7 @@ class OverviewMenus @Inject constructor(
|
|||
if (g > 0 && !m.secondary) return@forEach
|
||||
var insert = true
|
||||
if (m == CharType.PRE) insert = predictionsAvailable
|
||||
if (m == CharType.DEVSLOPE) insert = buildHelper.isDev()
|
||||
if (m == CharType.DEVSLOPE) insert = config.isDev()
|
||||
if (used.contains(m.ordinal)) insert = false
|
||||
for (g2 in g + 1 until numOfGraphs) {
|
||||
if (settingsCopy[g2][m.ordinal]) insert = false
|
||||
|
|
|
@ -19,7 +19,7 @@ import info.nightscout.androidaps.workflow.CalculationWorkflow
|
|||
import info.nightscout.core.fabric.FabricPrivacy
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.database.impl.ValueWrapper
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.Constants
|
||||
import info.nightscout.interfaces.aps.AutosensData
|
||||
import info.nightscout.interfaces.aps.SMBDefaults
|
||||
|
@ -59,7 +59,7 @@ class IobCobOref1Worker(
|
|||
@Inject lateinit var sensitivityAAPSPlugin: SensitivityAAPSPlugin
|
||||
@Inject lateinit var sensitivityWeightedAveragePlugin: SensitivityWeightedAveragePlugin
|
||||
@Inject lateinit var activePlugin: ActivePlugin
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var profiler: Profiler
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
|
|
|
@ -17,7 +17,7 @@ import info.nightscout.androidaps.utils.DecimalFormatter
|
|||
import info.nightscout.androidaps.workflow.CalculationWorkflow
|
||||
import info.nightscout.core.fabric.FabricPrivacy
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.Constants
|
||||
import info.nightscout.interfaces.aps.AutosensData
|
||||
import info.nightscout.interfaces.aps.SMBDefaults
|
||||
|
@ -55,7 +55,7 @@ class IobCobOrefWorker @Inject internal constructor(
|
|||
@Inject lateinit var sensitivityAAPSPlugin: SensitivityAAPSPlugin
|
||||
@Inject lateinit var sensitivityWeightedAveragePlugin: SensitivityWeightedAveragePlugin
|
||||
@Inject lateinit var activePlugin: ActivePlugin
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var profiler: Profiler
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
package info.nightscout.androidaps.utils.buildHelper
|
||||
|
||||
import info.nightscout.androidaps.BuildConfig
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider
|
||||
import java.io.File
|
||||
|
||||
class BuildHelperImpl constructor(
|
||||
private val config: Config,
|
||||
fileListProvider: PrefFileListProvider
|
||||
) : BuildHelper {
|
||||
|
||||
private var devBranch = false
|
||||
private var engineeringMode = false
|
||||
private var unfinishedMode = false
|
||||
|
||||
init {
|
||||
val engineeringModeSemaphore = File(fileListProvider.ensureExtraDirExists(), "engineering_mode")
|
||||
val unfinishedModeSemaphore = File(fileListProvider.ensureExtraDirExists(), "unfinished_mode")
|
||||
|
||||
engineeringMode = engineeringModeSemaphore.exists() && engineeringModeSemaphore.isFile
|
||||
unfinishedMode = unfinishedModeSemaphore.exists() && unfinishedModeSemaphore.isFile
|
||||
devBranch = BuildConfig.VERSION.contains("-") || BuildConfig.VERSION.matches(Regex(".*[a-zA-Z]+.*"))
|
||||
}
|
||||
|
||||
override fun isEngineeringModeOrRelease(): Boolean =
|
||||
if (!config.APS) true else engineeringMode || !devBranch
|
||||
|
||||
override fun isEngineeringMode(): Boolean = engineeringMode
|
||||
|
||||
override fun isUnfinishedMode(): Boolean = unfinishedMode
|
||||
|
||||
override fun isDev(): Boolean = devBranch
|
||||
}
|
|
@ -3,12 +3,16 @@ package info.nightscout.androidaps.utils.buildHelper
|
|||
import android.os.Build
|
||||
import info.nightscout.androidaps.BuildConfig
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider
|
||||
import info.nightscout.interfaces.Config
|
||||
import java.io.File
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
class ConfigImpl @Inject constructor() : Config {
|
||||
class ConfigImpl @Inject constructor(
|
||||
fileListProvider: PrefFileListProvider
|
||||
) : Config {
|
||||
|
||||
override val SUPPORTEDNSVERSION = 140206 // 14.2.6
|
||||
override val APS = BuildConfig.FLAVOR == "full"
|
||||
|
@ -23,4 +27,26 @@ class ConfigImpl @Inject constructor() : Config {
|
|||
override val currentDeviceModelString =
|
||||
Build.MANUFACTURER + " " + Build.MODEL + " (" + Build.DEVICE + ")"
|
||||
override val appName: Int = R.string.app_name
|
||||
|
||||
private var devBranch = false
|
||||
private var engineeringMode = false
|
||||
private var unfinishedMode = false
|
||||
|
||||
init {
|
||||
val engineeringModeSemaphore = File(fileListProvider.ensureExtraDirExists(), "engineering_mode")
|
||||
val unfinishedModeSemaphore = File(fileListProvider.ensureExtraDirExists(), "unfinished_mode")
|
||||
|
||||
engineeringMode = engineeringModeSemaphore.exists() && engineeringModeSemaphore.isFile
|
||||
unfinishedMode = unfinishedModeSemaphore.exists() && unfinishedModeSemaphore.isFile
|
||||
devBranch = BuildConfig.VERSION.contains("-") || BuildConfig.VERSION.matches(Regex(".*[a-zA-Z]+.*"))
|
||||
}
|
||||
|
||||
override fun isEngineeringModeOrRelease(): Boolean =
|
||||
if (!APS) true else engineeringMode || !devBranch
|
||||
|
||||
override fun isEngineeringMode(): Boolean = engineeringMode
|
||||
|
||||
override fun isUnfinishedMode(): Boolean = unfinishedMode
|
||||
|
||||
override fun isDev(): Boolean = devBranch
|
||||
}
|
|
@ -17,11 +17,9 @@ import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.RuffyScripter
|
|||
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
|
||||
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage
|
||||
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
|
||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin
|
||||
import info.nightscout.androidaps.utils.buildHelper.BuildHelperImpl
|
||||
import info.nightscout.androidaps.utils.buildHelper.ConfigImpl
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.implementation.constraints.ConstraintsImpl
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.constraints.Constraint
|
||||
import info.nightscout.interfaces.constraints.Constraints
|
||||
import info.nightscout.interfaces.constraints.Objectives
|
||||
|
@ -58,14 +56,12 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
|
|||
@Mock lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage
|
||||
@Mock lateinit var temporaryBasalStorage: TemporaryBasalStorage
|
||||
@Mock lateinit var glimpPlugin: GlimpPlugin
|
||||
@Mock lateinit var sensitivityOref1Plugin: SensitivityOref1Plugin
|
||||
@Mock lateinit var profiler: Profiler
|
||||
@Mock lateinit var fileListProvider: PrefFileListProvider
|
||||
@Mock lateinit var repository: AppRepository
|
||||
@Mock lateinit var pumpSync: PumpSync
|
||||
@Mock lateinit var insightDatabaseDao: InsightDatabaseDao
|
||||
@Mock lateinit var ruffyScripter: RuffyScripter
|
||||
@Mock lateinit var buildHelper: BuildHelper
|
||||
|
||||
private lateinit var hardLimits: HardLimits
|
||||
private lateinit var danaPump: DanaPump
|
||||
|
@ -193,7 +189,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
|
|||
dateUtil,
|
||||
repository,
|
||||
glucoseStatusProvider,
|
||||
buildHelper
|
||||
config
|
||||
)
|
||||
openAPSAMAPlugin =
|
||||
info.nightscout.plugins.aps.openAPSAMA.OpenAPSAMAPlugin(
|
||||
|
@ -224,9 +220,8 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
|
|||
constraintChecker,
|
||||
activePlugin,
|
||||
hardLimits,
|
||||
BuildHelperImpl(config, fileListProvider),
|
||||
ConfigImpl(fileListProvider),
|
||||
iobCobCalculator,
|
||||
config,
|
||||
dateUtil
|
||||
)
|
||||
val constraintsPluginsList = ArrayList<PluginBase>()
|
||||
|
|
|
@ -3,7 +3,6 @@ package info.nightscout.androidaps.plugins.general.maintenance
|
|||
import android.content.Context
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.TestBase
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.logging.LoggerUtils
|
||||
import info.nightscout.plugins.sync.nsclient.data.NSSettingsStatus
|
||||
|
@ -23,16 +22,15 @@ class MaintenancePluginTest : TestBase() {
|
|||
@Mock lateinit var rh: ResourceHelper
|
||||
@Mock lateinit var sp: SP
|
||||
@Mock lateinit var nsSettingsStatus: NSSettingsStatus
|
||||
@Mock lateinit var buildHelper: BuildHelper
|
||||
@Mock lateinit var config: Config
|
||||
@Mock lateinit var loggerUtils: LoggerUtils
|
||||
@Mock lateinit var fileListProvider: PrefFileListProvider
|
||||
@Mock lateinit var config: Config
|
||||
|
||||
private lateinit var sut: MaintenancePlugin
|
||||
|
||||
@Before
|
||||
fun mock() {
|
||||
sut = MaintenancePlugin(injector, context, rh, sp, nsSettingsStatus, aapsLogger, buildHelper, config, fileListProvider, loggerUtils)
|
||||
sut = MaintenancePlugin(injector, context, rh, sp, nsSettingsStatus, aapsLogger, config, fileListProvider, loggerUtils)
|
||||
`when`(loggerUtils.suffix).thenReturn(".log.zip")
|
||||
`when`(loggerUtils.logDirectory).thenReturn("src/test/res/logger")
|
||||
`when`(fileListProvider.ensureTempDirExists()).thenReturn(File("src/test/res/logger"))
|
||||
|
|
|
@ -6,7 +6,6 @@ import info.nightscout.androidaps.HardLimitsMock
|
|||
import info.nightscout.androidaps.TestBaseWithProfile
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Constants
|
||||
import info.nightscout.interfaces.constraints.Constraint
|
||||
import info.nightscout.interfaces.constraints.Constraints
|
||||
|
@ -33,7 +32,6 @@ class SafetyPluginTest : TestBaseWithProfile() {
|
|||
@Mock lateinit var sp: SP
|
||||
@Mock lateinit var constraintChecker: Constraints
|
||||
@Mock lateinit var activePlugin: ActivePlugin
|
||||
@Mock lateinit var buildHelper: BuildHelper
|
||||
@Mock lateinit var virtualPumpPlugin: VirtualPumpPlugin
|
||||
@Mock lateinit var glimpPlugin: GlimpPlugin
|
||||
@Mock lateinit var profiler: Profiler
|
||||
|
@ -75,7 +73,7 @@ class SafetyPluginTest : TestBaseWithProfile() {
|
|||
`when`(virtualPumpPlugin.pumpDescription).thenReturn(pumpDescription)
|
||||
`when`(config.APS).thenReturn(true)
|
||||
hardLimits = HardLimitsMock(sp, rh)
|
||||
safetyPlugin = SafetyPlugin(injector, aapsLogger, rh, sp, rxBus, constraintChecker, activePlugin, hardLimits, buildHelper, iobCobCalculator, config, dateUtil)
|
||||
safetyPlugin = SafetyPlugin(injector, aapsLogger, rh, sp, rxBus, constraintChecker, activePlugin, hardLimits, config, iobCobCalculator, dateUtil)
|
||||
openAPSAMAPlugin = OpenAPSAMAPlugin(
|
||||
injector, aapsLogger, rxBus, constraintChecker, rh, profileFunction, context, activePlugin, iobCobCalculator, hardLimits, profiler, fabricPrivacy,
|
||||
dateUtil, repository, glucoseStatusProvider, sp
|
||||
|
@ -98,7 +96,7 @@ class SafetyPluginTest : TestBaseWithProfile() {
|
|||
@Test
|
||||
fun disabledEngineeringModeShouldLimitClosedLoop() {
|
||||
`when`(sp.getString(R.string.key_aps_mode, "open")).thenReturn("closed")
|
||||
`when`(buildHelper.isEngineeringModeOrRelease()).thenReturn(false)
|
||||
`when`(config.isEngineeringModeOrRelease()).thenReturn(false)
|
||||
var c = Constraint(true)
|
||||
c = safetyPlugin.isClosedLoopAllowed(c)
|
||||
Assert.assertTrue(c.getReasons(aapsLogger).contains("Running dev version. Closed loop is disabled."))
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
package info.nightscout.androidaps.plugins.constraints.versionChecker
|
||||
|
||||
import android.os.Build
|
||||
import dagger.Lazy
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
||||
import info.nightscout.androidaps.receivers.ReceiverStatusStore
|
||||
import info.nightscout.core.main.R
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
||||
import info.nightscout.interfaces.notifications.Notification
|
||||
import info.nightscout.androidaps.receivers.ReceiverStatusStore
|
||||
import info.nightscout.interfaces.constraints.versionChecker.AllowedVersions
|
||||
import info.nightscout.shared.utils.DateUtil
|
||||
import info.nightscout.shared.utils.T
|
||||
import info.nightscout.interfaces.notifications.Notification
|
||||
import info.nightscout.rx.bus.RxBus
|
||||
import info.nightscout.rx.logging.AAPSLogger
|
||||
import info.nightscout.rx.logging.LTag
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import info.nightscout.shared.utils.DateUtil
|
||||
import info.nightscout.shared.utils.T
|
||||
import java.io.IOException
|
||||
import java.net.URL
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
@ -26,7 +27,7 @@ class VersionCheckerUtils @Inject constructor(
|
|||
private val sp: SP,
|
||||
private val rh: ResourceHelper,
|
||||
private val rxBus: RxBus,
|
||||
private val config: Config,
|
||||
private val config: Lazy<Config>,
|
||||
private val receiverStatusStore: ReceiverStatusStore,
|
||||
private val dateUtil: DateUtil
|
||||
) {
|
||||
|
@ -52,17 +53,17 @@ class VersionCheckerUtils @Inject constructor(
|
|||
try {
|
||||
val definition: String = URL("https://raw.githubusercontent.com/nightscout/AndroidAPS/versions/definition.json").readText()
|
||||
val version: String? = AllowedVersions().findByApi(definition, Build.VERSION.SDK_INT)?.optString("supported")
|
||||
compareWithCurrentVersion(version, config.VERSION_NAME)
|
||||
compareWithCurrentVersion(version, config.get().VERSION_NAME)
|
||||
|
||||
// App expiration
|
||||
var endDate = sp.getLong(rh.gs(R.string.key_app_expiration) + "_" + config.VERSION_NAME, 0)
|
||||
AllowedVersions().findByVersion(definition, config.VERSION_NAME)?.let { expirationJson ->
|
||||
var endDate = sp.getLong(rh.gs(R.string.key_app_expiration) + "_" + config.get().VERSION_NAME, 0)
|
||||
AllowedVersions().findByVersion(definition, config.get().VERSION_NAME)?.let { expirationJson ->
|
||||
AllowedVersions().endDateToMilliseconds(expirationJson.getString("endDate"))?.let { ed ->
|
||||
endDate = ed + T.days(1).msecs()
|
||||
sp.putLong(rh.gs(R.string.key_app_expiration) + "_" + config.VERSION_NAME, endDate)
|
||||
sp.putLong(rh.gs(R.string.key_app_expiration) + "_" + config.get().VERSION_NAME, endDate)
|
||||
}
|
||||
}
|
||||
if (endDate != 0L) onExpireDateDetected(config.VERSION_NAME, dateUtil.dateString(endDate))
|
||||
if (endDate != 0L) onExpireDateDetected(config.get().VERSION_NAME, dateUtil.dateString(endDate))
|
||||
|
||||
} catch (e: IOException) {
|
||||
aapsLogger.error(LTag.CORE, "Github master version check error: $e")
|
||||
|
@ -77,12 +78,12 @@ class VersionCheckerUtils @Inject constructor(
|
|||
val newVersionElements = newVersion.toNumberList()
|
||||
val currentVersionElements = currentVersion.toNumberList()
|
||||
|
||||
if (newVersionElements == null || newVersionElements.isEmpty()) {
|
||||
if (newVersionElements.isNullOrEmpty()) {
|
||||
onVersionNotDetectable()
|
||||
return
|
||||
}
|
||||
|
||||
if (currentVersionElements == null || currentVersionElements.isEmpty()) {
|
||||
if (currentVersionElements.isNullOrEmpty()) {
|
||||
// current version scrambled?!
|
||||
onNewVersionDetected(currentVersion, newVersion)
|
||||
return
|
||||
|
@ -96,7 +97,7 @@ class VersionCheckerUtils @Inject constructor(
|
|||
when {
|
||||
it > 0 -> return onNewVersionDetected(currentVersion, newVersion)
|
||||
it < 0 -> return onOlderVersionDetected()
|
||||
it == 0 -> Unit
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -147,8 +148,7 @@ class VersionCheckerUtils @Inject constructor(
|
|||
|
||||
fun findVersion(file: String?): String? {
|
||||
val regex = "(.*)version(.*)\"(((\\d+)\\.)+(\\d+))\"(.*)".toRegex()
|
||||
return file?.lines()?.filter { regex.matches(it) }
|
||||
?.mapNotNull { regex.matchEntire(it)?.groupValues?.getOrNull(3) }?.firstOrNull()
|
||||
return file?.lines()?.filter { regex.matches(it) }?.firstNotNullOfOrNull { regex.matchEntire(it)?.groupValues?.getOrNull(3) }
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -164,6 +164,5 @@ fun String.numericVersionPart(): String =
|
|||
|
||||
@Suppress("unused") fun findVersion(file: String?): String? {
|
||||
val regex = "(.*)version(.*)\"(((\\d+)\\.)+(\\d+))\"(.*)".toRegex()
|
||||
return file?.lines()?.filter { regex.matches(it) }
|
||||
?.mapNotNull { regex.matchEntire(it)?.groupValues?.getOrNull(3) }?.firstOrNull()
|
||||
return file?.lines()?.filter { regex.matches(it) }?.firstNotNullOfOrNull { regex.matchEntire(it)?.groupValues?.getOrNull(3) }
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.general.maintenance
|
|||
|
||||
import android.content.Context
|
||||
import android.os.Environment
|
||||
import dagger.Lazy
|
||||
import info.nightscout.androidaps.annotations.OpenForTesting
|
||||
import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerUtils
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.formats.EncryptedPrefsFormat
|
||||
|
@ -30,13 +31,12 @@ import kotlin.math.abs
|
|||
@Singleton
|
||||
class PrefFileListProvider @Inject constructor(
|
||||
private val rh: ResourceHelper,
|
||||
private val config: Config,
|
||||
private val config: Lazy<Config>,
|
||||
private val encryptedPrefsFormat: EncryptedPrefsFormat,
|
||||
private val storage: Storage,
|
||||
private val versionCheckerUtils: VersionCheckerUtils,
|
||||
context: Context
|
||||
) {
|
||||
@Suppress("DEPRECATION")
|
||||
private val path = File(Environment.getExternalStorageDirectory().toString())
|
||||
private val aapsPath = File(path, "AAPS" + File.separator + "preferences")
|
||||
private val exportsPath = File(path, "AAPS" + File.separator + "exports")
|
||||
|
@ -120,7 +120,7 @@ class PrefFileListProvider @Inject constructor(
|
|||
|
||||
fun newExportFile(): File {
|
||||
val timeLocal = LocalDateTime.now().toString(DateTimeFormat.forPattern("yyyy-MM-dd'_'HHmmss"))
|
||||
return File(aapsPath, timeLocal + "_" + config.FLAVOR + ".json")
|
||||
return File(aapsPath, timeLocal + "_" + config.get().FLAVOR + ".json")
|
||||
}
|
||||
|
||||
fun newExportCsvFile(): File {
|
||||
|
@ -134,14 +134,14 @@ class PrefFileListProvider @Inject constructor(
|
|||
|
||||
meta[PrefsMetadataKey.AAPS_FLAVOUR]?.let { flavour ->
|
||||
val flavourOfPrefs = flavour.value
|
||||
if (flavour.value != config.FLAVOR) {
|
||||
if (flavour.value != config.get().FLAVOR) {
|
||||
flavour.status = PrefsStatus.WARN
|
||||
flavour.info = rh.gs(R.string.metadata_warning_different_flavour, flavourOfPrefs, config.FLAVOR)
|
||||
flavour.info = rh.gs(R.string.metadata_warning_different_flavour, flavourOfPrefs, config.get().FLAVOR)
|
||||
}
|
||||
}
|
||||
|
||||
meta[PrefsMetadataKey.DEVICE_MODEL]?.let { model ->
|
||||
if (model.value != config.currentDeviceModelString) {
|
||||
if (model.value != config.get().currentDeviceModelString) {
|
||||
model.status = PrefsStatus.WARN
|
||||
model.info = rh.gs(R.string.metadata_warning_different_device)
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ class PrefFileListProvider @Inject constructor(
|
|||
}
|
||||
|
||||
meta[PrefsMetadataKey.AAPS_VERSION]?.let { version ->
|
||||
val currentAppVer = versionCheckerUtils.versionDigits(config.VERSION_NAME)
|
||||
val currentAppVer = versionCheckerUtils.versionDigits(config.get().VERSION_NAME)
|
||||
val metadataVer = versionCheckerUtils.versionDigits(version.value)
|
||||
|
||||
if ((currentAppVer.size >= 2) && (metadataVer.size >= 2) && (abs(currentAppVer[1] - metadataVer[1]) > 1)) {
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package info.nightscout.androidaps.plugins.contraints.versionChecker
|
||||
|
||||
import android.content.Context
|
||||
import dagger.Lazy
|
||||
import info.nightscout.androidaps.TestBase
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerUtils
|
||||
import info.nightscout.androidaps.plugins.constraints.versionChecker.numericVersionPart
|
||||
import info.nightscout.androidaps.receivers.ReceiverStatusStore
|
||||
import info.nightscout.shared.utils.DateUtil
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.rx.bus.RxBus
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import info.nightscout.shared.utils.DateUtil
|
||||
import org.junit.Assert.assertArrayEquals
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Before
|
||||
|
@ -27,9 +27,8 @@ import org.mockito.Mockito.`when`
|
|||
|
||||
@Mock lateinit var sp: SP
|
||||
@Mock lateinit var rh: ResourceHelper
|
||||
@Mock lateinit var context: Context
|
||||
@Mock lateinit var receiverStatusStore: ReceiverStatusStore
|
||||
@Mock lateinit var config: Config
|
||||
@Mock lateinit var config: Lazy<Config>
|
||||
@Mock lateinit var dateUtil: DateUtil
|
||||
@Mock lateinit var rxBus: RxBus
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ import info.nightscout.implementation.queue.commands.CommandStopPump
|
|||
import info.nightscout.implementation.queue.commands.CommandTempBasalAbsolute
|
||||
import info.nightscout.implementation.queue.commands.CommandTempBasalPercent
|
||||
import info.nightscout.interfaces.AndroidPermission
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.constraints.Constraint
|
||||
import info.nightscout.interfaces.constraints.Constraints
|
||||
|
@ -89,11 +88,10 @@ class CommandQueueImplementation @Inject constructor(
|
|||
private val activePlugin: ActivePlugin,
|
||||
private val context: Context,
|
||||
private val sp: SP,
|
||||
private val buildHelper: BuildHelper,
|
||||
private val config: Config,
|
||||
private val dateUtil: DateUtil,
|
||||
private val repository: AppRepository,
|
||||
private val fabricPrivacy: FabricPrivacy,
|
||||
private val config: Config,
|
||||
private val androidPermission: AndroidPermission,
|
||||
private val activityNames: ActivityNames
|
||||
) : CommandQueue {
|
||||
|
@ -233,7 +231,7 @@ class CommandQueueImplementation @Inject constructor(
|
|||
val tempCommandQueue = CommandQueueImplementation(
|
||||
injector, aapsLogger, rxBus, aapsSchedulers, rh,
|
||||
constraintChecker, profileFunction, activePlugin, context, sp,
|
||||
buildHelper, dateUtil, repository, fabricPrivacy, config, androidPermission, activityNames
|
||||
config, dateUtil, repository, fabricPrivacy, androidPermission, activityNames
|
||||
)
|
||||
tempCommandQueue.readStatus(reason, callback)
|
||||
tempCommandQueue.disposable.clear()
|
||||
|
|
|
@ -18,7 +18,6 @@ import info.nightscout.implementation.queue.commands.CommandExtendedBolus
|
|||
import info.nightscout.implementation.queue.commands.CommandLoadHistory
|
||||
import info.nightscout.implementation.queue.commands.CommandTempBasalPercent
|
||||
import info.nightscout.interfaces.AndroidPermission
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.constraints.Constraint
|
||||
import info.nightscout.interfaces.constraints.Constraints
|
||||
|
@ -56,7 +55,6 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
|
|||
@Mock lateinit var powerManager: PowerManager
|
||||
@Mock lateinit var repository: AppRepository
|
||||
@Mock lateinit var activityNames: ActivityNames
|
||||
@Mock lateinit var buildHelper: BuildHelper
|
||||
@Mock lateinit var androidPermission: AndroidPermission
|
||||
|
||||
class CommandQueueMocked(
|
||||
|
@ -70,16 +68,16 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
|
|||
activePlugin: ActivePlugin,
|
||||
context: Context,
|
||||
sp: SP,
|
||||
buildHelper: BuildHelper,
|
||||
config: Config,
|
||||
dateUtil: DateUtil,
|
||||
repository: AppRepository,
|
||||
fabricPrivacy: FabricPrivacy,
|
||||
config: Config,
|
||||
androidPermission: AndroidPermission,
|
||||
activityNames: ActivityNames
|
||||
) : CommandQueueImplementation(
|
||||
injector, aapsLogger, rxBus, aapsSchedulers, rh, constraintChecker, profileFunction,
|
||||
activePlugin, context, sp, buildHelper, dateUtil, repository, fabricPrivacy, config, androidPermission, activityNames
|
||||
activePlugin, context, sp, config, dateUtil, repository, fabricPrivacy,
|
||||
androidPermission, activityNames
|
||||
) {
|
||||
|
||||
override fun notifyAboutNewCommand() : Boolean = true
|
||||
|
@ -122,9 +120,8 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
|
|||
commandQueue = CommandQueueMocked(
|
||||
injector, aapsLogger, rxBus, aapsSchedulers, rh,
|
||||
constraintChecker, profileFunction, activePlugin, context, sp,
|
||||
buildHelper, dateUtil,
|
||||
repository,
|
||||
fabricPrivacy, config, androidPermission, activityNames
|
||||
config, dateUtil, repository,
|
||||
fabricPrivacy, androidPermission, activityNames
|
||||
)
|
||||
testPumpPlugin = TestPumpPlugin(injector)
|
||||
|
||||
|
@ -151,7 +148,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
|
|||
`when`(constraintChecker.applyBasalConstraints(anyObject(), anyObject())).thenReturn(rateConstraint)
|
||||
val percentageConstraint = Constraint(0)
|
||||
`when`(constraintChecker.applyBasalPercentConstraints(anyObject(), anyObject())).thenReturn(percentageConstraint)
|
||||
val thenReturn = `when`(rh.gs(R.string.connectiontimedout)).thenReturn("Connection timed out")
|
||||
`when`(rh.gs(R.string.connectiontimedout)).thenReturn("Connection timed out")
|
||||
`when`(rh.gs(R.string.formatinsulinunits)).thenReturn("%1\$.2f U")
|
||||
`when`(rh.gs(R.string.goingtodeliver)).thenReturn("Going to deliver %1\$.2f U")
|
||||
}
|
||||
|
@ -161,9 +158,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
|
|||
val commandQueue = CommandQueueImplementation(
|
||||
injector, aapsLogger, rxBus, aapsSchedulers, rh,
|
||||
constraintChecker, profileFunction, activePlugin, context, sp,
|
||||
buildHelper,
|
||||
dateUtil, repository,
|
||||
fabricPrivacy, config, androidPermission, activityNames
|
||||
config, dateUtil, repository, fabricPrivacy, androidPermission, activityNames
|
||||
)
|
||||
val handler = mock(Handler::class.java)
|
||||
`when`(handler.post(anyObject())).thenAnswer { invocation: InvocationOnMock ->
|
||||
|
|
|
@ -10,7 +10,6 @@ import info.nightscout.database.impl.AppRepository
|
|||
import info.nightscout.implementation.R
|
||||
import info.nightscout.implementation.queue.commands.CommandTempBasalAbsolute
|
||||
import info.nightscout.interfaces.AndroidPermission
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.constraints.Constraint
|
||||
import info.nightscout.interfaces.constraints.Constraints
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||
|
@ -33,7 +32,6 @@ class QueueThreadTest : TestBaseWithProfile() {
|
|||
@Mock lateinit var sp: SP
|
||||
@Mock lateinit var powerManager: PowerManager
|
||||
@Mock lateinit var repository: AppRepository
|
||||
@Mock lateinit var buildHelper: BuildHelper
|
||||
@Mock lateinit var androidPermission: AndroidPermission
|
||||
@Mock lateinit var activityNames: ActivityNames
|
||||
|
||||
|
@ -60,7 +58,7 @@ class QueueThreadTest : TestBaseWithProfile() {
|
|||
commandQueue = CommandQueueImplementation(
|
||||
injector, aapsLogger, rxBus, aapsSchedulers, rh, constraintChecker,
|
||||
profileFunction, activePlugin, context, sp,
|
||||
buildHelper, dateUtil, repository, fabricPrivacy, config, androidPermission, activityNames
|
||||
config, dateUtil, repository, fabricPrivacy, androidPermission, activityNames
|
||||
)
|
||||
|
||||
val pumpDescription = PumpDescription()
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
package info.nightscout.interfaces
|
||||
|
||||
interface BuildHelper {
|
||||
|
||||
fun isEngineeringModeOrRelease(): Boolean
|
||||
fun isEngineeringMode(): Boolean
|
||||
fun isUnfinishedMode(): Boolean
|
||||
fun isDev(): Boolean
|
||||
}
|
|
@ -13,4 +13,9 @@ interface Config {
|
|||
val DEBUG: Boolean
|
||||
val currentDeviceModelString : String
|
||||
val appName: Int
|
||||
|
||||
fun isEngineeringModeOrRelease(): Boolean
|
||||
fun isEngineeringMode(): Boolean
|
||||
fun isUnfinishedMode(): Boolean
|
||||
fun isDev(): Boolean
|
||||
}
|
|
@ -5,7 +5,7 @@ import dagger.android.HasAndroidInjector
|
|||
import info.nightscout.androidaps.annotations.OpenForTesting
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.aps.DetermineBasalAdapter
|
||||
import info.nightscout.interfaces.constraints.Constraints
|
||||
import info.nightscout.interfaces.iob.IobCobCalculator
|
||||
|
@ -42,7 +42,7 @@ class OpenAPSSMBDynamicISFPlugin @Inject constructor(
|
|||
dateUtil: DateUtil,
|
||||
repository: AppRepository,
|
||||
glucoseStatusProvider: GlucoseStatusProvider,
|
||||
private val buildHelper: BuildHelper
|
||||
private val config: Config
|
||||
) : OpenAPSSMBPlugin(
|
||||
injector,
|
||||
aapsLogger,
|
||||
|
@ -68,10 +68,10 @@ class OpenAPSSMBDynamicISFPlugin @Inject constructor(
|
|||
.shortName(R.string.dynisf_shortname)
|
||||
.preferencesId(R.xml.pref_openapssmbdynamicisf)
|
||||
.setDefault(false)
|
||||
.showInList(buildHelper.isEngineeringMode() && buildHelper.isDev())
|
||||
.showInList(config.isEngineeringMode() && config.isDev())
|
||||
}
|
||||
|
||||
override fun specialEnableCondition(): Boolean = buildHelper.isEngineeringMode() && buildHelper.isDev()
|
||||
override fun specialEnableCondition(): Boolean = config.isEngineeringMode() && config.isDev()
|
||||
|
||||
override fun provideDetermineBasalAdapter(): DetermineBasalAdapter = DetermineBasalAdapterSMBDynamicISFJS(ScriptReader(context), injector)
|
||||
}
|
|
@ -8,7 +8,7 @@ import info.nightscout.androidaps.logging.UserEntryLogger
|
|||
import info.nightscout.core.profile.ProfileStoreObject
|
||||
import info.nightscout.database.entities.UserEntry
|
||||
import info.nightscout.database.entities.ValueWithUnit
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.autotune.Autotune
|
||||
import info.nightscout.interfaces.insulin.Insulin
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||
|
@ -58,7 +58,7 @@ class AutotunePlugin @Inject constructor(
|
|||
private val autotuneIob: AutotuneIob,
|
||||
private val autotunePrep: AutotunePrep,
|
||||
private val autotuneCore: AutotuneCore,
|
||||
private val buildHelper: BuildHelper,
|
||||
private val config: Config,
|
||||
private val uel: UserEntryLogger,
|
||||
aapsLogger: AAPSLogger
|
||||
) : PluginBase(
|
||||
|
@ -69,7 +69,7 @@ class AutotunePlugin @Inject constructor(
|
|||
.pluginName(R.string.autotune)
|
||||
.shortName(R.string.autotune_shortname)
|
||||
.preferencesId(R.xml.pref_autotune)
|
||||
.showInList(buildHelper.isEngineeringMode() && buildHelper.isDev())
|
||||
.showInList(config.isEngineeringMode() && config.isDev())
|
||||
.description(R.string.autotune_description),
|
||||
aapsLogger, resourceHelper, injector
|
||||
), Autotune {
|
||||
|
@ -406,7 +406,7 @@ class AutotunePlugin @Inject constructor(
|
|||
atLog("[Plugin] $message")
|
||||
}
|
||||
|
||||
override fun specialEnableCondition(): Boolean = buildHelper.isEngineeringMode() && buildHelper.isDev()
|
||||
override fun specialEnableCondition(): Boolean = config.isEngineeringMode() && config.isDev()
|
||||
|
||||
override fun atLog(message: String) {
|
||||
autotuneFS.atLog(message)
|
||||
|
|
|
@ -9,7 +9,6 @@ import info.nightscout.androidaps.extensions.storeInt
|
|||
import info.nightscout.androidaps.extensions.storeString
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
||||
import info.nightscout.androidaps.utils.DecimalFormatter
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.constraints.Constraint
|
||||
import info.nightscout.interfaces.constraints.Constraints
|
||||
|
@ -44,9 +43,8 @@ class SafetyPlugin @Inject constructor(
|
|||
private val constraintChecker: Constraints,
|
||||
private val activePlugin: ActivePlugin,
|
||||
private val hardLimits: HardLimits,
|
||||
private val buildHelper: BuildHelper,
|
||||
private val iobCobCalculator: IobCobCalculator,
|
||||
private val config: Config,
|
||||
private val iobCobCalculator: IobCobCalculator,
|
||||
private val dateUtil: DateUtil
|
||||
) : PluginBase(
|
||||
PluginDescription()
|
||||
|
@ -70,7 +68,7 @@ class SafetyPlugin @Inject constructor(
|
|||
override fun isClosedLoopAllowed(value: Constraint<Boolean>): Constraint<Boolean> {
|
||||
val mode = sp.getString(R.string.key_aps_mode, "open")
|
||||
if (mode == "open") value.set(aapsLogger, false, rh.gs(R.string.closedmodedisabledinpreferences), this)
|
||||
if (!buildHelper.isEngineeringModeOrRelease()) {
|
||||
if (!config.isEngineeringModeOrRelease()) {
|
||||
if (value.value()) {
|
||||
val n = Notification(Notification.TOAST_ALARM, rh.gs(R.string.closed_loop_disabled_on_dev_branch), Notification.NORMAL)
|
||||
rxBus.send(EventNewNotification(n))
|
||||
|
|
|
@ -22,7 +22,6 @@ import info.nightscout.database.entities.UserEntry.Action
|
|||
import info.nightscout.database.entities.UserEntry.Sources
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.database.impl.ValueWrapper
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.aps.Loop
|
||||
import info.nightscout.interfaces.iob.IobCobCalculator
|
||||
|
@ -67,10 +66,9 @@ class ActionsFragment : DaggerFragment() {
|
|||
@Inject lateinit var activePlugin: ActivePlugin
|
||||
@Inject lateinit var iobCobCalculator: IobCobCalculator
|
||||
@Inject lateinit var commandQueue: CommandQueue
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||
@Inject lateinit var skinProvider: SkinProvider
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
@Inject lateinit var repository: AppRepository
|
||||
@Inject lateinit var loop: Loop
|
||||
|
|
|
@ -6,16 +6,15 @@ import androidx.work.WorkerParameters
|
|||
import androidx.work.workDataOf
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.receivers.DataWorkerStorage
|
||||
import info.nightscout.interfaces.receivers.Intents
|
||||
import info.nightscout.database.entities.GlucoseValue
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.database.impl.transactions.CgmSourceTransaction
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.Constants
|
||||
import info.nightscout.interfaces.plugin.PluginBase
|
||||
import info.nightscout.interfaces.plugin.PluginDescription
|
||||
import info.nightscout.interfaces.plugin.PluginType
|
||||
import info.nightscout.interfaces.receivers.Intents
|
||||
import info.nightscout.interfaces.source.BgSource
|
||||
import info.nightscout.plugins.R
|
||||
import info.nightscout.rx.logging.AAPSLogger
|
||||
|
@ -29,7 +28,6 @@ class AidexPlugin @Inject constructor(
|
|||
injector: HasAndroidInjector,
|
||||
rh: ResourceHelper,
|
||||
aapsLogger: AAPSLogger,
|
||||
private val buildHelper: BuildHelper,
|
||||
private val config: Config
|
||||
) : PluginBase(
|
||||
PluginDescription()
|
||||
|
@ -55,7 +53,7 @@ class AidexPlugin @Inject constructor(
|
|||
|
||||
// Allow only for pumpcontrol or dev & engineering_mode
|
||||
override fun specialEnableCondition(): Boolean {
|
||||
return config.APS.not() || buildHelper.isDev() && buildHelper.isEngineeringMode()
|
||||
return config.APS.not() || config.isDev() && config.isEngineeringMode()
|
||||
}
|
||||
|
||||
// cannot be inner class because of needed injection
|
||||
|
|
|
@ -8,7 +8,7 @@ import info.nightscout.androidaps.utils.extensions.isRunningTest
|
|||
import info.nightscout.database.entities.GlucoseValue
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.database.impl.transactions.CgmSourceTransaction
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.XDripBroadcast
|
||||
import info.nightscout.interfaces.plugin.PluginBase
|
||||
import info.nightscout.interfaces.plugin.PluginDescription
|
||||
|
@ -39,7 +39,7 @@ class RandomBgPlugin @Inject constructor(
|
|||
private val repository: AppRepository,
|
||||
private val xDripBroadcast: XDripBroadcast,
|
||||
private val virtualPumpPlugin: VirtualPumpPlugin,
|
||||
private val buildHelper: BuildHelper
|
||||
private val config: Config
|
||||
) : PluginBase(
|
||||
PluginDescription()
|
||||
.mainType(PluginType.BGSOURCE)
|
||||
|
@ -95,7 +95,7 @@ class RandomBgPlugin @Inject constructor(
|
|||
}
|
||||
|
||||
override fun specialEnableCondition(): Boolean {
|
||||
return isRunningTest() || buildHelper.isUnfinishedMode() || virtualPumpPlugin.isEnabled() && buildHelper.isEngineeringMode()
|
||||
return isRunningTest() || config.isUnfinishedMode() || virtualPumpPlugin.isEnabled() && config.isEngineeringMode()
|
||||
}
|
||||
|
||||
private fun handleNewData() {
|
||||
|
|
|
@ -17,7 +17,7 @@ import info.nightscout.androidaps.logging.UserEntryLogger
|
|||
import info.nightscout.core.fabric.FabricPrivacy
|
||||
import info.nightscout.core.ui.dialogs.OKDialog
|
||||
import info.nightscout.database.entities.UserEntry
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||
import info.nightscout.interfaces.plugin.PluginBase
|
||||
import info.nightscout.interfaces.plugin.PluginFragment
|
||||
|
@ -48,7 +48,7 @@ class NSClientFragment : DaggerFragment(), MenuProvider, PluginFragment {
|
|||
@Inject lateinit var uel: UserEntryLogger
|
||||
@Inject lateinit var aapsLogger: AAPSLogger
|
||||
@Inject lateinit var activePlugin: ActivePlugin
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var config: Config
|
||||
|
||||
companion object {
|
||||
|
||||
|
@ -97,7 +97,7 @@ class NSClientFragment : DaggerFragment(), MenuProvider, PluginFragment {
|
|||
}
|
||||
|
||||
override fun onCreateMenu(menu: Menu, inflater: MenuInflater) {
|
||||
if (buildHelper.isUnfinishedMode())
|
||||
if (config.isUnfinishedMode())
|
||||
menu.add(Menu.FIRST, ID_MENU_TEST, 0, "Test").setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
|
||||
menu.add(Menu.FIRST, ID_MENU_CLEAR_LOG, 0, rh.gs(R.string.clear_log)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
|
||||
menu.add(Menu.FIRST, ID_MENU_RESTART, 0, rh.gs(R.string.restart)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
|
||||
|
|
|
@ -15,7 +15,6 @@ import dagger.android.HasAndroidInjector
|
|||
import info.nightscout.core.fabric.FabricPrivacy
|
||||
import info.nightscout.core.toast.showToastAdNotification
|
||||
import info.nightscout.core.ui.toast.ToastUtils
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.Constants
|
||||
import info.nightscout.interfaces.plugin.PluginBase
|
||||
|
@ -62,7 +61,6 @@ class NSClientPlugin @Inject constructor(
|
|||
private val sp: SP,
|
||||
private val nsClientReceiverDelegate: NsClientReceiverDelegate,
|
||||
private val config: Config,
|
||||
private val buildHelper: BuildHelper,
|
||||
private val dataSyncSelector: DataSyncSelector
|
||||
) : NsClient, Sync, PluginBase(
|
||||
PluginDescription()
|
||||
|
@ -145,7 +143,7 @@ class NSClientPlugin @Inject constructor(
|
|||
preferenceFragment.findPreference<SwitchPreference>(rh.gs(R.string.key_ns_create_announcements_from_errors))?.isVisible = false
|
||||
preferenceFragment.findPreference<SwitchPreference>(rh.gs(R.string.key_ns_create_announcements_from_carbs_req))?.isVisible = false
|
||||
}
|
||||
preferenceFragment.findPreference<SwitchPreference>(rh.gs(R.string.key_ns_receive_tbr_eb))?.isVisible = buildHelper.isEngineeringMode()
|
||||
preferenceFragment.findPreference<SwitchPreference>(rh.gs(R.string.key_ns_receive_tbr_eb))?.isVisible = config.isEngineeringMode()
|
||||
}
|
||||
|
||||
override val hasWritePermission: Boolean get() = nsClientService?.hasWriteAuth ?: false
|
||||
|
|
|
@ -21,7 +21,6 @@ import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotifi
|
|||
import info.nightscout.androidaps.receivers.DataWorkerStorage
|
||||
import info.nightscout.core.fabric.FabricPrivacy
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.notifications.Notification
|
||||
import info.nightscout.interfaces.sync.DataSyncSelector
|
||||
|
@ -87,7 +86,6 @@ class NSClientService : DaggerService(), NsClient.NSClientService {
|
|||
@Inject lateinit var sp: SP
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var nsClientPlugin: NSClientPlugin
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||
|
@ -253,7 +251,7 @@ class NSClientService : DaggerService(), NsClient.NSClientService {
|
|||
} else if (!nsEnabled) {
|
||||
rxBus.send(EventNSClientNewLog("NSCLIENT", "disabled", NsClient.Version.V1))
|
||||
rxBus.send(EventNSClientStatus("Disabled", NsClient.Version.V1))
|
||||
} else if (nsURL != "" && (buildHelper.isEngineeringMode() || nsURL.lowercase(Locale.getDefault()).startsWith("https://"))) {
|
||||
} else if (nsURL != "" && (config.isEngineeringMode() || nsURL.lowercase(Locale.getDefault()).startsWith("https://"))) {
|
||||
try {
|
||||
rxBus.send(EventNSClientStatus("Connecting ...", NsClient.Version.V1))
|
||||
val opt = IO.Options()
|
||||
|
|
|
@ -10,7 +10,6 @@ import info.nightscout.androidaps.logging.UserEntryLogger
|
|||
import info.nightscout.androidaps.receivers.DataWorkerStorage
|
||||
import info.nightscout.database.entities.TherapyEvent
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.XDripBroadcast
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||
|
@ -42,10 +41,9 @@ class NSClientAddUpdateWorker(
|
|||
|
||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||
@Inject lateinit var aapsLogger: AAPSLogger
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var sp: SP
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var repository: AppRepository
|
||||
@Inject lateinit var activePlugin: ActivePlugin
|
||||
@Inject lateinit var rxBus: RxBus
|
||||
|
@ -140,14 +138,14 @@ class NSClientAddUpdateWorker(
|
|||
}
|
||||
|
||||
eventType == TherapyEvent.Type.COMBO_BOLUS.text ->
|
||||
if (buildHelper.isEngineeringMode() && sp.getBoolean(R.string.key_ns_receive_tbr_eb, false) || config.NSCLIENT) {
|
||||
if (config.isEngineeringMode() && sp.getBoolean(R.string.key_ns_receive_tbr_eb, false) || config.NSCLIENT) {
|
||||
extendedBolusFromJson(json)?.let { extendedBolus ->
|
||||
storeDataForDb.extendedBoluses.add(extendedBolus)
|
||||
} ?: aapsLogger.error("Error parsing ExtendedBolus json $json")
|
||||
}
|
||||
|
||||
eventType == TherapyEvent.Type.TEMPORARY_BASAL.text ->
|
||||
if (buildHelper.isEngineeringMode() && sp.getBoolean(R.string.key_ns_receive_tbr_eb, false) || config.NSCLIENT) {
|
||||
if (config.isEngineeringMode() && sp.getBoolean(R.string.key_ns_receive_tbr_eb, false) || config.NSCLIENT) {
|
||||
temporaryBasalFromJson(json)?.let { temporaryBasal ->
|
||||
storeDataForDb.temporaryBasals.add(temporaryBasal)
|
||||
} ?: aapsLogger.error("Error parsing TemporaryBasal json $json")
|
||||
|
@ -161,7 +159,7 @@ class NSClientAddUpdateWorker(
|
|||
}
|
||||
|
||||
eventType == TherapyEvent.Type.APS_OFFLINE.text ->
|
||||
if (sp.getBoolean(R.string.key_ns_receive_offline_event, false) && buildHelper.isEngineeringMode() || config.NSCLIENT) {
|
||||
if (sp.getBoolean(R.string.key_ns_receive_offline_event, false) && config.isEngineeringMode() || config.NSCLIENT) {
|
||||
offlineEventFromJson(json)?.let { offlineEvent ->
|
||||
storeDataForDb.offlineEvents.add(offlineEvent)
|
||||
} ?: aapsLogger.error("Error parsing OfflineEvent json $json")
|
||||
|
|
|
@ -15,7 +15,6 @@ import dagger.android.HasAndroidInjector
|
|||
import info.nightscout.core.fabric.FabricPrivacy
|
||||
import info.nightscout.core.toast.showToastAdNotification
|
||||
import info.nightscout.core.ui.toast.ToastUtils
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.Constants
|
||||
import info.nightscout.interfaces.plugin.PluginBase
|
||||
|
@ -72,7 +71,6 @@ class NSClientV3Plugin @Inject constructor(
|
|||
private val sp: SP,
|
||||
private val nsClientReceiverDelegate: NsClientReceiverDelegate,
|
||||
private val config: Config,
|
||||
private val buildHelper: BuildHelper,
|
||||
private val dateUtil: DateUtil
|
||||
) : NsClient, Sync, PluginBase(
|
||||
PluginDescription()
|
||||
|
@ -198,7 +196,7 @@ class NSClientV3Plugin @Inject constructor(
|
|||
preferenceFragment.findPreference<SwitchPreference>(rh.gs(R.string.key_ns_create_announcements_from_errors))?.isVisible = false
|
||||
preferenceFragment.findPreference<SwitchPreference>(rh.gs(R.string.key_ns_create_announcements_from_carbs_req))?.isVisible = false
|
||||
}
|
||||
preferenceFragment.findPreference<SwitchPreference>(rh.gs(R.string.key_ns_receive_tbr_eb))?.isVisible = buildHelper.isEngineeringMode()
|
||||
preferenceFragment.findPreference<SwitchPreference>(rh.gs(R.string.key_ns_receive_tbr_eb))?.isVisible = config.isEngineeringMode()
|
||||
}
|
||||
|
||||
override val hasWritePermission: Boolean get() = nsClientService?.hasWriteAuth ?: false
|
||||
|
|
|
@ -8,7 +8,6 @@ import dagger.android.HasAndroidInjector
|
|||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.receivers.DataWorkerStorage
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.Constants
|
||||
import info.nightscout.interfaces.XDripBroadcast
|
||||
|
@ -50,10 +49,9 @@ class ProcessTreatmentsWorker(
|
|||
|
||||
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
|
||||
@Inject lateinit var aapsLogger: AAPSLogger
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var sp: SP
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var repository: AppRepository
|
||||
@Inject lateinit var activePlugin: ActivePlugin
|
||||
@Inject lateinit var rxBus: RxBus
|
||||
|
@ -104,7 +102,7 @@ class ProcessTreatmentsWorker(
|
|||
}
|
||||
|
||||
is NSTemporaryBasal ->
|
||||
if (buildHelper.isEngineeringMode() && sp.getBoolean(R.string.key_ns_receive_tbr_eb, false) || config.NSCLIENT)
|
||||
if (config.isEngineeringMode() && sp.getBoolean(R.string.key_ns_receive_tbr_eb, false) || config.NSCLIENT)
|
||||
storeDataForDb.temporaryBasals.add(treatment.toTemporaryBasal())
|
||||
|
||||
is NSEffectiveProfileSwitch ->
|
||||
|
@ -133,13 +131,13 @@ class ProcessTreatmentsWorker(
|
|||
}
|
||||
|
||||
is NSOfflineEvent ->
|
||||
if (sp.getBoolean(R.string.key_ns_receive_offline_event, false) && buildHelper.isEngineeringMode() || config.NSCLIENT)
|
||||
if (sp.getBoolean(R.string.key_ns_receive_offline_event, false) && config.isEngineeringMode() || config.NSCLIENT)
|
||||
treatment.toOfflineEvent().let { offlineEvent ->
|
||||
storeDataForDb.offlineEvents.add(offlineEvent)
|
||||
}
|
||||
|
||||
is NSExtendedBolus ->
|
||||
if (buildHelper.isEngineeringMode() && sp.getBoolean(R.string.key_ns_receive_tbr_eb, false) || config.NSCLIENT)
|
||||
if (config.isEngineeringMode() && sp.getBoolean(R.string.key_ns_receive_tbr_eb, false) || config.NSCLIENT)
|
||||
treatment.toExtendedBolus().let { extendedBolus ->
|
||||
storeDataForDb.extendedBoluses.add(extendedBolus)
|
||||
}
|
||||
|
|
|
@ -26,10 +26,10 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definitio
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodConstants
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.state.OmnipodDashPodStateManager
|
||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||
import info.nightscout.core.ui.UIRunnable
|
||||
import info.nightscout.core.fabric.FabricPrivacy
|
||||
import info.nightscout.core.ui.UIRunnable
|
||||
import info.nightscout.core.ui.dialogs.OKDialog
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.Constants
|
||||
import info.nightscout.interfaces.notifications.Notification
|
||||
import info.nightscout.interfaces.queue.Callback
|
||||
|
@ -67,7 +67,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
|||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var activityNames: ActivityNames
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var config: Config
|
||||
|
||||
companion object {
|
||||
|
||||
|
@ -175,7 +175,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
|||
.messageOnSuccess(rh.gs(R.string.omnipod_common_confirmation_time_on_pod_updated))
|
||||
)
|
||||
}
|
||||
if (buildHelper.isEngineeringMode()) {
|
||||
if (config.isEngineeringMode()) {
|
||||
bluetoothStatusBinding.deliveryStatus.visibility = View.VISIBLE
|
||||
bluetoothStatusBinding.connectionQuality.visibility = View.VISIBLE
|
||||
}
|
||||
|
|
|
@ -24,10 +24,9 @@ import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodE
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.queue.command.CommandReadPulseLog
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.activation.ErosPodActivationWizardActivity
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.deactivation.ErosPodDeactivationWizardActivity
|
||||
import info.nightscout.core.ui.UIRunnable
|
||||
import info.nightscout.core.fabric.FabricPrivacy
|
||||
import info.nightscout.core.ui.dialogs.OKDialog
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.queue.Callback
|
||||
import info.nightscout.interfaces.queue.CommandQueue
|
||||
import info.nightscout.interfaces.ui.ActivityNames
|
||||
|
@ -53,7 +52,7 @@ class ErosPodManagementActivity : NoSplashAppCompatActivity() {
|
|||
@Inject lateinit var omnipodErosPumpPlugin: OmnipodErosPumpPlugin
|
||||
@Inject lateinit var serviceTaskExecutor: ServiceTaskExecutor
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var activityNames: ActivityNames
|
||||
|
||||
private var disposables: CompositeDisposable = CompositeDisposable()
|
||||
|
@ -172,7 +171,7 @@ class ErosPodManagementActivity : NoSplashAppCompatActivity() {
|
|||
// Otherwise, users should use the Deactivate Pod Wizard. In case proper deactivation fails,
|
||||
// they will get an option to discard the Pod state there
|
||||
// Milos Kozak: allow to show button by activating engineering mode
|
||||
val discardButtonEnabled = podStateManager.hasPodState() && (!podStateManager.isPodInitialized || buildHelper.isEngineeringMode())
|
||||
val discardButtonEnabled = podStateManager.hasPodState() && (!podStateManager.isPodInitialized || config.isEngineeringMode())
|
||||
binding.buttonDiscardPod.visibility = discardButtonEnabled.toVisibility()
|
||||
|
||||
val pulseLogButtonEnabled = aapsOmnipodManager.isPulseLogButtonEnabled
|
||||
|
|
|
@ -6,7 +6,7 @@ import androidx.fragment.app.Fragment
|
|||
import androidx.fragment.app.FragmentTransaction
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||
import info.nightscout.shared.extensions.toVisibility
|
||||
import info.nightscout.ui.R
|
||||
|
@ -22,7 +22,7 @@ import javax.inject.Inject
|
|||
|
||||
class TreatmentsActivity : NoSplashAppCompatActivity() {
|
||||
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var activePlugin: ActivePlugin
|
||||
|
||||
private lateinit var binding: TreatmentsFragmentBinding
|
||||
|
|
|
@ -34,7 +34,7 @@ import info.nightscout.database.impl.transactions.CutCarbsTransaction
|
|||
import info.nightscout.database.impl.transactions.InvalidateBolusCalculatorResultTransaction
|
||||
import info.nightscout.database.impl.transactions.InvalidateBolusTransaction
|
||||
import info.nightscout.database.impl.transactions.InvalidateCarbsTransaction
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||
import info.nightscout.interfaces.profile.ProfileFunction
|
||||
import info.nightscout.rx.AapsSchedulers
|
||||
|
@ -68,7 +68,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment(), MenuProvider {
|
|||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var profileFunction: ProfileFunction
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
@Inject lateinit var repository: AppRepository
|
||||
|
@ -306,7 +306,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment(), MenuProvider {
|
|||
this.menu = menu
|
||||
inflater.inflate(R.menu.menu_treatments_carbs_bolus, menu)
|
||||
updateMenuVisibility()
|
||||
val nsUploadOnly = !sp.getBoolean(R.string.key_ns_receive_insulin, false) || !sp.getBoolean(R.string.key_ns_receive_carbs, false) || !buildHelper.isEngineeringMode()
|
||||
val nsUploadOnly = !sp.getBoolean(R.string.key_ns_receive_insulin, false) || !sp.getBoolean(R.string.key_ns_receive_carbs, false) || !config.isEngineeringMode()
|
||||
menu.findItem(R.id.nav_refresh_ns)?.isVisible = !nsUploadOnly
|
||||
val hasItems = (binding.recyclerview.adapter?.itemCount ?: 0) > 0
|
||||
menu.findItem(R.id.nav_delete_future)?.isVisible = hasItems
|
||||
|
|
|
@ -27,7 +27,7 @@ import info.nightscout.database.entities.ValueWithUnit
|
|||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.database.impl.transactions.InvalidateAAPSStartedTherapyEventTransaction
|
||||
import info.nightscout.database.impl.transactions.InvalidateTherapyEventTransaction
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.rx.AapsSchedulers
|
||||
import info.nightscout.rx.bus.RxBus
|
||||
import info.nightscout.rx.events.EventNSClientRestart
|
||||
|
@ -59,7 +59,7 @@ class TreatmentsCareportalFragment : DaggerFragment(), MenuProvider {
|
|||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var translator: Translator
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var repository: AppRepository
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
@ -200,7 +200,7 @@ class TreatmentsCareportalFragment : DaggerFragment(), MenuProvider {
|
|||
this.menu = menu
|
||||
inflater.inflate(R.menu.menu_treatments_careportal, menu)
|
||||
updateMenuVisibility()
|
||||
val nsUploadOnly = !sp.getBoolean(R.string.key_ns_receive_therapy_events, false) || !buildHelper.isEngineeringMode()
|
||||
val nsUploadOnly = !sp.getBoolean(R.string.key_ns_receive_therapy_events, false) || !config.isEngineeringMode()
|
||||
menu.findItem(R.id.nav_refresh_ns)?.isVisible = !nsUploadOnly
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import info.nightscout.database.entities.UserEntry.Sources
|
|||
import info.nightscout.database.entities.ValueWithUnit
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.database.impl.transactions.InvalidateProfileSwitchTransaction
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||
import info.nightscout.interfaces.ui.ActivityNames
|
||||
import info.nightscout.rx.AapsSchedulers
|
||||
|
@ -65,7 +65,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment(), MenuProvider {
|
|||
@Inject lateinit var rh: ResourceHelper
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var repository: AppRepository
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
|
@ -284,7 +284,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment(), MenuProvider {
|
|||
this.menu = menu
|
||||
inflater.inflate(R.menu.menu_treatments_profile_switch, menu)
|
||||
updateMenuVisibility()
|
||||
val nsUploadOnly = !sp.getBoolean(R.string.key_ns_receive_profile_switch, false) || !buildHelper.isEngineeringMode()
|
||||
val nsUploadOnly = !sp.getBoolean(R.string.key_ns_receive_profile_switch, false) || !config.isEngineeringMode()
|
||||
menu.findItem(R.id.nav_refresh_ns)?.isVisible = !nsUploadOnly
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import info.nightscout.database.entities.interfaces.end
|
|||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.database.impl.ValueWrapper
|
||||
import info.nightscout.database.impl.transactions.InvalidateTemporaryTargetTransaction
|
||||
import info.nightscout.interfaces.BuildHelper
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.profile.ProfileFunction
|
||||
import info.nightscout.rx.AapsSchedulers
|
||||
import info.nightscout.rx.bus.RxBus
|
||||
|
@ -69,7 +69,7 @@ class TreatmentsTempTargetFragment : DaggerFragment(), MenuProvider {
|
|||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var translator: Translator
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var uel: UserEntryLogger
|
||||
@Inject lateinit var repository: AppRepository
|
||||
|
@ -219,7 +219,7 @@ class TreatmentsTempTargetFragment : DaggerFragment(), MenuProvider {
|
|||
this.menu = menu
|
||||
inflater.inflate(R.menu.menu_treatments_temp_target, menu)
|
||||
updateMenuVisibility()
|
||||
val nsUploadOnly = !sp.getBoolean(R.string.key_ns_receive_temp_target, false) || !buildHelper.isEngineeringMode()
|
||||
val nsUploadOnly = !sp.getBoolean(R.string.key_ns_receive_temp_target, false) || !config.isEngineeringMode()
|
||||
menu.findItem(R.id.nav_refresh_ns)?.isVisible = !nsUploadOnly
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue