From 365a270ece3fe9f939fcc97122fae40e924c4e9d Mon Sep 17 00:00:00 2001 From: xJoe Date: Tue, 21 Apr 2020 11:50:44 +0200 Subject: [PATCH 1/5] auto_gate docs + link docs instead of wiki + link to wiki page --- app/src/main/res/values/objectives.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/objectives.xml b/app/src/main/res/values/objectives.xml index 0c2adb8717..5c4c1a11c2 100644 --- a/app/src/main/res/values/objectives.xml +++ b/app/src/main/res/values/objectives.xml @@ -34,7 +34,7 @@ Enabling additional features for daytime use, such as SMB Enabling automation You must read the wiki and rise maxIOB to get SMBs working fine! A good start is maxIOB=average mealbolus + 3 x max daily basal - Read the wiki how automation works. Setup your first simple rules. Instead of action let AAPS display only notification. When you are sure automation is triggered at the right time replace notification by real action. + Read the docs how automation works. Setup your first simple rules. Instead of action let AAPS display only notification. When you are sure automation is triggered at the right time replace notification by real action. (https://androidaps.readthedocs.io/en/latest/EN/Usage/Automation.html) BG available in NS Pump status available in NS Manual enacts From 695ba6826bb0f8a1837fc2b28f900bc00b56b2a3 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 21 Apr 2020 20:08:12 +0200 Subject: [PATCH 2/5] missing runOnUiThread --- .../androidaps/utils/protection/BiometricCheck.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/utils/protection/BiometricCheck.kt b/app/src/main/java/info/nightscout/androidaps/utils/protection/BiometricCheck.kt index e55d6e999e..2ab79f6b54 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/protection/BiometricCheck.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/protection/BiometricCheck.kt @@ -5,6 +5,7 @@ import androidx.biometric.BiometricPrompt import androidx.fragment.app.FragmentActivity import info.nightscout.androidaps.R import info.nightscout.androidaps.utils.ToastUtils +import info.nightscout.androidaps.utils.extensions.runOnUiThread import java.util.concurrent.Executors object BiometricCheck { @@ -24,7 +25,9 @@ object BiometricCheck { BiometricConstants.ERROR_USER_CANCELED -> { ToastUtils.showToastInUiThread(activity.baseContext, errString.toString()) // fallback to master password - passwordCheck.queryPassword(activity, R.string.master_password, R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() }) + runOnUiThread(Runnable { + passwordCheck.queryPassword(activity, R.string.master_password, R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() }) + }) } BiometricConstants.ERROR_NEGATIVE_BUTTON -> @@ -34,7 +37,9 @@ object BiometricCheck { ToastUtils.showToastInUiThread(activity.baseContext, errString.toString()) // no pin set // fallback to master password - passwordCheck.queryPassword(activity, R.string.master_password, R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() }) + runOnUiThread(Runnable { + passwordCheck.queryPassword(activity, R.string.master_password, R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() }) + }) } BiometricConstants.ERROR_NO_SPACE, From e97aafb143591f8a4609e23c9cc91cc7131415fe Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 21 Apr 2020 21:39:11 +0200 Subject: [PATCH 3/5] setDeviceCredentialAllowed disabled --- .../plugins/general/overview/OverviewFragment.kt | 1 + .../androidaps/utils/protection/BiometricCheck.kt | 11 +++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt index ea0d2103c0..d56d8d9afe 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt @@ -755,6 +755,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList // ****** GRAPH ******* GlobalScope.launch(Dispatchers.Main) { + overview_bggraph?: return@launch val graphData = GraphData(injector, overview_bggraph, iobCobCalculatorPlugin) val secondaryGraphsData: ArrayList = ArrayList() diff --git a/app/src/main/java/info/nightscout/androidaps/utils/protection/BiometricCheck.kt b/app/src/main/java/info/nightscout/androidaps/utils/protection/BiometricCheck.kt index 2ab79f6b54..c58b5628d1 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/protection/BiometricCheck.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/protection/BiometricCheck.kt @@ -46,10 +46,9 @@ object BiometricCheck { BiometricConstants.ERROR_HW_UNAVAILABLE, BiometricConstants.ERROR_HW_NOT_PRESENT, BiometricConstants.ERROR_NO_BIOMETRICS -> - // call ok, because it's not possible to bypass it when biometrics fail - // ok?.run() - // changed to fail as you can use PIN instead with setDeviceCredentialAllowed enabled - fail?.run() + runOnUiThread(Runnable { + passwordCheck.queryPassword(activity, R.string.master_password, R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() }) + }) } } @@ -69,8 +68,8 @@ object BiometricCheck { val promptInfo = BiometricPrompt.PromptInfo.Builder() .setTitle(activity.getString(title)) .setDescription(activity.getString(R.string.biometric_title)) -// .setNegativeButtonText(activity.getString(R.string.cancel)) // not possible with setDeviceCredentialAllowed - .setDeviceCredentialAllowed(true) + .setNegativeButtonText(activity.getString(R.string.cancel)) // not possible with setDeviceCredentialAllowed +// .setDeviceCredentialAllowed(true) // setDeviceCredentialAllowed creates new activity when PIN is requested, activity.fragmentManager crash afterwards .build() biometricPrompt.authenticate(promptInfo) From 733370a126d501f16dcbeb1735547bdf01ea11b0 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 21 Apr 2020 22:02:38 +0200 Subject: [PATCH 4/5] fix NPE in NetworkChangeReceiver --- .../nightscout/androidaps/receivers/NetworkChangeReceiver.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/NetworkChangeReceiver.kt b/app/src/main/java/info/nightscout/androidaps/receivers/NetworkChangeReceiver.kt index 52a8894079..faeb4632cd 100644 --- a/app/src/main/java/info/nightscout/androidaps/receivers/NetworkChangeReceiver.kt +++ b/app/src/main/java/info/nightscout/androidaps/receivers/NetworkChangeReceiver.kt @@ -29,7 +29,7 @@ class NetworkChangeReceiver : DaggerBroadcastReceiver() { val cm = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager val networks: Array = cm.allNetworks networks.forEach { - val capabilities = cm.getNetworkCapabilities(it) + val capabilities = cm.getNetworkCapabilities(it) ?: return@forEach event.wifiConnected = event.wifiConnected || (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) || capabilities.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET)) event.mobileConnected = event.mobileConnected || capabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) From 74b7eba450e18e490f695fddaf75283bf30ea553 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 21 Apr 2020 22:19:43 +0200 Subject: [PATCH 5/5] fix devicestatus upload --- .../info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.java | 1 + .../androidaps/plugins/general/nsclient/NSUpload.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.java index 30c8603b71..cd99fb2c56 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.java @@ -382,6 +382,7 @@ public class LoopPlugin extends PluginBase { if (lastRun == null) lastRun = new LastRun(); lastRun.request = result; lastRun.constraintsProcessed = resultAfterConstraints; + lastRun.lastAPSRun = DateUtil.now(); lastRun.source = ((PluginBase) usedAPS).getName(); lastRun.tbrSetByPump = null; lastRun.smbSetByPump = null; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSUpload.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSUpload.java index 3894c68ba2..6f070d8245 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSUpload.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSUpload.java @@ -165,7 +165,7 @@ public class NSUpload { Profile profile = profileFunction.getProfile(); String profileName = profileFunction.getProfileName(); - if (profile == null || profileName == null) { + if (profile == null) { log.error("Profile is null. Skipping upload"); return; }