Merge pull request #962 from Philoul/New/StringsForReadStatusreason
Add strings for readstatus reason
This commit is contained in:
commit
2aa85c80a6
23 changed files with 48 additions and 25 deletions
|
@ -499,7 +499,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
|
||||
private fun processPUMP(divided: Array<String>, receivedSms: Sms) {
|
||||
if (divided.size == 1) {
|
||||
commandQueue.readStatus("SMS", object : Callback() {
|
||||
commandQueue.readStatus(rh.gs(R.string.sms), object : Callback() {
|
||||
override fun run() {
|
||||
val pump = activePlugin.activePump
|
||||
if (result.success) {
|
||||
|
@ -828,7 +828,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
override fun run() {
|
||||
val resultSuccess = result.success
|
||||
val resultBolusDelivered = result.bolusDelivered
|
||||
commandQueue.readStatus("SMS", object : Callback() {
|
||||
commandQueue.readStatus(rh.gs(R.string.sms), object : Callback() {
|
||||
override fun run() {
|
||||
if (resultSuccess) {
|
||||
var replyText = if (isMeal)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package info.nightscout.androidaps.queue.commands
|
||||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.PumpEnactResult
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
|
@ -29,5 +30,5 @@ class CommandReadStatus(
|
|||
callback?.result(result)?.run()
|
||||
}
|
||||
|
||||
override fun status(): String = "READSTATUS $reason"
|
||||
override fun status(): String = rh.gs(R.string.read_status, reason)
|
||||
}
|
|
@ -12,6 +12,7 @@ import com.google.common.util.concurrent.ListenableFuture
|
|||
import dagger.android.DaggerBroadcastReceiver
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.BuildConfig
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.ProfileSealed
|
||||
import info.nightscout.androidaps.interfaces.Config
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
|
@ -32,6 +33,7 @@ import info.nightscout.androidaps.utils.DateUtil
|
|||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.LocalAlertUtils
|
||||
import info.nightscout.androidaps.utils.T
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import javax.inject.Inject
|
||||
import kotlin.math.abs
|
||||
|
||||
|
@ -72,6 +74,7 @@ class KeepAliveReceiver : DaggerBroadcastReceiver() {
|
|||
@Inject lateinit var commandQueue: CommandQueue
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var maintenancePlugin: MaintenancePlugin
|
||||
@Inject lateinit var rh: ResourceHelper
|
||||
|
||||
init {
|
||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
||||
|
@ -152,10 +155,10 @@ class KeepAliveReceiver : DaggerBroadcastReceiver() {
|
|||
rxBus.send(EventProfileSwitchChanged())
|
||||
} else if (isStatusOutdated && !pump.isBusy()) {
|
||||
lastReadStatus = System.currentTimeMillis()
|
||||
commandQueue.readStatus("KeepAlive. Status outdated.", null)
|
||||
commandQueue.readStatus(rh.gs(R.string.keepalive_status_outdated), null)
|
||||
} else if (isBasalOutdated && !pump.isBusy()) {
|
||||
lastReadStatus = System.currentTimeMillis()
|
||||
commandQueue.readStatus("KeepAlive. Basal outdated.", null)
|
||||
commandQueue.readStatus(rh.gs(R.string.keepalive_basal_outdated), null)
|
||||
}
|
||||
if (lastRun != 0L && System.currentTimeMillis() - lastRun > T.mins(10).msecs()) {
|
||||
aapsLogger.error(LTag.CORE, "KeepAlive fail")
|
||||
|
|
|
@ -292,7 +292,7 @@ class SWDefinition @Inject constructor(
|
|||
.visibility { activePlugin.activePump is OmnipodErosPumpPlugin })
|
||||
.add(SWButton(injector)
|
||||
.text(R.string.readstatus)
|
||||
.action { commandQueue.readStatus("Clicked connect to pump", null) }
|
||||
.action { commandQueue.readStatus(rh.gs(R.string.clicked_connect_to_pump), null) }
|
||||
.visibility {
|
||||
// Hide for Omnipod, because as we don't require a Pod to be paired in the setup wizard,
|
||||
// Getting the status might not be possible
|
||||
|
|
|
@ -74,7 +74,7 @@ public class ComboFragment extends DaggerFragment {
|
|||
refreshButton = view.findViewById(R.id.combo_refresh_button);
|
||||
refreshButton.setOnClickListener(v -> {
|
||||
refreshButton.setEnabled(false);
|
||||
commandQueue.readStatus("User request", new Callback() {
|
||||
commandQueue.readStatus(rh.gs(R.string.user_request), new Callback() {
|
||||
@Override
|
||||
public void run() {
|
||||
runOnUiThread(() -> refreshButton.setEnabled(true));
|
||||
|
|
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.interfaces
|
|||
|
||||
import android.os.SystemClock
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.core.R
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
|
||||
|
@ -18,7 +19,7 @@ abstract class PumpPluginBase(
|
|||
if (getType() == PluginType.PUMP) {
|
||||
Thread {
|
||||
SystemClock.sleep(3000)
|
||||
commandQueue.readStatus("Pump driver changed.", null)
|
||||
commandQueue.readStatus(rh.gs(R.string.pump_driver_changed), null)
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -504,6 +504,24 @@
|
|||
<string name="basal_value">Basal value</string>
|
||||
<string name="nsclient_version_does_not_match">NSClient version doesn\'t match to AndroidAPS. Please update.</string>
|
||||
|
||||
<!-- readStatus reasons -->
|
||||
<string name="keepalive_status_outdated" comment="26 characters max for translation">KeepAlive. Status outdated.</string>
|
||||
<string name="keepalive_basal_outdated" comment="26 characters max for translation">KeepAlive. Basal outdated.</string>
|
||||
<string name="sms" comment="26 characters max for translation">SMS</string>
|
||||
<string name="clicked_connect_to_pump" comment="26 characters max for translation">Clicked connect to pump</string>
|
||||
<string name="pump_driver_changed" comment="26 characters max for translation">Pump driver changed.</string>
|
||||
<string name="pump_driver_change" comment="26 characters max for translation">Pump driver change.</string>
|
||||
<string name="device_changed" comment="26 characters max for translation">Device changed</string>
|
||||
<string name="clicked_refresh" comment="26 characters max for translation">Clicked refresh</string>
|
||||
<string name="scheduled_status_refresh" comment="26 characters max for translation">Scheduled Status Refresh</string>
|
||||
<string name="unconfirmed_command" comment="26 characters max for translation">Unconfirmed command</string>
|
||||
<string name="requested_by_user" comment="26 characters max for translation">Requested by user</string>
|
||||
<string name="user_request" comment="26 characters max for translation">User request</string>
|
||||
<string name="bolus_ok" comment="26 characters max for translation">Bolus OK</string>
|
||||
<string name="pump_paired" comment="26 characters max for translation">Pump paired</string>
|
||||
<string name="insight_refresh_button" comment="26 characters max for translation">Insight Refresh Button</string>
|
||||
<string name="read_status" comment="10 characters max for READSTATUS translation">READSTATUS %1$s</string>
|
||||
|
||||
<plurals name="days">
|
||||
<item quantity="one">%1$d day</item>
|
||||
<item quantity="other">%1$d days</item>
|
||||
|
|
|
@ -112,7 +112,7 @@ class DanaFragment : DaggerFragment() {
|
|||
binding.btConnectionLayout.setOnClickListener {
|
||||
aapsLogger.debug(LTag.PUMP, "Clicked connect to pump")
|
||||
danaPump.reset()
|
||||
commandQueue.readStatus("Clicked connect to pump", null)
|
||||
commandQueue.readStatus(rh.gs(R.string.clicked_connect_to_pump), null)
|
||||
}
|
||||
if (activePlugin.activePump.pumpDescription.pumpType == PumpType.DANA_RS ||
|
||||
activePlugin.activePump.pumpDescription.pumpType == PumpType.DANA_I
|
||||
|
|
|
@ -33,7 +33,7 @@ class MsgInitConnStatusTime_k(
|
|||
//If profile coming from pump, switch it as well
|
||||
configBuilder.storeSettings("ChangingKoreanDanaDriver")
|
||||
rxBus.send(EventRebuildTabs())
|
||||
commandQueue.readStatus("PumpDriverChange", null) // force new connection
|
||||
commandQueue.readStatus(rh.gs(R.string.pump_driver_change), null) // force new connection
|
||||
return
|
||||
}
|
||||
val time = dateTimeSecFromBuff(bytes, 0)
|
||||
|
|
|
@ -291,7 +291,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
|
|||
SystemClock.sleep(300);
|
||||
|
||||
danaPump.setBolusingTreatment(null);
|
||||
commandQueue.readStatus("bolusOK", null);
|
||||
commandQueue.readStatus(rh.gs(R.string.bolus_ok), null);
|
||||
}
|
||||
|
||||
return !start.failed;
|
||||
|
|
|
@ -40,7 +40,7 @@ class MsgCheckValue_v2(
|
|||
//If profile coming from pump, switch it as well
|
||||
configBuilder.storeSettings("ChangingDanaRv2Driver")
|
||||
rxBus.send(EventRebuildTabs())
|
||||
commandQueue.readStatus("PumpDriverChange", null) // force new connection
|
||||
commandQueue.readStatus(rh.gs(R.string.pump_driver_change), null) // force new connection
|
||||
return
|
||||
}
|
||||
if (danaPump.protocol != 2) {
|
||||
|
@ -57,7 +57,7 @@ class MsgCheckValue_v2(
|
|||
//If profile coming from pump, switch it as well
|
||||
configBuilder.storeSettings("ChangingDanaRv2Driver")
|
||||
rxBus.send(EventRebuildTabs())
|
||||
commandQueue.readStatus("PumpDriverChange", null) // force new connection
|
||||
commandQueue.readStatus(rh.gs(R.string.pump_driver_change), null) // force new connection
|
||||
return
|
||||
}
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Model: " + String.format("%02X ", danaPump.hwModel))
|
||||
|
|
|
@ -111,7 +111,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
|
|||
if (event.isChanged(getRh(), R.string.key_danar_bt_name)) {
|
||||
danaPump.reset();
|
||||
pumpSync.connectNewPump();
|
||||
getCommandQueue().readStatus("DeviceChanged", null);
|
||||
getCommandQueue().readStatus(getRh().gs(R.string.device_changed), null);
|
||||
}
|
||||
})
|
||||
);
|
||||
|
|
|
@ -32,7 +32,7 @@ class MsgInitConnStatusTime(
|
|||
//If profile coming from pump, switch it as well
|
||||
configBuilder.storeSettings("ChangingDanaDriver")
|
||||
rxBus.send(EventRebuildTabs())
|
||||
commandQueue.readStatus("PumpDriverChange", null) // force new connection
|
||||
commandQueue.readStatus(rh.gs(R.string.pump_driver_change), null) // force new connection
|
||||
failed = false
|
||||
return
|
||||
} else {
|
||||
|
|
|
@ -356,7 +356,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
commandQueue.readStatus("bolusOK", null);
|
||||
commandQueue.readStatus(rh.gs(R.string.bolus_ok), null);
|
||||
}
|
||||
}
|
||||
return !start.failed;
|
||||
|
|
|
@ -139,7 +139,7 @@ class DanaRSPlugin @Inject constructor(
|
|||
mDeviceAddress = sp.getString(R.string.key_danars_address, "")
|
||||
mDeviceName = sp.getString(R.string.key_danars_name, "")
|
||||
danaPump.reset()
|
||||
commandQueue.readStatus("DeviceChanged", null)
|
||||
commandQueue.readStatus(rh.gs(R.string.device_changed), null)
|
||||
}
|
||||
|
||||
override fun connect(reason: String) {
|
||||
|
|
|
@ -82,7 +82,7 @@ class DiaconnG8Fragment : DaggerFragment() {
|
|||
binding.btconnection.setOnClickListener {
|
||||
aapsLogger.debug(LTag.PUMP, "Clicked connect to pump")
|
||||
diaconnG8Pump.lastConnection = 0
|
||||
commandQueue.readStatus("Clicked connect to pump", null)
|
||||
commandQueue.readStatus(rh.gs(R.string.clicked_connect_to_pump), null)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ class DiaconnG8Plugin @Inject constructor(
|
|||
mDeviceAddress = sp.getString(R.string.key_diaconn_g8_address, "")
|
||||
mDeviceName = sp.getString(R.string.key_diaconn_g8_name, "")
|
||||
diaconnG8Pump.reset()
|
||||
commandQueue.readStatus("DeviceChanged", null)
|
||||
commandQueue.readStatus(rh.gs(R.string.device_changed), null)
|
||||
}
|
||||
|
||||
override fun connect(reason: String) {
|
||||
|
|
|
@ -149,7 +149,7 @@ public class LocalInsightFragment extends DaggerFragment implements View.OnClick
|
|||
});
|
||||
}
|
||||
};
|
||||
commandQueue.readStatus("InsightRefreshButton", refreshCallback);
|
||||
commandQueue.readStatus(rh.gs(R.string.insight_refresh_button), refreshCallback);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1628,7 +1628,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constrai
|
|||
|
||||
@Override
|
||||
public void onPumpPaired() {
|
||||
commandQueue.readStatus("Pump paired", null);
|
||||
commandQueue.readStatus(rh.gs(R.string.pump_paired), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -110,7 +110,7 @@ class MedtronicFragment : DaggerFragment() {
|
|||
} else {
|
||||
binding.refresh.isEnabled = false
|
||||
medtronicPumpPlugin.resetStatusState()
|
||||
commandQueue.readStatus("Clicked refresh", object : Callback() {
|
||||
commandQueue.readStatus(rh.gs(R.string.clicked_refresh), object : Callback() {
|
||||
override fun run() {
|
||||
activity?.runOnUiThread { if (_binding != null) binding.refresh.isEnabled = true }
|
||||
}
|
||||
|
|
|
@ -203,7 +203,7 @@ class MedtronicPumpPlugin @Inject constructor(
|
|||
)!!
|
||||
if (doWeHaveAnyStatusNeededRefreshing(statusRefresh)) {
|
||||
if (!commandQueue.statusInQueue()) {
|
||||
commandQueue.readStatus("Scheduled Status Refresh", null)
|
||||
commandQueue.readStatus(rh.gs(R.string.scheduled_status_refresh), null)
|
||||
}
|
||||
}
|
||||
clearBusyQueue()
|
||||
|
|
|
@ -197,7 +197,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
|||
commandQueue.size() == 0 &&
|
||||
commandQueue.performing() == null
|
||||
) {
|
||||
commandQueue.readStatus("Unconfirmed command", null)
|
||||
commandQueue.readStatus(rh.gs(R.string.unconfirmed_command), null)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
|||
buttonBinding.buttonRefreshStatus.setOnClickListener {
|
||||
disablePodActionButtons()
|
||||
commandQueue.readStatus(
|
||||
"REQUESTED BY USER",
|
||||
rh.gs(R.string.requested_by_user),
|
||||
DisplayResultDialogCallback(
|
||||
rh.gs(R.string.omnipod_common_error_failed_to_refresh_status),
|
||||
false
|
||||
|
|
Loading…
Reference in a new issue