Merge remote-tracking branch 'Nightscout/dev' into Fix_DisableLoop

# Conflicts:
#	app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt
This commit is contained in:
Philoul 2021-08-29 17:59:21 +02:00
commit 8770cfa4ad
11 changed files with 63 additions and 26 deletions

View file

@ -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()

View file

@ -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)

View file

@ -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)

View file

@ -132,7 +132,7 @@
<string name="wronginsulin_label">Insulin delivery/entry errors</string>
<string name="wronginsulin_whattodo">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? </string>
<string name="wronginsulin_careportal">Delete insulin data from Nightscout Careportal to remove it from the pump history.</string>
<string name="wronginsulin_compare">Compare values in AndroidAPS and pump history.</string>
<string name="wronginsulin_compare">Compare values in AndroidAPS and pump history (if pump supports this).</string>
<string name="wronginsulin_prime">Bolus a proportion of your calculated missed insulin by either syringe/pen or using a prime.</string>
<string name="wronginsulin_donothing">Do nothing and allow AndroidAPS to correct any resulting high blood glucose level.</string>
<string name="iob_label">Insulin on Board (IOB)</string>

View file

@ -43,7 +43,7 @@
android:title="@string/ns_receive_cgm" />
<SwitchPreference
android:defaultValue="false"
android:defaultValue="true"
android:key="@string/key_ns_receive_profile_store"
android:summary="@string/ns_receive_profile_store_summary"
android:title="@string/ns_receive_profile_store" />

View file

@ -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)

View file

@ -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

View file

@ -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'
}

View file

@ -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"

View file

@ -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"

View file

@ -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'
}
}