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; } 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/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) 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..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 @@ -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,17 +37,18 @@ 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, 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() }) + }) } } @@ -64,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) 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