Remove Reset RileyLink Config button from actions for Omnipod (in favor of Pod Management menu)

This commit is contained in:
Bart Sopers 2020-12-03 23:24:03 +01:00
parent e02438cc8c
commit c3bf5d66fd
7 changed files with 16 additions and 40 deletions

View file

@ -64,13 +64,10 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpInfo;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ResetRileyLinkConfigurationTask;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor;
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.data.ActiveBolus;
import info.nightscout.androidaps.plugins.pump.omnipod.data.RLHistoryItemOmnipod;
import info.nightscout.androidaps.plugins.pump.omnipod.definition.OmnipodCommandType;
import info.nightscout.androidaps.plugins.pump.omnipod.definition.OmnipodCustomActionType;
import info.nightscout.androidaps.plugins.pump.omnipod.definition.OmnipodStorageKeys;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action.service.ExpirationReminderBuilder;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo.PodInfoRecentPulseLog;
@ -122,7 +119,6 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
private final PodStateManager podStateManager;
private final RileyLinkServiceData rileyLinkServiceData;
private final ServiceTaskExecutor serviceTaskExecutor;
private final AapsOmnipodManager aapsOmnipodManager;
private final AapsOmnipodUtil aapsOmnipodUtil;
private final RileyLinkUtil rileyLinkUtil;
@ -140,8 +136,6 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
private final ServiceConnection serviceConnection;
private final PumpType pumpType = PumpType.Insulet_Omnipod;
private final List<CustomAction> customActions = Collections.singletonList(new CustomAction(
R.string.omnipod_custom_action_reset_rileylink, OmnipodCustomActionType.RESET_RILEY_LINK_CONFIGURATION, R.drawable.icon_pod_activity_reset_rileylink_config, true));
private final CompositeDisposable disposables = new CompositeDisposable();
private final NSUpload nsUpload;
@ -174,7 +168,6 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
CommandQueueProvider commandQueue,
FabricPrivacy fabricPrivacy,
RileyLinkServiceData rileyLinkServiceData,
ServiceTaskExecutor serviceTaskExecutor,
DateUtil dateUtil,
AapsOmnipodUtil aapsOmnipodUtil,
RileyLinkUtil rileyLinkUtil,
@ -200,7 +193,6 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
this.dateUtil = dateUtil;
this.podStateManager = podStateManager;
this.rileyLinkServiceData = rileyLinkServiceData;
this.serviceTaskExecutor = serviceTaskExecutor;
this.aapsOmnipodManager = aapsOmnipodManager;
this.aapsOmnipodUtil = aapsOmnipodUtil;
this.rileyLinkUtil = rileyLinkUtil;
@ -482,8 +474,9 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
@Override
public boolean isHandshakeInProgress() {
if (displayConnectionMessages)
if (displayConnectionMessages) {
aapsLogger.debug(LTag.PUMP, "isHandshakeInProgress [OmnipodPumpPlugin] - default (empty) implementation.");
}
return false;
}
@ -805,18 +798,12 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
@Override
public List<CustomAction> getCustomActions() {
return customActions;
return Collections.emptyList();
}
@Override
public void executeCustomAction(CustomActionType customActionType) {
OmnipodCustomActionType omnipodCustomActionType = (OmnipodCustomActionType) customActionType;
if (omnipodCustomActionType == OmnipodCustomActionType.RESET_RILEY_LINK_CONFIGURATION) {
serviceTaskExecutor.startTask(new ResetRileyLinkConfigurationTask(getInjector()));
} else {
aapsLogger.warn(LTag.PUMP, "Unknown custom action: " + omnipodCustomActionType);
}
aapsLogger.warn(LTag.PUMP, "Unknown custom action: " + customActionType);
}
@Override

View file

@ -1,17 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.definition;
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
/**
* Created by andy on 4.8.2019
*/
public enum OmnipodCustomActionType implements CustomActionType {
RESET_RILEY_LINK_CONFIGURATION;
@Override
public String getKey() {
return this.name();
}
}

View file

@ -9,8 +9,7 @@ public enum OmnipodCustomCommandType {
DEACTIVATE_POD("DEACTIVATE POD"),
HANDLE_TIME_CHANGE("HANDLE TIME CHANGE"),
UPDATE_ALERT_CONFIGURATION("UPDATE ALERT CONFIGURATION"),
PLAY_TEST_BEEP("PLAY TEST BEEP")
;
PLAY_TEST_BEEP("PLAY TEST BEEP");
private final String description;

View file

@ -11,6 +11,8 @@ import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ResetRileyLinkConfigurationTask
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin
import info.nightscout.androidaps.plugins.pump.omnipod.R
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.ActivationProgress
@ -50,6 +52,7 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
@Inject lateinit var aapsOmnipodManager: AapsOmnipodManager
@Inject lateinit var context: Context
@Inject lateinit var omnipodPumpPlugin: OmnipodPumpPlugin
@Inject lateinit var serviceTaskExecutor: ServiceTaskExecutor
private var disposables: CompositeDisposable = CompositeDisposable()
@ -80,6 +83,11 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
}
}
omnipod_pod_management_button_reset_rileylink_config.setOnClickListener {
// TODO improvement: properly disable button until task is finished
serviceTaskExecutor.startTask(ResetRileyLinkConfigurationTask(injector))
}
omnipod_pod_management_button_play_test_beep.setOnClickListener {
omnipod_pod_management_button_play_test_beep.isEnabled = false
omnipod_pod_management_button_play_test_beep.setText(R.string.omnipod_pod_management_button_playing_test_beep)

View file

@ -145,7 +145,7 @@
android:textAllCaps="false" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/omnipod"
android:id="@+id/omnipod_pod_management_button_rileylink_stats"
style="?android:attr/buttonStyle"
android:layout_width="match_parent"
android:layout_height="fill_parent"

View file

@ -185,7 +185,7 @@
<string name="omnipod_pod_management_button_discard_pod">Discard Pod</string>
<string name="omnipod_pod_management_button_pod_history">Pod history</string>
<string name="omnipod_pod_management_button_riley_link_stats">RileyLink stats</string>
<string name="omnipod_pod_management_button_reset_riley_link_config">Reest RileyLink Config</string>
<string name="omnipod_pod_management_button_reset_riley_link_config">Reset RileyLink Config</string>
<string name="omnipod_pod_management_button_read_pulse_log">Read pulse log</string>
<string name="omnipod_pod_management_button_reading_pulse_log">Reading pulse log…</string>
<string name="omnipod_pod_management_discard_pod_confirmation">If you discard the Pod, you will not be able to communicate with it anymore. You should only do this when all communication with the Pod persistently fails. If you can still communicate with the Pod, please use the <b>Deactivate Pod</b> option.\n\nIf you wish to proceed, please make sure to remove the Pod from your body!</string>
@ -254,7 +254,6 @@
<!-- Omnipod - Other -->
<string name="omnipod_pump_description">Pump integration for Omnipod, requires RileyLink (with at least 2.0 firmware) device.</string>
<string name="omnipod_custom_action_reset_rileylink">Reset RileyLink config</string>
<string name="omnipod_uncertain">uncertain</string>
<string name="omnipod_pulse_log">Pulse log</string>
<string name="omnipod_pulse_log_value">Pulse Log (copied to clipboard)</string>

View file

@ -59,7 +59,7 @@ public class OmnipodPumpPluginTest {
PowerMockito.mockStatic(Looper.class);
OmnipodPumpPlugin plugin = new OmnipodPumpPlugin(injector, aapsLogger, rxBusWrapper, null,
resourceHelper, activePluginProvider, null, null, aapsOmnipodManager, commandQueueProvider,
null, null, null, null, null,
null, null, null, null,
rileyLinkUtil, null, null, null
);
when(activePluginProvider.getActiveTreatments().getTempBasalFromHistory(anyLong())).thenReturn(null);