Skip to content

Commit

Permalink
Merge pull request #3709 from nightscout/dev
Browse files Browse the repository at this point in the history
3.3.1.0
  • Loading branch information
MilosKozak authored Jan 7, 2025
2 parents 436ba63 + 81beac1 commit 2ac634c
Show file tree
Hide file tree
Showing 310 changed files with 1,877 additions and 597 deletions.
9 changes: 9 additions & 0 deletions _docs/icons/as_above.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions _docs/icons/as_below.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions _docs/icons/x_as_above.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions _docs/icons/x_as_below.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/src/androidTest/kotlin/app/aaps/CompatDbHelperTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class CompatDbHelperTest @Inject constructor() {
val now = dateUtil.now()

// Set Profile in ProfilePlugin
nsIncomingDataProcessor.processProfile(JSONObject(profileData))
nsIncomingDataProcessor.processProfile(JSONObject(profileData), false)
assertThat(activePlugin.activeProfileSource.profile).isNotNull()

// Create a profile switch
Expand Down
2 changes: 1 addition & 1 deletion app/src/androidTest/kotlin/app/aaps/LoopTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class LoopTest @Inject constructor() {
assertThat((loopStatusEvent.second as EventLoopSetLastRunGui).text).contains("NO PROFILE SET")

// Set Profile in ProfilePlugin
nsIncomingDataProcessor.processProfile(JSONObject(profileData))
nsIncomingDataProcessor.processProfile(JSONObject(profileData), false)
assertThat(activePlugin.activeProfileSource.profile).isNotNull()

// Create a profile switch
Expand Down
2 changes: 1 addition & 1 deletion app/src/androidTest/kotlin/app/aaps/di/TestModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ open class TestModule {
val plugins = allConfigs.toMutableMap()
if (config.PUMPDRIVERS) plugins += pumpDrivers.get()
if (config.APS) plugins += aps.get()
if (!config.NSCLIENT) plugins += notNsClient.get()
if (!config.AAPSCLIENT) plugins += notNsClient.get()
//if (config.isUnfinishedMode()) plugins += unfinished.get()
return plugins.toList().sortedBy { it.first }.map { it.second }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class DetermineBasalAdapterAMAJS(private val scriptReader: ScriptReader, private
val rhino = Context.enter()
val scope: Scriptable = rhino.initStandardObjects()
// Turn off optimization to make Rhino Android compatible
rhino.optimizationLevel = -1
rhino.isInterpretedMode = true
try {

//register logger callback for console.log and console.error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class DetermineBasalAdapterSMBJS(private val scriptReader: ScriptReader, private
val rhino = Context.enter()
val scope: Scriptable = rhino.initStandardObjects()
// Turn off optimization to make Rhino Android compatible
rhino.optimizationLevel = -1
rhino.isInterpretedMode = true
try {

//register logger callback for console.log and console.error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class DetermineBasalAdapterAutoISFJS(private val scriptReader: ScriptReader, pri
val rhino = Context.enter()
val scope: Scriptable = rhino.initStandardObjects()
// Turn off optimization to make Rhino Android compatible
rhino.optimizationLevel = -1
rhino.isInterpretedMode = true
try {

//register logger callback for console.log and console.error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class DetermineBasalAdapterSMBDynamicISFJS(private val scriptReader: ScriptReade
val rhino = Context.enter()
val scope: Scriptable = rhino.initStandardObjects()
// Turn off optimization to make Rhino Android compatible
rhino.optimizationLevel = -1
rhino.isInterpretedMode = true
try {

//register logger callback for console.log and console.error
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/kotlin/app/aaps/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class MainActivity : DaggerAppCompatActivityWithResult() {
@Inject lateinit var iconsProvider: IconsProvider
@Inject lateinit var constraintChecker: ConstraintsChecker
@Inject lateinit var signatureVerifierPlugin: SignatureVerifierPlugin
@Inject lateinit var maitenancePlugin: MaintenancePlugin
@Inject lateinit var uel: UserEntryLogger
@Inject lateinit var profileFunction: ProfileFunction
@Inject lateinit var fileListProvider: FileListProvider
Expand Down Expand Up @@ -288,7 +289,7 @@ class MainActivity : DaggerAppCompatActivityWithResult() {
}
androidPermission.notifyForStoragePermission(this)
androidPermission.notifyForBatteryOptimizationPermission(this)
if (!config.NSCLIENT) androidPermission.notifyForLocationPermissions(this)
if (!config.AAPSCLIENT) androidPermission.notifyForLocationPermissions(this)
if (config.PUMPDRIVERS) {
if (smsCommunicator.isEnabled())
androidPermission.notifyForSMSPermissions(this)
Expand Down Expand Up @@ -331,7 +332,7 @@ class MainActivity : DaggerAppCompatActivityWithResult() {
text = rh.gs(app.aaps.core.ui.R.string.aaps_directory_not_selected),
level = Notification.IMPORTANCE_HIGH,
buttonText = R.string.select,
action = { accessTree?.launch(null) },
action = { maitenancePlugin.selectAapsDirectory(this) },
validityCheck = { preferences.getIfExists(StringKey.AapsDirectoryUri).isNullOrEmpty() }
)
}
Expand Down Expand Up @@ -493,7 +494,7 @@ class MainActivity : DaggerAppCompatActivityWithResult() {
val hashes: List<String> = signatureVerifierPlugin.shortHashes()
if (hashes.isNotEmpty()) fabricPrivacy.setUserProperty("Hash", hashes[0])
activePlugin.activePump.let { fabricPrivacy.setUserProperty("Pump", it::class.java.simpleName) }
if (!config.NSCLIENT && !config.PUMPCONTROL)
if (!config.AAPSCLIENT && !config.PUMPCONTROL)
activePlugin.activeAPS.let { fabricPrivacy.setUserProperty("Aps", it::class.java.simpleName) }
activePlugin.activeBgSource.let { fabricPrivacy.setUserProperty("BgSource", it::class.java.simpleName) }
fabricPrivacy.setUserProperty("Profile", activePlugin.activeProfileSource.javaClass.simpleName)
Expand Down
15 changes: 7 additions & 8 deletions app/src/main/kotlin/app/aaps/MainApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ import android.os.Build
import android.os.Handler
import android.os.HandlerThread
import androidx.lifecycle.ProcessLifecycleOwner
import androidx.work.Data
import androidx.work.ExistingPeriodicWorkPolicy
import androidx.work.PeriodicWorkRequest
import androidx.work.WorkManager
import app.aaps.core.data.model.GlucoseUnit
import app.aaps.core.data.model.TE
import app.aaps.core.data.ue.Action
Expand Down Expand Up @@ -61,7 +57,6 @@ import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
import rxdogtag2.RxDogTag
import java.io.IOException
import java.util.concurrent.TimeUnit
import javax.inject.Inject
import javax.inject.Provider

Expand Down Expand Up @@ -211,9 +206,13 @@ class MainApp : DaggerApplication() {
sp.putBoolean("ConfigBuilder_APS_OpenAPSSMB_Enabled", true)
preferences.put(BooleanKey.ApsUseDynamicSensitivity, true)
}
// convert Double to IntString
if (preferences.getIfExists(IntKey.ApsDynIsfAdjustmentFactor) != null)
sp.putString(IntKey.ApsDynIsfAdjustmentFactor.key, preferences.get(IntKey.ApsDynIsfAdjustmentFactor).toString())
// convert Double to Int
try {
val dynIsf = sp.getDouble("DynISFAdjust", 0.0)
if (dynIsf != 0.0 && dynIsf.toInt() != preferences.get(IntKey.ApsDynIsfAdjustmentFactor))
preferences.put(IntKey.ApsDynIsfAdjustmentFactor, dynIsf.toInt())
} catch (_: Exception) { /* ignore */
}
}

override fun applicationInjector(): AndroidInjector<out DaggerApplication> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,8 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
if (pluginName != null) {
val plugin = activePlugin.getPluginsList().firstOrNull { it.javaClass.simpleName == pluginName } ?: error("Plugin not found")
addPreferencesIfEnabled(plugin, rootKey)
} else if (customPreference != null) {
when (customPreference!!) {
UiInteraction.Preferences.PROTECTION -> addProtectionScreen(rootKey)
}
} else if (customPreference == UiInteraction.Preferences.PROTECTION) {
addProtectionScreen(rootKey)
} else {
addGeneralScreen(rootKey)
addProtectionScreen(rootKey)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/app/aaps/di/AppModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ open class AppModule {
val plugins = allConfigs.toMutableMap()
if (config.PUMPDRIVERS) plugins += pumpDrivers.get()
if (config.APS) plugins += aps.get()
if (!config.NSCLIENT) plugins += notNsClient.get()
if (!config.AAPSCLIENT) plugins += notNsClient.get()
//if (config.isUnfinishedMode()) plugins += unfinished.get()
return plugins.toList().sortedBy { it.first }.map { it.second }
}
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/kotlin/app/aaps/implementations/ConfigImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class ConfigImpl @Inject constructor(

override val SUPPORTED_NS_VERSION = 150000 // 15.0.0
override val APS = BuildConfig.FLAVOR == "full"
override val NSCLIENT = BuildConfig.FLAVOR == "aapsclient" || BuildConfig.FLAVOR == "aapsclient2"
override val NSCLIENT1 = BuildConfig.FLAVOR == "aapsclient"
override val NSCLIENT2 = BuildConfig.FLAVOR == "aapsclient2"
override val AAPSCLIENT = BuildConfig.FLAVOR == "aapsclient" || BuildConfig.FLAVOR == "aapsclient2"
override val AAPSCLIENT1 = BuildConfig.FLAVOR == "aapsclient"
override val AAPSCLIENT2 = BuildConfig.FLAVOR == "aapsclient2"
override val PUMPCONTROL = BuildConfig.FLAVOR == "pumpcontrol"
override val PUMPDRIVERS = BuildConfig.FLAVOR == "full" || BuildConfig.FLAVOR == "pumpcontrol"
override val FLAVOR = BuildConfig.FLAVOR
Expand Down
15 changes: 10 additions & 5 deletions app/src/main/kotlin/app/aaps/implementations/UiInteractionImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,15 @@ class UiInteractionImpl @Inject constructor(
}

override fun runBolusProgressDialog(fragmentManager: FragmentManager, insulin: Double, id: Long) {
BolusProgressDialog().also {
it.setInsulin(insulin)
it.setId(id)
it.show(fragmentManager, "BolusProgress")
// Activity may be destroyed before Dialog pop up so try/catch
try {
BolusProgressDialog().also {
it.setInsulin(insulin)
it.setId(id)
it.show(fragmentManager, "BolusProgress")
}
} catch (_: Exception) {
// do nothing
}
}

Expand Down Expand Up @@ -198,7 +203,7 @@ class UiInteractionImpl @Inject constructor(
rxBus.send(EventNewNotification(NotificationWithAction(injector, nsAlarm)))
}

override fun addNotificationWithAction(id: Int, text: String, level: Int, buttonText: Int, action: Runnable, validityCheck: (() -> Boolean)?, @RawRes soundId: Int?, date: Long) {
override fun addNotificationWithAction(id: Int, text: String, level: Int, buttonText: Int, action: Runnable, validityCheck: (() -> Boolean)?, @RawRes soundId: Int?, date: Long, validTo: Long) {
rxBus.send(
EventNewNotification(
NotificationWithAction(injector = injector, id = id, text = text, level = level, validityCheck = validityCheck)
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/kotlin/app/aaps/receivers/KeepAliveWorker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@ class KeepAliveWorker(
// IOB displayed in NS
private fun checkAPS() {
var shouldUploadStatus = false
if (config.NSCLIENT) return
if (config.AAPSCLIENT) return
if (config.PUMPCONTROL) shouldUploadStatus = true
else if (!loop.isEnabled() || iobCobCalculator.ads.actualBg() == null) shouldUploadStatus = true
else if (dateUtil.isOlderThan(activePlugin.activeAPS.lastAPSRun, 5)) shouldUploadStatus = true
if (dateUtil.isOlderThan(lastIobUpload, IOB_UPDATE_FREQUENCY_IN_MINUTES) && shouldUploadStatus) {
lastIobUpload = dateUtil.now()
loop.buildAndStoreDeviceStatus("KeepAliveWorker")
loop.scheduleBuildAndStoreDeviceStatus("KeepAliveWorker")
}
}

Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget

object Versions {

const val appVersion = "3.3.0.0"
const val appVersion = "3.3.1.0"
const val versionCode = 1500

const val ndkVersion = "21.1.6352462"
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/test-app-dependencies.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies {
testImplementation("org.junit.jupiter:junit-jupiter:5.11.3")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.11.3")
testImplementation("org.json:json:20230618")
testImplementation("org.mockito:mockito-junit-jupiter:5.14.2")
testImplementation("org.mockito:mockito-junit-jupiter:5.15.2")
testImplementation("org.mockito.kotlin:mockito-kotlin:5.1.0")
testImplementation("joda-time:joda-time:2.13.0")
testImplementation("com.google.truth:truth:1.1.5")
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/test-module-dependencies.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies {
testImplementation("org.junit.jupiter:junit-jupiter:5.11.3")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.11.3")
testImplementation("org.json:json:20230618")
testImplementation("org.mockito:mockito-junit-jupiter:5.14.2")
testImplementation("org.mockito:mockito-junit-jupiter:5.15.2")
testImplementation("org.mockito.kotlin:mockito-kotlin:5.1.0")
testImplementation("joda-time:joda-time:2.13.0")
testImplementation("com.google.truth:truth:1.1.5")
Expand All @@ -24,8 +24,8 @@ dependencies {
androidTestImplementation("androidx.test:rules:1.6.1")
androidTestImplementation("com.google.truth:truth:1.1.5")
androidTestImplementation("androidx.test.uiautomator:uiautomator:2.2.0")
androidTestImplementation("org.mockito:mockito-core:5.14.2")
androidTestImplementation("org.mockito:mockito-android:5.14.2")
androidTestImplementation("org.mockito:mockito-core:5.15.2")
androidTestImplementation("org.mockito:mockito-android:5.15.2")
androidTestImplementation("org.mockito.kotlin:mockito-kotlin:5.1.0")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ enum class SourceSensor(val text: String) {
LIBRE_1_BUBBLE("Bubble"),
LIBRE_1_ATOM("Bubble"),
LIBRE_1_GLIMP("Glimp"),
LIBRE_2_NATIVE("Libre2"),
LIBRE_2("Libre2"),
LIBRE_2_NATIVE("Libre2 Native"),
LIBRE_3("Libre3"),
POCTECH_NATIVE("Poctech"),
GLUNOVO_NATIVE("Glunovo"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ interface APS : ConfigExportImport {
*/
fun supportsDynamicIc(): Boolean = false

/**
* Dedicated string for Sensitivity OKDialog in overview on ISF calculation ?
* @return string or null if nothing to show
*/
fun getSensitivityOverviewString(): String? = null

/**
* Calculate current ISF
* @param profile Actual profile to get multiplier form [ProfileSealed.EPS]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface AutosensData {
var deviation: Double
var validDeviation: Boolean
var activeCarbsList: MutableList<CarbsInPast>
var absorbed: Double
var this5MinAbsorption: Double
var carbsFromBolus: Double
var cob: Double
var bgi: Double
Expand All @@ -43,6 +43,10 @@ interface AutosensData {
var autosensResult: AutosensResult

fun cloneCarbsList(): MutableList<CarbsInPast>

/**
* Deduct this 5 min absorption from the active carbs list from oldest to newest.
*/
fun deductAbsorbedCarbs()
fun removeOldCarbs(toTime: Long, isAAPSOrWeighted: Boolean)
}
Loading

0 comments on commit 2ac634c

Please sign in to comment.