Merge pull request #178 from AAPS-Omnipod/omnipod_eros_dev_upstream_merge

Prevent crash in Omnipod overview fragment
This commit is contained in:
Milos Kozak 2021-01-03 10:20:00 +01:00 committed by GitHub
commit 61813c65d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 8 deletions

View file

@ -102,10 +102,12 @@ class OmnipodOverviewFragment : DaggerFragment() {
omnipod_overview_button_pod_management.setOnClickListener { omnipod_overview_button_pod_management.setOnClickListener {
if (omnipodPumpPlugin.rileyLinkService?.verifyConfiguration() == true) { if (omnipodPumpPlugin.rileyLinkService?.verifyConfiguration() == true) {
activity?.let { activity -> activity?.let { activity ->
protectionCheck.queryProtection( context?.let { context ->
activity, ProtectionCheck.Protection.PREFERENCES, protectionCheck.queryProtection(
UIRunnable(Runnable { startActivity(Intent(context, PodManagementActivity::class.java)) }) activity, ProtectionCheck.Protection.PREFERENCES,
) UIRunnable { startActivity(Intent(context, PodManagementActivity::class.java)) }
)
}
} }
} else { } else {
displayNotConfiguredDialog() displayNotConfiguredDialog()
@ -514,10 +516,10 @@ class OmnipodOverviewFragment : DaggerFragment() {
private fun displayNotConfiguredDialog() { private fun displayNotConfiguredDialog() {
context?.let { context?.let {
UIRunnable(Runnable { UIRunnable {
OKDialog.show(it, resourceHelper.gs(R.string.omnipod_warning), OKDialog.show(it, resourceHelper.gs(R.string.omnipod_warning),
resourceHelper.gs(R.string.omnipod_error_operation_not_possible_no_configuration), null) resourceHelper.gs(R.string.omnipod_error_operation_not_possible_no_configuration), null)
}).run() }.run()
} }
} }
@ -534,9 +536,9 @@ class OmnipodOverviewFragment : DaggerFragment() {
private fun displayOkDialog(title: String, message: String) { private fun displayOkDialog(title: String, message: String) {
context?.let { context?.let {
UIRunnable(Runnable { UIRunnable {
OKDialog.show(it, title, message, null) OKDialog.show(it, title, message, null)
}).run() }.run()
} }
} }

View file

@ -65,6 +65,11 @@ public class InitializePumpManagerTask extends ServiceTask {
lastGoodFrequency = rileyLinkServiceData.lastGoodFrequency; lastGoodFrequency = rileyLinkServiceData.lastGoodFrequency;
} }
/* FIXME this can apparently crash:
Fatal Exception: java.lang.ClassCastException
info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
cannot be cast to info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice
*/
RileyLinkCommunicationManager<?> rileyLinkCommunicationManager = ((RileyLinkPumpDevice) activePlugin.getActivePump()).getRileyLinkService().getDeviceCommunicationManager(); RileyLinkCommunicationManager<?> rileyLinkCommunicationManager = ((RileyLinkPumpDevice) activePlugin.getActivePump()).getRileyLinkService().getDeviceCommunicationManager();
if (activePlugin.getActivePump().manufacturer() == ManufacturerType.Medtronic) { if (activePlugin.getActivePump().manufacturer() == ManufacturerType.Medtronic) {