forgotten namespace
This commit is contained in:
parent
9d96219c67
commit
87cd4b354f
|
@ -477,7 +477,7 @@ class MainActivity : DaggerAppCompatActivityWithResult() {
|
|||
FirebaseCrashlytics.getInstance().setCustomKey("Remote", remote)
|
||||
FirebaseCrashlytics.getInstance().setCustomKey("Committed", BuildConfig.COMMITTED)
|
||||
FirebaseCrashlytics.getInstance().setCustomKey("Hash", hashes[0])
|
||||
FirebaseCrashlytics.getInstance().setCustomKey("Email", sp.getString(info.nightscout.core.utils.R.string.key_email_for_crash_report, ""))
|
||||
FirebaseCrashlytics.getInstance().setCustomKey("Email", sp.getString(app.aaps.core.utils.R.string.key_email_for_crash_report, ""))
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -488,7 +488,7 @@ class MainActivity : DaggerAppCompatActivityWithResult() {
|
|||
val passwordReset = File(fileListProvider.ensureExtraDirExists(), "PasswordReset")
|
||||
if (passwordReset.exists()) {
|
||||
val sn = activePlugin.activePump.serialNumber()
|
||||
sp.putString(info.nightscout.core.utils.R.string.key_master_password, cryptoUtil.hashPassword(sn))
|
||||
sp.putString(app.aaps.core.utils.R.string.key_master_password, cryptoUtil.hashPassword(sn))
|
||||
passwordReset.delete()
|
||||
ToastUtils.okToast(context, context.getString(app.aaps.core.ui.R.string.password_set))
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ class MainApp : DaggerApplication() {
|
|||
handler.postDelayed(
|
||||
{
|
||||
// check if identification is set
|
||||
if (config.isDev() && sp.getStringOrNull(info.nightscout.core.utils.R.string.key_email_for_crash_report, null).isNullOrBlank())
|
||||
if (config.isDev() && sp.getStringOrNull(app.aaps.core.utils.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()
|
||||
|
|
|
@ -246,11 +246,11 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
|
|||
if (key == rh.gs(app.aaps.plugins.main.R.string.key_short_tabtitles)) {
|
||||
rxBus.send(EventRebuildTabs())
|
||||
}
|
||||
if (key == rh.gs(info.nightscout.core.utils.R.string.key_units)) {
|
||||
if (key == rh.gs(app.aaps.core.utils.R.string.key_units)) {
|
||||
activity?.recreate()
|
||||
return
|
||||
}
|
||||
if (key == rh.gs(info.nightscout.core.utils.R.string.key_use_autosens) && sp.getBoolean(info.nightscout.core.utils.R.string.key_use_autosens, false)) {
|
||||
if (key == rh.gs(app.aaps.core.utils.R.string.key_use_autosens) && sp.getBoolean(app.aaps.core.utils.R.string.key_use_autosens, false)) {
|
||||
activity?.let {
|
||||
OKDialog.show(it, rh.gs(app.aaps.plugins.configuration.R.string.configbuilder_sensitivity), rh.gs(R.string.sensitivity_warning))
|
||||
}
|
||||
|
@ -269,10 +269,10 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
|
|||
|
||||
private fun checkForBiometricFallback(key: String) {
|
||||
// Biometric protection activated without set master password
|
||||
if ((rh.gs(info.nightscout.core.utils.R.string.key_settings_protection) == key ||
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_application_protection) == key ||
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_bolus_protection) == key) &&
|
||||
sp.getString(info.nightscout.core.utils.R.string.key_master_password, "") == "" &&
|
||||
if ((rh.gs(app.aaps.core.utils.R.string.key_settings_protection) == key ||
|
||||
rh.gs(app.aaps.core.utils.R.string.key_application_protection) == key ||
|
||||
rh.gs(app.aaps.core.utils.R.string.key_bolus_protection) == key) &&
|
||||
sp.getString(app.aaps.core.utils.R.string.key_master_password, "") == "" &&
|
||||
sp.getInt(key, NONE.ordinal) == BIOMETRIC.ordinal
|
||||
) {
|
||||
activity?.let {
|
||||
|
@ -288,10 +288,10 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
|
|||
}
|
||||
|
||||
// Master password erased with activated Biometric protection
|
||||
val isBiometricActivated = sp.getInt(info.nightscout.core.utils.R.string.key_settings_protection, NONE.ordinal) == BIOMETRIC.ordinal ||
|
||||
sp.getInt(info.nightscout.core.utils.R.string.key_application_protection, NONE.ordinal) == BIOMETRIC.ordinal ||
|
||||
sp.getInt(info.nightscout.core.utils.R.string.key_bolus_protection, NONE.ordinal) == BIOMETRIC.ordinal
|
||||
if (rh.gs(info.nightscout.core.utils.R.string.key_master_password) == key && sp.getString(key, "") == "" && isBiometricActivated) {
|
||||
val isBiometricActivated = sp.getInt(app.aaps.core.utils.R.string.key_settings_protection, NONE.ordinal) == BIOMETRIC.ordinal ||
|
||||
sp.getInt(app.aaps.core.utils.R.string.key_application_protection, NONE.ordinal) == BIOMETRIC.ordinal ||
|
||||
sp.getInt(app.aaps.core.utils.R.string.key_bolus_protection, NONE.ordinal) == BIOMETRIC.ordinal
|
||||
if (rh.gs(app.aaps.core.utils.R.string.key_master_password) == key && sp.getString(key, "") == "" && isBiometricActivated) {
|
||||
activity?.let {
|
||||
val title = rh.gs(app.aaps.core.ui.R.string.unsecure_fallback_biometric)
|
||||
val message = rh.gs(app.aaps.core.ui.R.string.unsecure_fallback_descriotion_biometric)
|
||||
|
@ -324,11 +324,11 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
|
|||
|
||||
private fun adjustUnitDependentPrefs(pref: Preference) { // convert preferences values to current units
|
||||
val unitDependent = arrayOf(
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_hypo_target),
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_activity_target),
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_eatingsoon_target),
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_high_mark),
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_low_mark)
|
||||
rh.gs(app.aaps.core.utils.R.string.key_hypo_target),
|
||||
rh.gs(app.aaps.core.utils.R.string.key_activity_target),
|
||||
rh.gs(app.aaps.core.utils.R.string.key_eatingsoon_target),
|
||||
rh.gs(app.aaps.core.utils.R.string.key_high_mark),
|
||||
rh.gs(app.aaps.core.utils.R.string.key_low_mark)
|
||||
)
|
||||
if (unitDependent.toList().contains(pref.key) && pref is EditTextPreference) {
|
||||
val converted = profileUtil.valueInCurrentUnitsDetect(SafeParse.stringToDouble(pref.text))
|
||||
|
@ -359,29 +359,29 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
|
|||
if (pref is ListPreference) {
|
||||
pref.setSummary(pref.entry)
|
||||
// Preferences
|
||||
if (pref.getKey() == rh.gs(info.nightscout.core.utils.R.string.key_settings_protection)) {
|
||||
val pass: Preference? = findPreference(rh.gs(info.nightscout.core.utils.R.string.key_settings_password))
|
||||
if (pref.getKey() == rh.gs(app.aaps.core.utils.R.string.key_settings_protection)) {
|
||||
val pass: Preference? = findPreference(rh.gs(app.aaps.core.utils.R.string.key_settings_password))
|
||||
val usePassword = pref.value == CUSTOM_PASSWORD.ordinal.toString()
|
||||
pass?.let { it.isVisible = usePassword }
|
||||
val pin: Preference? = findPreference(rh.gs(info.nightscout.core.utils.R.string.key_settings_pin))
|
||||
val pin: Preference? = findPreference(rh.gs(app.aaps.core.utils.R.string.key_settings_pin))
|
||||
val usePin = pref.value == CUSTOM_PIN.ordinal.toString()
|
||||
pin?.let { it.isVisible = usePin }
|
||||
}
|
||||
// Application
|
||||
if (pref.getKey() == rh.gs(info.nightscout.core.utils.R.string.key_application_protection)) {
|
||||
val pass: Preference? = findPreference(rh.gs(info.nightscout.core.utils.R.string.key_application_password))
|
||||
if (pref.getKey() == rh.gs(app.aaps.core.utils.R.string.key_application_protection)) {
|
||||
val pass: Preference? = findPreference(rh.gs(app.aaps.core.utils.R.string.key_application_password))
|
||||
val usePassword = pref.value == CUSTOM_PASSWORD.ordinal.toString()
|
||||
pass?.let { it.isVisible = usePassword }
|
||||
val pin: Preference? = findPreference(rh.gs(info.nightscout.core.utils.R.string.key_application_pin))
|
||||
val pin: Preference? = findPreference(rh.gs(app.aaps.core.utils.R.string.key_application_pin))
|
||||
val usePin = pref.value == CUSTOM_PIN.ordinal.toString()
|
||||
pin?.let { it.isVisible = usePin }
|
||||
}
|
||||
// Bolus
|
||||
if (pref.getKey() == rh.gs(info.nightscout.core.utils.R.string.key_bolus_protection)) {
|
||||
val pass: Preference? = findPreference(rh.gs(info.nightscout.core.utils.R.string.key_bolus_password))
|
||||
if (pref.getKey() == rh.gs(app.aaps.core.utils.R.string.key_bolus_protection)) {
|
||||
val pass: Preference? = findPreference(rh.gs(app.aaps.core.utils.R.string.key_bolus_password))
|
||||
val usePassword = pref.value == CUSTOM_PASSWORD.ordinal.toString()
|
||||
pass?.let { it.isVisible = usePassword }
|
||||
val pin: Preference? = findPreference(rh.gs(info.nightscout.core.utils.R.string.key_bolus_pin))
|
||||
val pin: Preference? = findPreference(rh.gs(app.aaps.core.utils.R.string.key_bolus_pin))
|
||||
val usePin = pref.value == CUSTOM_PIN.ordinal.toString()
|
||||
pin?.let { it.isVisible = usePin }
|
||||
}
|
||||
|
@ -399,13 +399,13 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
|
|||
}
|
||||
|
||||
val hmacPasswords = arrayOf(
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_bolus_password),
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_master_password),
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_application_password),
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_settings_password),
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_bolus_pin),
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_application_pin),
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_settings_pin)
|
||||
rh.gs(app.aaps.core.utils.R.string.key_bolus_password),
|
||||
rh.gs(app.aaps.core.utils.R.string.key_master_password),
|
||||
rh.gs(app.aaps.core.utils.R.string.key_application_password),
|
||||
rh.gs(app.aaps.core.utils.R.string.key_settings_password),
|
||||
rh.gs(app.aaps.core.utils.R.string.key_bolus_pin),
|
||||
rh.gs(app.aaps.core.utils.R.string.key_application_pin),
|
||||
rh.gs(app.aaps.core.utils.R.string.key_settings_pin)
|
||||
)
|
||||
|
||||
if (pref is Preference && (pref.key != null) && (hmacPasswords.contains(pref.key))) {
|
||||
|
@ -442,40 +442,40 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
|
|||
override fun onPreferenceTreeClick(preference: Preference): Boolean =
|
||||
context?.let { context ->
|
||||
when (preference.key) {
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_master_password) -> {
|
||||
passwordCheck.queryPassword(context, app.aaps.plugins.configuration.R.string.current_master_password, info.nightscout.core.utils.R.string.key_master_password, {
|
||||
passwordCheck.setPassword(context, app.aaps.core.ui.R.string.master_password, info.nightscout.core.utils.R.string.key_master_password)
|
||||
rh.gs(app.aaps.core.utils.R.string.key_master_password) -> {
|
||||
passwordCheck.queryPassword(context, app.aaps.plugins.configuration.R.string.current_master_password, app.aaps.core.utils.R.string.key_master_password, {
|
||||
passwordCheck.setPassword(context, app.aaps.core.ui.R.string.master_password, app.aaps.core.utils.R.string.key_master_password)
|
||||
})
|
||||
true
|
||||
}
|
||||
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_settings_password) -> {
|
||||
passwordCheck.setPassword(context, app.aaps.core.ui.R.string.settings_password, info.nightscout.core.utils.R.string.key_settings_password)
|
||||
rh.gs(app.aaps.core.utils.R.string.key_settings_password) -> {
|
||||
passwordCheck.setPassword(context, app.aaps.core.ui.R.string.settings_password, app.aaps.core.utils.R.string.key_settings_password)
|
||||
true
|
||||
}
|
||||
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_bolus_password) -> {
|
||||
passwordCheck.setPassword(context, app.aaps.core.ui.R.string.bolus_password, info.nightscout.core.utils.R.string.key_bolus_password)
|
||||
rh.gs(app.aaps.core.utils.R.string.key_bolus_password) -> {
|
||||
passwordCheck.setPassword(context, app.aaps.core.ui.R.string.bolus_password, app.aaps.core.utils.R.string.key_bolus_password)
|
||||
true
|
||||
}
|
||||
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_application_password) -> {
|
||||
passwordCheck.setPassword(context, app.aaps.core.ui.R.string.application_password, info.nightscout.core.utils.R.string.key_application_password)
|
||||
rh.gs(app.aaps.core.utils.R.string.key_application_password) -> {
|
||||
passwordCheck.setPassword(context, app.aaps.core.ui.R.string.application_password, app.aaps.core.utils.R.string.key_application_password)
|
||||
true
|
||||
}
|
||||
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_settings_pin) -> {
|
||||
passwordCheck.setPassword(context, app.aaps.core.ui.R.string.settings_pin, info.nightscout.core.utils.R.string.key_settings_pin, pinInput = true)
|
||||
rh.gs(app.aaps.core.utils.R.string.key_settings_pin) -> {
|
||||
passwordCheck.setPassword(context, app.aaps.core.ui.R.string.settings_pin, app.aaps.core.utils.R.string.key_settings_pin, pinInput = true)
|
||||
true
|
||||
}
|
||||
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_bolus_pin) -> {
|
||||
passwordCheck.setPassword(context, app.aaps.core.ui.R.string.bolus_pin, info.nightscout.core.utils.R.string.key_bolus_pin, pinInput = true)
|
||||
rh.gs(app.aaps.core.utils.R.string.key_bolus_pin) -> {
|
||||
passwordCheck.setPassword(context, app.aaps.core.ui.R.string.bolus_pin, app.aaps.core.utils.R.string.key_bolus_pin, pinInput = true)
|
||||
true
|
||||
}
|
||||
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_application_pin) -> {
|
||||
passwordCheck.setPassword(context, app.aaps.core.ui.R.string.application_pin, info.nightscout.core.utils.R.string.key_application_pin, pinInput = true)
|
||||
rh.gs(app.aaps.core.utils.R.string.key_application_pin) -> {
|
||||
passwordCheck.setPassword(context, app.aaps.core.ui.R.string.application_pin, app.aaps.core.utils.R.string.key_application_pin, pinInput = true)
|
||||
true
|
||||
}
|
||||
// NSClient copy settings
|
||||
|
|
|
@ -17,7 +17,7 @@ class QuickWizard @Inject constructor(
|
|||
private var storage = JSONArray()
|
||||
|
||||
init {
|
||||
setData(JSONArray(sp.getString(info.nightscout.core.utils.R.string.key_quickwizard, "[]")))
|
||||
setData(JSONArray(sp.getString(app.aaps.core.utils.R.string.key_quickwizard, "[]")))
|
||||
setGuidsForOldEntries()
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ class QuickWizard @Inject constructor(
|
|||
}
|
||||
|
||||
fun save() {
|
||||
sp.putString(info.nightscout.core.utils.R.string.key_quickwizard, storage.toString())
|
||||
sp.putString(app.aaps.core.utils.R.string.key_quickwizard, storage.toString())
|
||||
}
|
||||
|
||||
fun size(): Int = storage.length()
|
||||
|
|
|
@ -137,7 +137,7 @@ class QuickWizardEntry @Inject constructor(private val injector: HasAndroidInjec
|
|||
}
|
||||
// SuperBolus
|
||||
var superBolus = false
|
||||
if (useSuperBolus() == YES && sp.getBoolean(info.nightscout.core.utils.R.string.key_usesuperbolus, false)) {
|
||||
if (useSuperBolus() == YES && sp.getBoolean(app.aaps.core.utils.R.string.key_usesuperbolus, false)) {
|
||||
superBolus = true
|
||||
}
|
||||
if (loop.isEnabled() && loop.isSuperBolus) superBolus = false
|
||||
|
@ -151,7 +151,7 @@ class QuickWizardEntry @Inject constructor(private val injector: HasAndroidInjec
|
|||
} else if (useTrend() == NEGATIVE_ONLY && glucoseStatus != null && glucoseStatus.shortAvgDelta < 0) {
|
||||
trend = true
|
||||
}
|
||||
val percentage = if (usePercentage() == DEFAULT) sp.getInt(info.nightscout.core.utils.R.string.key_boluswizard_percentage, 100) else percentage()
|
||||
val percentage = if (usePercentage() == DEFAULT) sp.getInt(app.aaps.core.utils.R.string.key_boluswizard_percentage, 100) else percentage()
|
||||
return BolusWizard(injector).doCalc(
|
||||
profile,
|
||||
profileName,
|
||||
|
|
|
@ -48,7 +48,7 @@ class QuickWizardTest : TestBase() {
|
|||
|
||||
@BeforeEach
|
||||
fun setup() {
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_quickwizard, "[]")).thenReturn("[]")
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_quickwizard, "[]")).thenReturn("[]")
|
||||
quickWizard = QuickWizard(sp, injector)
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ apply from: "${project.rootDir}/core/main/jacoco_global.gradle"
|
|||
|
||||
android {
|
||||
|
||||
namespace 'info.nightscout.core.utils'
|
||||
namespace 'app.aaps.core.utils'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -51,18 +51,18 @@ class LocalAlertUtilsImpl @Inject constructor(
|
|||
private val disposable = CompositeDisposable()
|
||||
|
||||
private fun missedReadingsThreshold(): Long {
|
||||
return T.mins(sp.getInt(info.nightscout.core.utils.R.string.key_missed_bg_readings_threshold_minutes, Constants.DEFAULT_MISSED_BG_READINGS_THRESHOLD_MINUTES).toLong()).msecs()
|
||||
return T.mins(sp.getInt(app.aaps.core.utils.R.string.key_missed_bg_readings_threshold_minutes, Constants.DEFAULT_MISSED_BG_READINGS_THRESHOLD_MINUTES).toLong()).msecs()
|
||||
}
|
||||
|
||||
private fun pumpUnreachableThreshold(): Long {
|
||||
return T.mins(sp.getInt(info.nightscout.core.utils.R.string.key_pump_unreachable_threshold_minutes, Constants.DEFAULT_PUMP_UNREACHABLE_THRESHOLD_MINUTES).toLong()).msecs()
|
||||
return T.mins(sp.getInt(app.aaps.core.utils.R.string.key_pump_unreachable_threshold_minutes, Constants.DEFAULT_PUMP_UNREACHABLE_THRESHOLD_MINUTES).toLong()).msecs()
|
||||
}
|
||||
|
||||
override fun checkPumpUnreachableAlarm(lastConnection: Long, isStatusOutdated: Boolean, isDisconnected: Boolean) {
|
||||
val alarmTimeoutExpired = isAlarmTimeoutExpired(lastConnection, pumpUnreachableThreshold())
|
||||
val nextAlarmOccurrenceReached = sp.getLong("nextPumpDisconnectedAlarm", 0L) < System.currentTimeMillis()
|
||||
if (config.APS && isStatusOutdated && alarmTimeoutExpired && nextAlarmOccurrenceReached && !isDisconnected) {
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_enable_pump_unreachable_alert, true)) {
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_enable_pump_unreachable_alert, true)) {
|
||||
aapsLogger.debug(LTag.CORE, "Generating pump unreachable alarm. lastConnection: " + dateUtil.dateAndTimeString(lastConnection) + " isStatusOutdated: " + isStatusOutdated)
|
||||
sp.putLong("nextPumpDisconnectedAlarm", System.currentTimeMillis() + pumpUnreachableThreshold())
|
||||
rxBus.send(EventNewNotification(Notification(Notification.PUMP_UNREACHABLE, rh.gs(app.aaps.core.ui.R.string.pump_unreachable), Notification.URGENT).also {
|
||||
|
@ -70,10 +70,10 @@ class LocalAlertUtilsImpl @Inject constructor(
|
|||
app.aaps.core.ui.R.raw.alarm
|
||||
}))
|
||||
uel.log(Action.CAREPORTAL, Sources.Aaps, rh.gs(app.aaps.core.ui.R.string.pump_unreachable), ValueWithUnit.TherapyEventType(TherapyEvent.Type.ANNOUNCEMENT))
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_create_announcements_from_errors, true))
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_create_announcements_from_errors, true))
|
||||
disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(rh.gs(app.aaps.core.ui.R.string.pump_unreachable))).subscribe()
|
||||
}
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_smscommunicator_report_pump_unreachable, true))
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_smscommunicator_report_pump_unreachable, true))
|
||||
smsCommunicator.sendNotificationToAllNumbers(rh.gs(app.aaps.core.ui.R.string.pump_unreachable))
|
||||
}
|
||||
if (!isStatusOutdated && !alarmTimeoutExpired) rxBus.send(EventDismissNotification(Notification.PUMP_UNREACHABLE))
|
||||
|
@ -123,7 +123,7 @@ class LocalAlertUtilsImpl @Inject constructor(
|
|||
override fun checkStaleBGAlert() {
|
||||
val bgReadingWrapped = repository.getLastGlucoseValueWrapped().blockingGet()
|
||||
val bgReading = if (bgReadingWrapped is ValueWrapper.Existing) bgReadingWrapped.value else return
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_enable_missed_bg_readings_alert, false)
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_enable_missed_bg_readings_alert, false)
|
||||
&& bgReading.timestamp + missedReadingsThreshold() < System.currentTimeMillis()
|
||||
&& sp.getLong("nextMissedReadingsAlarm", 0L) < System.currentTimeMillis()
|
||||
) {
|
||||
|
@ -132,7 +132,7 @@ class LocalAlertUtilsImpl @Inject constructor(
|
|||
sp.putLong("nextMissedReadingsAlarm", System.currentTimeMillis() + missedReadingsThreshold())
|
||||
rxBus.send(EventNewNotification(n))
|
||||
uel.log(Action.CAREPORTAL, Sources.Aaps, rh.gs(app.aaps.core.ui.R.string.missed_bg_readings), ValueWithUnit.TherapyEventType(TherapyEvent.Type.ANNOUNCEMENT))
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_create_announcements_from_errors, true)) {
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_create_announcements_from_errors, true)) {
|
||||
disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(n.text)).subscribe()
|
||||
}
|
||||
} else if (dateUtil.isOlderThan(bgReading.timestamp, 5).not()) {
|
||||
|
|
|
@ -108,7 +108,7 @@ class OverviewDataImpl @Inject constructor(
|
|||
}
|
||||
|
||||
override fun initRange() {
|
||||
rangeToDisplay = sp.getInt(info.nightscout.core.utils.R.string.key_rangetodisplay, 6)
|
||||
rangeToDisplay = sp.getInt(app.aaps.core.utils.R.string.key_rangetodisplay, 6)
|
||||
|
||||
val calendar = Calendar.getInstance().also {
|
||||
it.timeInMillis = System.currentTimeMillis()
|
||||
|
|
|
@ -53,13 +53,13 @@ class DefaultValueHelperImpl @Inject constructor(
|
|||
*/
|
||||
override fun determineEatingSoonTT(): Double {
|
||||
val units = profileUtil.units
|
||||
var value = sp.getDouble(info.nightscout.core.utils.R.string.key_eatingsoon_target, getDefaultEatingSoonTT(units))
|
||||
var value = sp.getDouble(app.aaps.core.utils.R.string.key_eatingsoon_target, getDefaultEatingSoonTT(units))
|
||||
value = profileUtil.valueInCurrentUnitsDetect(value)
|
||||
return if (value > 0) value else getDefaultEatingSoonTT(units)
|
||||
}
|
||||
|
||||
override fun determineEatingSoonTTDuration(): Int {
|
||||
val value = sp.getInt(info.nightscout.core.utils.R.string.key_eatingsoon_duration, Constants.defaultEatingSoonTTDuration)
|
||||
val value = sp.getInt(app.aaps.core.utils.R.string.key_eatingsoon_duration, Constants.defaultEatingSoonTTDuration)
|
||||
return if (value > 0) value else Constants.defaultEatingSoonTTDuration
|
||||
}
|
||||
|
||||
|
@ -70,13 +70,13 @@ class DefaultValueHelperImpl @Inject constructor(
|
|||
*/
|
||||
override fun determineActivityTT(): Double {
|
||||
val units = profileUtil.units
|
||||
var value = sp.getDouble(info.nightscout.core.utils.R.string.key_activity_target, getDefaultActivityTT(units))
|
||||
var value = sp.getDouble(app.aaps.core.utils.R.string.key_activity_target, getDefaultActivityTT(units))
|
||||
value = profileUtil.valueInCurrentUnitsDetect(value)
|
||||
return if (value > 0) value else getDefaultActivityTT(units)
|
||||
}
|
||||
|
||||
override fun determineActivityTTDuration(): Int {
|
||||
val value = sp.getInt(info.nightscout.core.utils.R.string.key_activity_duration, Constants.defaultActivityTTDuration)
|
||||
val value = sp.getInt(app.aaps.core.utils.R.string.key_activity_duration, Constants.defaultActivityTTDuration)
|
||||
return if (value > 0) value else Constants.defaultActivityTTDuration
|
||||
}
|
||||
|
||||
|
@ -87,13 +87,13 @@ class DefaultValueHelperImpl @Inject constructor(
|
|||
*/
|
||||
override fun determineHypoTT(): Double {
|
||||
val units = profileUtil.units
|
||||
var value = sp.getDouble(info.nightscout.core.utils.R.string.key_hypo_target, getDefaultHypoTT(units))
|
||||
var value = sp.getDouble(app.aaps.core.utils.R.string.key_hypo_target, getDefaultHypoTT(units))
|
||||
value = profileUtil.valueInCurrentUnitsDetect(value)
|
||||
return if (value > 0) value else getDefaultHypoTT(units)
|
||||
}
|
||||
|
||||
override fun determineHypoTTDuration(): Int {
|
||||
val value = sp.getInt(info.nightscout.core.utils.R.string.key_hypo_duration, Constants.defaultHypoTTDuration)
|
||||
val value = sp.getInt(app.aaps.core.utils.R.string.key_hypo_duration, Constants.defaultHypoTTDuration)
|
||||
return if (value > 0) value else Constants.defaultHypoTTDuration
|
||||
}
|
||||
|
||||
|
@ -101,14 +101,14 @@ class DefaultValueHelperImpl @Inject constructor(
|
|||
override var bgTargetHigh = 180.0
|
||||
|
||||
override fun determineHighLine(): Double {
|
||||
var highLineSetting = sp.getDouble(info.nightscout.core.utils.R.string.key_high_mark, bgTargetHigh)
|
||||
var highLineSetting = sp.getDouble(app.aaps.core.utils.R.string.key_high_mark, bgTargetHigh)
|
||||
if (highLineSetting < 1) highLineSetting = Constants.HIGH_MARK
|
||||
highLineSetting = profileUtil.valueInCurrentUnitsDetect(highLineSetting)
|
||||
return highLineSetting
|
||||
}
|
||||
|
||||
override fun determineLowLine(): Double {
|
||||
var lowLineSetting = sp.getDouble(info.nightscout.core.utils.R.string.key_low_mark, bgTargetLow)
|
||||
var lowLineSetting = sp.getDouble(app.aaps.core.utils.R.string.key_low_mark, bgTargetLow)
|
||||
if (lowLineSetting < 1) lowLineSetting = Constants.LOW_MARK
|
||||
lowLineSetting = profileUtil.valueInCurrentUnitsDetect(lowLineSetting)
|
||||
return lowLineSetting
|
||||
|
|
|
@ -142,7 +142,7 @@ class ProfileFunctionImpl @Inject constructor(
|
|||
}
|
||||
|
||||
override fun getUnits(): GlucoseUnit =
|
||||
if (sp.getString(info.nightscout.core.utils.R.string.key_units, GlucoseUnit.MGDL.asText) == GlucoseUnit.MGDL.asText) GlucoseUnit.MGDL
|
||||
if (sp.getString(app.aaps.core.utils.R.string.key_units, GlucoseUnit.MGDL.asText) == GlucoseUnit.MGDL.asText) GlucoseUnit.MGDL
|
||||
else GlucoseUnit.MMOL
|
||||
|
||||
override fun buildProfileSwitch(profileStore: ProfileStore, profileName: String, durationInMinutes: Int, percentage: Int, timeShiftInHours: Int, timestamp: Long): ProfileSwitch? {
|
||||
|
|
|
@ -15,7 +15,7 @@ class ProfileUtilImpl @Inject constructor(
|
|||
|
||||
override val units: GlucoseUnit
|
||||
get() =
|
||||
if (sp.getString(info.nightscout.core.utils.R.string.key_units, GlucoseUnit.MGDL.asText) == GlucoseUnit.MGDL.asText) GlucoseUnit.MGDL
|
||||
if (sp.getString(app.aaps.core.utils.R.string.key_units, GlucoseUnit.MGDL.asText) == GlucoseUnit.MGDL.asText) GlucoseUnit.MGDL
|
||||
else GlucoseUnit.MMOL
|
||||
|
||||
override fun fromMgdlToUnits(valueInMgdl: Double, targetUnits: GlucoseUnit): Double =
|
||||
|
|
|
@ -42,7 +42,7 @@ object BiometricCheck {
|
|||
ToastUtils.errorToast(activity.baseContext, errString.toString())
|
||||
// fallback to master password
|
||||
runOnUiThread {
|
||||
passwordCheck.queryPassword(activity, R.string.master_password, info.nightscout.core.utils.R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() })
|
||||
passwordCheck.queryPassword(activity, R.string.master_password, app.aaps.core.utils.R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ object BiometricCheck {
|
|||
// no pin set
|
||||
// fallback to master password
|
||||
runOnUiThread {
|
||||
passwordCheck.queryPassword(activity, R.string.master_password, info.nightscout.core.utils.R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() })
|
||||
passwordCheck.queryPassword(activity, R.string.master_password, app.aaps.core.utils.R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ object BiometricCheck {
|
|||
ERROR_HW_NOT_PRESENT,
|
||||
ERROR_NO_BIOMETRICS ->
|
||||
runOnUiThread {
|
||||
passwordCheck.queryPassword(activity, R.string.master_password, info.nightscout.core.utils.R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() })
|
||||
passwordCheck.queryPassword(activity, R.string.master_password, app.aaps.core.utils.R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,21 +19,21 @@ class ProtectionCheckImpl @Inject constructor(
|
|||
private var lastAuthorization = mutableListOf(0L, 0L, 0L)
|
||||
|
||||
private val passwordsResourceIDs = listOf(
|
||||
info.nightscout.core.utils.R.string.key_settings_password,
|
||||
info.nightscout.core.utils.R.string.key_application_password,
|
||||
info.nightscout.core.utils.R.string.key_bolus_password
|
||||
app.aaps.core.utils.R.string.key_settings_password,
|
||||
app.aaps.core.utils.R.string.key_application_password,
|
||||
app.aaps.core.utils.R.string.key_bolus_password
|
||||
)
|
||||
|
||||
private val pinsResourceIDs = listOf(
|
||||
info.nightscout.core.utils.R.string.key_settings_pin,
|
||||
info.nightscout.core.utils.R.string.key_application_pin,
|
||||
info.nightscout.core.utils.R.string.key_bolus_pin
|
||||
app.aaps.core.utils.R.string.key_settings_pin,
|
||||
app.aaps.core.utils.R.string.key_application_pin,
|
||||
app.aaps.core.utils.R.string.key_bolus_pin
|
||||
)
|
||||
|
||||
private val protectionTypeResourceIDs = listOf(
|
||||
info.nightscout.core.utils.R.string.key_settings_protection,
|
||||
info.nightscout.core.utils.R.string.key_application_protection,
|
||||
info.nightscout.core.utils.R.string.key_bolus_protection
|
||||
app.aaps.core.utils.R.string.key_settings_protection,
|
||||
app.aaps.core.utils.R.string.key_application_protection,
|
||||
app.aaps.core.utils.R.string.key_bolus_protection
|
||||
)
|
||||
|
||||
private val titlePassResourceIDs = listOf(
|
||||
|
@ -55,7 +55,7 @@ class ProtectionCheckImpl @Inject constructor(
|
|||
return when (ProtectionCheck.ProtectionType.values()[sp.getInt(protectionTypeResourceIDs[protection.ordinal], ProtectionCheck.ProtectionType.NONE.ordinal)]) {
|
||||
ProtectionCheck.ProtectionType.NONE -> false
|
||||
ProtectionCheck.ProtectionType.BIOMETRIC -> true
|
||||
ProtectionCheck.ProtectionType.MASTER_PASSWORD -> sp.getString(info.nightscout.core.utils.R.string.key_master_password, "") != ""
|
||||
ProtectionCheck.ProtectionType.MASTER_PASSWORD -> sp.getString(app.aaps.core.utils.R.string.key_master_password, "") != ""
|
||||
ProtectionCheck.ProtectionType.CUSTOM_PASSWORD -> sp.getString(passwordsResourceIDs[protection.ordinal], "") != ""
|
||||
ProtectionCheck.ProtectionType.CUSTOM_PIN -> sp.getString(pinsResourceIDs[protection.ordinal], "") != ""
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ class ProtectionCheckImpl @Inject constructor(
|
|||
}
|
||||
|
||||
private fun activeSession(protection: ProtectionCheck.Protection): Boolean {
|
||||
var timeout = TimeUnit.SECONDS.toMillis(sp.getInt(info.nightscout.core.utils.R.string.key_protection_timeout, 0).toLong())
|
||||
var timeout = TimeUnit.SECONDS.toMillis(sp.getInt(app.aaps.core.utils.R.string.key_protection_timeout, 0).toLong())
|
||||
// Default timeout to pass the resume check at start of an activity
|
||||
timeout = if (timeout < 1000) 1000 else timeout
|
||||
val last = lastAuthorization[protection.ordinal]
|
||||
|
@ -96,7 +96,7 @@ class ProtectionCheckImpl @Inject constructor(
|
|||
passwordCheck.queryPassword(
|
||||
activity,
|
||||
app.aaps.core.ui.R.string.master_password,
|
||||
info.nightscout.core.utils.R.string.key_master_password,
|
||||
app.aaps.core.utils.R.string.key_master_password,
|
||||
{ onOk(protection); ok?.run() },
|
||||
{ cancel?.run() },
|
||||
{ fail?.run() })
|
||||
|
|
|
@ -73,14 +73,14 @@ class PumpSyncImplementation @Inject constructor(
|
|||
syncStopExtendedBolusWithPumpId(dateUtil.now(), dateUtil.now(), it.pumpType, it.pumpSerial)
|
||||
}
|
||||
}
|
||||
sp.remove(info.nightscout.core.utils.R.string.key_active_pump_type)
|
||||
sp.remove(info.nightscout.core.utils.R.string.key_active_pump_serial_number)
|
||||
sp.remove(info.nightscout.core.utils.R.string.key_active_pump_change_timestamp)
|
||||
sp.remove(app.aaps.core.utils.R.string.key_active_pump_type)
|
||||
sp.remove(app.aaps.core.utils.R.string.key_active_pump_serial_number)
|
||||
sp.remove(app.aaps.core.utils.R.string.key_active_pump_change_timestamp)
|
||||
}
|
||||
|
||||
override fun verifyPumpIdentification(type: PumpType, serialNumber: String): Boolean {
|
||||
val storedType = sp.getString(info.nightscout.core.utils.R.string.key_active_pump_type, "")
|
||||
val storedSerial = sp.getString(info.nightscout.core.utils.R.string.key_active_pump_serial_number, "")
|
||||
val storedType = sp.getString(app.aaps.core.utils.R.string.key_active_pump_type, "")
|
||||
val storedSerial = sp.getString(app.aaps.core.utils.R.string.key_active_pump_serial_number, "")
|
||||
if (activePlugin.activePump is VirtualPump) return true
|
||||
if (type.description == storedType && serialNumber == storedSerial) return true
|
||||
aapsLogger.debug(LTag.PUMP, "verifyPumpIdentification failed for $type $serialNumber")
|
||||
|
@ -96,16 +96,16 @@ class PumpSyncImplementation @Inject constructor(
|
|||
* @return true if data is allowed
|
||||
*/
|
||||
private fun confirmActivePump(timestamp: Long, type: PumpType, serialNumber: String, showNotification: Boolean = true): Boolean {
|
||||
val storedType = sp.getString(info.nightscout.core.utils.R.string.key_active_pump_type, "")
|
||||
val storedSerial = sp.getString(info.nightscout.core.utils.R.string.key_active_pump_serial_number, "")
|
||||
val storedTimestamp = sp.getLong(info.nightscout.core.utils.R.string.key_active_pump_change_timestamp, 0L)
|
||||
val storedType = sp.getString(app.aaps.core.utils.R.string.key_active_pump_type, "")
|
||||
val storedSerial = sp.getString(app.aaps.core.utils.R.string.key_active_pump_serial_number, "")
|
||||
val storedTimestamp = sp.getLong(app.aaps.core.utils.R.string.key_active_pump_change_timestamp, 0L)
|
||||
|
||||
// If no value stored assume we start using new pump from now
|
||||
if (storedType.isEmpty() || storedSerial.isEmpty()) {
|
||||
aapsLogger.debug(LTag.PUMP, "Registering new pump ${type.description} $serialNumber")
|
||||
sp.putString(info.nightscout.core.utils.R.string.key_active_pump_type, type.description)
|
||||
sp.putString(info.nightscout.core.utils.R.string.key_active_pump_serial_number, serialNumber)
|
||||
sp.putLong(info.nightscout.core.utils.R.string.key_active_pump_change_timestamp, dateUtil.now()) // allow only data newer than register time (ie. ignore older history)
|
||||
sp.putString(app.aaps.core.utils.R.string.key_active_pump_type, type.description)
|
||||
sp.putString(app.aaps.core.utils.R.string.key_active_pump_serial_number, serialNumber)
|
||||
sp.putLong(app.aaps.core.utils.R.string.key_active_pump_change_timestamp, dateUtil.now()) // allow only data newer than register time (ie. ignore older history)
|
||||
return timestamp > dateUtil.now() - T.mins(1).msecs() // allow first record to be 1 min old
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ class PumpSyncImplementation @Inject constructor(
|
|||
}
|
||||
else null,
|
||||
profile = profileFunction.getProfile(),
|
||||
serialNumber = sp.getString(info.nightscout.core.utils.R.string.key_active_pump_serial_number, "")
|
||||
serialNumber = sp.getString(app.aaps.core.utils.R.string.key_active_pump_serial_number, "")
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -68,13 +68,13 @@ class QueueThread internal constructor(
|
|||
pump.stopConnecting()
|
||||
|
||||
//BLUETOOTH-WATCHDOG
|
||||
var watchdog = sp.getBoolean(info.nightscout.core.utils.R.string.key_btwatchdog, false)
|
||||
val lastWatchdog = sp.getLong(info.nightscout.core.utils.R.string.key_btwatchdog_lastbark, 0L)
|
||||
var watchdog = sp.getBoolean(app.aaps.core.utils.R.string.key_btwatchdog, false)
|
||||
val lastWatchdog = sp.getLong(app.aaps.core.utils.R.string.key_btwatchdog_lastbark, 0L)
|
||||
watchdog = watchdog && System.currentTimeMillis() - lastWatchdog > Constants.MIN_WATCHDOG_INTERVAL_IN_SECONDS * 1000
|
||||
if (watchdog) {
|
||||
aapsLogger.debug(LTag.PUMPQUEUE, "BT watchdog - toggling the phone bluetooth")
|
||||
//write time
|
||||
sp.putLong(info.nightscout.core.utils.R.string.key_btwatchdog_lastbark, System.currentTimeMillis())
|
||||
sp.putLong(app.aaps.core.utils.R.string.key_btwatchdog_lastbark, System.currentTimeMillis())
|
||||
//toggle BT
|
||||
pump.disconnect("watchdog")
|
||||
SystemClock.sleep(1000)
|
||||
|
|
|
@ -64,13 +64,13 @@ class HardLimitsImpl @Inject constructor(
|
|||
|
||||
}
|
||||
|
||||
private fun loadAge(): Int = when (sp.getString(info.nightscout.core.utils.R.string.key_age, "")) {
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_child) -> CHILD
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_teenage) -> TEENAGE
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_adult) -> ADULT
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_resistantadult) -> RESISTANT_ADULT
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_pregnant) -> PREGNANT
|
||||
else -> ADULT
|
||||
private fun loadAge(): Int = when (sp.getString(app.aaps.core.utils.R.string.key_age, "")) {
|
||||
rh.gs(app.aaps.core.utils.R.string.key_child) -> CHILD
|
||||
rh.gs(app.aaps.core.utils.R.string.key_teenage) -> TEENAGE
|
||||
rh.gs(app.aaps.core.utils.R.string.key_adult) -> ADULT
|
||||
rh.gs(app.aaps.core.utils.R.string.key_resistantadult) -> RESISTANT_ADULT
|
||||
rh.gs(app.aaps.core.utils.R.string.key_pregnant) -> PREGNANT
|
||||
else -> ADULT
|
||||
}
|
||||
|
||||
override fun maxBolus(): Double = MAX_BOLUS[loadAge()]
|
||||
|
|
|
@ -7,11 +7,11 @@ import app.aaps.core.interfaces.logging.LTag
|
|||
import app.aaps.core.interfaces.rx.weardata.EventData
|
||||
import app.aaps.core.interfaces.sharedPreferences.SP
|
||||
import app.aaps.core.interfaces.utils.fabric.FabricPrivacy
|
||||
import app.aaps.core.utils.R
|
||||
import com.google.firebase.analytics.FirebaseAnalytics
|
||||
import com.google.firebase.analytics.ktx.analytics
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics
|
||||
import com.google.firebase.ktx.Firebase
|
||||
import info.nightscout.core.utils.R
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.IOException
|
||||
import java.io.ObjectInputStream
|
||||
|
|
|
@ -322,7 +322,7 @@ open class APSResultObject @Inject constructor(val injector: HasAndroidInjector)
|
|||
}
|
||||
}
|
||||
// report change bigger than 30%
|
||||
var percentMinChangeChange = sp.getDouble(info.nightscout.core.utils.R.string.key_loop_openmode_min_change, 30.0)
|
||||
var percentMinChangeChange = sp.getDouble(app.aaps.core.utils.R.string.key_loop_openmode_min_change, 30.0)
|
||||
percentMinChangeChange /= 100.0
|
||||
val lowThreshold = 1 - percentMinChangeChange
|
||||
val highThreshold = 1 + percentMinChangeChange
|
||||
|
@ -358,7 +358,7 @@ open class APSResultObject @Inject constructor(val injector: HasAndroidInjector)
|
|||
}
|
||||
}
|
||||
// report change bigger than 30%
|
||||
var percentMinChangeChange = sp.getDouble(info.nightscout.core.utils.R.string.key_loop_openmode_min_change, 30.0)
|
||||
var percentMinChangeChange = sp.getDouble(app.aaps.core.utils.R.string.key_loop_openmode_min_change, 30.0)
|
||||
percentMinChangeChange /= 100.0
|
||||
val lowThreshold = 1 - percentMinChangeChange
|
||||
val highThreshold = 1 + percentMinChangeChange
|
||||
|
|
|
@ -41,9 +41,9 @@ class AutotuneCore @Inject constructor(
|
|||
val pumpCarbRatio = pumpProfile.ic
|
||||
val pumpCSF = pumpISF / pumpCarbRatio
|
||||
// Autosens constraints
|
||||
val autotuneMax = sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_max, 1.2)
|
||||
val autotuneMin = sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_min, 0.7)
|
||||
val min5minCarbImpact = sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)
|
||||
val autotuneMax = sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_max, 1.2)
|
||||
val autotuneMin = sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_min, 0.7)
|
||||
val min5minCarbImpact = sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)
|
||||
|
||||
// tune DIA
|
||||
var newDia = dia
|
||||
|
|
|
@ -96,12 +96,12 @@ class AutotuneFragment : DaggerFragment() {
|
|||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
sp.putBoolean(info.nightscout.core.utils.R.string.key_autotune_tune_insulin_curve, false) // put to false tune insulin curve
|
||||
sp.putBoolean(info.nightscout.core.utils.R.string.key_autotune_additional_log, false) // put to false additional log
|
||||
sp.putBoolean(app.aaps.core.utils.R.string.key_autotune_tune_insulin_curve, false) // put to false tune insulin curve
|
||||
sp.putBoolean(app.aaps.core.utils.R.string.key_autotune_additional_log, false) // put to false additional log
|
||||
autotunePlugin.loadLastRun()
|
||||
if (autotunePlugin.lastNbDays.isEmpty())
|
||||
autotunePlugin.lastNbDays = sp.getInt(info.nightscout.core.utils.R.string.key_autotune_default_tune_days, 5).toString()
|
||||
val defaultValue = sp.getInt(info.nightscout.core.utils.R.string.key_autotune_default_tune_days, 5).toDouble()
|
||||
autotunePlugin.lastNbDays = sp.getInt(app.aaps.core.utils.R.string.key_autotune_default_tune_days, 5).toString()
|
||||
val defaultValue = sp.getInt(app.aaps.core.utils.R.string.key_autotune_default_tune_days, 5).toDouble()
|
||||
profileStore = activePlugin.activeProfileSource.profile ?: instantiator.provideProfileStore(JSONObject())
|
||||
profileName = if (binding.profileList.text.toString() == rh.gs(app.aaps.core.ui.R.string.active)) "" else binding.profileList.text.toString()
|
||||
profileFunction.getProfile()?.let { currentProfile ->
|
||||
|
@ -150,7 +150,7 @@ class AutotuneFragment : DaggerFragment() {
|
|||
|
||||
binding.autotuneCopyLocal.setOnClickListener {
|
||||
val localName = rh.gs(app.aaps.core.ui.R.string.autotune_tunedprofile_name) + " " + dateUtil.dateAndTimeString(autotunePlugin.lastRun)
|
||||
val circadian = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_circadian_ic_isf, false)
|
||||
val circadian = sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_circadian_ic_isf, false)
|
||||
autotunePlugin.tunedProfile?.let { tunedProfile ->
|
||||
OKDialog.showConfirmation(requireContext(),
|
||||
rh.gs(app.aaps.core.ui.R.string.autotune_copy_localprofile_button),
|
||||
|
@ -233,7 +233,7 @@ class AutotuneFragment : DaggerFragment() {
|
|||
|
||||
binding.autotuneCompare.setOnClickListener {
|
||||
val pumpProfile = autotunePlugin.pumpProfile
|
||||
val circadian = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_circadian_ic_isf, false)
|
||||
val circadian = sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_circadian_ic_isf, false)
|
||||
val tunedProfile = if (circadian) autotunePlugin.tunedProfile?.circadianProfile else autotunePlugin.tunedProfile?.profile
|
||||
uiInteraction.runProfileViewerDialog(
|
||||
fragmentManager = childFragmentManager,
|
||||
|
@ -248,7 +248,7 @@ class AutotuneFragment : DaggerFragment() {
|
|||
binding.autotuneProfileswitch.setOnClickListener {
|
||||
val tunedProfile = autotunePlugin.tunedProfile
|
||||
autotunePlugin.updateProfile(tunedProfile)
|
||||
val circadian = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_circadian_ic_isf, false)
|
||||
val circadian = sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_circadian_ic_isf, false)
|
||||
tunedProfile?.let { tunedP ->
|
||||
tunedP.profileStore(circadian)?.let {
|
||||
OKDialog.showConfirmation(requireContext(),
|
||||
|
@ -400,7 +400,7 @@ class AutotuneFragment : DaggerFragment() {
|
|||
private fun resetParam(resetDay: Boolean) {
|
||||
binding.tuneWarning.text = addWarnings()
|
||||
if (resetDay) {
|
||||
autotunePlugin.lastNbDays = sp.getInt(info.nightscout.core.utils.R.string.key_autotune_default_tune_days, 5).toString()
|
||||
autotunePlugin.lastNbDays = sp.getInt(app.aaps.core.utils.R.string.key_autotune_default_tune_days, 5).toString()
|
||||
days.setAll(true)
|
||||
}
|
||||
autotunePlugin.result = ""
|
||||
|
@ -452,7 +452,7 @@ class AutotuneFragment : DaggerFragment() {
|
|||
})
|
||||
autotunePlugin.tunedProfile?.let { tuned ->
|
||||
layout.addView(toTableRowHeader(context))
|
||||
val tuneInsulin = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_tune_insulin_curve, false)
|
||||
val tuneInsulin = sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_tune_insulin_curve, false)
|
||||
if (tuneInsulin) {
|
||||
layout.addView(
|
||||
toTableRowValue(
|
||||
|
|
|
@ -255,7 +255,7 @@ open class AutotuneIob @Inject constructor(
|
|||
|
||||
private fun getCalculationToTimeTreatments(time: Long, localInsulin: LocalInsulin): IobTotal {
|
||||
val total = IobTotal(time)
|
||||
val detailedLog = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_additional_log, false)
|
||||
val detailedLog = sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_additional_log, false)
|
||||
for (pos in boluses.indices) {
|
||||
val t = boluses[pos]
|
||||
if (!t.isValid) continue
|
||||
|
|
|
@ -120,7 +120,7 @@ class AutotunePlugin @Inject constructor(
|
|||
calculationRunning = false
|
||||
return
|
||||
}
|
||||
val detailedLog = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_additional_log, false)
|
||||
val detailedLog = sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_additional_log, false)
|
||||
calculationRunning = true
|
||||
lastNbDays = "" + daysBack
|
||||
lastRun = dateUtil.now()
|
||||
|
@ -223,7 +223,7 @@ class AutotunePlugin @Inject constructor(
|
|||
updateButtonVisibility = View.VISIBLE
|
||||
|
||||
if (autoSwitch) {
|
||||
val circadian = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_circadian_ic_isf, false)
|
||||
val circadian = sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_circadian_ic_isf, false)
|
||||
tunedProfile?.let { tunedP ->
|
||||
tunedP.profileName = pumpProfile.profileName
|
||||
updateProfile(tunedP)
|
||||
|
@ -277,7 +277,7 @@ class AutotunePlugin @Inject constructor(
|
|||
var strResult = line
|
||||
strResult += rh.gs(app.aaps.core.ui.R.string.autotune_log_title)
|
||||
strResult += line
|
||||
val tuneInsulin = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_tune_insulin_curve, false)
|
||||
val tuneInsulin = sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_tune_insulin_curve, false)
|
||||
if (tuneInsulin) {
|
||||
strResult += rh.gs(app.aaps.core.ui.R.string.autotune_log_peak, rh.gs(R.string.insulin_peak), pumpProfile.localInsulin.peak, tunedProfile.localInsulin.peak)
|
||||
strResult += rh.gs(app.aaps.core.ui.R.string.autotune_log_dia, rh.gs(app.aaps.core.ui.R.string.ic_short), pumpProfile.localInsulin.dia, tunedProfile.localInsulin.dia)
|
||||
|
@ -308,16 +308,16 @@ class AutotunePlugin @Inject constructor(
|
|||
val utcOffset = T.msecs(TimeZone.getDefault().getOffset(dateUtil.now()).toLong()).hours()
|
||||
val startDateString = dateUtil.toISOString(firstLoopStart).substring(0, 10)
|
||||
val endDateString = dateUtil.toISOString(lastLoopEnd - 24 * 60 * 60 * 1000L).substring(0, 10)
|
||||
val nsUrl = sp.getString(info.nightscout.core.utils.R.string.key_nsclientinternal_url, "")
|
||||
val optCategorizeUam = if (sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_categorize_uam_as_basal, false)) "-c=true" else ""
|
||||
val optInsulinCurve = if (sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_tune_insulin_curve, false)) "-i=true" else ""
|
||||
val nsUrl = sp.getString(app.aaps.core.utils.R.string.key_nsclientinternal_url, "")
|
||||
val optCategorizeUam = if (sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_categorize_uam_as_basal, false)) "-c=true" else ""
|
||||
val optInsulinCurve = if (sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_tune_insulin_curve, false)) "-i=true" else ""
|
||||
try {
|
||||
jsonSettings.put("datestring", dateUtil.toISOString(runDate))
|
||||
jsonSettings.put("dateutc", dateUtil.toISOAsUTC(runDate))
|
||||
jsonSettings.put("utcOffset", utcOffset)
|
||||
jsonSettings.put("units", profileFunction.getUnits().asText)
|
||||
jsonSettings.put("timezone", TimeZone.getDefault().id)
|
||||
jsonSettings.put("url_nightscout", sp.getString(info.nightscout.core.utils.R.string.key_nsclientinternal_url, ""))
|
||||
jsonSettings.put("url_nightscout", sp.getString(app.aaps.core.utils.R.string.key_nsclientinternal_url, ""))
|
||||
jsonSettings.put("nbdays", nbDays)
|
||||
jsonSettings.put("startdate", startDateString)
|
||||
jsonSettings.put("enddate", endDateString)
|
||||
|
@ -327,7 +327,7 @@ class AutotunePlugin @Inject constructor(
|
|||
jsonSettings.put("oref0_command", "oref0-autotune -d=~/aaps -n=$nsUrl -s=$startDateString -e=$endDateString $optCategorizeUam $optInsulinCurve")
|
||||
// aaps_command is for running modified oref0-autotune with exported data from aaps (ns-entries and ns-treatment json files copied in ~/aaps/autotune folder and pumpprofile.json copied in ~/aaps/settings/
|
||||
jsonSettings.put("aaps_command", "aaps-autotune -d=~/aaps -s=$startDateString -e=$endDateString $optCategorizeUam $optInsulinCurve")
|
||||
jsonSettings.put("categorize_uam_as_basal", sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_categorize_uam_as_basal, false))
|
||||
jsonSettings.put("categorize_uam_as_basal", sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_categorize_uam_as_basal, false))
|
||||
jsonSettings.put("tune_insulin_curve", false)
|
||||
|
||||
val peakTime: Int = insulinInterface.peak
|
||||
|
@ -354,7 +354,7 @@ class AutotunePlugin @Inject constructor(
|
|||
fun updateProfile(newProfile: ATProfile?) {
|
||||
if (newProfile == null) return
|
||||
val profilePlugin = activePlugin.activeProfileSource
|
||||
val circadian = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_circadian_ic_isf, false)
|
||||
val circadian = sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_circadian_ic_isf, false)
|
||||
val profileStore = activePlugin.activeProfileSource.profile ?: instantiator.provideProfileStore(JSONObject())
|
||||
val profileList: ArrayList<CharSequence> = profileStore.getProfileList()
|
||||
var indexLocalProfile = -1
|
||||
|
@ -396,14 +396,14 @@ class AutotunePlugin @Inject constructor(
|
|||
}
|
||||
json.put("result", result)
|
||||
json.put("updateButtonVisibility", updateButtonVisibility)
|
||||
sp.putString(info.nightscout.core.utils.R.string.key_autotune_last_run, json.toString())
|
||||
sp.putString(app.aaps.core.utils.R.string.key_autotune_last_run, json.toString())
|
||||
}
|
||||
|
||||
fun loadLastRun() {
|
||||
result = ""
|
||||
lastRunSuccess = false
|
||||
try {
|
||||
val json = JSONObject(sp.getString(info.nightscout.core.utils.R.string.key_autotune_last_run, ""))
|
||||
val json = JSONObject(sp.getString(app.aaps.core.utils.R.string.key_autotune_last_run, ""))
|
||||
lastNbDays = JsonHelper.safeGetString(json, "lastNbDays", "")
|
||||
lastRun = JsonHelper.safeGetLong(json, "lastRun")
|
||||
val pumpPeak = JsonHelper.safeGetInt(json, "pumpPeak")
|
||||
|
|
|
@ -32,7 +32,7 @@ class AutotunePrep @Inject constructor(
|
|||
|
||||
fun categorize(tunedProfile: ATProfile): PreppedGlucose? {
|
||||
val preppedGlucose = categorizeBGDatums(tunedProfile, tunedProfile.localInsulin)
|
||||
val tuneInsulin = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_tune_insulin_curve, false)
|
||||
val tuneInsulin = sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_tune_insulin_curve, false)
|
||||
if (tuneInsulin) {
|
||||
var minDeviations = 1000000.0
|
||||
val diaDeviations: MutableList<DiaDeviation> = ArrayList()
|
||||
|
@ -312,7 +312,7 @@ class AutotunePrep @Inject constructor(
|
|||
|
||||
// Then, calculate carb absorption for that 5m interval using the deviation.
|
||||
if (mealCOB > 0) {
|
||||
val ci = max(deviation, sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0))
|
||||
val ci = max(deviation, sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0))
|
||||
val absorbed = ci * tunedProfile.ic / sens
|
||||
// Store the COB, and use it as the starting point for the next data point.
|
||||
mealCOB = max(0.0, mealCOB - absorbed)
|
||||
|
@ -463,7 +463,7 @@ class AutotunePrep @Inject constructor(
|
|||
var isfLength = isfGlucoseData.size
|
||||
val uamLength = uamGlucoseData.size
|
||||
var basalLength = basalGlucoseData.size
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_categorize_uam_as_basal, false)) {
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_categorize_uam_as_basal, false)) {
|
||||
//aapsLogger.debug(LTag.AUTOTUNE, "Categorizing all UAM data as basal.")
|
||||
if (verbose)
|
||||
log("Categorizing all UAM data as basal.")
|
||||
|
|
|
@ -114,7 +114,7 @@ class ATProfile(profile: Profile, var localInsulin: LocalInsulin, val injector:
|
|||
json.put("useCustomPeakTime", true)
|
||||
json.put("insulinPeakTime", 45)
|
||||
} else if (insulinInterface.id === Insulin.InsulinType.OREF_FREE_PEAK) {
|
||||
val peakTime: Int = sp.getInt(rh.gs(info.nightscout.core.utils.R.string.key_insulin_oref_peak), 75)
|
||||
val peakTime: Int = sp.getInt(rh.gs(app.aaps.core.utils.R.string.key_insulin_oref_peak), 75)
|
||||
json.put("curve", if (peakTime > 50) "rapid-acting" else "ultra-rapid")
|
||||
json.put("useCustomPeakTime", true)
|
||||
json.put("insulinPeakTime", peakTime)
|
||||
|
@ -142,8 +142,8 @@ class ATProfile(profile: Profile, var localInsulin: LocalInsulin, val injector:
|
|||
)
|
||||
)
|
||||
json.put("carb_ratio", avgIC)
|
||||
json.put("autosens_max", SafeParse.stringToDouble(sp.getString(info.nightscout.core.utils.R.string.key_openapsama_autosens_max, "1.2")))
|
||||
json.put("autosens_min", SafeParse.stringToDouble(sp.getString(info.nightscout.core.utils.R.string.key_openapsama_autosens_min, "0.7")))
|
||||
json.put("autosens_max", SafeParse.stringToDouble(sp.getString(app.aaps.core.utils.R.string.key_openapsama_autosens_max, "1.2")))
|
||||
json.put("autosens_min", SafeParse.stringToDouble(sp.getString(app.aaps.core.utils.R.string.key_openapsama_autosens_min, "0.7")))
|
||||
json.put("units", GlucoseUnit.MGDL.asText)
|
||||
json.put("timezone", TimeZone.getDefault().id)
|
||||
jsonString = json.toString(2).replace("\\/", "/")
|
||||
|
|
|
@ -116,7 +116,7 @@ class LoopFragment : DaggerFragment(), MenuProvider {
|
|||
}, fabricPrivacy::logException)
|
||||
|
||||
updateGUI()
|
||||
sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveuseloop, true)
|
||||
sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveuseloop, true)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
|
|
|
@ -183,7 +183,7 @@ class LoopPlugin @Inject constructor(
|
|||
get() {
|
||||
val closedLoopEnabled = constraintChecker.isClosedLoopAllowed()
|
||||
val maxIobAllowed = constraintChecker.getMaxIOBAllowed().value()
|
||||
val apsMode = ApsMode.fromString(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name))
|
||||
val apsMode = ApsMode.fromString(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name))
|
||||
val pump = activePlugin.activePump
|
||||
var isLGS = false
|
||||
if (!isSuspended && !pump.isSuspended()) if (closedLoopEnabled.value()) if (maxIobAllowed == HardLimits.MAX_IOB_LGS || apsMode == ApsMode.LGS) isLGS = true
|
||||
|
@ -322,18 +322,18 @@ class LoopPlugin @Inject constructor(
|
|||
) && carbsSuggestionsSuspendedUntil < System.currentTimeMillis() && !treatmentTimeThreshold(-15)
|
||||
) {
|
||||
if (sp.getBoolean(
|
||||
info.nightscout.core.utils.R.string.key_enable_carbs_required_alert_local,
|
||||
app.aaps.core.utils.R.string.key_enable_carbs_required_alert_local,
|
||||
true
|
||||
) && !sp.getBoolean(app.aaps.core.ui.R.string.key_raise_notifications_as_android_notifications, true)
|
||||
) {
|
||||
val carbReqLocal = Notification(Notification.CARBS_REQUIRED, resultAfterConstraints.carbsRequiredText, Notification.NORMAL)
|
||||
rxBus.send(EventNewNotification(carbReqLocal))
|
||||
}
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_create_announcements_from_carbs_req, false)) {
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_create_announcements_from_carbs_req, false)) {
|
||||
disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(resultAfterConstraints.carbsRequiredText)).subscribe()
|
||||
}
|
||||
if (sp.getBoolean(
|
||||
info.nightscout.core.utils.R.string.key_enable_carbs_required_alert_local,
|
||||
app.aaps.core.utils.R.string.key_enable_carbs_required_alert_local,
|
||||
true
|
||||
) && sp.getBoolean(app.aaps.core.ui.R.string.key_raise_notifications_as_android_notifications, true)
|
||||
) {
|
||||
|
@ -442,7 +442,7 @@ class LoopPlugin @Inject constructor(
|
|||
.setPriority(Notification.IMPORTANCE_HIGH)
|
||||
.setCategory(Notification.CATEGORY_ALARM)
|
||||
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_wear_control, false)) {
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_wear_control, false)) {
|
||||
builder.setLocalOnly(true)
|
||||
}
|
||||
presentSuggestion(builder)
|
||||
|
@ -519,7 +519,7 @@ class LoopPlugin @Inject constructor(
|
|||
lastRun.lastTBREnact = dateUtil.now()
|
||||
lastRun.lastOpenModeAccept = dateUtil.now()
|
||||
buildAndStoreDeviceStatus()
|
||||
sp.incInt(info.nightscout.core.utils.R.string.key_ObjectivesmanualEnacts)
|
||||
sp.incInt(app.aaps.core.utils.R.string.key_ObjectivesmanualEnacts)
|
||||
}
|
||||
rxBus.send(EventAcceptOpenLoopChange())
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ class DetermineBasalAdapterAMAJS internal constructor(scriptReader: ScriptReader
|
|||
if (mealData.usedMinCarbsImpact > 0) {
|
||||
this.profile.put("min_5m_carbimpact", mealData.usedMinCarbsImpact)
|
||||
} else {
|
||||
this.profile.put("min_5m_carbimpact", sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact))
|
||||
this.profile.put("min_5m_carbimpact", sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact))
|
||||
}
|
||||
if (profileFunction.getUnits() == GlucoseUnit.MMOL) {
|
||||
this.profile.put("out_units", "mmol/L")
|
||||
|
|
|
@ -270,7 +270,7 @@ class OpenAPSAMAPlugin @Inject constructor(
|
|||
}
|
||||
|
||||
override fun isAutosensModeEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
|
||||
val enabled = sp.getBoolean(info.nightscout.core.utils.R.string.key_use_autosens, false)
|
||||
val enabled = sp.getBoolean(app.aaps.core.utils.R.string.key_use_autosens, false)
|
||||
if (!enabled) value.set(false, rh.gs(R.string.autosens_disabled_in_preferences), this)
|
||||
return value
|
||||
}
|
||||
|
|
|
@ -230,7 +230,7 @@ class DetermineBasalAdapterSMBJS internal constructor(private val scriptReader:
|
|||
this.profile.put("carbsReqThreshold", sp.getInt(R.string.key_carbsReqThreshold, SMBDefaults.carbsReqThreshold))
|
||||
this.profile.put("current_basal", basalRate)
|
||||
this.profile.put("temptargetSet", tempTargetSet)
|
||||
this.profile.put("autosens_max", SafeParse.stringToDouble(sp.getString(info.nightscout.core.utils.R.string.key_openapsama_autosens_max, "1.2")))
|
||||
this.profile.put("autosens_max", SafeParse.stringToDouble(sp.getString(app.aaps.core.utils.R.string.key_openapsama_autosens_max, "1.2")))
|
||||
if (profileFunction.getUnits() == GlucoseUnit.MMOL) {
|
||||
this.profile.put("out_units", "mmol/L")
|
||||
}
|
||||
|
|
|
@ -348,7 +348,7 @@ open class OpenAPSSMBPlugin @Inject constructor(
|
|||
}
|
||||
|
||||
override fun isAutosensModeEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
|
||||
val enabled = sp.getBoolean(info.nightscout.core.utils.R.string.key_use_autosens, false)
|
||||
val enabled = sp.getBoolean(app.aaps.core.utils.R.string.key_use_autosens, false)
|
||||
if (!enabled) value.set(false, rh.gs(R.string.autosens_disabled_in_preferences), this)
|
||||
return value
|
||||
}
|
||||
|
|
|
@ -209,10 +209,10 @@ class DetermineBasalAdapterSMBDynamicISFJS internal constructor(private val scri
|
|||
//mProfile.put("high_temptarget_raises_sensitivity", SP.getBoolean(R.string.key_high_temptarget_raises_sensitivity, SMBDefaults.high_temptarget_raises_sensitivity));
|
||||
this.profile.put(
|
||||
"high_temptarget_raises_sensitivity",
|
||||
sp.getBoolean(info.nightscout.core.utils.R.string.key_high_temptarget_raises_sensitivity, SMBDefaults.high_temptarget_raises_sensitivity)
|
||||
sp.getBoolean(app.aaps.core.utils.R.string.key_high_temptarget_raises_sensitivity, SMBDefaults.high_temptarget_raises_sensitivity)
|
||||
)
|
||||
//mProfile.put("low_temptarget_lowers_sensitivity", SP.getBoolean(R.string.key_low_temptarget_lowers_sensitivity, SMBDefaults.low_temptarget_lowers_sensitivity));
|
||||
this.profile.put("low_temptarget_lowers_sensitivity", sp.getBoolean(info.nightscout.core.utils.R.string.key_low_temptarget_lowers_sensitivity, SMBDefaults.low_temptarget_lowers_sensitivity))
|
||||
this.profile.put("low_temptarget_lowers_sensitivity", sp.getBoolean(app.aaps.core.utils.R.string.key_low_temptarget_lowers_sensitivity, SMBDefaults.low_temptarget_lowers_sensitivity))
|
||||
this.profile.put("sensitivity_raises_target", sp.getBoolean(R.string.key_sensitivity_raises_target, SMBDefaults.sensitivity_raises_target))
|
||||
this.profile.put("resistance_lowers_target", sp.getBoolean(R.string.key_resistance_lowers_target, SMBDefaults.resistance_lowers_target))
|
||||
this.profile.put("adv_target_adjustments", SMBDefaults.adv_target_adjustments)
|
||||
|
@ -244,8 +244,8 @@ class DetermineBasalAdapterSMBDynamicISFJS internal constructor(private val scri
|
|||
this.profile.put("carbsReqThreshold", sp.getInt(R.string.key_carbsReqThreshold, SMBDefaults.carbsReqThreshold))
|
||||
this.profile.put("current_basal", basalRate)
|
||||
this.profile.put("temptargetSet", tempTargetSet)
|
||||
this.profile.put("autosens_max", SafeParse.stringToDouble(sp.getString(info.nightscout.core.utils.R.string.key_openapsama_autosens_max, "1.2")))
|
||||
this.profile.put("autosens_min", SafeParse.stringToDouble(sp.getString(info.nightscout.core.utils.R.string.key_openapsama_autosens_min, "0.7")))
|
||||
this.profile.put("autosens_max", SafeParse.stringToDouble(sp.getString(app.aaps.core.utils.R.string.key_openapsama_autosens_max, "1.2")))
|
||||
this.profile.put("autosens_min", SafeParse.stringToDouble(sp.getString(app.aaps.core.utils.R.string.key_openapsama_autosens_min, "0.7")))
|
||||
//set the min SMB amount to be the amount set by the pump.
|
||||
if (profileFunction.getUnits() == GlucoseUnit.MMOL) {
|
||||
this.profile.put("out_units", "mmol/L")
|
||||
|
|
|
@ -44,9 +44,9 @@ class AutotuneCoreTest : TestBaseWithProfile() {
|
|||
val inputProfile = atProfileFromOapsJson(JSONObject(inputProfileJson), dateUtil)!!
|
||||
val prep = PreppedGlucose(JSONObject(prepJson), dateUtil)
|
||||
|
||||
`when`(sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_max, 1.2)).thenReturn(autotuneMax)
|
||||
`when`(sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_min, 0.7)).thenReturn(autotuneMin)
|
||||
`when`(sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)).thenReturn(min5mCarbImpact)
|
||||
`when`(sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_max, 1.2)).thenReturn(autotuneMax)
|
||||
`when`(sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_min, 0.7)).thenReturn(autotuneMin)
|
||||
`when`(sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)).thenReturn(min5mCarbImpact)
|
||||
val oapsOutputProfileJson = File("src/test/res/autotune/test1/aapsorefprofile.json").readText()
|
||||
val oapsOutputProfile = atProfileFromOapsJson(JSONObject(oapsOutputProfileJson), dateUtil)!!
|
||||
val outProfile = autotuneCore.tuneAllTheThings(prep, inputProfile, inputProfile)
|
||||
|
@ -66,9 +66,9 @@ class AutotuneCoreTest : TestBaseWithProfile() {
|
|||
val pumpProfileJson = File("src/test/res/autotune/test4/profile.pump.json").readText()
|
||||
val pumpProfile = atProfileFromOapsJson(JSONObject(pumpProfileJson), dateUtil)!!
|
||||
val prep = PreppedGlucose(JSONObject(prepJson), dateUtil)
|
||||
`when`(sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_max, 1.2)).thenReturn(autotuneMax)
|
||||
`when`(sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_min, 0.7)).thenReturn(autotuneMin)
|
||||
`when`(sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)).thenReturn(min5mCarbImpact)
|
||||
`when`(sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_max, 1.2)).thenReturn(autotuneMax)
|
||||
`when`(sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_min, 0.7)).thenReturn(autotuneMin)
|
||||
`when`(sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)).thenReturn(min5mCarbImpact)
|
||||
val oapsOutputProfileJson = File("src/test/res/autotune/test4/newprofile.2022-05-30.json").readText()
|
||||
val oapsOutputProfile = atProfileFromOapsJson(JSONObject(oapsOutputProfileJson), dateUtil)!!
|
||||
val outProfile = autotuneCore.tuneAllTheThings(prep, inputProfile, pumpProfile)
|
||||
|
|
|
@ -63,8 +63,8 @@ class AutotunePrepTest : TestBaseWithProfile() {
|
|||
val oapsTreatmentsJson = File("src/test/res/autotune/test1/aaps-treatments.2022-05-21.json").readText()
|
||||
autotuneIob.meals = buildMeals(JSONArray(oapsTreatmentsJson)) //Only meals is used in unit test, Insulin only used for iob calculation
|
||||
autotuneIob.boluses = buildBoluses(oapsPreppedGlucose) //Values from oapsPrepData because linked to iob calculation method for TBR
|
||||
`when`(sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)).thenReturn(min5mCarbImpact)
|
||||
`when`(sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_categorize_uam_as_basal, false)).thenReturn(false)
|
||||
`when`(sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)).thenReturn(min5mCarbImpact)
|
||||
`when`(sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_categorize_uam_as_basal, false)).thenReturn(false)
|
||||
val aapsPreppedGlucose = autotunePrep.categorizeBGDatums(inputProfile, inputProfile.localInsulin, false)!!
|
||||
// compare all categorization calculated by aaps plugin (aapsPreppedGlucose) with categorization calculated by OpenAPS (oapsPreppedGlucose)
|
||||
for (i in aapsPreppedGlucose.crData.indices)
|
||||
|
@ -96,8 +96,8 @@ class AutotunePrepTest : TestBaseWithProfile() {
|
|||
val oapsTreatmentsJson = File("src/test/res/autotune/test2/aaps-treatments.2022-05-21.json").readText()
|
||||
autotuneIob.meals = buildMeals(JSONArray(oapsTreatmentsJson)) //Only meals is used in unit test, Insulin only used for iob calculation
|
||||
autotuneIob.boluses = buildBoluses(oapsPreppedGlucose) //Values from oapsPrepData because linked to iob calculation method for TBR
|
||||
`when`(sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)).thenReturn(min5mCarbImpact)
|
||||
`when`(sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_categorize_uam_as_basal, false)).thenReturn(false) // CategorizeUAM as Basal = False
|
||||
`when`(sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)).thenReturn(min5mCarbImpact)
|
||||
`when`(sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_categorize_uam_as_basal, false)).thenReturn(false) // CategorizeUAM as Basal = False
|
||||
val aapsPreppedGlucose = autotunePrep.categorizeBGDatums(inputProfile, inputProfile.localInsulin, false)!!
|
||||
// compare all categorization calculated by aaps plugin (aapsPreppedGlucose) with categorization calculated by OpenAPS (oapsPreppedGlucose)
|
||||
for (i in aapsPreppedGlucose.crData.indices)
|
||||
|
@ -129,8 +129,8 @@ class AutotunePrepTest : TestBaseWithProfile() {
|
|||
val oapsTreatmentsJson = File("src/test/res/autotune/test3/aaps-treatments.2022-05-21.json").readText()
|
||||
autotuneIob.meals = buildMeals(JSONArray(oapsTreatmentsJson)) //Only meals is used in unit test, Insulin only used for iob calculation
|
||||
autotuneIob.boluses = buildBoluses(oapsPreppedGlucose) //Values from oapsPrepData because linked to iob calculation method for TBR
|
||||
`when`(sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)).thenReturn(min5mCarbImpact)
|
||||
`when`(sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_categorize_uam_as_basal, false)).thenReturn(true) // CategorizeUAM as Basal = True
|
||||
`when`(sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact, 3.0)).thenReturn(min5mCarbImpact)
|
||||
`when`(sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_categorize_uam_as_basal, false)).thenReturn(true) // CategorizeUAM as Basal = True
|
||||
val aapsPreppedGlucose = autotunePrep.categorizeBGDatums(inputProfile, inputProfile.localInsulin, false)!!
|
||||
// compare all categorization calculated by aaps plugin (aapsPreppedGlucose) with categorization calculated by OpenAPS (oapsPreppedGlucose)
|
||||
for (i in aapsPreppedGlucose.crData.indices)
|
||||
|
|
|
@ -69,7 +69,7 @@ class LoopPluginTest : TestBase() {
|
|||
fun testPluginInterface() {
|
||||
`when`(rh.gs(app.aaps.core.ui.R.string.loop)).thenReturn("Loop")
|
||||
`when`(rh.gs(app.aaps.plugins.aps.R.string.loop_shortname)).thenReturn("LOOP")
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name)
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name)
|
||||
val pumpDescription = PumpDescription()
|
||||
`when`(virtualPumpPlugin.pumpDescription).thenReturn(pumpDescription)
|
||||
assertThat(loopPlugin.pluginDescription.fragmentClass).isEqualTo(LoopFragment::class.java.name)
|
||||
|
|
|
@ -39,7 +39,7 @@ class ActionRunAutotune(injector: HasAndroidInjector) : Action(injector) {
|
|||
@DrawableRes override fun icon(): Int = app.aaps.core.ui.R.drawable.ic_actions_profileswitch
|
||||
|
||||
override fun doAction(callback: Callback) {
|
||||
val autoSwitch = sp.getBoolean(info.nightscout.core.utils.R.string.key_autotune_auto, false)
|
||||
val autoSwitch = sp.getBoolean(app.aaps.core.utils.R.string.key_autotune_auto, false)
|
||||
val profileName = if (inputProfileName.value == rh.gs(app.aaps.core.ui.R.string.active)) "" else inputProfileName.value
|
||||
var message = if (autoSwitch) app.aaps.core.ui.R.string.autotune_run_with_autoswitch else app.aaps.core.ui.R.string.autotune_run_without_autoswitch
|
||||
Thread {
|
||||
|
@ -62,7 +62,7 @@ class ActionRunAutotune(injector: HasAndroidInjector) : Action(injector) {
|
|||
|
||||
override fun generateDialog(root: LinearLayout) {
|
||||
if (defaultValue == 0)
|
||||
defaultValue = sp.getInt(info.nightscout.core.utils.R.string.key_autotune_default_tune_days, 5)
|
||||
defaultValue = sp.getInt(app.aaps.core.utils.R.string.key_autotune_default_tune_days, 5)
|
||||
daysBack.value = defaultValue
|
||||
LayoutBuilder()
|
||||
.add(LabelWithElement(rh, rh.gs(app.aaps.core.ui.R.string.autotune_select_profile), "", inputProfileName))
|
||||
|
@ -93,7 +93,7 @@ class ActionRunAutotune(injector: HasAndroidInjector) : Action(injector) {
|
|||
inputProfileName.value = JsonHelper.safeGetString(o, "profileToTune", "")
|
||||
defaultValue = JsonHelper.safeGetInt(o, "tunedays")
|
||||
if (defaultValue == 0)
|
||||
defaultValue = sp.getInt(info.nightscout.core.utils.R.string.key_autotune_default_tune_days, 5)
|
||||
defaultValue = sp.getInt(app.aaps.core.utils.R.string.key_autotune_default_tune_days, 5)
|
||||
daysBack.value = defaultValue
|
||||
return this
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ import java.util.Optional
|
|||
|
||||
class TriggerAutosensValue(injector: HasAndroidInjector) : Trigger(injector) {
|
||||
|
||||
private val minValue = (sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_min, 0.7) * 100).toInt()
|
||||
private val maxValue = (sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_max, 1.2) * 100).toInt()
|
||||
private val minValue = (sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_min, 0.7) * 100).toInt()
|
||||
private val maxValue = (sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_max, 1.2) * 100).toInt()
|
||||
private val step = 1.0
|
||||
private val decimalFormat = DecimalFormat("1")
|
||||
var autosens: InputDouble = InputDouble(100.0, minValue.toDouble(), maxValue.toDouble(), step, decimalFormat)
|
||||
|
|
|
@ -18,7 +18,7 @@ import java.util.Optional
|
|||
class TriggerCOB(injector: HasAndroidInjector) : Trigger(injector) {
|
||||
|
||||
private val minValue = 0
|
||||
private val maxValue = sp.getInt(info.nightscout.core.utils.R.string.key_treatmentssafety_maxcarbs, 48)
|
||||
private val maxValue = sp.getInt(app.aaps.core.utils.R.string.key_treatmentssafety_maxcarbs, 48)
|
||||
var cob: InputDouble = InputDouble(0.0, minValue.toDouble(), maxValue.toDouble(), 1.0, DecimalFormat("1"))
|
||||
var comparator: Comparator = Comparator(rh)
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ import org.mockito.Mockito.`when`
|
|||
class TriggerAutosensValueTest : TriggerTestBase() {
|
||||
|
||||
@Test fun shouldRunTest() {
|
||||
`when`(sp.getDouble(Mockito.eq(info.nightscout.core.utils.R.string.key_openapsama_autosens_max), ArgumentMatchers.anyDouble())).thenReturn(1.2)
|
||||
`when`(sp.getDouble(Mockito.eq(info.nightscout.core.utils.R.string.key_openapsama_autosens_min), ArgumentMatchers.anyDouble())).thenReturn(0.7)
|
||||
`when`(sp.getDouble(Mockito.eq(app.aaps.core.utils.R.string.key_openapsama_autosens_max), ArgumentMatchers.anyDouble())).thenReturn(1.2)
|
||||
`when`(sp.getDouble(Mockito.eq(app.aaps.core.utils.R.string.key_openapsama_autosens_min), ArgumentMatchers.anyDouble())).thenReturn(0.7)
|
||||
`when`(autosensDataStore.getLastAutosensData(anyObject(), anyObject(), anyObject())).thenReturn(generateAutosensData())
|
||||
var t = TriggerAutosensValue(injector)
|
||||
t.autosens.value = 110.0
|
||||
|
|
|
@ -120,8 +120,8 @@ class RunningConfigurationImpl @Inject constructor(
|
|||
}
|
||||
|
||||
configuration.pump?.let {
|
||||
if (sp.getString(info.nightscout.core.utils.R.string.key_virtualpump_type, "fake") != it) {
|
||||
sp.putString(info.nightscout.core.utils.R.string.key_virtualpump_type, it)
|
||||
if (sp.getString(app.aaps.core.utils.R.string.key_virtualpump_type, "fake") != it) {
|
||||
sp.putString(app.aaps.core.utils.R.string.key_virtualpump_type, it)
|
||||
activePlugin.activePump.pumpDescription.fillFor(PumpType.getByDescription(it))
|
||||
pumpSync.connectNewPump(endRunning = false) // do not end running TBRs, we call this only to accept data properly
|
||||
aapsLogger.debug(LTag.CORE, "Changing pump type to $it")
|
||||
|
|
|
@ -141,7 +141,7 @@ class ImportExportPrefsImpl @Inject constructor(
|
|||
val n6 = Settings.Global.getString(context.contentResolver, "device_name")
|
||||
|
||||
// name provided (hopefully) by user
|
||||
val patientName = sp.getString(info.nightscout.core.utils.R.string.key_patient_name, "")
|
||||
val patientName = sp.getString(app.aaps.core.utils.R.string.key_patient_name, "")
|
||||
val defaultPatientName = rh.gs(app.aaps.core.ui.R.string.patient_name_default)
|
||||
|
||||
// name we detect from OS
|
||||
|
@ -150,7 +150,7 @@ class ImportExportPrefsImpl @Inject constructor(
|
|||
}
|
||||
|
||||
private fun askForMasterPass(activity: FragmentActivity, @StringRes canceledMsg: Int, then: ((password: String) -> Unit)) {
|
||||
passwordCheck.queryPassword(activity, app.aaps.core.ui.R.string.master_password, info.nightscout.core.utils.R.string.key_master_password, { password ->
|
||||
passwordCheck.queryPassword(activity, app.aaps.core.ui.R.string.master_password, app.aaps.core.utils.R.string.key_master_password, { password ->
|
||||
then(password)
|
||||
}, {
|
||||
ToastUtils.warnToast(activity, rh.gs(canceledMsg))
|
||||
|
@ -162,7 +162,7 @@ class ImportExportPrefsImpl @Inject constructor(
|
|||
activity: FragmentActivity, @StringRes canceledMsg: Int, @StringRes passwordName: Int, @StringRes passwordExplanation: Int?,
|
||||
@StringRes passwordWarning: Int?, then: ((password: String) -> Unit)
|
||||
) {
|
||||
passwordCheck.queryAnyPassword(activity, passwordName, info.nightscout.core.utils.R.string.key_master_password, passwordExplanation, passwordWarning, { password ->
|
||||
passwordCheck.queryAnyPassword(activity, passwordName, app.aaps.core.utils.R.string.key_master_password, passwordExplanation, passwordWarning, { password ->
|
||||
then(password)
|
||||
}, {
|
||||
ToastUtils.warnToast(activity, rh.gs(canceledMsg))
|
||||
|
@ -175,7 +175,7 @@ class ImportExportPrefsImpl @Inject constructor(
|
|||
}
|
||||
|
||||
private fun assureMasterPasswordSet(activity: FragmentActivity, @StringRes wrongPwdTitle: Int): Boolean {
|
||||
if (!sp.contains(info.nightscout.core.utils.R.string.key_master_password) || (sp.getString(info.nightscout.core.utils.R.string.key_master_password, "") == "")) {
|
||||
if (!sp.contains(app.aaps.core.utils.R.string.key_master_password) || (sp.getString(app.aaps.core.utils.R.string.key_master_password, "") == "")) {
|
||||
WarningDialog.showWarning(activity,
|
||||
rh.gs(wrongPwdTitle),
|
||||
rh.gs(R.string.master_password_missing, rh.gs(R.string.configbuilder_general), rh.gs(R.string.protection)),
|
||||
|
|
|
@ -105,7 +105,7 @@ class MaintenanceFragment : DaggerFragment() {
|
|||
.subscribeBy(
|
||||
onError = { aapsLogger.error("Error clearing databases", it) },
|
||||
onComplete = {
|
||||
rxBus.send(EventPreferenceChange(rh.gs(info.nightscout.core.utils.R.string.key_units)))
|
||||
rxBus.send(EventPreferenceChange(rh.gs(app.aaps.core.utils.R.string.key_units)))
|
||||
runOnUiThread { activity.recreate() }
|
||||
}
|
||||
)
|
||||
|
|
|
@ -99,7 +99,7 @@ class PrefFileListProviderImpl @Inject constructor(
|
|||
|
||||
override fun listCustomWatchfaceFiles(): MutableList<CwfData> {
|
||||
val customWatchfaceFiles = mutableListOf<CwfData>()
|
||||
val customAwtchfaceAuthorization = sp.getBoolean(info.nightscout.core.utils.R.string.key_wear_custom_watchface_autorization, false)
|
||||
val customAwtchfaceAuthorization = sp.getBoolean(app.aaps.core.utils.R.string.key_wear_custom_watchface_autorization, false)
|
||||
exportsPath.walk().filter { it.isFile && it.name.endsWith(ZipWatchfaceFormat.CWF_EXTENTION) }.forEach { file ->
|
||||
ZipWatchfaceFormat.loadCustomWatchface(ZipInputStream(file.inputStream()), file.name, customAwtchfaceAuthorization)?.also { customWatchface ->
|
||||
customWatchfaceFiles.add(customWatchface)
|
||||
|
|
|
@ -107,7 +107,7 @@ class CustomWatchfaceImportListActivity : TranslatedDaggerAppCompatActivity() {
|
|||
val colorAttr = if (checkCustomVersion(metadata)) app.aaps.core.ui.R.attr.metadataTextOkColor else app.aaps.core.ui.R.attr.metadataTextWarningColor
|
||||
cwfVersion.setTextColor(rh.gac(cwfVersion.context, colorAttr))
|
||||
val prefExisting = metadata.keys.any { it.isPref }
|
||||
val prefSetting = sp.getBoolean(info.nightscout.core.utils.R.string.key_wear_custom_watchface_autorization, false)
|
||||
val prefSetting = sp.getBoolean(app.aaps.core.utils.R.string.key_wear_custom_watchface_autorization, false)
|
||||
val prefColor = if (prefSetting) app.aaps.core.ui.R.attr.metadataTextWarningColor else app.aaps.core.ui.R.attr.importListFileNameColor
|
||||
prefWarning.visibility = (prefExisting && prefSetting).toVisibility()
|
||||
prefInfo.visibility = (prefExisting && !prefSetting).toVisibility()
|
||||
|
|
|
@ -114,17 +114,17 @@ class SWDefinition @Inject constructor(
|
|||
.add(
|
||||
SWRadioButton(injector)
|
||||
.option(R.array.unitsArray, R.array.unitsValues)
|
||||
.preferenceId(info.nightscout.core.utils.R.string.key_units).label(R.string.units)
|
||||
.preferenceId(app.aaps.core.utils.R.string.key_units).label(R.string.units)
|
||||
.comment(R.string.setupwizard_units_prompt)
|
||||
)
|
||||
.validator { sp.contains(info.nightscout.core.utils.R.string.key_units) }
|
||||
.validator { sp.contains(app.aaps.core.utils.R.string.key_units) }
|
||||
|
||||
private val displaySettings
|
||||
get() = SWScreen(injector, R.string.display_settings)
|
||||
.skippable(false)
|
||||
.add(
|
||||
SWEditNumberWithUnits(injector, Constants.LOW_MARK * Constants.MGDL_TO_MMOLL, 3.0, 8.0)
|
||||
.preferenceId(info.nightscout.core.utils.R.string.key_low_mark)
|
||||
.preferenceId(app.aaps.core.utils.R.string.key_low_mark)
|
||||
.updateDelay(5)
|
||||
.label(R.string.low_mark)
|
||||
.comment(R.string.low_mark_comment)
|
||||
|
@ -132,7 +132,7 @@ class SWDefinition @Inject constructor(
|
|||
.add(SWBreak(injector))
|
||||
.add(
|
||||
SWEditNumberWithUnits(injector, Constants.HIGH_MARK * Constants.MGDL_TO_MMOLL, 5.0, 20.0)
|
||||
.preferenceId(info.nightscout.core.utils.R.string.key_high_mark)
|
||||
.preferenceId(app.aaps.core.utils.R.string.key_high_mark)
|
||||
.updateDelay(5)
|
||||
.label(R.string.high_mark)
|
||||
.comment(R.string.high_mark_comment)
|
||||
|
@ -207,7 +207,7 @@ class SWDefinition @Inject constructor(
|
|||
get() = SWScreen(injector, R.string.patient_name)
|
||||
.skippable(true)
|
||||
.add(SWInfoText(injector).label(R.string.patient_name_summary))
|
||||
.add(SWEditString(injector).validator(String::isNotEmpty).preferenceId(info.nightscout.core.utils.R.string.key_patient_name))
|
||||
.add(SWEditString(injector).validator(String::isNotEmpty).preferenceId(app.aaps.core.utils.R.string.key_patient_name))
|
||||
|
||||
private val privacy
|
||||
get() = SWScreen(injector, R.string.privacy_settings)
|
||||
|
@ -219,10 +219,10 @@ class SWDefinition @Inject constructor(
|
|||
get() = SWScreen(injector, app.aaps.core.ui.R.string.master_password)
|
||||
.skippable(false)
|
||||
.add(SWInfoText(injector).label(app.aaps.core.ui.R.string.master_password))
|
||||
.add(SWEditEncryptedPassword(injector, cryptoUtil).preferenceId(info.nightscout.core.utils.R.string.key_master_password))
|
||||
.add(SWEditEncryptedPassword(injector, cryptoUtil).preferenceId(app.aaps.core.utils.R.string.key_master_password))
|
||||
.add(SWBreak(injector))
|
||||
.add(SWInfoText(injector).label(R.string.master_password_summary))
|
||||
.validator { !cryptoUtil.checkPassword("", sp.getString(info.nightscout.core.utils.R.string.key_master_password, "")) }
|
||||
.validator { !cryptoUtil.checkPassword("", sp.getString(app.aaps.core.utils.R.string.key_master_password, "")) }
|
||||
|
||||
private val screenAge
|
||||
get() = SWScreen(injector, app.aaps.core.ui.R.string.patient_type)
|
||||
|
@ -230,30 +230,30 @@ class SWDefinition @Inject constructor(
|
|||
.add(SWBreak(injector))
|
||||
.add(
|
||||
SWRadioButton(injector)
|
||||
.option(app.aaps.core.ui.R.array.ageArray, info.nightscout.core.utils.R.array.ageValues)
|
||||
.preferenceId(info.nightscout.core.utils.R.string.key_age)
|
||||
.option(app.aaps.core.ui.R.array.ageArray, app.aaps.core.utils.R.array.ageValues)
|
||||
.preferenceId(app.aaps.core.utils.R.string.key_age)
|
||||
.label(app.aaps.core.ui.R.string.patient_type)
|
||||
.comment(app.aaps.core.ui.R.string.patient_age_summary)
|
||||
)
|
||||
.add(SWBreak(injector))
|
||||
.add(
|
||||
SWEditNumber(injector, 3.0, 0.1, 25.0)
|
||||
.preferenceId(info.nightscout.core.utils.R.string.key_treatmentssafety_maxbolus)
|
||||
.preferenceId(app.aaps.core.utils.R.string.key_treatmentssafety_maxbolus)
|
||||
.updateDelay(5)
|
||||
.label(app.aaps.core.ui.R.string.max_bolus_title)
|
||||
.comment(R.string.common_values)
|
||||
)
|
||||
.add(
|
||||
SWEditIntNumber(injector, 48, 1, 100)
|
||||
.preferenceId(info.nightscout.core.utils.R.string.key_treatmentssafety_maxcarbs)
|
||||
.preferenceId(app.aaps.core.utils.R.string.key_treatmentssafety_maxcarbs)
|
||||
.updateDelay(5)
|
||||
.label(app.aaps.core.ui.R.string.max_carbs_title)
|
||||
.comment(R.string.common_values)
|
||||
)
|
||||
.validator {
|
||||
sp.contains(info.nightscout.core.utils.R.string.key_age)
|
||||
&& sp.getDouble(info.nightscout.core.utils.R.string.key_treatmentssafety_maxbolus, 0.0) > 0
|
||||
&& sp.getInt(info.nightscout.core.utils.R.string.key_treatmentssafety_maxcarbs, 0) > 0
|
||||
sp.contains(app.aaps.core.utils.R.string.key_age)
|
||||
&& sp.getDouble(app.aaps.core.utils.R.string.key_treatmentssafety_maxbolus, 0.0) > 0
|
||||
&& sp.getInt(app.aaps.core.utils.R.string.key_treatmentssafety_maxcarbs, 0) > 0
|
||||
}
|
||||
|
||||
private val screenInsulin
|
||||
|
@ -354,10 +354,10 @@ class SWDefinition @Inject constructor(
|
|||
.add(
|
||||
SWRadioButton(injector)
|
||||
.option(app.aaps.core.ui.R.array.aps_modeArray, app.aaps.core.ui.R.array.aps_modeValues)
|
||||
.preferenceId(info.nightscout.core.utils.R.string.key_aps_mode).label(R.string.apsmode_title)
|
||||
.preferenceId(app.aaps.core.utils.R.string.key_aps_mode).label(R.string.apsmode_title)
|
||||
.comment(R.string.setupwizard_preferred_aps_mode)
|
||||
)
|
||||
.validator { sp.contains(info.nightscout.core.utils.R.string.key_aps_mode) }
|
||||
.validator { sp.contains(app.aaps.core.utils.R.string.key_aps_mode) }
|
||||
|
||||
private val screenLoop
|
||||
get() = SWScreen(injector, R.string.configbuilder_loop)
|
||||
|
|
|
@ -26,13 +26,13 @@ class SWEditEncryptedPassword(injector: HasAndroidInjector, private val cryptoUt
|
|||
|
||||
override fun generateDialog(layout: LinearLayout) {
|
||||
val context = layout.context
|
||||
val isPasswordSet = sp.contains(info.nightscout.core.utils.R.string.key_master_password) && sp.getString(info.nightscout.core.utils.R.string.key_master_password, "") != ""
|
||||
val isPasswordSet = sp.contains(app.aaps.core.utils.R.string.key_master_password) && sp.getString(app.aaps.core.utils.R.string.key_master_password, "") != ""
|
||||
|
||||
button = Button(context)
|
||||
button?.setText(app.aaps.core.ui.R.string.unlock_settings)
|
||||
button?.setOnClickListener {
|
||||
scanForActivity(context)?.let { activity ->
|
||||
passwordCheck.queryPassword(activity, app.aaps.core.ui.R.string.master_password, info.nightscout.core.utils.R.string.key_master_password, {
|
||||
passwordCheck.queryPassword(activity, app.aaps.core.ui.R.string.master_password, app.aaps.core.utils.R.string.key_master_password, {
|
||||
button?.visibility = View.GONE
|
||||
editText?.visibility = View.VISIBLE
|
||||
editText2?.visibility = View.VISIBLE
|
||||
|
|
|
@ -87,16 +87,16 @@ class ObjectivesPlugin @Inject constructor(
|
|||
objective.startedOn = 0
|
||||
objective.accomplishedOn = 0
|
||||
}
|
||||
sp.putBoolean(info.nightscout.core.utils.R.string.key_objectives_bg_is_available_in_ns, false)
|
||||
sp.putBoolean(info.nightscout.core.utils.R.string.key_objectives_pump_status_is_available_in_ns, false)
|
||||
sp.putInt(info.nightscout.core.utils.R.string.key_ObjectivesmanualEnacts, 0)
|
||||
sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveuseprofileswitch, false)
|
||||
sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveusedisconnect, false)
|
||||
sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveusereconnect, false)
|
||||
sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveusetemptarget, false)
|
||||
sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveuseactions, false)
|
||||
sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveuseloop, false)
|
||||
sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveusescale, false)
|
||||
sp.putBoolean(app.aaps.core.utils.R.string.key_objectives_bg_is_available_in_ns, false)
|
||||
sp.putBoolean(app.aaps.core.utils.R.string.key_objectives_pump_status_is_available_in_ns, false)
|
||||
sp.putInt(app.aaps.core.utils.R.string.key_ObjectivesmanualEnacts, 0)
|
||||
sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveuseprofileswitch, false)
|
||||
sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveusedisconnect, false)
|
||||
sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveusereconnect, false)
|
||||
sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveusetemptarget, false)
|
||||
sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveuseactions, false)
|
||||
sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveuseloop, false)
|
||||
sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveusescale, false)
|
||||
}
|
||||
|
||||
fun allPriorAccomplished(position: Int): Boolean {
|
||||
|
|
|
@ -24,7 +24,7 @@ class Objective0(injector: HasAndroidInjector) : Objective(injector, "config", R
|
|||
init {
|
||||
tasks.add(object : Task(this, R.string.objectives_bgavailableinns) {
|
||||
override fun isCompleted(): Boolean {
|
||||
return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectives_bg_is_available_in_ns, false) || tidepoolPlugin?.hasWritePermission == true
|
||||
return sp.getBoolean(app.aaps.core.utils.R.string.key_objectives_bg_is_available_in_ns, false) || tidepoolPlugin?.hasWritePermission == true
|
||||
}
|
||||
})
|
||||
tasks.add(object : Task(this, R.string.synchaswritepermission) {
|
||||
|
@ -34,7 +34,7 @@ class Objective0(injector: HasAndroidInjector) : Objective(injector, "config", R
|
|||
})
|
||||
tasks.add(object : Task(this, app.aaps.core.ui.R.string.virtualpump_uploadstatus_title) {
|
||||
override fun isCompleted(): Boolean {
|
||||
return sp.getBoolean(info.nightscout.core.utils.R.string.key_virtual_pump_upload_status, false) || tidepoolPlugin?.hasWritePermission == true
|
||||
return sp.getBoolean(app.aaps.core.utils.R.string.key_virtual_pump_upload_status, false) || tidepoolPlugin?.hasWritePermission == true
|
||||
}
|
||||
|
||||
override fun shouldBeIgnored(): Boolean {
|
||||
|
@ -44,7 +44,7 @@ class Objective0(injector: HasAndroidInjector) : Objective(injector, "config", R
|
|||
tasks.add(
|
||||
object : Task(this, R.string.objectives_pumpstatusavailableinns) {
|
||||
override fun isCompleted(): Boolean {
|
||||
return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectives_pump_status_is_available_in_ns, false) || tidepoolPlugin?.hasWritePermission == true
|
||||
return sp.getBoolean(app.aaps.core.utils.R.string.key_objectives_pump_status_is_available_in_ns, false) || tidepoolPlugin?.hasWritePermission == true
|
||||
}
|
||||
}.learned(Learned(R.string.objectives_0_learned))
|
||||
)
|
||||
|
|
|
@ -15,38 +15,38 @@ class Objective1 @Inject constructor(injector: HasAndroidInjector) : Objective(i
|
|||
init {
|
||||
tasks.add(object : Task(this, R.string.objectives_useprofileswitch) {
|
||||
override fun isCompleted(): Boolean {
|
||||
return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectiveuseprofileswitch, false)
|
||||
return sp.getBoolean(app.aaps.core.utils.R.string.key_objectiveuseprofileswitch, false)
|
||||
}
|
||||
})
|
||||
tasks.add(object : Task(this, R.string.objectives_usedisconnectpump) {
|
||||
override fun isCompleted(): Boolean {
|
||||
return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectiveusedisconnect, false)
|
||||
return sp.getBoolean(app.aaps.core.utils.R.string.key_objectiveusedisconnect, false)
|
||||
}
|
||||
}.hint(Hint(R.string.disconnectpump_hint)))
|
||||
tasks.add(object : Task(this, R.string.objectives_usereconnectpump) {
|
||||
override fun isCompleted(): Boolean {
|
||||
return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectiveusereconnect, false)
|
||||
return sp.getBoolean(app.aaps.core.utils.R.string.key_objectiveusereconnect, false)
|
||||
}
|
||||
}.hint(Hint(R.string.disconnectpump_hint)))
|
||||
tasks.add(object : Task(this, R.string.objectives_usetemptarget) {
|
||||
override fun isCompleted(): Boolean {
|
||||
return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectiveusetemptarget, false)
|
||||
return sp.getBoolean(app.aaps.core.utils.R.string.key_objectiveusetemptarget, false)
|
||||
}
|
||||
}.hint(Hint(R.string.usetemptarget_hint)))
|
||||
tasks.add(object : Task(this, R.string.objectives_useactions) {
|
||||
override fun isCompleted(): Boolean {
|
||||
return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectiveuseactions, false) && actionsPlugin.isEnabled() && actionsPlugin.isFragmentVisible()
|
||||
return sp.getBoolean(app.aaps.core.utils.R.string.key_objectiveuseactions, false) && actionsPlugin.isEnabled() && actionsPlugin.isFragmentVisible()
|
||||
}
|
||||
}.hint(Hint(R.string.useaction_hint)))
|
||||
tasks.add(object : Task(this, R.string.objectives_useloop) {
|
||||
override fun isCompleted(): Boolean {
|
||||
return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectiveuseloop, false)
|
||||
return sp.getBoolean(app.aaps.core.utils.R.string.key_objectiveuseloop, false)
|
||||
}
|
||||
}.hint(Hint(R.string.useaction_hint)))
|
||||
tasks.add(
|
||||
object : Task(this, R.string.objectives_usescale) {
|
||||
override fun isCompleted(): Boolean {
|
||||
return sp.getBoolean(info.nightscout.core.utils.R.string.key_objectiveusescale, false)
|
||||
return sp.getBoolean(app.aaps.core.utils.R.string.key_objectiveusescale, false)
|
||||
}
|
||||
}.hint(Hint(R.string.usescale_hint))
|
||||
.learned(Learned(R.string.objectives_usage_learned))
|
||||
|
|
|
@ -16,14 +16,14 @@ class Objective3 @Inject constructor(injector: HasAndroidInjector) : Objective(i
|
|||
tasks.add(
|
||||
object : Task(this, R.string.objectives_manualenacts) {
|
||||
override fun isCompleted(): Boolean {
|
||||
return sp.getInt(info.nightscout.core.utils.R.string.key_ObjectivesmanualEnacts, 0) >= MANUAL_ENACTS_NEEDED
|
||||
return sp.getInt(app.aaps.core.utils.R.string.key_ObjectivesmanualEnacts, 0) >= MANUAL_ENACTS_NEEDED
|
||||
}
|
||||
|
||||
override val progress: String
|
||||
get() =
|
||||
if (sp.getInt(info.nightscout.core.utils.R.string.key_ObjectivesmanualEnacts, 0) >= MANUAL_ENACTS_NEEDED)
|
||||
if (sp.getInt(app.aaps.core.utils.R.string.key_ObjectivesmanualEnacts, 0) >= MANUAL_ENACTS_NEEDED)
|
||||
rh.gs(R.string.completed_well_done)
|
||||
else sp.getInt(info.nightscout.core.utils.R.string.key_ObjectivesmanualEnacts, 0).toString() + " / " + MANUAL_ENACTS_NEEDED
|
||||
else sp.getInt(app.aaps.core.utils.R.string.key_ObjectivesmanualEnacts, 0).toString() + " / " + MANUAL_ENACTS_NEEDED
|
||||
}.learned(Learned(R.string.objectives_openloop_learned))
|
||||
)
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class Objective6(injector: HasAndroidInjector) : Objective(injector, "maxiob", R
|
|||
tasks.add(MinimumDurationTask(this, T.days(1).msecs()))
|
||||
tasks.add(
|
||||
object : Task(this, R.string.closedmodeenabled) {
|
||||
override fun isCompleted(): Boolean = ApsMode.fromString(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)) == ApsMode.CLOSED
|
||||
override fun isCompleted(): Boolean = ApsMode.fromString(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)) == ApsMode.CLOSED
|
||||
})
|
||||
tasks.add(
|
||||
object : Task(this, R.string.maxiobset) {
|
||||
|
|
|
@ -69,7 +69,7 @@ class SafetyPlugin @Inject constructor(
|
|||
}
|
||||
|
||||
override fun isClosedLoopAllowed(value: Constraint<Boolean>): Constraint<Boolean> {
|
||||
val mode = ApsMode.fromString(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name))
|
||||
val mode = ApsMode.fromString(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name))
|
||||
if (mode == ApsMode.OPEN) value.set(false, rh.gs(R.string.closedmodedisabledinpreferences), this)
|
||||
if (!config.isEngineeringModeOrRelease()) {
|
||||
if (value.value()) {
|
||||
|
@ -139,7 +139,7 @@ class SafetyPlugin @Inject constructor(
|
|||
|
||||
override fun applyBolusConstraints(insulin: Constraint<Double>): Constraint<Double> {
|
||||
insulin.setIfGreater(0.0, rh.gs(app.aaps.core.ui.R.string.limitingbolus, 0.0, rh.gs(app.aaps.core.ui.R.string.itmustbepositivevalue)), this)
|
||||
val maxBolus = sp.getDouble(info.nightscout.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0)
|
||||
val maxBolus = sp.getDouble(app.aaps.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0)
|
||||
insulin.setIfSmaller(maxBolus, rh.gs(app.aaps.core.ui.R.string.limitingbolus, maxBolus, rh.gs(R.string.maxvalueinpreferences)), this)
|
||||
insulin.setIfSmaller(hardLimits.maxBolus(), rh.gs(app.aaps.core.ui.R.string.limitingbolus, hardLimits.maxBolus(), rh.gs(R.string.hardlimit)), this)
|
||||
val pump = activePlugin.activePump
|
||||
|
@ -150,7 +150,7 @@ class SafetyPlugin @Inject constructor(
|
|||
|
||||
override fun applyExtendedBolusConstraints(insulin: Constraint<Double>): Constraint<Double> {
|
||||
insulin.setIfGreater(0.0, rh.gs(R.string.limitingextendedbolus, 0.0, rh.gs(app.aaps.core.ui.R.string.itmustbepositivevalue)), this)
|
||||
val maxBolus = sp.getDouble(info.nightscout.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0)
|
||||
val maxBolus = sp.getDouble(app.aaps.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0)
|
||||
insulin.setIfSmaller(maxBolus, rh.gs(R.string.limitingextendedbolus, maxBolus, rh.gs(R.string.maxvalueinpreferences)), this)
|
||||
insulin.setIfSmaller(hardLimits.maxBolus(), rh.gs(R.string.limitingextendedbolus, hardLimits.maxBolus(), rh.gs(R.string.hardlimit)), this)
|
||||
val pump = activePlugin.activePump
|
||||
|
@ -161,13 +161,13 @@ class SafetyPlugin @Inject constructor(
|
|||
|
||||
override fun applyCarbsConstraints(carbs: Constraint<Int>): Constraint<Int> {
|
||||
carbs.setIfGreater(0, rh.gs(R.string.limitingcarbs, 0, rh.gs(app.aaps.core.ui.R.string.itmustbepositivevalue)), this)
|
||||
val maxCarbs = sp.getInt(info.nightscout.core.utils.R.string.key_treatmentssafety_maxcarbs, 48)
|
||||
val maxCarbs = sp.getInt(app.aaps.core.utils.R.string.key_treatmentssafety_maxcarbs, 48)
|
||||
carbs.setIfSmaller(maxCarbs, rh.gs(R.string.limitingcarbs, maxCarbs, rh.gs(R.string.maxvalueinpreferences)), this)
|
||||
return carbs
|
||||
}
|
||||
|
||||
override fun applyMaxIOBConstraints(maxIob: Constraint<Double>): Constraint<Double> {
|
||||
val apsMode = ApsMode.fromString(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name))
|
||||
val apsMode = ApsMode.fromString(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name))
|
||||
if (apsMode == ApsMode.LGS) maxIob.setIfSmaller(
|
||||
HardLimits.MAX_IOB_LGS,
|
||||
rh.gs(app.aaps.core.ui.R.string.limiting_iob, HardLimits.MAX_IOB_LGS, rh.gs(app.aaps.core.ui.R.string.lowglucosesuspend)),
|
||||
|
@ -178,13 +178,13 @@ class SafetyPlugin @Inject constructor(
|
|||
|
||||
override fun configuration(): JSONObject =
|
||||
JSONObject()
|
||||
.putString(info.nightscout.core.utils.R.string.key_age, sp, rh)
|
||||
.putDouble(info.nightscout.core.utils.R.string.key_treatmentssafety_maxbolus, sp, rh)
|
||||
.putInt(info.nightscout.core.utils.R.string.key_treatmentssafety_maxcarbs, sp, rh)
|
||||
.putString(app.aaps.core.utils.R.string.key_age, sp, rh)
|
||||
.putDouble(app.aaps.core.utils.R.string.key_treatmentssafety_maxbolus, sp, rh)
|
||||
.putInt(app.aaps.core.utils.R.string.key_treatmentssafety_maxcarbs, sp, rh)
|
||||
|
||||
override fun applyConfiguration(configuration: JSONObject) {
|
||||
configuration.storeString(info.nightscout.core.utils.R.string.key_age, sp, rh)
|
||||
configuration.storeDouble(info.nightscout.core.utils.R.string.key_treatmentssafety_maxbolus, sp, rh)
|
||||
configuration.storeInt(info.nightscout.core.utils.R.string.key_treatmentssafety_maxcarbs, sp, rh)
|
||||
configuration.storeString(app.aaps.core.utils.R.string.key_age, sp, rh)
|
||||
configuration.storeDouble(app.aaps.core.utils.R.string.key_treatmentssafety_maxbolus, sp, rh)
|
||||
configuration.storeInt(app.aaps.core.utils.R.string.key_treatmentssafety_maxcarbs, sp, rh)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ class VersionCheckerPlugin @Inject constructor(
|
|||
versionCheckerUtils.triggerCheckVersion()
|
||||
if (lastCheckOlderThan(gracePeriod.veryOld.daysToMillis()))
|
||||
value.set(false, rh.gs(R.string.very_old_version), this)
|
||||
val endDate = sp.getLong(rh.gs(info.nightscout.core.utils.R.string.key_app_expiration) + "_" + config.VERSION_NAME, 0)
|
||||
val endDate = sp.getLong(rh.gs(app.aaps.core.utils.R.string.key_app_expiration) + "_" + config.VERSION_NAME, 0)
|
||||
if (endDate != 0L && dateUtil.now() > endDate)
|
||||
value.set(false, rh.gs(R.string.application_expired), this)
|
||||
return value
|
||||
|
@ -99,7 +99,7 @@ class VersionCheckerPlugin @Inject constructor(
|
|||
uiInteraction.addNotification(Notification.OLD_VERSION, message, Notification.NORMAL)
|
||||
}
|
||||
|
||||
val endDate = sp.getLong(rh.gs(info.nightscout.core.utils.R.string.key_app_expiration) + "_" + config.VERSION_NAME, 0)
|
||||
val endDate = sp.getLong(rh.gs(app.aaps.core.utils.R.string.key_app_expiration) + "_" + config.VERSION_NAME, 0)
|
||||
if (endDate != 0L && dateUtil.now() > endDate && shouldWarnAgain()) {
|
||||
// store last notification time
|
||||
sp.putLong(R.string.key_last_versionchecker_plugin_warning_timestamp, now)
|
||||
|
|
|
@ -55,11 +55,11 @@ class VersionCheckerUtilsImpl @Inject constructor(
|
|||
compareWithCurrentVersion(version, config.get().VERSION_NAME)
|
||||
|
||||
// App expiration
|
||||
var endDate = sp.getLong(rh.gs(info.nightscout.core.utils.R.string.key_app_expiration) + "_" + config.get().VERSION_NAME, 0)
|
||||
var endDate = sp.getLong(rh.gs(app.aaps.core.utils.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(info.nightscout.core.utils.R.string.key_app_expiration) + "_" + config.get().VERSION_NAME, endDate)
|
||||
sp.putLong(rh.gs(app.aaps.core.utils.R.string.key_app_expiration) + "_" + config.get().VERSION_NAME, endDate)
|
||||
}
|
||||
}
|
||||
if (endDate != 0L) onExpireDateDetected(config.get().VERSION_NAME, dateUtil.dateString(endDate))
|
||||
|
|
|
@ -109,7 +109,7 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() {
|
|||
`when`(rh.gs(app.aaps.core.ui.R.string.pumplimit)).thenReturn("pump limit")
|
||||
`when`(rh.gs(app.aaps.core.ui.R.string.limitingbolus)).thenReturn("Limiting bolus to %.1f U because of %s")
|
||||
`when`(rh.gs(app.aaps.plugins.constraints.R.string.hardlimit)).thenReturn("hard limit")
|
||||
`when`(rh.gs(info.nightscout.core.utils.R.string.key_child)).thenReturn("child")
|
||||
`when`(rh.gs(app.aaps.core.utils.R.string.key_child)).thenReturn("child")
|
||||
`when`(rh.gs(app.aaps.plugins.constraints.R.string.limitingcarbs)).thenReturn("Limiting carbs to %d g because of %s")
|
||||
`when`(rh.gs(app.aaps.plugins.aps.R.string.limiting_iob)).thenReturn("Limiting IOB to %.1f U because of %s")
|
||||
`when`(rh.gs(app.aaps.core.ui.R.string.limitingbasalratio)).thenReturn("Limiting max basal rate to %1\$.2f U/h because of %2\$s")
|
||||
|
@ -243,13 +243,13 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() {
|
|||
// 2x Safety & Objectives
|
||||
@Test
|
||||
fun isClosedLoopAllowedTest() {
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name)
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name)
|
||||
objectivesPlugin.objectives[Objectives.MAXIOB_ZERO_CL_OBJECTIVE].startedOn = 0
|
||||
var c: Constraint<Boolean> = constraintChecker.isClosedLoopAllowed()
|
||||
aapsLogger.debug("Reason list: " + c.reasonList.toString())
|
||||
// assertThat(c.reasonList[0].toString()).contains("Closed loop is disabled") // Safety & Objectives
|
||||
assertThat(c.value()).isFalse()
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.OPEN.name)
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.OPEN.name)
|
||||
c = constraintChecker.isClosedLoopAllowed()
|
||||
assertThat(c.reasonList[0]).contains("Closed loop mode disabled in preferences") // Safety & Objectives
|
||||
// assertThat(c.reasonList).hasThat(3) // 2x Safety & Objectives
|
||||
|
@ -261,7 +261,7 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() {
|
|||
fun isAutosensModeEnabledTest() {
|
||||
openAPSSMBPlugin.setPluginEnabled(PluginType.APS, true)
|
||||
objectivesPlugin.objectives[Objectives.AUTOSENS_OBJECTIVE].startedOn = 0
|
||||
`when`(sp.getBoolean(info.nightscout.core.utils.R.string.key_use_autosens, false)).thenReturn(false)
|
||||
`when`(sp.getBoolean(app.aaps.core.utils.R.string.key_use_autosens, false)).thenReturn(false)
|
||||
val c = constraintChecker.isAutosensModeEnabled()
|
||||
assertThat(c.reasonList).hasSize(2) // Safety & Objectives
|
||||
assertThat(c.mostLimitedReasonList).hasSize(2) // Safety & Objectives
|
||||
|
@ -292,7 +292,7 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() {
|
|||
openAPSSMBPlugin.setPluginEnabled(PluginType.APS, true)
|
||||
objectivesPlugin.objectives[Objectives.SMB_OBJECTIVE].startedOn = 0
|
||||
`when`(sp.getBoolean(app.aaps.plugins.aps.R.string.key_use_smb, false)).thenReturn(false)
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.OPEN.name)
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.OPEN.name)
|
||||
// `when`(constraintChecker.isClosedLoopAllowed()).thenReturn(ConstraintObject(true))
|
||||
val c = constraintChecker.isSMBModeEnabled()
|
||||
assertThat(c.reasonList).hasSize(3) // 2x Safety & Objectives
|
||||
|
@ -319,7 +319,7 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() {
|
|||
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0)
|
||||
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0)
|
||||
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_max_daily_safety_multiplier, 3.0)).thenReturn(3.0)
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||
|
||||
// Apply all limits
|
||||
val d = constraintChecker.getMaxBasalAllowed(validProfile)
|
||||
|
@ -346,7 +346,7 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() {
|
|||
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0)
|
||||
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0)
|
||||
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_max_daily_safety_multiplier, 3.0)).thenReturn(3.0)
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||
|
||||
// Apply all limits
|
||||
val i = constraintChecker.getMaxBasalPercentAllowed(validProfile)
|
||||
|
@ -372,8 +372,8 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() {
|
|||
// insightPlugin.setStatusResult(result);
|
||||
|
||||
// No limit by default
|
||||
`when`(sp.getDouble(info.nightscout.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0)).thenReturn(3.0)
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||
`when`(sp.getDouble(app.aaps.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0)).thenReturn(3.0)
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||
|
||||
// Apply all limits
|
||||
val d = constraintChecker.getMaxBolusAllowed()
|
||||
|
@ -386,7 +386,7 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() {
|
|||
@Test
|
||||
fun carbsAmountShouldBeLimited() {
|
||||
// No limit by default
|
||||
`when`(sp.getInt(info.nightscout.core.utils.R.string.key_treatmentssafety_maxcarbs, 48)).thenReturn(48)
|
||||
`when`(sp.getInt(app.aaps.core.utils.R.string.key_treatmentssafety_maxcarbs, 48)).thenReturn(48)
|
||||
|
||||
// Apply all limits
|
||||
val i = constraintChecker.getMaxCarbsAllowed()
|
||||
|
@ -399,9 +399,9 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() {
|
|||
@Test
|
||||
fun iobAMAShouldBeLimited() {
|
||||
// No limit by default
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name)
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name)
|
||||
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsma_max_iob, 1.5)).thenReturn(1.5)
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("teenage")
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("teenage")
|
||||
openAPSAMAPlugin.setPluginEnabled(PluginType.APS, true)
|
||||
openAPSSMBPlugin.setPluginEnabled(PluginType.APS, false)
|
||||
|
||||
|
@ -415,9 +415,9 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() {
|
|||
@Test
|
||||
fun iobSMBShouldBeLimited() {
|
||||
// No limit by default
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name)
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name)
|
||||
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapssmb_max_iob, 3.0)).thenReturn(3.0)
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("teenage")
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("teenage")
|
||||
openAPSSMBPlugin.setPluginEnabled(PluginType.APS, true)
|
||||
openAPSAMAPlugin.setPluginEnabled(PluginType.APS, false)
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ class SafetyPluginTest : TestBaseWithProfile() {
|
|||
`when`(rh.gs(app.aaps.plugins.constraints.R.string.closed_loop_disabled_on_dev_branch)).thenReturn("Running dev version. Closed loop is disabled.")
|
||||
`when`(rh.gs(app.aaps.plugins.constraints.R.string.smbalwaysdisabled)).thenReturn("SMB always and after carbs disabled because active BG source doesn\\'t support advanced filtering")
|
||||
`when`(rh.gs(app.aaps.plugins.constraints.R.string.smbnotallowedinopenloopmode)).thenReturn("SMB not allowed in open loop mode")
|
||||
`when`(rh.gs(info.nightscout.core.utils.R.string.key_child)).thenReturn("child")
|
||||
`when`(rh.gs(app.aaps.core.utils.R.string.key_child)).thenReturn("child")
|
||||
`when`(rh.gs(app.aaps.core.ui.R.string.lowglucosesuspend)).thenReturn("Low Glucose Suspend")
|
||||
|
||||
`when`(activePlugin.activePump).thenReturn(virtualPumpPlugin)
|
||||
|
@ -95,7 +95,7 @@ class SafetyPluginTest : TestBaseWithProfile() {
|
|||
|
||||
@Test
|
||||
fun disabledEngineeringModeShouldLimitClosedLoop() {
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name)
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name)
|
||||
`when`(config.isEngineeringModeOrRelease()).thenReturn(false)
|
||||
val c = safetyPlugin.isClosedLoopAllowed(ConstraintObject(true, aapsLogger))
|
||||
assertThat(c.getReasons()).contains("Running dev version. Closed loop is disabled.")
|
||||
|
@ -104,7 +104,7 @@ class SafetyPluginTest : TestBaseWithProfile() {
|
|||
|
||||
@Test
|
||||
fun setOpenLoopInPreferencesShouldLimitClosedLoop() {
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.OPEN.name)
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.OPEN.name)
|
||||
val c = safetyPlugin.isClosedLoopAllowed(ConstraintObject(true, aapsLogger))
|
||||
assertThat(c.getReasons()).contains("Closed loop mode disabled in preferences")
|
||||
assertThat(c.value()).isFalse()
|
||||
|
@ -141,7 +141,7 @@ class SafetyPluginTest : TestBaseWithProfile() {
|
|||
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0)
|
||||
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0)
|
||||
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_max_daily_safety_multiplier, 3.0)).thenReturn(3.0)
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||
val c = ConstraintObject(Double.MAX_VALUE, aapsLogger)
|
||||
safetyPlugin.applyBasalConstraints(c, validProfile)
|
||||
assertThat(c.value()).isWithin(0.01).of(2.0)
|
||||
|
@ -155,7 +155,7 @@ class SafetyPluginTest : TestBaseWithProfile() {
|
|||
|
||||
@Test
|
||||
fun doNotAllowNegativeBasalRate() {
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||
val d = ConstraintObject(-0.5, aapsLogger)
|
||||
safetyPlugin.applyBasalConstraints(d, validProfile)
|
||||
assertThat(d.value()).isWithin(0.01).of(0.0)
|
||||
|
@ -170,7 +170,7 @@ class SafetyPluginTest : TestBaseWithProfile() {
|
|||
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0)
|
||||
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0)
|
||||
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_max_daily_safety_multiplier, 3.0)).thenReturn(3.0)
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||
val i = ConstraintObject(Int.MAX_VALUE, aapsLogger)
|
||||
safetyPlugin.applyBasalPercentConstraints(i, validProfile)
|
||||
assertThat(i.value()).isEqualTo(200)
|
||||
|
@ -193,7 +193,7 @@ Safety: Limiting max basal rate to 500.00 U/h because of pump limit
|
|||
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsma_max_basal, 1.0)).thenReturn(1.0)
|
||||
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_current_basal_safety_multiplier, 4.0)).thenReturn(4.0)
|
||||
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsama_max_daily_safety_multiplier, 3.0)).thenReturn(3.0)
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||
openAPSSMBPlugin.setPluginEnabled(PluginType.APS, true)
|
||||
val i = ConstraintObject(Double.MAX_VALUE, aapsLogger)
|
||||
openAPSSMBPlugin.applyBasalConstraints(i, validProfile)
|
||||
|
@ -210,7 +210,7 @@ Safety: Limiting max basal rate to 500.00 U/h because of pump limit
|
|||
|
||||
@Test
|
||||
fun doNotAllowNegativePercentBasalRate() {
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||
val i = ConstraintObject(-22, aapsLogger)
|
||||
safetyPlugin.applyBasalPercentConstraints(i, validProfile)
|
||||
assertThat(i.value()).isEqualTo(0)
|
||||
|
@ -226,8 +226,8 @@ Safety: Limiting max basal rate to 500.00 U/h because of pump limit
|
|||
|
||||
@Test
|
||||
fun bolusAmountShouldBeLimited() {
|
||||
`when`(sp.getDouble(info.nightscout.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0)).thenReturn(3.0)
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||
`when`(sp.getDouble(app.aaps.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0)).thenReturn(3.0)
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||
val d = safetyPlugin.applyBolusConstraints(ConstraintObject(Double.MAX_VALUE, aapsLogger))
|
||||
assertThat(d.value()).isWithin(0.01).of(3.0)
|
||||
assertThat(d.getReasons()).isEqualTo(
|
||||
|
@ -241,8 +241,8 @@ Safety: Limiting max basal rate to 500.00 U/h because of pump limit
|
|||
|
||||
@Test
|
||||
fun doNotAllowNegativeBolusAmount() {
|
||||
`when`(sp.getDouble(info.nightscout.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0)).thenReturn(3.0)
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||
`when`(sp.getDouble(app.aaps.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0)).thenReturn(3.0)
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("child")
|
||||
val d = safetyPlugin.applyBolusConstraints(ConstraintObject(-22.0, aapsLogger))
|
||||
assertThat(d.value()).isWithin(0.01).of(0.0)
|
||||
assertThat(d.getReasons()).isEqualTo("Safety: Limiting bolus to 0.0 U because of it must be positive value")
|
||||
|
@ -252,7 +252,7 @@ Safety: Limiting max basal rate to 500.00 U/h because of pump limit
|
|||
@Test
|
||||
fun carbsAmountShouldBeLimited() {
|
||||
// No limit by default
|
||||
`when`(sp.getInt(info.nightscout.core.utils.R.string.key_treatmentssafety_maxcarbs, 48)).thenReturn(48)
|
||||
`when`(sp.getInt(app.aaps.core.utils.R.string.key_treatmentssafety_maxcarbs, 48)).thenReturn(48)
|
||||
|
||||
// Negative carbs not allowed
|
||||
var i: Constraint<Int> = ConstraintObject(-22, aapsLogger)
|
||||
|
@ -272,10 +272,10 @@ Safety: Limiting max basal rate to 500.00 U/h because of pump limit
|
|||
openAPSSMBPlugin.setPluginEnabled(PluginType.APS, true)
|
||||
//`when`(openAPSSMBPlugin.isEnabled()).thenReturn(true)
|
||||
//`when`(openAPSAMAPlugin.isEnabled()).thenReturn(false)
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.LGS.name)
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.LGS.name)
|
||||
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapsma_max_iob, 1.5)).thenReturn(1.5)
|
||||
`when`(sp.getDouble(app.aaps.plugins.aps.R.string.key_openapssmb_max_iob, 3.0)).thenReturn(3.0)
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_age, "")).thenReturn("teenage")
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_age, "")).thenReturn("teenage")
|
||||
|
||||
// Apply all limits
|
||||
var d: Constraint<Double> = ConstraintObject(Double.MAX_VALUE, aapsLogger)
|
||||
|
|
|
@ -36,9 +36,9 @@ class InsulinOrefFreePeakPlugin @Inject constructor(
|
|||
|
||||
override val friendlyName get(): String = rh.gs(R.string.free_peak_oref)
|
||||
|
||||
override fun configuration(): JSONObject = JSONObject().putInt(info.nightscout.core.utils.R.string.key_insulin_oref_peak, sp, rh)
|
||||
override fun configuration(): JSONObject = JSONObject().putInt(app.aaps.core.utils.R.string.key_insulin_oref_peak, sp, rh)
|
||||
override fun applyConfiguration(configuration: JSONObject) {
|
||||
configuration.storeInt(info.nightscout.core.utils.R.string.key_insulin_oref_peak, sp, rh)
|
||||
configuration.storeInt(app.aaps.core.utils.R.string.key_insulin_oref_peak, sp, rh)
|
||||
}
|
||||
|
||||
override fun commentStandardText(): String {
|
||||
|
@ -46,7 +46,7 @@ class InsulinOrefFreePeakPlugin @Inject constructor(
|
|||
}
|
||||
|
||||
override val peak: Int
|
||||
get() = sp.getInt(info.nightscout.core.utils.R.string.key_insulin_oref_peak, DEFAULT_PEAK)
|
||||
get() = sp.getInt(app.aaps.core.utils.R.string.key_insulin_oref_peak, DEFAULT_PEAK)
|
||||
|
||||
companion object {
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ class InsulinOrefFreePeakPluginTest : TestBase() {
|
|||
|
||||
@Test
|
||||
fun `simple peak test`() {
|
||||
`when`(sp.getInt(eq(info.nightscout.core.utils.R.string.key_insulin_oref_peak), anyInt())).thenReturn(90)
|
||||
`when`(sp.getInt(eq(app.aaps.core.utils.R.string.key_insulin_oref_peak), anyInt())).thenReturn(90)
|
||||
assertThat(sut.peak).isEqualTo(90)
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ class InsulinOrefFreePeakPluginTest : TestBase() {
|
|||
|
||||
@Test
|
||||
fun commentStandardTextTest() {
|
||||
`when`(sp.getInt(eq(info.nightscout.core.utils.R.string.key_insulin_oref_peak), anyInt())).thenReturn(90)
|
||||
`when`(sp.getInt(eq(app.aaps.core.utils.R.string.key_insulin_oref_peak), anyInt())).thenReturn(90)
|
||||
`when`(rh.gs(eq(R.string.insulin_peak_time))).thenReturn("Peak Time [min]")
|
||||
assertThat(sut.commentStandardText()).isEqualTo("Peak Time [min]: 90")
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ class ActionsFragment : DaggerFragment() {
|
|||
uiInteraction.runCareDialog(childFragmentManager, UiInteraction.EventType.ANNOUNCEMENT, app.aaps.core.ui.R.string.careportal_announcement)
|
||||
}
|
||||
|
||||
sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveuseactions, true)
|
||||
sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveuseactions, true)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
|
|
|
@ -208,9 +208,9 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
binding.graphsLayout.bgGraph.setOnLongClickListener {
|
||||
overviewData.rangeToDisplay += 6
|
||||
overviewData.rangeToDisplay = if (overviewData.rangeToDisplay > 24) 6 else overviewData.rangeToDisplay
|
||||
sp.putInt(info.nightscout.core.utils.R.string.key_rangetodisplay, overviewData.rangeToDisplay)
|
||||
rxBus.send(EventPreferenceChange(rh.gs(info.nightscout.core.utils.R.string.key_rangetodisplay)))
|
||||
sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveusescale, true)
|
||||
sp.putInt(app.aaps.core.utils.R.string.key_rangetodisplay, overviewData.rangeToDisplay)
|
||||
rxBus.send(EventPreferenceChange(rh.gs(app.aaps.core.utils.R.string.key_rangetodisplay)))
|
||||
sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveusescale, true)
|
||||
false
|
||||
}
|
||||
prepareGraphsIfNeeded(overviewMenus.setting.size)
|
||||
|
@ -272,9 +272,9 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
.observeOn(aapsSchedulers.main)
|
||||
.subscribe({
|
||||
overviewData.rangeToDisplay = it.hours
|
||||
sp.putInt(info.nightscout.core.utils.R.string.key_rangetodisplay, it.hours)
|
||||
rxBus.send(EventPreferenceChange(rh.gs(info.nightscout.core.utils.R.string.key_rangetodisplay)))
|
||||
sp.putBoolean(info.nightscout.core.utils.R.string.key_objectiveusescale, true)
|
||||
sp.putInt(app.aaps.core.utils.R.string.key_rangetodisplay, it.hours)
|
||||
rxBus.send(EventPreferenceChange(rh.gs(app.aaps.core.utils.R.string.key_rangetodisplay)))
|
||||
sp.putBoolean(app.aaps.core.utils.R.string.key_objectiveusescale, true)
|
||||
}, fabricPrivacy::logException)
|
||||
disposable += rxBus
|
||||
.toObservable(EventBucketedDataCreated::class.java)
|
||||
|
@ -1088,7 +1088,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
private fun updateSensitivity() {
|
||||
_binding ?: return
|
||||
val lastAutosensData = overviewData.lastAutosensData(iobCobCalculator)
|
||||
if (config.NSCLIENT && sp.getBoolean(info.nightscout.core.utils.R.string.key_used_autosens_on_main_phone, false) ||
|
||||
if (config.NSCLIENT && sp.getBoolean(app.aaps.core.utils.R.string.key_used_autosens_on_main_phone, false) ||
|
||||
!config.NSCLIENT && constraintChecker.isAutosensModeEnabled().value()
|
||||
) {
|
||||
binding.infoLayout.sensitivityIcon.setImageResource(app.aaps.core.main.R.drawable.ic_swap_vert_black_48dp_green)
|
||||
|
|
|
@ -157,7 +157,7 @@ class OverviewPlugin @Inject constructor(
|
|||
}
|
||||
}
|
||||
if (!config.isEngineeringMode())
|
||||
(preferenceFragment.findPreference(rh.gs(info.nightscout.core.utils.R.string.key_reset_boluswizard_percentage_time)) as ValidatingEditTextPreference?)?.let {
|
||||
(preferenceFragment.findPreference(rh.gs(app.aaps.core.utils.R.string.key_reset_boluswizard_percentage_time)) as ValidatingEditTextPreference?)?.let {
|
||||
it.isVisible = false
|
||||
it.isEnabled = false
|
||||
}
|
||||
|
@ -165,64 +165,64 @@ class OverviewPlugin @Inject constructor(
|
|||
|
||||
override fun configuration(): JSONObject =
|
||||
JSONObject()
|
||||
.putString(info.nightscout.core.utils.R.string.key_units, sp, rh)
|
||||
.putString(info.nightscout.core.utils.R.string.key_quickwizard, sp, rh)
|
||||
.putInt(info.nightscout.core.utils.R.string.key_eatingsoon_duration, sp, rh)
|
||||
.putDouble(info.nightscout.core.utils.R.string.key_eatingsoon_target, sp, rh)
|
||||
.putInt(info.nightscout.core.utils.R.string.key_activity_duration, sp, rh)
|
||||
.putDouble(info.nightscout.core.utils.R.string.key_activity_target, sp, rh)
|
||||
.putInt(info.nightscout.core.utils.R.string.key_hypo_duration, sp, rh)
|
||||
.putDouble(info.nightscout.core.utils.R.string.key_hypo_target, sp, rh)
|
||||
.putDouble(info.nightscout.core.utils.R.string.key_low_mark, sp, rh)
|
||||
.putDouble(info.nightscout.core.utils.R.string.key_high_mark, sp, rh)
|
||||
.putDouble(info.nightscout.core.utils.R.string.key_statuslights_cage_warning, sp, rh)
|
||||
.putDouble(info.nightscout.core.utils.R.string.key_statuslights_cage_critical, sp, rh)
|
||||
.putDouble(info.nightscout.core.utils.R.string.key_statuslights_iage_warning, sp, rh)
|
||||
.putDouble(info.nightscout.core.utils.R.string.key_statuslights_iage_critical, sp, rh)
|
||||
.putDouble(info.nightscout.core.utils.R.string.key_statuslights_sage_warning, sp, rh)
|
||||
.putDouble(info.nightscout.core.utils.R.string.key_statuslights_sage_critical, sp, rh)
|
||||
.putString(app.aaps.core.utils.R.string.key_units, sp, rh)
|
||||
.putString(app.aaps.core.utils.R.string.key_quickwizard, sp, rh)
|
||||
.putInt(app.aaps.core.utils.R.string.key_eatingsoon_duration, sp, rh)
|
||||
.putDouble(app.aaps.core.utils.R.string.key_eatingsoon_target, sp, rh)
|
||||
.putInt(app.aaps.core.utils.R.string.key_activity_duration, sp, rh)
|
||||
.putDouble(app.aaps.core.utils.R.string.key_activity_target, sp, rh)
|
||||
.putInt(app.aaps.core.utils.R.string.key_hypo_duration, sp, rh)
|
||||
.putDouble(app.aaps.core.utils.R.string.key_hypo_target, sp, rh)
|
||||
.putDouble(app.aaps.core.utils.R.string.key_low_mark, sp, rh)
|
||||
.putDouble(app.aaps.core.utils.R.string.key_high_mark, sp, rh)
|
||||
.putDouble(app.aaps.core.utils.R.string.key_statuslights_cage_warning, sp, rh)
|
||||
.putDouble(app.aaps.core.utils.R.string.key_statuslights_cage_critical, sp, rh)
|
||||
.putDouble(app.aaps.core.utils.R.string.key_statuslights_iage_warning, sp, rh)
|
||||
.putDouble(app.aaps.core.utils.R.string.key_statuslights_iage_critical, sp, rh)
|
||||
.putDouble(app.aaps.core.utils.R.string.key_statuslights_sage_warning, sp, rh)
|
||||
.putDouble(app.aaps.core.utils.R.string.key_statuslights_sage_critical, sp, rh)
|
||||
.putDouble(R.string.key_statuslights_sbat_warning, sp, rh)
|
||||
.putDouble(R.string.key_statuslights_sbat_critical, sp, rh)
|
||||
.putDouble(info.nightscout.core.utils.R.string.key_statuslights_bage_warning, sp, rh)
|
||||
.putDouble(info.nightscout.core.utils.R.string.key_statuslights_bage_critical, sp, rh)
|
||||
.putDouble(app.aaps.core.utils.R.string.key_statuslights_bage_warning, sp, rh)
|
||||
.putDouble(app.aaps.core.utils.R.string.key_statuslights_bage_critical, sp, rh)
|
||||
.putDouble(R.string.key_statuslights_res_warning, sp, rh)
|
||||
.putDouble(R.string.key_statuslights_res_critical, sp, rh)
|
||||
.putDouble(R.string.key_statuslights_bat_warning, sp, rh)
|
||||
.putDouble(R.string.key_statuslights_bat_critical, sp, rh)
|
||||
.putInt(info.nightscout.core.utils.R.string.key_boluswizard_percentage, sp, rh)
|
||||
.put(rh.gs(info.nightscout.core.utils.R.string.key_used_autosens_on_main_phone), constraintsChecker.isAutosensModeEnabled().value()) // can be disabled by activated DynISF
|
||||
.putInt(app.aaps.core.utils.R.string.key_boluswizard_percentage, sp, rh)
|
||||
.put(rh.gs(app.aaps.core.utils.R.string.key_used_autosens_on_main_phone), constraintsChecker.isAutosensModeEnabled().value()) // can be disabled by activated DynISF
|
||||
|
||||
override fun applyConfiguration(configuration: JSONObject) {
|
||||
val previousUnits = sp.getString(info.nightscout.core.utils.R.string.key_units, "random")
|
||||
val previousUnits = sp.getString(app.aaps.core.utils.R.string.key_units, "random")
|
||||
configuration
|
||||
.storeString(info.nightscout.core.utils.R.string.key_units, sp, rh)
|
||||
.storeString(info.nightscout.core.utils.R.string.key_quickwizard, sp, rh)
|
||||
.storeInt(info.nightscout.core.utils.R.string.key_eatingsoon_duration, sp, rh)
|
||||
.storeDouble(info.nightscout.core.utils.R.string.key_eatingsoon_target, sp, rh)
|
||||
.storeInt(info.nightscout.core.utils.R.string.key_activity_duration, sp, rh)
|
||||
.storeDouble(info.nightscout.core.utils.R.string.key_activity_target, sp, rh)
|
||||
.storeInt(info.nightscout.core.utils.R.string.key_hypo_duration, sp, rh)
|
||||
.storeDouble(info.nightscout.core.utils.R.string.key_hypo_target, sp, rh)
|
||||
.storeDouble(info.nightscout.core.utils.R.string.key_low_mark, sp, rh)
|
||||
.storeDouble(info.nightscout.core.utils.R.string.key_high_mark, sp, rh)
|
||||
.storeDouble(info.nightscout.core.utils.R.string.key_statuslights_cage_warning, sp, rh)
|
||||
.storeDouble(info.nightscout.core.utils.R.string.key_statuslights_cage_critical, sp, rh)
|
||||
.storeDouble(info.nightscout.core.utils.R.string.key_statuslights_iage_warning, sp, rh)
|
||||
.storeDouble(info.nightscout.core.utils.R.string.key_statuslights_iage_critical, sp, rh)
|
||||
.storeDouble(info.nightscout.core.utils.R.string.key_statuslights_sage_warning, sp, rh)
|
||||
.storeDouble(info.nightscout.core.utils.R.string.key_statuslights_sage_critical, sp, rh)
|
||||
.storeString(app.aaps.core.utils.R.string.key_units, sp, rh)
|
||||
.storeString(app.aaps.core.utils.R.string.key_quickwizard, sp, rh)
|
||||
.storeInt(app.aaps.core.utils.R.string.key_eatingsoon_duration, sp, rh)
|
||||
.storeDouble(app.aaps.core.utils.R.string.key_eatingsoon_target, sp, rh)
|
||||
.storeInt(app.aaps.core.utils.R.string.key_activity_duration, sp, rh)
|
||||
.storeDouble(app.aaps.core.utils.R.string.key_activity_target, sp, rh)
|
||||
.storeInt(app.aaps.core.utils.R.string.key_hypo_duration, sp, rh)
|
||||
.storeDouble(app.aaps.core.utils.R.string.key_hypo_target, sp, rh)
|
||||
.storeDouble(app.aaps.core.utils.R.string.key_low_mark, sp, rh)
|
||||
.storeDouble(app.aaps.core.utils.R.string.key_high_mark, sp, rh)
|
||||
.storeDouble(app.aaps.core.utils.R.string.key_statuslights_cage_warning, sp, rh)
|
||||
.storeDouble(app.aaps.core.utils.R.string.key_statuslights_cage_critical, sp, rh)
|
||||
.storeDouble(app.aaps.core.utils.R.string.key_statuslights_iage_warning, sp, rh)
|
||||
.storeDouble(app.aaps.core.utils.R.string.key_statuslights_iage_critical, sp, rh)
|
||||
.storeDouble(app.aaps.core.utils.R.string.key_statuslights_sage_warning, sp, rh)
|
||||
.storeDouble(app.aaps.core.utils.R.string.key_statuslights_sage_critical, sp, rh)
|
||||
.storeDouble(R.string.key_statuslights_sbat_warning, sp, rh)
|
||||
.storeDouble(R.string.key_statuslights_sbat_critical, sp, rh)
|
||||
.storeDouble(info.nightscout.core.utils.R.string.key_statuslights_bage_warning, sp, rh)
|
||||
.storeDouble(info.nightscout.core.utils.R.string.key_statuslights_bage_critical, sp, rh)
|
||||
.storeDouble(app.aaps.core.utils.R.string.key_statuslights_bage_warning, sp, rh)
|
||||
.storeDouble(app.aaps.core.utils.R.string.key_statuslights_bage_critical, sp, rh)
|
||||
.storeDouble(R.string.key_statuslights_res_warning, sp, rh)
|
||||
.storeDouble(R.string.key_statuslights_res_critical, sp, rh)
|
||||
.storeDouble(R.string.key_statuslights_bat_warning, sp, rh)
|
||||
.storeDouble(R.string.key_statuslights_bat_critical, sp, rh)
|
||||
.storeInt(info.nightscout.core.utils.R.string.key_boluswizard_percentage, sp, rh)
|
||||
.storeBoolean(info.nightscout.core.utils.R.string.key_used_autosens_on_main_phone, sp, rh)
|
||||
.storeInt(app.aaps.core.utils.R.string.key_boluswizard_percentage, sp, rh)
|
||||
.storeBoolean(app.aaps.core.utils.R.string.key_used_autosens_on_main_phone, sp, rh)
|
||||
|
||||
val newUnits = sp.getString(info.nightscout.core.utils.R.string.key_units, "new")
|
||||
val newUnits = sp.getString(app.aaps.core.utils.R.string.key_units, "new")
|
||||
if (previousUnits != newUnits) {
|
||||
overviewData.reset()
|
||||
rxBus.send(EventNewHistoryData(0L, reloadBgData = true))
|
||||
|
|
|
@ -62,9 +62,9 @@ class NotificationWithAction(
|
|||
activePlugin.activeNsClient?.handleClearAlarm(nsAlarm, 60 * 60 * 1000L)
|
||||
// Adding current time to snooze if we got staleData
|
||||
aapsLogger.debug(LTag.NOTIFICATION, "Notification text is: $text")
|
||||
val msToSnooze = sp.getInt(info.nightscout.core.utils.R.string.key_ns_alarm_stale_data_value, 15) * 60 * 1000L
|
||||
val msToSnooze = sp.getInt(app.aaps.core.utils.R.string.key_ns_alarm_stale_data_value, 15) * 60 * 1000L
|
||||
aapsLogger.debug(LTag.NOTIFICATION, "snooze nsalarm_staledatavalue in minutes is ${T.msecs(msToSnooze).mins()} currentTimeMillis is: ${System.currentTimeMillis()}")
|
||||
sp.putLong(rh.gs(info.nightscout.core.utils.R.string.key_snoozed_to) + nsAlarm.level(), System.currentTimeMillis() + msToSnooze)
|
||||
sp.putLong(rh.gs(app.aaps.core.utils.R.string.key_snoozed_to) + nsAlarm.level(), System.currentTimeMillis() + msToSnooze)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,34 +56,34 @@ class StatusLightHandler @Inject constructor(
|
|||
handleAge(
|
||||
cannulaAge,
|
||||
TherapyEvent.Type.CANNULA_CHANGE,
|
||||
info.nightscout.core.utils.R.string.key_statuslights_cage_warning,
|
||||
app.aaps.core.utils.R.string.key_statuslights_cage_warning,
|
||||
48.0,
|
||||
info.nightscout.core.utils.R.string.key_statuslights_cage_critical,
|
||||
app.aaps.core.utils.R.string.key_statuslights_cage_critical,
|
||||
72.0
|
||||
)
|
||||
handleAge(
|
||||
insulinAge,
|
||||
TherapyEvent.Type.INSULIN_CHANGE,
|
||||
info.nightscout.core.utils.R.string.key_statuslights_iage_warning,
|
||||
app.aaps.core.utils.R.string.key_statuslights_iage_warning,
|
||||
72.0,
|
||||
info.nightscout.core.utils.R.string.key_statuslights_iage_critical,
|
||||
app.aaps.core.utils.R.string.key_statuslights_iage_critical,
|
||||
144.0
|
||||
)
|
||||
handleAge(
|
||||
sensorAge,
|
||||
TherapyEvent.Type.SENSOR_CHANGE,
|
||||
info.nightscout.core.utils.R.string.key_statuslights_sage_warning,
|
||||
app.aaps.core.utils.R.string.key_statuslights_sage_warning,
|
||||
216.0,
|
||||
info.nightscout.core.utils.R.string.key_statuslights_sage_critical,
|
||||
app.aaps.core.utils.R.string.key_statuslights_sage_critical,
|
||||
240.0
|
||||
)
|
||||
if (pump.pumpDescription.isBatteryReplaceable || pump.isBatteryChangeLoggingEnabled()) {
|
||||
handleAge(
|
||||
batteryAge,
|
||||
TherapyEvent.Type.PUMP_BATTERY_CHANGE,
|
||||
info.nightscout.core.utils.R.string.key_statuslights_bage_warning,
|
||||
app.aaps.core.utils.R.string.key_statuslights_bage_warning,
|
||||
216.0,
|
||||
info.nightscout.core.utils.R.string.key_statuslights_bage_critical,
|
||||
app.aaps.core.utils.R.string.key_statuslights_bage_critical,
|
||||
240.0
|
||||
)
|
||||
}
|
||||
|
|
|
@ -512,7 +512,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(pumpCommand = false) {
|
||||
override fun run() {
|
||||
uel.log(Action.LGS_LOOP_MODE, Sources.SMS)
|
||||
sp.putString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.LGS.name)
|
||||
sp.putString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.LGS.name)
|
||||
rxBus.send(EventPreferenceChange(rh.gs(app.aaps.core.ui.R.string.lowglucosesuspend)))
|
||||
val replyText = rh.gs(R.string.smscommunicator_current_loop_mode, getApsModeText())
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
|
@ -527,7 +527,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(pumpCommand = false) {
|
||||
override fun run() {
|
||||
uel.log(Action.CLOSED_LOOP_MODE, Sources.SMS)
|
||||
sp.putString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.CLOSED.name)
|
||||
sp.putString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.CLOSED.name)
|
||||
rxBus.send(EventPreferenceChange(rh.gs(app.aaps.core.ui.R.string.closedloop)))
|
||||
val replyText = rh.gs(R.string.smscommunicator_current_loop_mode, getApsModeText())
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
|
@ -947,13 +947,13 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
lastRemoteBolusTime = dateUtil.now()
|
||||
if (isMeal) {
|
||||
profileFunction.getProfile()?.let { currentProfile ->
|
||||
var eatingSoonTTDuration = sp.getInt(info.nightscout.core.utils.R.string.key_eatingsoon_duration, Constants.defaultEatingSoonTTDuration)
|
||||
var eatingSoonTTDuration = sp.getInt(app.aaps.core.utils.R.string.key_eatingsoon_duration, Constants.defaultEatingSoonTTDuration)
|
||||
eatingSoonTTDuration =
|
||||
if (eatingSoonTTDuration > 0) eatingSoonTTDuration
|
||||
else Constants.defaultEatingSoonTTDuration
|
||||
var eatingSoonTT =
|
||||
sp.getDouble(
|
||||
info.nightscout.core.utils.R.string.key_eatingsoon_target,
|
||||
app.aaps.core.utils.R.string.key_eatingsoon_target,
|
||||
if (currentProfile.units == GlucoseUnit.MMOL) Constants.defaultEatingSoonTTmmol else Constants.defaultEatingSoonTTmgdl
|
||||
)
|
||||
eatingSoonTT =
|
||||
|
@ -1088,27 +1088,27 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
var reason = TemporaryTarget.Reason.EATING_SOON
|
||||
when {
|
||||
isMeal -> {
|
||||
keyDuration = info.nightscout.core.utils.R.string.key_eatingsoon_duration
|
||||
keyDuration = app.aaps.core.utils.R.string.key_eatingsoon_duration
|
||||
defaultTargetDuration = Constants.defaultEatingSoonTTDuration
|
||||
keyTarget = info.nightscout.core.utils.R.string.key_eatingsoon_target
|
||||
keyTarget = app.aaps.core.utils.R.string.key_eatingsoon_target
|
||||
defaultTargetMMOL = Constants.defaultEatingSoonTTmmol
|
||||
defaultTargetMGDL = Constants.defaultEatingSoonTTmgdl
|
||||
reason = TemporaryTarget.Reason.EATING_SOON
|
||||
}
|
||||
|
||||
isActivity -> {
|
||||
keyDuration = info.nightscout.core.utils.R.string.key_activity_duration
|
||||
keyDuration = app.aaps.core.utils.R.string.key_activity_duration
|
||||
defaultTargetDuration = Constants.defaultActivityTTDuration
|
||||
keyTarget = info.nightscout.core.utils.R.string.key_activity_target
|
||||
keyTarget = app.aaps.core.utils.R.string.key_activity_target
|
||||
defaultTargetMMOL = Constants.defaultActivityTTmmol
|
||||
defaultTargetMGDL = Constants.defaultActivityTTmgdl
|
||||
reason = TemporaryTarget.Reason.ACTIVITY
|
||||
}
|
||||
|
||||
isHypo -> {
|
||||
keyDuration = info.nightscout.core.utils.R.string.key_hypo_duration
|
||||
keyDuration = app.aaps.core.utils.R.string.key_hypo_duration
|
||||
defaultTargetDuration = Constants.defaultHypoTTDuration
|
||||
keyTarget = info.nightscout.core.utils.R.string.key_hypo_target
|
||||
keyTarget = app.aaps.core.utils.R.string.key_hypo_target
|
||||
defaultTargetMMOL = Constants.defaultHypoTTmmol
|
||||
defaultTargetMGDL = Constants.defaultHypoTTmgdl
|
||||
reason = TemporaryTarget.Reason.HYPOGLYCEMIA
|
||||
|
@ -1291,7 +1291,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
}
|
||||
|
||||
private fun getApsModeText(): String =
|
||||
when (ApsMode.fromString(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name))) {
|
||||
when (ApsMode.fromString(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name))) {
|
||||
ApsMode.OPEN -> rh.gs(app.aaps.core.ui.R.string.openloop)
|
||||
ApsMode.CLOSED -> rh.gs(app.aaps.core.ui.R.string.closedloop)
|
||||
ApsMode.LGS -> rh.gs(app.aaps.core.ui.R.string.lowglucosesuspend)
|
||||
|
|
|
@ -37,7 +37,7 @@ class OneTimePassword @Inject constructor(
|
|||
*/
|
||||
fun name(): String {
|
||||
val defaultUserName = rh.gs(app.aaps.core.ui.R.string.patient_name_default)
|
||||
var userName = sp.getString(info.nightscout.core.utils.R.string.key_patient_name, defaultUserName).replace(":", "").trim()
|
||||
var userName = sp.getString(app.aaps.core.utils.R.string.key_patient_name, defaultUserName).replace(":", "").trim()
|
||||
if (userName.isEmpty())
|
||||
userName = defaultUserName
|
||||
return userName
|
||||
|
|
|
@ -40,7 +40,7 @@ class ThemeSwitcherPlugin @Inject constructor(
|
|||
|
||||
override fun onStart() {
|
||||
compositeDisposable.add(rxBus.toObservable(EventPreferenceChange::class.java).subscribe {
|
||||
if (it.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_use_dark_mode))) {
|
||||
if (it.isChanged(rh.gs(app.aaps.core.utils.R.string.key_use_dark_mode))) {
|
||||
setThemeMode()
|
||||
rxBus.send(EventThemeSwitch())
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ class ThemeSwitcherPlugin @Inject constructor(
|
|||
|
||||
fun setThemeMode() {
|
||||
val mode = try {
|
||||
when (sp.getString(info.nightscout.core.utils.R.string.key_use_dark_mode, "dark")) {
|
||||
when (sp.getString(app.aaps.core.utils.R.string.key_use_dark_mode, "dark")) {
|
||||
sp.getString(R.string.value_dark_theme, "dark") -> MODE_NIGHT_YES
|
||||
sp.getString(R.string.value_light_theme, "light") -> MODE_NIGHT_NO
|
||||
else -> MODE_NIGHT_FOLLOW_SYSTEM
|
||||
|
|
|
@ -112,11 +112,11 @@ class WearPlugin @Inject constructor(
|
|||
|
||||
fun checkCustomWatchfacePreferences() {
|
||||
savedCustomWatchface?.let { cwf ->
|
||||
val cwf_authorization = sp.getBoolean(info.nightscout.core.utils.R.string.key_wear_custom_watchface_autorization, false)
|
||||
val cwf_authorization = sp.getBoolean(app.aaps.core.utils.R.string.key_wear_custom_watchface_autorization, false)
|
||||
if (cwf_authorization != cwf.metadata[CwfMetadataKey.CWF_AUTHORIZATION]?.toBooleanStrictOrNull()) {
|
||||
// resend new customWatchface to Watch with updated authorization for preferences update
|
||||
val newCwf = cwf.copy()
|
||||
newCwf.metadata[CwfMetadataKey.CWF_AUTHORIZATION] = sp.getBoolean(info.nightscout.core.utils.R.string.key_wear_custom_watchface_autorization, false).toString()
|
||||
newCwf.metadata[CwfMetadataKey.CWF_AUTHORIZATION] = sp.getBoolean(app.aaps.core.utils.R.string.key_wear_custom_watchface_autorization, false).toString()
|
||||
rxBus.send(EventMobileDataToWear(EventData.ActionSetCustomWatchface(newCwf)))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ class CwfInfosActivity : TranslatedDaggerAppCompatActivity() {
|
|||
|
||||
private fun updateGui() {
|
||||
wearPlugin.savedCustomWatchface?.let {
|
||||
val cwfAuthorization = sp.getBoolean(info.nightscout.core.utils.R.string.key_wear_custom_watchface_autorization, false)
|
||||
val cwfAuthorization = sp.getBoolean(app.aaps.core.utils.R.string.key_wear_custom_watchface_autorization, false)
|
||||
val metadata = it.metadata
|
||||
val drawable = it.resDatas[ResFileMap.CUSTOM_WATCHFACE.fileName]?.toDrawable(resources)
|
||||
binding.customWatchface.setImageDrawable(drawable)
|
||||
|
|
|
@ -417,13 +417,13 @@ class DataHandlerMobile @Inject constructor(
|
|||
bg = bgReading.valueToUnits(profileFunction.getUnits()),
|
||||
correction = 0.0,
|
||||
percentageCorrection = percentage,
|
||||
useBg = sp.getBoolean(info.nightscout.core.utils.R.string.key_wearwizard_bg, true),
|
||||
useCob = sp.getBoolean(info.nightscout.core.utils.R.string.key_wearwizard_cob, true),
|
||||
includeBolusIOB = sp.getBoolean(info.nightscout.core.utils.R.string.key_wearwizard_iob, true),
|
||||
includeBasalIOB = sp.getBoolean(info.nightscout.core.utils.R.string.key_wearwizard_iob, true),
|
||||
useBg = sp.getBoolean(app.aaps.core.utils.R.string.key_wearwizard_bg, true),
|
||||
useCob = sp.getBoolean(app.aaps.core.utils.R.string.key_wearwizard_cob, true),
|
||||
includeBolusIOB = sp.getBoolean(app.aaps.core.utils.R.string.key_wearwizard_iob, true),
|
||||
includeBasalIOB = sp.getBoolean(app.aaps.core.utils.R.string.key_wearwizard_iob, true),
|
||||
useSuperBolus = false,
|
||||
useTT = sp.getBoolean(info.nightscout.core.utils.R.string.key_wearwizard_tt, false),
|
||||
useTrend = sp.getBoolean(info.nightscout.core.utils.R.string.key_wearwizard_trend, false),
|
||||
useTT = sp.getBoolean(app.aaps.core.utils.R.string.key_wearwizard_tt, false),
|
||||
useTrend = sp.getBoolean(app.aaps.core.utils.R.string.key_wearwizard_trend, false),
|
||||
useAlarm = false
|
||||
)
|
||||
val insulinAfterConstraints = bolusWizard.insulinAfterConstraints
|
||||
|
@ -745,15 +745,15 @@ class DataHandlerMobile @Inject constructor(
|
|||
EventMobileToWear(
|
||||
EventData.Preferences(
|
||||
timeStamp = System.currentTimeMillis(),
|
||||
wearControl = sp.getBoolean(info.nightscout.core.utils.R.string.key_wear_control, false),
|
||||
wearControl = sp.getBoolean(app.aaps.core.utils.R.string.key_wear_control, false),
|
||||
unitsMgdl = profileFunction.getUnits() == GlucoseUnit.MGDL,
|
||||
bolusPercentage = sp.getInt(info.nightscout.core.utils.R.string.key_boluswizard_percentage, 100),
|
||||
maxCarbs = sp.getInt(info.nightscout.core.utils.R.string.key_treatmentssafety_maxcarbs, 48),
|
||||
maxBolus = sp.getDouble(info.nightscout.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0),
|
||||
bolusPercentage = sp.getInt(app.aaps.core.utils.R.string.key_boluswizard_percentage, 100),
|
||||
maxCarbs = sp.getInt(app.aaps.core.utils.R.string.key_treatmentssafety_maxcarbs, 48),
|
||||
maxBolus = sp.getDouble(app.aaps.core.utils.R.string.key_treatmentssafety_maxbolus, 3.0),
|
||||
insulinButtonIncrement1 = sp.getDouble(app.aaps.core.interfaces.R.string.key_insulin_button_increment_1, Constants.INSULIN_PLUS1_DEFAULT),
|
||||
insulinButtonIncrement2 = sp.getDouble(app.aaps.core.interfaces.R.string.key_insulin_button_increment_2, Constants.INSULIN_PLUS2_DEFAULT),
|
||||
carbsButtonIncrement1 = sp.getInt(info.nightscout.core.utils.R.string.key_carbs_button_increment_1, Constants.CARBS_FAV1_DEFAULT),
|
||||
carbsButtonIncrement2 = sp.getInt(info.nightscout.core.utils.R.string.key_carbs_button_increment_2, Constants.CARBS_FAV2_DEFAULT)
|
||||
carbsButtonIncrement1 = sp.getInt(app.aaps.core.utils.R.string.key_carbs_button_increment_1, Constants.CARBS_FAV1_DEFAULT),
|
||||
carbsButtonIncrement2 = sp.getInt(app.aaps.core.utils.R.string.key_carbs_button_increment_2, Constants.CARBS_FAV2_DEFAULT)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -122,14 +122,14 @@ class IobCobCalculatorPlugin @Inject constructor(
|
|||
.toObservable(EventPreferenceChange::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ event ->
|
||||
if (event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_period)) ||
|
||||
event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_age)) ||
|
||||
event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_absorption_maxtime)) ||
|
||||
event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact)) ||
|
||||
event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_absorption_cutoff)) ||
|
||||
event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_max)) ||
|
||||
event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_min)) ||
|
||||
event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_insulin_oref_peak))
|
||||
if (event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_period)) ||
|
||||
event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_age)) ||
|
||||
event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_absorption_maxtime)) ||
|
||||
event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact)) ||
|
||||
event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_absorption_cutoff)) ||
|
||||
event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_max)) ||
|
||||
event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_min)) ||
|
||||
event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_insulin_oref_peak))
|
||||
) {
|
||||
resetDataAndRunCalculation("onEventPreferenceChange", event)
|
||||
}
|
||||
|
@ -490,7 +490,7 @@ class IobCobCalculatorPlugin @Inject constructor(
|
|||
val total = IobTotal(toTime)
|
||||
val profile = profileFunction.getProfile() ?: return total
|
||||
val dia = profile.dia
|
||||
val divisor = sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_bolus_snooze_dia_divisor, 2.0)
|
||||
val divisor = sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_bolus_snooze_dia_divisor, 2.0)
|
||||
assert(divisor > 0)
|
||||
|
||||
val boluses = repository.getBolusesDataFromTime(toTime - range(), true).blockingGet()
|
||||
|
|
|
@ -92,8 +92,8 @@ class AutosensDataObject(injector: HasAndroidInjector) : AutosensData {
|
|||
// remove carbs older than timeframe
|
||||
override fun removeOldCarbs(toTime: Long, isAAPSOrWeighted: Boolean) {
|
||||
val maxAbsorptionHours: Double =
|
||||
if (isAAPSOrWeighted) sp.getDouble(info.nightscout.core.utils.R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME)
|
||||
else sp.getDouble(info.nightscout.core.utils.R.string.key_absorption_cutoff, Constants.DEFAULT_MAX_ABSORPTION_TIME)
|
||||
if (isAAPSOrWeighted) sp.getDouble(app.aaps.core.utils.R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME)
|
||||
else sp.getDouble(app.aaps.core.utils.R.string.key_absorption_cutoff, Constants.DEFAULT_MAX_ABSORPTION_TIME)
|
||||
var i = 0
|
||||
while (i < activeCarbsList.size) {
|
||||
val c = activeCarbsList[i]
|
||||
|
|
|
@ -187,7 +187,7 @@ class ProfilePlugin @Inject constructor(
|
|||
}
|
||||
sp.putInt(Constants.LOCAL_PROFILE + "_profiles", numOfProfiles)
|
||||
|
||||
sp.putLong(info.nightscout.core.utils.R.string.key_local_profile_last_change, timestamp)
|
||||
sp.putLong(app.aaps.core.utils.R.string.key_local_profile_last_change, timestamp)
|
||||
createAndStoreConvertedProfile()
|
||||
isEdited = false
|
||||
aapsLogger.debug(LTag.PROFILE, "Storing settings: " + rawProfile?.data.toString())
|
||||
|
@ -406,7 +406,7 @@ class ProfilePlugin @Inject constructor(
|
|||
}
|
||||
}
|
||||
if (numOfProfiles > 0) json.put("defaultProfile", currentProfile()?.name)
|
||||
val startDate = sp.getLong(info.nightscout.core.utils.R.string.key_local_profile_last_change, dateUtil.now())
|
||||
val startDate = sp.getLong(app.aaps.core.utils.R.string.key_local_profile_last_change, dateUtil.now())
|
||||
json.put("date", startDate)
|
||||
json.put("created_at", dateUtil.toISOAsUTC(startDate))
|
||||
json.put("startDate", dateUtil.toISOAsUTC(startDate))
|
||||
|
|
|
@ -327,7 +327,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
|||
//LOOP STATUS : enabled - APS mode - Closed
|
||||
`when`(loop.enabled).thenReturn(true)
|
||||
`when`(loop.isSuspended).thenReturn(false)
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name)
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name)
|
||||
smsCommunicatorPlugin.messages = ArrayList()
|
||||
sms = Sms("1234", "LOOP STATUS")
|
||||
smsCommunicatorPlugin.processSms(sms)
|
||||
|
@ -336,7 +336,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
|||
assertThat(smsCommunicatorPlugin.messages[1].text).isEqualTo("Loop is enabled - $modeClosed")
|
||||
|
||||
//LOOP STATUS : enabled - APS mode - Open
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.OPEN.name)
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.OPEN.name)
|
||||
smsCommunicatorPlugin.messages = ArrayList()
|
||||
smsCommunicatorPlugin.processSms(sms)
|
||||
assertThat(sms.ignored).isFalse()
|
||||
|
@ -344,7 +344,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
|||
assertThat(smsCommunicatorPlugin.messages[1].text).isEqualTo("Loop is enabled - $modeOpen")
|
||||
|
||||
//LOOP STATUS : enabled - APS mode - LGS
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.LGS.name)
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.LGS.name)
|
||||
smsCommunicatorPlugin.messages = ArrayList()
|
||||
smsCommunicatorPlugin.processSms(sms)
|
||||
assertThat(sms.ignored).isFalse()
|
||||
|
@ -352,7 +352,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
|||
assertThat(smsCommunicatorPlugin.messages[1].text).isEqualTo("Loop is enabled - $modeLgs")
|
||||
|
||||
//LOOP STATUS : enabled - APS mode - unknown
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn("some wrong value")
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn("some wrong value")
|
||||
smsCommunicatorPlugin.messages = ArrayList()
|
||||
smsCommunicatorPlugin.processSms(sms)
|
||||
assertThat(sms.ignored).isFalse()
|
||||
|
@ -504,7 +504,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
|||
var smsCommand = "LOOP CLOSED"
|
||||
val replyClosed = "In order to switch Loop mode to Closed loop reply with code "
|
||||
`when`(loop.enabled).thenReturn(true)
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name)
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name)
|
||||
smsCommunicatorPlugin.messages = ArrayList()
|
||||
sms = Sms("1234", smsCommand)
|
||||
smsCommunicatorPlugin.processSms(sms)
|
||||
|
@ -519,7 +519,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
|||
//LOOP LGS
|
||||
smsCommand = "LOOP LGS"
|
||||
val replyLgs = "In order to switch Loop mode to LGS (Low Glucose Suspend) reply with code "
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.LGS.name)
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.LGS.name)
|
||||
smsCommunicatorPlugin.messages = ArrayList()
|
||||
sms = Sms("1234", smsCommand)
|
||||
smsCommunicatorPlugin.processSms(sms)
|
||||
|
|
|
@ -32,8 +32,8 @@ abstract class AbstractSensitivityPlugin(
|
|||
return fillResult(
|
||||
ratio, carbsAbsorbed, pastSensitivity, ratioLimit, sensResult,
|
||||
deviationsArraySize,
|
||||
SafeParse.stringToDouble(sp.getString(info.nightscout.core.utils.R.string.key_openapsama_autosens_min, "0.7")),
|
||||
SafeParse.stringToDouble(sp.getString(info.nightscout.core.utils.R.string.key_openapsama_autosens_max, "1.2"))
|
||||
SafeParse.stringToDouble(sp.getString(app.aaps.core.utils.R.string.key_openapsama_autosens_min, "0.7")),
|
||||
SafeParse.stringToDouble(sp.getString(app.aaps.core.utils.R.string.key_openapsama_autosens_max, "1.2"))
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -49,12 +49,12 @@ class SensitivityAAPSPlugin @Inject constructor(
|
|||
) {
|
||||
|
||||
override fun detectSensitivity(ads: AutosensDataStore, fromTime: Long, toTime: Long): AutosensResult {
|
||||
val age = sp.getString(info.nightscout.core.utils.R.string.key_age, "")
|
||||
val age = sp.getString(app.aaps.core.utils.R.string.key_age, "")
|
||||
var defaultHours = 24
|
||||
if (age == rh.gs(info.nightscout.core.utils.R.string.key_adult)) defaultHours = 24
|
||||
if (age == rh.gs(info.nightscout.core.utils.R.string.key_teenage)) defaultHours = 4
|
||||
if (age == rh.gs(info.nightscout.core.utils.R.string.key_child)) defaultHours = 4
|
||||
val hoursForDetection = sp.getInt(info.nightscout.core.utils.R.string.key_openapsama_autosens_period, defaultHours)
|
||||
if (age == rh.gs(app.aaps.core.utils.R.string.key_adult)) defaultHours = 24
|
||||
if (age == rh.gs(app.aaps.core.utils.R.string.key_teenage)) defaultHours = 4
|
||||
if (age == rh.gs(app.aaps.core.utils.R.string.key_child)) defaultHours = 4
|
||||
val hoursForDetection = sp.getInt(app.aaps.core.utils.R.string.key_openapsama_autosens_period, defaultHours)
|
||||
val profile = profileFunction.getProfile()
|
||||
if (profile == null) {
|
||||
aapsLogger.error("No profile")
|
||||
|
@ -139,7 +139,7 @@ class SensitivityAAPSPlugin @Inject constructor(
|
|||
return output
|
||||
}
|
||||
|
||||
override fun maxAbsorptionHours(): Double = sp.getDouble(info.nightscout.core.utils.R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME)
|
||||
override fun maxAbsorptionHours(): Double = sp.getDouble(app.aaps.core.utils.R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME)
|
||||
override val isMinCarbsAbsorptionDynamic: Boolean = true
|
||||
override val isOref1: Boolean = false
|
||||
|
||||
|
@ -149,10 +149,10 @@ class SensitivityAAPSPlugin @Inject constructor(
|
|||
override fun configuration(): JSONObject {
|
||||
val c = JSONObject()
|
||||
try {
|
||||
c.put(rh.gs(info.nightscout.core.utils.R.string.key_absorption_maxtime), sp.getDouble(info.nightscout.core.utils.R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME))
|
||||
c.put(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_period), sp.getInt(info.nightscout.core.utils.R.string.key_openapsama_autosens_period, 24))
|
||||
c.put(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_max), sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_max, 1.2))
|
||||
c.put(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_min), sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_min, 0.7))
|
||||
c.put(rh.gs(app.aaps.core.utils.R.string.key_absorption_maxtime), sp.getDouble(app.aaps.core.utils.R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME))
|
||||
c.put(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_period), sp.getInt(app.aaps.core.utils.R.string.key_openapsama_autosens_period, 24))
|
||||
c.put(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_max), sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_max, 1.2))
|
||||
c.put(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_min), sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_min, 0.7))
|
||||
} catch (e: JSONException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
@ -161,28 +161,28 @@ class SensitivityAAPSPlugin @Inject constructor(
|
|||
|
||||
override fun applyConfiguration(configuration: JSONObject) {
|
||||
try {
|
||||
if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_absorption_maxtime))) sp.putDouble(
|
||||
info.nightscout.core.utils.R.string.key_absorption_maxtime, configuration.getDouble(
|
||||
if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_absorption_maxtime))) sp.putDouble(
|
||||
app.aaps.core.utils.R.string.key_absorption_maxtime, configuration.getDouble(
|
||||
rh.gs(
|
||||
info.nightscout.core.utils.R.string.key_absorption_maxtime
|
||||
app.aaps.core.utils.R.string.key_absorption_maxtime
|
||||
)
|
||||
)
|
||||
)
|
||||
if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_period))) sp.putDouble(
|
||||
info.nightscout.core.utils.R.string.key_openapsama_autosens_period,
|
||||
configuration.getDouble(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_period))
|
||||
if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_period))) sp.putDouble(
|
||||
app.aaps.core.utils.R.string.key_openapsama_autosens_period,
|
||||
configuration.getDouble(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_period))
|
||||
)
|
||||
if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_max))) sp.getDouble(
|
||||
info.nightscout.core.utils.R.string.key_openapsama_autosens_max, configuration.getDouble(
|
||||
if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_max))) sp.getDouble(
|
||||
app.aaps.core.utils.R.string.key_openapsama_autosens_max, configuration.getDouble(
|
||||
rh.gs(
|
||||
info.nightscout.core.utils.R.string.key_openapsama_autosens_max
|
||||
app.aaps.core.utils.R.string.key_openapsama_autosens_max
|
||||
)
|
||||
)
|
||||
)
|
||||
if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_min))) sp.getDouble(
|
||||
info.nightscout.core.utils.R.string.key_openapsama_autosens_min, configuration.getDouble(
|
||||
if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_min))) sp.getDouble(
|
||||
app.aaps.core.utils.R.string.key_openapsama_autosens_min, configuration.getDouble(
|
||||
rh.gs(
|
||||
info.nightscout.core.utils.R.string.key_openapsama_autosens_min
|
||||
app.aaps.core.utils.R.string.key_openapsama_autosens_min
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -204,7 +204,7 @@ class SensitivityOref1Plugin @Inject constructor(
|
|||
return output
|
||||
}
|
||||
|
||||
override fun maxAbsorptionHours(): Double = sp.getDouble(info.nightscout.core.utils.R.string.key_absorption_cutoff, Constants.DEFAULT_MAX_ABSORPTION_TIME)
|
||||
override fun maxAbsorptionHours(): Double = sp.getDouble(app.aaps.core.utils.R.string.key_absorption_cutoff, Constants.DEFAULT_MAX_ABSORPTION_TIME)
|
||||
override val isMinCarbsAbsorptionDynamic: Boolean = false
|
||||
override val isOref1: Boolean = true
|
||||
|
||||
|
@ -212,12 +212,12 @@ class SensitivityOref1Plugin @Inject constructor(
|
|||
val c = JSONObject()
|
||||
try {
|
||||
c.put(
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact),
|
||||
sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact)
|
||||
rh.gs(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact),
|
||||
sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact)
|
||||
)
|
||||
c.put(rh.gs(info.nightscout.core.utils.R.string.key_absorption_cutoff), sp.getDouble(info.nightscout.core.utils.R.string.key_absorption_cutoff, Constants.DEFAULT_MAX_ABSORPTION_TIME))
|
||||
c.put(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_max), sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_max, 1.2))
|
||||
c.put(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_min), sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_min, 0.7))
|
||||
c.put(rh.gs(app.aaps.core.utils.R.string.key_absorption_cutoff), sp.getDouble(app.aaps.core.utils.R.string.key_absorption_cutoff, Constants.DEFAULT_MAX_ABSORPTION_TIME))
|
||||
c.put(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_max), sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_max, 1.2))
|
||||
c.put(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_min), sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_min, 0.7))
|
||||
} catch (e: JSONException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
@ -226,28 +226,28 @@ class SensitivityOref1Plugin @Inject constructor(
|
|||
|
||||
override fun applyConfiguration(configuration: JSONObject) {
|
||||
try {
|
||||
if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact))) sp.putDouble(
|
||||
info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact,
|
||||
configuration.getDouble(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_min_5m_carbimpact))
|
||||
if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact))) sp.putDouble(
|
||||
app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact,
|
||||
configuration.getDouble(rh.gs(app.aaps.core.utils.R.string.key_openapsama_min_5m_carbimpact))
|
||||
)
|
||||
if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_absorption_cutoff))) sp.putDouble(
|
||||
info.nightscout.core.utils.R.string.key_absorption_cutoff, configuration.getDouble(
|
||||
if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_absorption_cutoff))) sp.putDouble(
|
||||
app.aaps.core.utils.R.string.key_absorption_cutoff, configuration.getDouble(
|
||||
rh.gs(
|
||||
info.nightscout.core.utils.R.string.key_absorption_cutoff
|
||||
app.aaps.core.utils.R.string.key_absorption_cutoff
|
||||
)
|
||||
)
|
||||
)
|
||||
if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_max))) sp.getDouble(
|
||||
info.nightscout.core.utils.R.string.key_openapsama_autosens_max, configuration.getDouble(
|
||||
if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_max))) sp.getDouble(
|
||||
app.aaps.core.utils.R.string.key_openapsama_autosens_max, configuration.getDouble(
|
||||
rh.gs(
|
||||
info.nightscout.core.utils.R.string.key_openapsama_autosens_max
|
||||
app.aaps.core.utils.R.string.key_openapsama_autosens_max
|
||||
)
|
||||
)
|
||||
)
|
||||
if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_min))) sp.getDouble(
|
||||
info.nightscout.core.utils.R.string.key_openapsama_autosens_min, configuration.getDouble(
|
||||
if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_min))) sp.getDouble(
|
||||
app.aaps.core.utils.R.string.key_openapsama_autosens_min, configuration.getDouble(
|
||||
rh.gs(
|
||||
info.nightscout.core.utils.R.string.key_openapsama_autosens_min
|
||||
app.aaps.core.utils.R.string.key_openapsama_autosens_min
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -48,12 +48,12 @@ class SensitivityWeightedAveragePlugin @Inject constructor(
|
|||
) {
|
||||
|
||||
override fun detectSensitivity(ads: AutosensDataStore, fromTime: Long, toTime: Long): AutosensResult {
|
||||
val age = sp.getString(info.nightscout.core.utils.R.string.key_age, "")
|
||||
val age = sp.getString(app.aaps.core.utils.R.string.key_age, "")
|
||||
var defaultHours = 24
|
||||
if (age == rh.gs(info.nightscout.core.utils.R.string.key_adult)) defaultHours = 24
|
||||
if (age == rh.gs(info.nightscout.core.utils.R.string.key_teenage)) defaultHours = 4
|
||||
if (age == rh.gs(info.nightscout.core.utils.R.string.key_child)) defaultHours = 4
|
||||
val hoursForDetection = sp.getInt(info.nightscout.core.utils.R.string.key_openapsama_autosens_period, defaultHours)
|
||||
if (age == rh.gs(app.aaps.core.utils.R.string.key_adult)) defaultHours = 24
|
||||
if (age == rh.gs(app.aaps.core.utils.R.string.key_teenage)) defaultHours = 4
|
||||
if (age == rh.gs(app.aaps.core.utils.R.string.key_child)) defaultHours = 4
|
||||
val hoursForDetection = sp.getInt(app.aaps.core.utils.R.string.key_openapsama_autosens_period, defaultHours)
|
||||
if (ads.autosensDataTable.size() < 4) {
|
||||
aapsLogger.debug(LTag.AUTOSENS, "No autosens data available. lastDataTime=" + ads.lastDataTime(dateUtil))
|
||||
return AutosensResult()
|
||||
|
@ -159,7 +159,7 @@ class SensitivityWeightedAveragePlugin @Inject constructor(
|
|||
return output
|
||||
}
|
||||
|
||||
override fun maxAbsorptionHours(): Double = sp.getDouble(info.nightscout.core.utils.R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME)
|
||||
override fun maxAbsorptionHours(): Double = sp.getDouble(app.aaps.core.utils.R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME)
|
||||
override val isMinCarbsAbsorptionDynamic: Boolean = true
|
||||
override val isOref1: Boolean = false
|
||||
|
||||
|
@ -169,10 +169,10 @@ class SensitivityWeightedAveragePlugin @Inject constructor(
|
|||
override fun configuration(): JSONObject {
|
||||
val c = JSONObject()
|
||||
try {
|
||||
c.put(rh.gs(info.nightscout.core.utils.R.string.key_absorption_maxtime), sp.getDouble(info.nightscout.core.utils.R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME))
|
||||
c.put(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_period), sp.getInt(info.nightscout.core.utils.R.string.key_openapsama_autosens_period, 24))
|
||||
c.put(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_max), sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_max, 1.2))
|
||||
c.put(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_min), sp.getDouble(info.nightscout.core.utils.R.string.key_openapsama_autosens_min, 0.7))
|
||||
c.put(rh.gs(app.aaps.core.utils.R.string.key_absorption_maxtime), sp.getDouble(app.aaps.core.utils.R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME))
|
||||
c.put(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_period), sp.getInt(app.aaps.core.utils.R.string.key_openapsama_autosens_period, 24))
|
||||
c.put(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_max), sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_max, 1.2))
|
||||
c.put(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_min), sp.getDouble(app.aaps.core.utils.R.string.key_openapsama_autosens_min, 0.7))
|
||||
} catch (e: JSONException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
@ -181,23 +181,23 @@ class SensitivityWeightedAveragePlugin @Inject constructor(
|
|||
|
||||
override fun applyConfiguration(configuration: JSONObject) {
|
||||
try {
|
||||
if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_absorption_maxtime))) sp.putDouble(
|
||||
info.nightscout.core.utils.R.string.key_absorption_maxtime, configuration.getDouble(
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_absorption_maxtime)
|
||||
if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_absorption_maxtime))) sp.putDouble(
|
||||
app.aaps.core.utils.R.string.key_absorption_maxtime, configuration.getDouble(
|
||||
rh.gs(app.aaps.core.utils.R.string.key_absorption_maxtime)
|
||||
)
|
||||
)
|
||||
if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_period))) sp.putDouble(
|
||||
info.nightscout.core.utils.R.string.key_openapsama_autosens_period,
|
||||
configuration.getDouble(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_period))
|
||||
if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_period))) sp.putDouble(
|
||||
app.aaps.core.utils.R.string.key_openapsama_autosens_period,
|
||||
configuration.getDouble(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_period))
|
||||
)
|
||||
if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_max))) sp.getDouble(
|
||||
info.nightscout.core.utils.R.string.key_openapsama_autosens_max, configuration.getDouble(
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_max)
|
||||
if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_max))) sp.getDouble(
|
||||
app.aaps.core.utils.R.string.key_openapsama_autosens_max, configuration.getDouble(
|
||||
rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_max)
|
||||
)
|
||||
)
|
||||
if (configuration.has(rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_min))) sp.getDouble(
|
||||
info.nightscout.core.utils.R.string.key_openapsama_autosens_min, configuration.getDouble(
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_openapsama_autosens_min)
|
||||
if (configuration.has(rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_min))) sp.getDouble(
|
||||
app.aaps.core.utils.R.string.key_openapsama_autosens_min, configuration.getDouble(
|
||||
rh.gs(app.aaps.core.utils.R.string.key_openapsama_autosens_min)
|
||||
)
|
||||
)
|
||||
} catch (e: JSONException) {
|
||||
|
|
|
@ -84,7 +84,7 @@ class NsIncomingDataProcessor @Inject constructor(
|
|||
@Suppress("SpellCheckingInspection")
|
||||
fun processSgvs(sgvs: Any) {
|
||||
|
||||
if (!nsClientSource.isEnabled() && !sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_cgm, false)) return
|
||||
if (!nsClientSource.isEnabled() && !sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_cgm, false)) return
|
||||
|
||||
var latestDateInReceivedData: Long = 0
|
||||
aapsLogger.debug(LTag.NSCLIENT, "Received NS Data: $sgvs")
|
||||
|
@ -123,15 +123,15 @@ class NsIncomingDataProcessor @Inject constructor(
|
|||
|
||||
when (treatment) {
|
||||
is NSBolus ->
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_insulin, false) || config.NSCLIENT)
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_insulin, false) || config.NSCLIENT)
|
||||
storeDataForDb.boluses.add(treatment.toBolus())
|
||||
|
||||
is NSCarbs ->
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_carbs, false) || config.NSCLIENT)
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_carbs, false) || config.NSCLIENT)
|
||||
storeDataForDb.carbs.add(treatment.toCarbs())
|
||||
|
||||
is NSTemporaryTarget ->
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_temp_target, false) || config.NSCLIENT) {
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_temp_target, false) || config.NSCLIENT) {
|
||||
if (treatment.duration > 0L) {
|
||||
// not ending event
|
||||
if (treatment.targetBottomAsMgdl() < Constants.MIN_TT_MGDL
|
||||
|
@ -152,14 +152,14 @@ class NsIncomingDataProcessor @Inject constructor(
|
|||
storeDataForDb.temporaryBasals.add(treatment.toTemporaryBasal())
|
||||
|
||||
is NSEffectiveProfileSwitch ->
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT) {
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT) {
|
||||
treatment.toEffectiveProfileSwitch(dateUtil)?.let { effectiveProfileSwitch ->
|
||||
storeDataForDb.effectiveProfileSwitches.add(effectiveProfileSwitch)
|
||||
}
|
||||
}
|
||||
|
||||
is NSProfileSwitch ->
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT) {
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT) {
|
||||
treatment.toProfileSwitch(activePlugin, dateUtil)?.let { profileSwitch ->
|
||||
storeDataForDb.profileSwitches.add(profileSwitch)
|
||||
}
|
||||
|
@ -171,13 +171,13 @@ class NsIncomingDataProcessor @Inject constructor(
|
|||
}
|
||||
|
||||
is NSTherapyEvent ->
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT)
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT)
|
||||
treatment.toTherapyEvent().let { therapyEvent ->
|
||||
storeDataForDb.therapyEvents.add(therapyEvent)
|
||||
}
|
||||
|
||||
is NSOfflineEvent ->
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_offline_event, false) && config.isEngineeringMode() || config.NSCLIENT)
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_offline_event, false) && config.isEngineeringMode() || config.NSCLIENT)
|
||||
treatment.toOfflineEvent().let { offlineEvent ->
|
||||
storeDataForDb.offlineEvents.add(offlineEvent)
|
||||
}
|
||||
|
@ -237,10 +237,10 @@ class NsIncomingDataProcessor @Inject constructor(
|
|||
}
|
||||
|
||||
fun processProfile(profileJson: JSONObject) {
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_profile_store, true) || config.NSCLIENT) {
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_profile_store, true) || config.NSCLIENT) {
|
||||
val store = instantiator.provideProfileStore(profileJson)
|
||||
val createdAt = store.getStartDate()
|
||||
val lastLocalChange = sp.getLong(info.nightscout.core.utils.R.string.key_local_profile_last_change, 0)
|
||||
val lastLocalChange = sp.getLong(app.aaps.core.utils.R.string.key_local_profile_last_change, 0)
|
||||
aapsLogger.debug(LTag.PROFILE, "Received profileStore: createdAt: $createdAt Local last modification: $lastLocalChange")
|
||||
if (createdAt > lastLocalChange || createdAt % 1000 == 0L) { // whole second means edited in NS
|
||||
profileSource.loadFromStore(store)
|
||||
|
|
|
@ -555,13 +555,13 @@ class StoreDataForDbImpl @Inject constructor(
|
|||
sendLog("BolusCalculatorResult", BolusCalculatorResult::class.java.simpleName)
|
||||
SystemClock.sleep(pause)
|
||||
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT)
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT)
|
||||
therapyEvents.filter { it.type == TherapyEvent.Type.ANNOUNCEMENT }.forEach {
|
||||
if (it.timestamp > dateUtil.now() - 15 * 60 * 1000L &&
|
||||
it.note?.isNotEmpty() == true &&
|
||||
it.enteredBy != sp.getString("careportal_enteredby", "AndroidAPS")
|
||||
) {
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_announcements, config.NSCLIENT))
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_announcements, config.NSCLIENT))
|
||||
uiInteraction.addNotificationValidFor(Notification.NS_ANNOUNCEMENT, it.note ?: "", Notification.ANNOUNCEMENT, 60)
|
||||
}
|
||||
}
|
||||
|
@ -977,7 +977,7 @@ class StoreDataForDbImpl @Inject constructor(
|
|||
|
||||
override fun updateDeletedTreatmentsInDb() {
|
||||
deleteTreatment.forEach { id ->
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_insulin, false) || config.NSCLIENT)
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_insulin, false) || config.NSCLIENT)
|
||||
repository.findBolusByNSId(id)?.let { bolus ->
|
||||
repository.runTransactionForResult(InvalidateBolusTransaction(bolus.id))
|
||||
.doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating Bolus", it) }
|
||||
|
@ -989,7 +989,7 @@ class StoreDataForDbImpl @Inject constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_carbs, false) || config.NSCLIENT)
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_carbs, false) || config.NSCLIENT)
|
||||
repository.findCarbsByNSId(id)?.let { carb ->
|
||||
repository.runTransactionForResult(InvalidateCarbsTransaction(carb.id))
|
||||
.doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating Carbs", it) }
|
||||
|
@ -1001,7 +1001,7 @@ class StoreDataForDbImpl @Inject constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_temp_target, false) || config.NSCLIENT)
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_temp_target, false) || config.NSCLIENT)
|
||||
repository.findTemporaryTargetByNSId(id)?.let { gv ->
|
||||
repository.runTransactionForResult(InvalidateTemporaryTargetTransaction(gv.id))
|
||||
.doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating TemporaryTarget", it) }
|
||||
|
@ -1025,7 +1025,7 @@ class StoreDataForDbImpl @Inject constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT)
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT)
|
||||
repository.findEffectiveProfileSwitchByNSId(id)?.let { gv ->
|
||||
repository.runTransactionForResult(InvalidateEffectiveProfileSwitchTransaction(gv.id))
|
||||
.doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating EffectiveProfileSwitch", it) }
|
||||
|
@ -1037,7 +1037,7 @@ class StoreDataForDbImpl @Inject constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT)
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT)
|
||||
repository.findProfileSwitchByNSId(id)?.let { gv ->
|
||||
repository.runTransactionForResult(InvalidateProfileSwitchTransaction(gv.id))
|
||||
.doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating ProfileSwitch", it) }
|
||||
|
@ -1060,7 +1060,7 @@ class StoreDataForDbImpl @Inject constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT)
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT)
|
||||
repository.findTherapyEventByNSId(id)?.let { gv ->
|
||||
repository.runTransactionForResult(InvalidateTherapyEventTransaction(gv.id))
|
||||
.doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating TherapyEvent", it) }
|
||||
|
@ -1072,7 +1072,7 @@ class StoreDataForDbImpl @Inject constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_offline_event, false) && config.isEngineeringMode() || config.NSCLIENT)
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_offline_event, false) && config.isEngineeringMode() || config.NSCLIENT)
|
||||
repository.findOfflineEventByNSId(id)?.let { gv ->
|
||||
repository.runTransactionForResult(InvalidateOfflineEventTransaction(gv.id))
|
||||
.doOnError { aapsLogger.error(LTag.DATABASE, "Error while invalidating OfflineEvent", it) }
|
||||
|
|
|
@ -76,7 +76,7 @@ class DataSyncSelectorV1 @Inject constructor(
|
|||
private var running = false
|
||||
private val sync = Any()
|
||||
|
||||
private val bgUploadEnabled get() = sp.getBoolean(info.nightscout.core.utils.R.string.key_do_ns_upload, false) && activePlugin.activeBgSource !is NSClientSource
|
||||
private val bgUploadEnabled get() = sp.getBoolean(app.aaps.core.utils.R.string.key_do_ns_upload, false) && activePlugin.activeBgSource !is NSClientSource
|
||||
|
||||
override suspend fun doUpload() {
|
||||
synchronized(sync) {
|
||||
|
@ -782,7 +782,7 @@ class DataSyncSelectorV1 @Inject constructor(
|
|||
private suspend fun processChangedProfileStore() {
|
||||
if (isPaused) return
|
||||
val lastSync = sp.getLong(R.string.key_ns_profile_store_last_synced_timestamp, 0)
|
||||
val lastChange = sp.getLong(info.nightscout.core.utils.R.string.key_local_profile_last_change, 0)
|
||||
val lastChange = sp.getLong(app.aaps.core.utils.R.string.key_local_profile_last_change, 0)
|
||||
if (lastChange == 0L) return
|
||||
if (lastChange > lastSync) {
|
||||
if (activePlugin.activeProfileSource.profile?.allProfilesValid != true) return
|
||||
|
|
|
@ -124,8 +124,8 @@ class NSClientPlugin @Inject constructor(
|
|||
if (config.NSCLIENT) {
|
||||
preferenceFragment.findPreference<PreferenceScreen>(rh.gs(R.string.ns_sync_options))?.isVisible = false
|
||||
|
||||
preferenceFragment.findPreference<SwitchPreference>(rh.gs(info.nightscout.core.utils.R.string.key_ns_create_announcements_from_errors))?.isVisible = false
|
||||
preferenceFragment.findPreference<SwitchPreference>(rh.gs(info.nightscout.core.utils.R.string.key_ns_create_announcements_from_carbs_req))?.isVisible = false
|
||||
preferenceFragment.findPreference<SwitchPreference>(rh.gs(app.aaps.core.utils.R.string.key_ns_create_announcements_from_errors))?.isVisible = false
|
||||
preferenceFragment.findPreference<SwitchPreference>(rh.gs(app.aaps.core.utils.R.string.key_ns_create_announcements_from_carbs_req))?.isVisible = false
|
||||
}
|
||||
preferenceFragment.findPreference<SwitchPreference>(rh.gs(R.string.key_ns_receive_tbr_eb))?.isVisible = config.isEngineeringMode()
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ class NSDeviceStatusHandler @Inject constructor(
|
|||
updateDeviceData(nsDeviceStatus)
|
||||
updateOpenApsData(nsDeviceStatus)
|
||||
updateUploaderData(nsDeviceStatus)
|
||||
nsDeviceStatus.pump?.let { sp.putBoolean(info.nightscout.core.utils.R.string.key_objectives_pump_status_is_available_in_ns, true) } // Objective 0
|
||||
nsDeviceStatus.pump?.let { sp.putBoolean(app.aaps.core.utils.R.string.key_objectives_pump_status_is_available_in_ns, true) } // Objective 0
|
||||
if (config.NSCLIENT && !configurationDetected)
|
||||
nsDeviceStatus.configuration?.let {
|
||||
// copy configuration of Insulin and Sensitivity from main AAPS
|
||||
|
|
|
@ -238,14 +238,14 @@ class NSSettingsStatusImpl @Inject constructor(
|
|||
|
||||
override fun copyStatusLightsNsSettings(context: Context?) {
|
||||
val action = Runnable {
|
||||
getExtendedWarnValue("cage", "warn")?.let { sp.putDouble(info.nightscout.core.utils.R.string.key_statuslights_cage_warning, it) }
|
||||
getExtendedWarnValue("cage", "urgent")?.let { sp.putDouble(info.nightscout.core.utils.R.string.key_statuslights_cage_critical, it) }
|
||||
getExtendedWarnValue("iage", "warn")?.let { sp.putDouble(info.nightscout.core.utils.R.string.key_statuslights_iage_warning, it) }
|
||||
getExtendedWarnValue("iage", "urgent")?.let { sp.putDouble(info.nightscout.core.utils.R.string.key_statuslights_iage_critical, it) }
|
||||
getExtendedWarnValue("sage", "warn")?.let { sp.putDouble(info.nightscout.core.utils.R.string.key_statuslights_sage_warning, it) }
|
||||
getExtendedWarnValue("sage", "urgent")?.let { sp.putDouble(info.nightscout.core.utils.R.string.key_statuslights_sage_critical, it) }
|
||||
getExtendedWarnValue("bage", "warn")?.let { sp.putDouble(info.nightscout.core.utils.R.string.key_statuslights_bage_warning, it) }
|
||||
getExtendedWarnValue("bage", "urgent")?.let { sp.putDouble(info.nightscout.core.utils.R.string.key_statuslights_bage_critical, it) }
|
||||
getExtendedWarnValue("cage", "warn")?.let { sp.putDouble(app.aaps.core.utils.R.string.key_statuslights_cage_warning, it) }
|
||||
getExtendedWarnValue("cage", "urgent")?.let { sp.putDouble(app.aaps.core.utils.R.string.key_statuslights_cage_critical, it) }
|
||||
getExtendedWarnValue("iage", "warn")?.let { sp.putDouble(app.aaps.core.utils.R.string.key_statuslights_iage_warning, it) }
|
||||
getExtendedWarnValue("iage", "urgent")?.let { sp.putDouble(app.aaps.core.utils.R.string.key_statuslights_iage_critical, it) }
|
||||
getExtendedWarnValue("sage", "warn")?.let { sp.putDouble(app.aaps.core.utils.R.string.key_statuslights_sage_warning, it) }
|
||||
getExtendedWarnValue("sage", "urgent")?.let { sp.putDouble(app.aaps.core.utils.R.string.key_statuslights_sage_critical, it) }
|
||||
getExtendedWarnValue("bage", "warn")?.let { sp.putDouble(app.aaps.core.utils.R.string.key_statuslights_bage_warning, it) }
|
||||
getExtendedWarnValue("bage", "urgent")?.let { sp.putDouble(app.aaps.core.utils.R.string.key_statuslights_bage_critical, it) }
|
||||
uel.log(Action.NS_SETTINGS_COPIED, UserEntry.Sources.NSClient)
|
||||
}
|
||||
|
||||
|
|
|
@ -101,10 +101,10 @@ class ProcessedDeviceStatusDataImpl @Inject constructor(
|
|||
|
||||
// test warning level
|
||||
val level = when {
|
||||
openAPSData.clockSuggested + T.mins(sp.getLong(info.nightscout.core.utils.R.string.key_ns_alarm_urgent_stale_data_value, 31))
|
||||
openAPSData.clockSuggested + T.mins(sp.getLong(app.aaps.core.utils.R.string.key_ns_alarm_urgent_stale_data_value, 31))
|
||||
.msecs() < dateUtil.now() -> ProcessedDeviceStatusData.Levels.URGENT
|
||||
|
||||
openAPSData.clockSuggested + T.mins(sp.getLong(info.nightscout.core.utils.R.string.key_ns_alarm_stale_data_value, 16)).msecs() < dateUtil.now() -> ProcessedDeviceStatusData.Levels.WARN
|
||||
openAPSData.clockSuggested + T.mins(sp.getLong(app.aaps.core.utils.R.string.key_ns_alarm_stale_data_value, 16)).msecs() < dateUtil.now() -> ProcessedDeviceStatusData.Levels.WARN
|
||||
else -> ProcessedDeviceStatusData.Levels.INFO
|
||||
}
|
||||
string.append("<span style=\"color:${level.toColor()}\">")
|
||||
|
|
|
@ -137,8 +137,8 @@ import javax.inject.Inject
|
|||
.toObservable(EventPreferenceChange::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ event: EventPreferenceChange ->
|
||||
if (event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_nsclientinternal_url)) ||
|
||||
event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_nsclientinternal_api_secret)) ||
|
||||
if (event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_nsclientinternal_url)) ||
|
||||
event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_nsclientinternal_api_secret)) ||
|
||||
event.isChanged(rh.gs(R.string.key_ns_paused))
|
||||
) {
|
||||
latestDateInReceivedData = 0
|
||||
|
@ -360,8 +360,8 @@ import javax.inject.Inject
|
|||
|
||||
private fun readPreferences() {
|
||||
nsEnabled = nsClientPlugin.isEnabled()
|
||||
nsURL = sp.getString(info.nightscout.core.utils.R.string.key_nsclientinternal_url, "")
|
||||
nsAPISecret = sp.getString(info.nightscout.core.utils.R.string.key_nsclientinternal_api_secret, "")
|
||||
nsURL = sp.getString(app.aaps.core.utils.R.string.key_nsclientinternal_url, "")
|
||||
nsAPISecret = sp.getString(app.aaps.core.utils.R.string.key_nsclientinternal_api_secret, "")
|
||||
nsDevice = sp.getString("careportal_enteredby", "")
|
||||
}
|
||||
|
||||
|
@ -557,7 +557,7 @@ import javax.inject.Inject
|
|||
if (sgvs.length() > 0) {
|
||||
rxBus.send(EventNSClientNewLog("◄ DATA", "received " + sgvs.length() + " sgvs"))
|
||||
// Objective0
|
||||
sp.putBoolean(info.nightscout.core.utils.R.string.key_objectives_bg_is_available_in_ns, true)
|
||||
sp.putBoolean(app.aaps.core.utils.R.string.key_objectives_bg_is_available_in_ns, true)
|
||||
nsIncomingDataProcessor.processSgvs(sgvs)
|
||||
storeDataForDb.storeGlucoseValuesToDb()
|
||||
}
|
||||
|
@ -635,7 +635,7 @@ import javax.inject.Inject
|
|||
|
||||
private fun handleAnnouncement(announcement: JSONObject) {
|
||||
val defaultVal = config.NSCLIENT
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_announcements, defaultVal)) {
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_announcements, defaultVal)) {
|
||||
val nsAlarm = NSAlarmObject(announcement)
|
||||
uiInteraction.addNotificationWithAction(injector, nsAlarm)
|
||||
rxBus.send(EventNSClientNewLog("◄ ANNOUNCEMENT", safeGetString(announcement, "message", "received")))
|
||||
|
@ -645,8 +645,8 @@ import javax.inject.Inject
|
|||
|
||||
private fun handleAlarm(alarm: JSONObject) {
|
||||
val defaultVal = config.NSCLIENT
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_alarms, defaultVal)) {
|
||||
val snoozedTo = sp.getLong(rh.gs(info.nightscout.core.utils.R.string.key_snoozed_to) + alarm.optString("level"), 0L)
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_alarms, defaultVal)) {
|
||||
val snoozedTo = sp.getLong(rh.gs(app.aaps.core.utils.R.string.key_snoozed_to) + alarm.optString("level"), 0L)
|
||||
if (snoozedTo == 0L || System.currentTimeMillis() > snoozedTo) {
|
||||
val nsAlarm = NSAlarmObject(alarm)
|
||||
uiInteraction.addNotificationWithAction(injector, nsAlarm)
|
||||
|
@ -658,8 +658,8 @@ import javax.inject.Inject
|
|||
|
||||
private fun handleUrgentAlarm(alarm: JSONObject) {
|
||||
val defaultVal = config.NSCLIENT
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_alarms, defaultVal)) {
|
||||
val snoozedTo = sp.getLong(rh.gs(info.nightscout.core.utils.R.string.key_snoozed_to) + alarm.optString("level"), 0L)
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_alarms, defaultVal)) {
|
||||
val snoozedTo = sp.getLong(rh.gs(app.aaps.core.utils.R.string.key_snoozed_to) + alarm.optString("level"), 0L)
|
||||
if (snoozedTo == 0L || System.currentTimeMillis() > snoozedTo) {
|
||||
val nsAlarm = NSAlarmObject(alarm)
|
||||
uiInteraction.addNotificationWithAction(injector, nsAlarm)
|
||||
|
|
|
@ -72,14 +72,14 @@ class NSClientAddUpdateWorker(
|
|||
if (mills > latestDateInReceivedData) latestDateInReceivedData = mills
|
||||
|
||||
if (insulin > 0) {
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_insulin, false) || config.NSCLIENT) {
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_insulin, false) || config.NSCLIENT) {
|
||||
Bolus.fromJson(json)?.let { bolus ->
|
||||
storeDataForDb.boluses.add(bolus)
|
||||
} ?: aapsLogger.error("Error parsing bolus json $json")
|
||||
}
|
||||
}
|
||||
if (carbs > 0) {
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_carbs, false) || config.NSCLIENT) {
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_carbs, false) || config.NSCLIENT) {
|
||||
Carbs.fromJson(json)?.let { carb ->
|
||||
storeDataForDb.carbs.add(carb)
|
||||
} ?: aapsLogger.error("Error parsing bolus json $json")
|
||||
|
@ -99,14 +99,14 @@ class NSClientAddUpdateWorker(
|
|||
when {
|
||||
insulin > 0 || carbs > 0 -> Any()
|
||||
eventType == TherapyEvent.Type.TEMPORARY_TARGET.text ->
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_temp_target, false) || config.NSCLIENT) {
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_temp_target, false) || config.NSCLIENT) {
|
||||
TemporaryTarget.fromJson(json, profileUtil)?.let { temporaryTarget ->
|
||||
storeDataForDb.temporaryTargets.add(temporaryTarget)
|
||||
} ?: aapsLogger.error("Error parsing TT json $json")
|
||||
}
|
||||
|
||||
eventType == TherapyEvent.Type.NOTE.text && json.isEffectiveProfileSwitch() -> // replace this by new Type when available in NS
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT) {
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT) {
|
||||
EffectiveProfileSwitch.fromJson(json, dateUtil)?.let { effectiveProfileSwitch ->
|
||||
storeDataForDb.effectiveProfileSwitches.add(effectiveProfileSwitch)
|
||||
} ?: aapsLogger.error("Error parsing EffectiveProfileSwitch json $json")
|
||||
|
@ -127,7 +127,7 @@ class NSClientAddUpdateWorker(
|
|||
eventType == TherapyEvent.Type.EXERCISE.text ||
|
||||
eventType == TherapyEvent.Type.NOTE.text ||
|
||||
eventType == TherapyEvent.Type.PUMP_BATTERY_CHANGE.text ->
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT) {
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT) {
|
||||
TherapyEvent.fromJson(json)?.let { therapyEvent ->
|
||||
storeDataForDb.therapyEvents.add(therapyEvent)
|
||||
} ?: aapsLogger.error("Error parsing TherapyEvent json $json")
|
||||
|
@ -148,14 +148,14 @@ class NSClientAddUpdateWorker(
|
|||
}
|
||||
|
||||
eventType == TherapyEvent.Type.PROFILE_SWITCH.text ->
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT) {
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_profile_switch, false) || config.NSCLIENT) {
|
||||
ProfileSwitch.fromJson(json, dateUtil, activePlugin)?.let { profileSwitch ->
|
||||
storeDataForDb.profileSwitches.add(profileSwitch)
|
||||
} ?: aapsLogger.error("Error parsing ProfileSwitch json $json")
|
||||
}
|
||||
|
||||
eventType == TherapyEvent.Type.APS_OFFLINE.text ->
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_offline_event, false) && config.isEngineeringMode() || config.NSCLIENT) {
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_offline_event, false) && config.isEngineeringMode() || config.NSCLIENT) {
|
||||
OfflineEvent.fromJson(json)?.let { offlineEvent ->
|
||||
storeDataForDb.offlineEvents.add(offlineEvent)
|
||||
} ?: aapsLogger.error("Error parsing OfflineEvent json $json")
|
||||
|
|
|
@ -26,7 +26,7 @@ class NSClientMbgWorker(
|
|||
override suspend fun doWorkAndLog(): Result {
|
||||
val ret = Result.success()
|
||||
|
||||
val acceptNSData = sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT
|
||||
val acceptNSData = sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_therapy_events, false) || config.NSCLIENT
|
||||
if (!acceptNSData) return Result.success(workDataOf("Result" to "Sync not enabled"))
|
||||
|
||||
val mbgArray = dataWorkerStorage.pickupJSONArray(inputData.getLong(DataWorkerStorage.STORE_KEY, -1))
|
||||
|
|
|
@ -71,7 +71,7 @@ class DataSyncSelectorV3 @Inject constructor(
|
|||
|
||||
override fun queueSize(): Long = queueCounter.size()
|
||||
|
||||
private val bgUploadEnabled get() = sp.getBoolean(info.nightscout.core.utils.R.string.key_do_ns_upload, false) && activePlugin.activeBgSource !is NSClientSource
|
||||
private val bgUploadEnabled get() = sp.getBoolean(app.aaps.core.utils.R.string.key_do_ns_upload, false) && activePlugin.activeBgSource !is NSClientSource
|
||||
|
||||
override suspend fun doUpload() {
|
||||
rxBus.send(EventNSClientUpdateGuiStatus())
|
||||
|
@ -675,7 +675,7 @@ class DataSyncSelectorV3 @Inject constructor(
|
|||
private suspend fun processChangedProfileStore() {
|
||||
if (isPaused) return
|
||||
val lastSync = sp.getLong(R.string.key_ns_profile_store_last_synced_timestamp, 0)
|
||||
val lastChange = sp.getLong(info.nightscout.core.utils.R.string.key_local_profile_last_change, 0)
|
||||
val lastChange = sp.getLong(app.aaps.core.utils.R.string.key_local_profile_last_change, 0)
|
||||
if (lastChange == 0L) return
|
||||
if (lastChange > lastSync) {
|
||||
if (activePlugin.activeProfileSource.profile?.allProfilesValid != true) return
|
||||
|
|
|
@ -158,8 +158,8 @@ class NSClientV3Plugin @Inject constructor(
|
|||
when {
|
||||
sp.getBoolean(R.string.key_ns_paused, false) -> rh.gs(app.aaps.core.ui.R.string.paused)
|
||||
isAllowed.not() -> blockingReason
|
||||
sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_use_ws, true) && wsConnected -> "WS: " + rh.gs(app.aaps.core.interfaces.R.string.connected)
|
||||
sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_use_ws, true) && !wsConnected -> "WS: " + rh.gs(R.string.not_connected)
|
||||
sp.getBoolean(app.aaps.core.utils.R.string.key_ns_use_ws, true) && wsConnected -> "WS: " + rh.gs(app.aaps.core.interfaces.R.string.connected)
|
||||
sp.getBoolean(app.aaps.core.utils.R.string.key_ns_use_ws, true) && !wsConnected -> "WS: " + rh.gs(R.string.not_connected)
|
||||
lastOperationError != null -> rh.gs(app.aaps.core.ui.R.string.error)
|
||||
nsAndroidClient?.lastStatus == null -> rh.gs(R.string.not_connected)
|
||||
workIsRunning() -> rh.gs(R.string.working)
|
||||
|
@ -206,14 +206,14 @@ class NSClientV3Plugin @Inject constructor(
|
|||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ ev ->
|
||||
if (ev.isChanged(rh.gs(R.string.key_ns_client_token)) ||
|
||||
ev.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_nsclientinternal_url)) ||
|
||||
ev.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_ns_use_ws)) ||
|
||||
ev.isChanged(rh.gs(app.aaps.core.utils.R.string.key_nsclientinternal_url)) ||
|
||||
ev.isChanged(rh.gs(app.aaps.core.utils.R.string.key_ns_use_ws)) ||
|
||||
ev.isChanged(rh.gs(R.string.key_ns_paused)) ||
|
||||
ev.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_ns_alarms)) ||
|
||||
ev.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_ns_announcements))
|
||||
ev.isChanged(rh.gs(app.aaps.core.utils.R.string.key_ns_alarms)) ||
|
||||
ev.isChanged(rh.gs(app.aaps.core.utils.R.string.key_ns_announcements))
|
||||
)
|
||||
setClient("SETTING CHANGE")
|
||||
if (ev.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_local_profile_last_change)))
|
||||
if (ev.isChanged(rh.gs(app.aaps.core.utils.R.string.key_local_profile_last_change)))
|
||||
executeUpload("PROFILE_CHANGE", forceNew = true)
|
||||
|
||||
}, fabricPrivacy::logException)
|
||||
|
@ -268,7 +268,7 @@ class NSClientV3Plugin @Inject constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_use_ws, true))
|
||||
if (!sp.getBoolean(app.aaps.core.utils.R.string.key_ns_use_ws, true))
|
||||
executeLoop("MAIN_LOOP", forceNew = true)
|
||||
else
|
||||
rxBus.send(EventNSClientNewLog("● TICK", ""))
|
||||
|
@ -311,8 +311,8 @@ class NSClientV3Plugin @Inject constructor(
|
|||
if (config.NSCLIENT) {
|
||||
preferenceFragment.findPreference<PreferenceScreen>(rh.gs(R.string.ns_sync_options))?.isVisible = false
|
||||
|
||||
preferenceFragment.findPreference<SwitchPreference>(rh.gs(info.nightscout.core.utils.R.string.key_ns_create_announcements_from_errors))?.isVisible = false
|
||||
preferenceFragment.findPreference<SwitchPreference>(rh.gs(info.nightscout.core.utils.R.string.key_ns_create_announcements_from_carbs_req))?.isVisible = false
|
||||
preferenceFragment.findPreference<SwitchPreference>(rh.gs(app.aaps.core.utils.R.string.key_ns_create_announcements_from_errors))?.isVisible = false
|
||||
preferenceFragment.findPreference<SwitchPreference>(rh.gs(app.aaps.core.utils.R.string.key_ns_create_announcements_from_carbs_req))?.isVisible = false
|
||||
}
|
||||
preferenceFragment.findPreference<SwitchPreference>(rh.gs(R.string.key_ns_receive_tbr_eb))?.isVisible = config.isEngineeringMode()
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ class NSClientV3Plugin @Inject constructor(
|
|||
|
||||
private fun setClient(reason: String) {
|
||||
nsAndroidClient = NSAndroidClientImpl(
|
||||
baseUrl = sp.getString(info.nightscout.core.utils.R.string.key_nsclientinternal_url, "").lowercase().replace("https://", "").replace(Regex("/$"), ""),
|
||||
baseUrl = sp.getString(app.aaps.core.utils.R.string.key_nsclientinternal_url, "").lowercase().replace("https://", "").replace(Regex("/$"), ""),
|
||||
accessToken = sp.getString(R.string.key_ns_client_token, ""),
|
||||
context = context,
|
||||
logging = true,
|
||||
|
@ -357,10 +357,10 @@ class NSClientV3Plugin @Inject constructor(
|
|||
var wsConnected = false
|
||||
internal var initialLoadFinished = false
|
||||
private fun initializeWebSockets(reason: String) {
|
||||
if (!sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_use_ws, true)) return
|
||||
if (sp.getString(info.nightscout.core.utils.R.string.key_nsclientinternal_url, "").isEmpty()) return
|
||||
val urlStorage = sp.getString(info.nightscout.core.utils.R.string.key_nsclientinternal_url, "").lowercase().replace(Regex("/$"), "") + "/storage"
|
||||
val urlAlarm = sp.getString(info.nightscout.core.utils.R.string.key_nsclientinternal_url, "").lowercase().replace(Regex("/$"), "") + "/alarm"
|
||||
if (!sp.getBoolean(app.aaps.core.utils.R.string.key_ns_use_ws, true)) return
|
||||
if (sp.getString(app.aaps.core.utils.R.string.key_nsclientinternal_url, "").isEmpty()) return
|
||||
val urlStorage = sp.getString(app.aaps.core.utils.R.string.key_nsclientinternal_url, "").lowercase().replace(Regex("/$"), "") + "/storage"
|
||||
val urlAlarm = sp.getString(app.aaps.core.utils.R.string.key_nsclientinternal_url, "").lowercase().replace(Regex("/$"), "") + "/alarm"
|
||||
if (!isAllowed) {
|
||||
rxBus.send(EventNSClientNewLog("● WS", blockingReason))
|
||||
} else if (sp.getBoolean(R.string.key_ns_paused, false)) {
|
||||
|
@ -377,8 +377,8 @@ class NSClientV3Plugin @Inject constructor(
|
|||
socket.on("update", onDataCreateUpdate)
|
||||
socket.on("delete", onDataDelete)
|
||||
}
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_announcements, config.NSCLIENT) ||
|
||||
sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_alarms, config.NSCLIENT)
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_announcements, config.NSCLIENT) ||
|
||||
sp.getBoolean(app.aaps.core.utils.R.string.key_ns_alarms, config.NSCLIENT)
|
||||
)
|
||||
alarmSocket = IO.socket(urlAlarm).also { socket ->
|
||||
socket.on(Socket.EVENT_CONNECT, onConnectAlarms)
|
||||
|
@ -525,7 +525,7 @@ class NSClientV3Plugin @Inject constructor(
|
|||
val data = args[0] as JSONObject
|
||||
rxBus.send(EventNSClientNewLog("◄ ANNOUNCEMENT", data.optString("message")))
|
||||
aapsLogger.debug(LTag.NSCLIENT, data.toString())
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_announcements, config.NSCLIENT))
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_announcements, config.NSCLIENT))
|
||||
uiInteraction.addNotificationWithAction(injector, NSAlarmObject(data))
|
||||
}
|
||||
private val onAlarm = Emitter.Listener { args ->
|
||||
|
@ -546,8 +546,8 @@ class NSClientV3Plugin @Inject constructor(
|
|||
val data = args[0] as JSONObject
|
||||
rxBus.send(EventNSClientNewLog("◄ ALARM", data.optString("message")))
|
||||
aapsLogger.debug(LTag.NSCLIENT, data.toString())
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_alarms, config.NSCLIENT)) {
|
||||
val snoozedTo = sp.getLong(rh.gs(info.nightscout.core.utils.R.string.key_snoozed_to) + data.optString("level"), 0L)
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_alarms, config.NSCLIENT)) {
|
||||
val snoozedTo = sp.getLong(rh.gs(app.aaps.core.utils.R.string.key_snoozed_to) + data.optString("level"), 0L)
|
||||
if (snoozedTo == 0L || System.currentTimeMillis() > snoozedTo)
|
||||
uiInteraction.addNotificationWithAction(injector, NSAlarmObject(data))
|
||||
}
|
||||
|
@ -557,8 +557,8 @@ class NSClientV3Plugin @Inject constructor(
|
|||
val data = args[0] as JSONObject
|
||||
rxBus.send(EventNSClientNewLog("◄ URGENT ALARM", data.optString("message")))
|
||||
aapsLogger.debug(LTag.NSCLIENT, data.toString())
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_alarms, config.NSCLIENT)) {
|
||||
val snoozedTo = sp.getLong(rh.gs(info.nightscout.core.utils.R.string.key_snoozed_to) + data.optString("level"), 0L)
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_alarms, config.NSCLIENT)) {
|
||||
val snoozedTo = sp.getLong(rh.gs(app.aaps.core.utils.R.string.key_snoozed_to) + data.optString("level"), 0L)
|
||||
if (snoozedTo == 0L || System.currentTimeMillis() > snoozedTo)
|
||||
uiInteraction.addNotificationWithAction(injector, NSAlarmObject(data))
|
||||
}
|
||||
|
@ -599,7 +599,7 @@ class NSClientV3Plugin @Inject constructor(
|
|||
// If WS is enabled, download is triggered by changes in NS. Thus uploadOnly
|
||||
// Exception is after reset to full sync (initialLoadFinished == false), where
|
||||
// older data must be loaded directly and then continue over WS
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_use_ws, true) && initialLoadFinished)
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_use_ws, true) && initialLoadFinished)
|
||||
executeUpload("START $reason", forceNew = true)
|
||||
else
|
||||
executeLoop("START $reason", forceNew = true)
|
||||
|
@ -612,7 +612,7 @@ class NSClientV3Plugin @Inject constructor(
|
|||
|
||||
override fun detectedNsVersion(): String? = nsAndroidClient?.lastStatus?.version
|
||||
|
||||
override val address: String get() = sp.getString(info.nightscout.core.utils.R.string.key_nsclientinternal_url, "")
|
||||
override val address: String get() = sp.getString(app.aaps.core.utils.R.string.key_nsclientinternal_url, "")
|
||||
|
||||
override fun isFirstLoad(collection: NsClient.Collection) =
|
||||
when (collection) {
|
||||
|
@ -695,7 +695,7 @@ class NSClientV3Plugin @Inject constructor(
|
|||
result.identifier?.let {
|
||||
dataPair.value.interfaceIDs.nightscoutId = it
|
||||
storeDataForDb.nsIdDeviceStatuses.add(dataPair.value)
|
||||
sp.putBoolean(info.nightscout.core.utils.R.string.key_objectives_pump_status_is_available_in_ns, true)
|
||||
sp.putBoolean(app.aaps.core.utils.R.string.key_objectives_pump_status_is_available_in_ns, true)
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
|
@ -931,7 +931,7 @@ class NSClientV3Plugin @Inject constructor(
|
|||
}
|
||||
|
||||
private fun executeLoop(origin: String, forceNew: Boolean) {
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_use_ws, true) && initialLoadFinished) return
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_ns_use_ws, true) && initialLoadFinished) return
|
||||
if (sp.getBoolean(R.string.key_ns_paused, false)) {
|
||||
rxBus.send(EventNSClientNewLog("● RUN", "paused $origin"))
|
||||
return
|
||||
|
|
|
@ -34,7 +34,7 @@ class LoadBgWorker(
|
|||
@Inject lateinit var storeDataForDb: StoreDataForDb
|
||||
|
||||
override suspend fun doWorkAndLog(): Result {
|
||||
if (!nsClientSource.isEnabled() && !sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_cgm, false))
|
||||
if (!nsClientSource.isEnabled() && !sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_cgm, false))
|
||||
return Result.success(workDataOf("Result" to "Load not enabled"))
|
||||
|
||||
val nsAndroidClient = nsClientV3Plugin.nsAndroidClient ?: return Result.failure(workDataOf("Error" to "AndroidClient is null"))
|
||||
|
@ -62,7 +62,7 @@ class LoadBgWorker(
|
|||
val action = if (isFirstLoad) "RCV-F" else "RCV"
|
||||
rxBus.send(EventNSClientNewLog("◄ $action", "${sgvs.size} SVGs from ${dateUtil.dateAndTimeAndSecondsString(lastLoaded)}"))
|
||||
// Objective0
|
||||
sp.putBoolean(info.nightscout.core.utils.R.string.key_objectives_bg_is_available_in_ns, true)
|
||||
sp.putBoolean(app.aaps.core.utils.R.string.key_objectives_bg_is_available_in_ns, true)
|
||||
// Schedule processing of fetched data and continue of loading
|
||||
continueLoading = response.code != 304
|
||||
nsIncomingDataProcessor.processSgvs(sgvs)
|
||||
|
|
|
@ -61,7 +61,7 @@ class DataSyncSelectorXdripImpl @Inject constructor(
|
|||
}
|
||||
|
||||
private val queueCounter = QueueCounter()
|
||||
private val isEnabled get() = sp.getBoolean(info.nightscout.core.utils.R.string.key_xdrip_local_broadcasts, false)
|
||||
private val isEnabled get() = sp.getBoolean(app.aaps.core.utils.R.string.key_xdrip_local_broadcasts, false)
|
||||
private val xdripPlugin get() = xdripBroadcast.get()
|
||||
|
||||
private val maxAge get() = T.days(1).msecs()
|
||||
|
@ -538,7 +538,7 @@ class DataSyncSelectorXdripImpl @Inject constructor(
|
|||
private fun processChangedProfileStore() {
|
||||
if (!isEnabled) return
|
||||
val lastSync = sp.getLong(R.string.key_xdrip_profile_store_last_synced_timestamp, 0)
|
||||
val lastChange = sp.getLong(info.nightscout.core.utils.R.string.key_local_profile_last_change, 0)
|
||||
val lastChange = sp.getLong(app.aaps.core.utils.R.string.key_local_profile_last_change, 0)
|
||||
if (lastChange == 0L) return
|
||||
if (lastChange > lastSync) {
|
||||
if (activePlugin.activeProfileSource.profile?.allProfilesValid != true) return
|
||||
|
|
|
@ -288,7 +288,7 @@ class XdripPlugin @Inject constructor(
|
|||
// sent in 640G mode
|
||||
// com.eveningoutpost.dexdrip.NSEmulatorReceiver
|
||||
override fun sendIn640gMode(glucoseValue: GlucoseValue) {
|
||||
if (sp.getBoolean(info.nightscout.core.utils.R.string.key_dexcomg5_xdripupload, false)) {
|
||||
if (sp.getBoolean(app.aaps.core.utils.R.string.key_dexcomg5_xdripupload, false)) {
|
||||
val format = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.US)
|
||||
try {
|
||||
val entriesBody = JSONArray()
|
||||
|
|
|
@ -22,7 +22,6 @@ import app.aaps.core.nssdk.remotemodel.LastModified
|
|||
import app.aaps.core.utils.receivers.DataWorkerStorage
|
||||
import app.aaps.database.entities.GlucoseValue
|
||||
import app.aaps.database.entities.embedments.InterfaceIDs
|
||||
import app.aaps.database.impl.AppRepository
|
||||
import app.aaps.implementation.utils.DecimalFormatterImpl
|
||||
import app.aaps.plugins.sync.nsShared.NsIncomingDataProcessor
|
||||
import app.aaps.plugins.sync.nsclient.ReceiverDelegate
|
||||
|
@ -120,7 +119,7 @@ internal class LoadBgWorkerTest : TestBase() {
|
|||
fun notEnabledNSClientSource() = runTest {
|
||||
sut = TestListenableWorkerBuilder<LoadBgWorker>(context).build()
|
||||
Mockito.`when`(nsClientSource.isEnabled()).thenReturn(false)
|
||||
Mockito.`when`(sp.getBoolean(info.nightscout.core.utils.R.string.key_ns_receive_cgm, false)).thenReturn(false)
|
||||
Mockito.`when`(sp.getBoolean(app.aaps.core.utils.R.string.key_ns_receive_cgm, false)).thenReturn(false)
|
||||
|
||||
val result = sut.doWorkAndLog()
|
||||
assertIs<ListenableWorker.Result.Success>(result)
|
||||
|
|
|
@ -82,7 +82,7 @@ class DanaRKoreanPlugin @Inject constructor(
|
|||
|
||||
init {
|
||||
pluginDescription.description(info.nightscout.pump.dana.R.string.description_pump_dana_r_korean)
|
||||
useExtendedBoluses = sp.getBoolean(info.nightscout.core.utils.R.string.key_danar_useextended, false)
|
||||
useExtendedBoluses = sp.getBoolean(app.aaps.core.utils.R.string.key_danar_useextended, false)
|
||||
pumpDescription.fillFor(PumpType.DANA_R_KOREAN)
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ class DanaRKoreanPlugin @Inject constructor(
|
|||
.subscribe({
|
||||
if (isEnabled()) {
|
||||
val previousValue = useExtendedBoluses
|
||||
useExtendedBoluses = sp.getBoolean(info.nightscout.core.utils.R.string.key_danar_useextended, false)
|
||||
useExtendedBoluses = sp.getBoolean(app.aaps.core.utils.R.string.key_danar_useextended, false)
|
||||
if (useExtendedBoluses != previousValue && pumpSync.expectedPumpState().extendedBolus != null) {
|
||||
sExecutionService.extendedBolusStop()
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
|
|||
this.rh = rh;
|
||||
this.fabricPrivacy = fabricPrivacy;
|
||||
|
||||
useExtendedBoluses = sp.getBoolean(info.nightscout.core.utils.R.string.key_danar_useextended, false);
|
||||
useExtendedBoluses = sp.getBoolean(app.aaps.core.utils.R.string.key_danar_useextended, false);
|
||||
pumpDescription.fillFor(PumpType.DANA_R);
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
|
|||
.subscribe(event -> {
|
||||
if (isEnabled()) {
|
||||
boolean previousValue = useExtendedBoluses;
|
||||
useExtendedBoluses = sp.getBoolean(info.nightscout.core.utils.R.string.key_danar_useextended, false);
|
||||
useExtendedBoluses = sp.getBoolean(app.aaps.core.utils.R.string.key_danar_useextended, false);
|
||||
|
||||
if (useExtendedBoluses != previousValue && pumpSync.expectedPumpState().getExtendedBolus() != null) {
|
||||
sExecutionService.extendedBolusStop();
|
||||
|
|
|
@ -767,7 +767,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
|||
private fun getPumpUnreachableTimeout(): Duration {
|
||||
return Duration.ofMinutes(
|
||||
sp.getInt(
|
||||
info.nightscout.core.utils.R.string.key_pump_unreachable_threshold_minutes,
|
||||
app.aaps.core.utils.R.string.key_pump_unreachable_threshold_minutes,
|
||||
Constants.DEFAULT_PUMP_UNREACHABLE_THRESHOLD_MINUTES
|
||||
).toLong()
|
||||
)
|
||||
|
|
|
@ -703,7 +703,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
|||
|
||||
// FIXME ideally we should just have access to LocalAlertUtils here
|
||||
private fun getPumpUnreachableTimeout(): Duration {
|
||||
return Duration.standardMinutes(sp.getInt(info.nightscout.core.utils.R.string.key_pump_unreachable_threshold_minutes, Constants.DEFAULT_PUMP_UNREACHABLE_THRESHOLD_MINUTES).toLong())
|
||||
return Duration.standardMinutes(sp.getInt(app.aaps.core.utils.R.string.key_pump_unreachable_threshold_minutes, Constants.DEFAULT_PUMP_UNREACHABLE_THRESHOLD_MINUTES).toLong())
|
||||
}
|
||||
|
||||
inner class DisplayResultDialogCallback(private val errorMessagePrefix: String, private val withSoundOnError: Boolean) : Callback() {
|
||||
|
|
|
@ -116,7 +116,7 @@ open class VirtualPumpPlugin @Inject constructor(
|
|||
disposable += rxBus
|
||||
.toObservable(EventPreferenceChange::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ event: EventPreferenceChange -> if (event.isChanged(rh.gs(info.nightscout.core.utils.R.string.key_virtualpump_type))) refreshConfiguration() }, fabricPrivacy::logException)
|
||||
.subscribe({ event: EventPreferenceChange -> if (event.isChanged(rh.gs(app.aaps.core.utils.R.string.key_virtualpump_type))) refreshConfiguration() }, fabricPrivacy::logException)
|
||||
refreshConfiguration()
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ open class VirtualPumpPlugin @Inject constructor(
|
|||
|
||||
override fun preprocessPreferences(preferenceFragment: PreferenceFragmentCompat) {
|
||||
super.preprocessPreferences(preferenceFragment)
|
||||
val uploadStatus = preferenceFragment.findPreference(rh.gs(info.nightscout.core.utils.R.string.key_virtual_pump_upload_status)) as SwitchPreference?
|
||||
val uploadStatus = preferenceFragment.findPreference(rh.gs(app.aaps.core.utils.R.string.key_virtual_pump_upload_status)) as SwitchPreference?
|
||||
?: return
|
||||
uploadStatus.isVisible = !config.NSCLIENT
|
||||
}
|
||||
|
@ -341,7 +341,7 @@ open class VirtualPumpPlugin @Inject constructor(
|
|||
|
||||
override fun getJSONStatus(profile: Profile, profileName: String, version: String): JSONObject {
|
||||
val now = System.currentTimeMillis()
|
||||
if (!sp.getBoolean(info.nightscout.core.utils.R.string.key_virtual_pump_upload_status, false)) {
|
||||
if (!sp.getBoolean(app.aaps.core.utils.R.string.key_virtual_pump_upload_status, false)) {
|
||||
return JSONObject()
|
||||
}
|
||||
val pump = JSONObject()
|
||||
|
@ -391,7 +391,7 @@ open class VirtualPumpPlugin @Inject constructor(
|
|||
override fun canHandleDST(): Boolean = true
|
||||
|
||||
fun refreshConfiguration() {
|
||||
val pumpType = sp.getString(info.nightscout.core.utils.R.string.key_virtualpump_type, PumpType.GENERIC_AAPS.description)
|
||||
val pumpType = sp.getString(app.aaps.core.utils.R.string.key_virtualpump_type, PumpType.GENERIC_AAPS.description)
|
||||
val pumpTypeNew = PumpType.getByDescription(pumpType)
|
||||
aapsLogger.debug(LTag.PUMP, "Pump in configuration: $pumpType, PumpType object: $pumpTypeNew")
|
||||
if (this.pumpType == pumpTypeNew) return
|
||||
|
|
|
@ -47,16 +47,16 @@ class VirtualPumpPluginUTest : TestBase() {
|
|||
|
||||
@Test
|
||||
fun refreshConfiguration() {
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo")
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo")
|
||||
virtualPumpPlugin.refreshConfiguration()
|
||||
Assertions.assertEquals(PumpType.ACCU_CHEK_COMBO, virtualPumpPlugin.pumpType)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun refreshConfigurationTwice() {
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo")
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo")
|
||||
virtualPumpPlugin.refreshConfiguration()
|
||||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo")
|
||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo")
|
||||
virtualPumpPlugin.refreshConfiguration()
|
||||
Assertions.assertEquals(PumpType.ACCU_CHEK_COMBO, virtualPumpPlugin.pumpType)
|
||||
}
|
||||
|
|
|
@ -47,12 +47,12 @@ import kotlin.math.min
|
|||
|
||||
}
|
||||
|
||||
private fun loadAge(): Int = when (sp.getString(info.nightscout.core.utils.R.string.key_age, "")) {
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_child) -> CHILD
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_teenage) -> TEENAGE
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_adult) -> ADULT
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_resistantadult) -> RESISTANT_ADULT
|
||||
rh.gs(info.nightscout.core.utils.R.string.key_pregnant) -> PREGNANT
|
||||
private fun loadAge(): Int = when (sp.getString(app.aaps.core.utils.R.string.key_age, "")) {
|
||||
rh.gs(app.aaps.core.utils.R.string.key_child) -> CHILD
|
||||
rh.gs(app.aaps.core.utils.R.string.key_teenage) -> TEENAGE
|
||||
rh.gs(app.aaps.core.utils.R.string.key_adult) -> ADULT
|
||||
rh.gs(app.aaps.core.utils.R.string.key_resistantadult) -> RESISTANT_ADULT
|
||||
rh.gs(app.aaps.core.utils.R.string.key_pregnant) -> PREGNANT
|
||||
else -> ADULT
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue