diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt index 8fb262c452..284bd1cbaf 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt @@ -74,7 +74,10 @@ class LoopDialog : DaggerDialogFragment() { override fun onStart() { super.onStart() - dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) + dialog?.window?.setLayout( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.WRAP_CONTENT + ) } override fun onSaveInstanceState(savedInstanceState: Bundle) { @@ -213,6 +216,12 @@ class LoopDialog : DaggerDialogFragment() { binding.overviewOpenloop.visibility = (apsMode != "open").toVisibility() } + apsMode == "open" -> { + binding.overviewCloseloop.visibility = View.VISIBLE + binding.overviewLgsloop.visibility = View.GONE + binding.overviewOpenloop.visibility = View.GONE + } + lgsEnabled.value() -> { binding.overviewCloseloop.visibility = View.GONE binding.overviewLgsloop.visibility = (apsMode != "lgs").toVisibility() diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.kt index ddbae593fa..c6868b4337 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.kt @@ -73,6 +73,7 @@ class MaintenancePlugin @Inject constructor( val files = logDir.listFiles { _: File?, name: String -> (name.startsWith("AndroidAPS") && name.endsWith(".zip")) } + if (files.isEmpty()) return Arrays.sort(files) { f1: File, f2: File -> f2.name.compareTo(f1.name) } var delFiles = listOf(*files) val amount = sp.getInt(R.string.key_logshipper_amount, keep) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt index 2feeab89d8..96a487249e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfilePlugin.kt @@ -410,7 +410,7 @@ class LocalProfilePlugin @Inject constructor( override fun doWork(): Result { val profileJson = dataWorker.pickupJSONObject(inputData.getLong(DataWorker.STORE_KEY, -1)) ?: return Result.failure(workDataOf("Error" to "missing input data")) - if (sp.getBoolean(R.string.key_ns_receive_profile_store, false) || config.NSCLIENT) { + if (sp.getBoolean(R.string.key_ns_receive_profile_store, true) || config.NSCLIENT) { val store = ProfileStore(injector, profileJson, dateUtil) val startDate = store.getStartDate() val lastLocalChange = sp.getLong(R.string.key_local_profile_last_change, 0) diff --git a/app/src/main/res/values/exam.xml b/app/src/main/res/values/exam.xml index b5505d5f38..778e865cbf 100644 --- a/app/src/main/res/values/exam.xml +++ b/app/src/main/res/values/exam.xml @@ -132,7 +132,7 @@ Insulin delivery/entry errors What should you do if you received less insulin than the pump history suggests e.g. due to an occlusion, a failed cannula or forgetting to reattach the pump after a shower?  Delete insulin data from Nightscout Careportal to remove it from the pump history. - Compare values in AndroidAPS and pump history. + Compare values in AndroidAPS and pump history (if pump supports this). Bolus a proportion of your calculated ‘missed’ insulin by either syringe/pen or using a prime. Do nothing and allow AndroidAPS to correct any resulting high blood glucose level. Insulin on Board (IOB) diff --git a/app/src/main/res/xml/pref_nsclientinternal.xml b/app/src/main/res/xml/pref_nsclientinternal.xml index 5929db5532..c9dbe2d1e5 100644 --- a/app/src/main/res/xml/pref_nsclientinternal.xml +++ b/app/src/main/res/xml/pref_nsclientinternal.xml @@ -43,7 +43,7 @@ android:title="@string/ns_receive_cgm" /> diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/Action.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/Action.kt index 9d3b86e875..df4d6faad3 100644 --- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/Action.kt +++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/Action.kt @@ -9,7 +9,6 @@ import info.nightscout.androidaps.queue.Callback import org.json.JSONException import org.json.JSONObject import javax.inject.Inject -import kotlin.reflect.full.primaryConstructor abstract class Action(val injector: HasAndroidInjector) { @@ -48,10 +47,37 @@ abstract class Action(val injector: HasAndroidInjector) { fun instantiate(obj: JSONObject): Action? { try { val type = obj.getString("type") - val data = obj.optJSONObject("data") - val clazz = Class.forName(type).kotlin - return (clazz.primaryConstructor?.call(injector) as Action).fromJSON(data?.toString() - ?: "") + val data = obj.getJSONObject("data") + when (type) { + ActionAlarm::class.java.name, // backward compatibility + ActionAlarm::class.java.simpleName -> ActionAlarm(injector).fromJSON(data.toString()) + ActionDummy::class.java.name, + ActionDummy::class.java.simpleName -> ActionDummy(injector).fromJSON(data.toString()) + ActionLoopDisable::class.java.name, + ActionLoopDisable::class.java.simpleName -> ActionLoopDisable(injector).fromJSON(data.toString()) + ActionLoopEnable::class.java.name, + ActionLoopEnable::class.java.simpleName -> ActionLoopEnable(injector).fromJSON(data.toString()) + ActionLoopResume::class.java.name, + ActionLoopResume::class.java.simpleName -> ActionLoopResume(injector).fromJSON(data.toString()) + ActionLoopSuspend::class.java.name, + ActionLoopSuspend::class.java.simpleName -> ActionLoopSuspend(injector).fromJSON(data.toString()) + ActionNotification::class.java.name, + ActionNotification::class.java.simpleName -> ActionNotification(injector).fromJSON(data.toString()) + ActionProfileSwitch::class.java.name, + ActionProfileSwitch::class.java.simpleName -> ActionProfileSwitch(injector).fromJSON(data.toString()) + ActionProfileSwitchPercent::class.java.name, + ActionProfileSwitchPercent::class.java.simpleName -> ActionProfileSwitchPercent(injector).fromJSON(data.toString()) + ActionSendSMS::class.java.name, + ActionSendSMS::class.java.simpleName -> ActionSendSMS(injector).fromJSON(data.toString()) + ActionStartTempTarget::class.java.name, + ActionStartTempTarget::class.java.simpleName -> ActionStartTempTarget(injector).fromJSON(data.toString()) + ActionStopTempTarget::class.java.name, + ActionStopTempTarget::class.java.simpleName -> ActionStopTempTarget(injector).fromJSON(data.toString()) + else -> throw ClassNotFoundException(type) + } + //val clazz = Class.forName(type).kotlin + //return (clazz.primaryConstructor?.call(injector) as Action).fromJSON(data?.toString() + // ?: "") //return (clazz.newInstance() as Action).fromJSON(data?.toString() ?: "") } catch (e: ClassNotFoundException) { aapsLogger.error("Unhandled exception", e) diff --git a/build.gradle b/build.gradle index d95f882706..4ccd6dd22e 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ buildscript { ext { - kotlin_version = '1.5.10' + kotlin_version = '1.5.21' coreVersion = '1.6.0' rxjava_version = '2.2.21' rxandroid_version = '2.1.1' @@ -11,13 +11,13 @@ buildscript { lifecycle_version = '2.3.1' dagger_version = '2.38.1' coroutinesVersion = '1.4.1' - activityVersion = '1.2.0' - fragmentktx_version = '1.3.0' + activityVersion = '1.3.1' + fragmentktx_version = '1.3.6' ormLiteVersion = '4.46' - nav_version = '2.3.3' - appcompat_version = '1.3.0' - material_version = '1.3.0' - constraintlayout_version = '2.0.4' + nav_version = '2.3.5' + appcompat_version = '1.3.1' + material_version = '1.4.0' + constraintlayout_version = '2.1.0' preferencektx_version = '1.1.1' commonslang3_version = '3.11' commonscodec_version = '1.15' @@ -25,12 +25,12 @@ buildscript { work_version = '2.5.0' junit_version = '4.13.2' - mockitoVersion = '3.11.2' + mockitoVersion = '3.12.4' powermockVersion = '2.0.9' dexmakerVersion = "1.2" retrofit2Version = '2.9.0' okhttp3Version = '4.9.0' - byteBuddyVersion = '1.11.5' + byteBuddyVersion = '1.11.13' androidx_junit = '1.1.2' androidx_rules = '1.4.0-alpha04' @@ -42,7 +42,7 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:7.0.0' - classpath 'com.google.gms:google-services:4.3.8' + classpath 'com.google.gms:google-services:4.3.10' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1' // NOTE: Do not place your application dependencies here; they belong diff --git a/core/core_dependencies.gradle b/core/core_dependencies.gradle index 8e261738bb..aa285737bb 100644 --- a/core/core_dependencies.gradle +++ b/core/core_dependencies.gradle @@ -15,7 +15,7 @@ dependencies { api "androidx.activity:activity-ktx:${activityVersion}" api "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version" api 'androidx.cardview:cardview:1.0.0' - api 'androidx.recyclerview:recyclerview:1.1.0' + api 'androidx.recyclerview:recyclerview:1.2.1' api 'androidx.gridlayout:gridlayout:1.0.0' api 'androidx.percentlayout:percentlayout:1.0.0' api "com.google.android.material:material:$material_version" @@ -55,7 +55,7 @@ dependencies { api "com.j256.ormlite:ormlite-android:${ormLiteVersion}" // pumpCommon - api "com.google.code.gson:gson:2.8.6" + api "com.google.code.gson:gson:2.8.7" // don't kill my app api('dev.doubledot.doki:library:0.0.1@aar') { @@ -103,5 +103,6 @@ dependencies { api "commons-codec:commons-codec:$commonscodec_version" // Phone checker + // updating to 0.0.9 prevents AAPS from build api 'com.scottyab:rootbeer-lib:0.0.8' } \ No newline at end of file diff --git a/database/build.gradle b/database/build.gradle index 951064cb47..f570a3d484 100644 --- a/database/build.gradle +++ b/database/build.gradle @@ -24,7 +24,7 @@ dependencies { implementation "io.reactivex.rxjava2:rxandroid:$rxandroid_version" implementation("io.reactivex.rxjava2:rxkotlin:$rxkotlin_version") - implementation "com.google.code.gson:gson:2.8.7" + implementation "com.google.code.gson:gson:2.8.8" api "androidx.room:room-runtime:$room_version" kapt "androidx.room:room-compiler:$room_version" diff --git a/gradle/test_dependencies.gradle b/gradle/test_dependencies.gradle index 059f92d2a7..8f64082505 100644 --- a/gradle/test_dependencies.gradle +++ b/gradle/test_dependencies.gradle @@ -1,19 +1,19 @@ dependencies { testImplementation "junit:junit:$junit_version" - testImplementation 'org.json:json:20201115' + testImplementation 'org.json:json:20210307' testImplementation "org.mockito:mockito-core:${mockitoVersion}" testImplementation "org.powermock:powermock-api-mockito2:${powermockVersion}" testImplementation "org.powermock:powermock-module-junit4-rule-agent:${powermockVersion}" testImplementation "org.powermock:powermock-module-junit4-rule:${powermockVersion}" testImplementation "org.powermock:powermock-module-junit4:${powermockVersion}" testImplementation "joda-time:joda-time:$jodatime_version" - testImplementation('com.google.truth:truth:1.1.2') { + testImplementation('com.google.truth:truth:1.1.3') { exclude group: "com.google.guava", module: "guava" } testImplementation "org.skyscreamer:jsonassert:1.5.0" testImplementation "org.hamcrest:hamcrest-all:1.3" - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0-alpha04' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' androidTestImplementation "androidx.test.ext:junit:$androidx_junit" androidTestImplementation "androidx.test:rules:$androidx_rules" diff --git a/pump-common/build.gradle b/pump-common/build.gradle index 5bb1a09fa4..10a6c55b08 100644 --- a/pump-common/build.gradle +++ b/pump-common/build.gradle @@ -12,7 +12,7 @@ dependencies { implementation project(':core') //implementation project(':database') - implementation('com.thoughtworks.xstream:xstream:1.4.17') { + implementation('com.thoughtworks.xstream:xstream:1.4.18') { exclude group: 'xmlpull', module: 'xmlpull' } }