Enhancements to Nightscout and Terminal apps

Nightscout app: Alert thresholds for canula age, cartridge volume, pump
battery, time since last loop, shown in top bar. Option to always show
in top bar when window is closed.

Terminal app: Activity indicators in the app-switcher sidebar.
</details>
This commit is contained in:
James Babcock committed 2026-09-08 13:58:47 -07:00
1 parent 9b70880a5b
commit 070c891577
13 files changed
+566 -71

No files matched your search

+43
View File
@@ -1,3 +1,4 @@
import { normalizeNightscoutThreshold, type NightscoutThresholds } from "../apps/nightscout/nightscout-alerts";
import { GESTURE_DOUBLE_CLICK, InputEvent } from "./gestures";
import {
getBooleanSetting,
@@ -755,6 +756,48 @@ export const nightscoutApiTokenSetting = new ConfigSettingString({
description: "Access token for the Nightscout site's API.",
});
function nightscoutThresholdSetting(id: string, label: string, unit: string, description: string): ConfigSettingString {
return new ConfigSettingString({
id: `nightscout-${id}`,
label,
storageKey: `integrations.nightscout.${id}`,
defaultValue: "0",
editorTitle: `${label} (${unit}; 0 = off)`,
normalize: normalizeNightscoutThreshold,
formatValue: (value) => Number(value) > 0 ? `${value} ${unit}` : "Off",
description: `${description} Enter 0 to disable.`,
});
}
export const nightscoutMaxCannulaAgeSetting = nightscoutThresholdSetting(
"max-cannula-age-hours", "Max cannula age", "h", "Warn when time since the last site change exceeds this many hours.",
);
export const nightscoutCartridgeLowSetting = nightscoutThresholdSetting(
"cartridge-low-units", "Cartridge low threshold", "U", "Warn when the pump reservoir falls below this many units.",
);
export const nightscoutBatteryLowSetting = nightscoutThresholdSetting(
"battery-low-voltage", "Battery voltage threshold", "V", "Warn when pump battery voltage falls below this value.",
);
export const nightscoutMaxLoopAgeSetting = nightscoutThresholdSetting(
"max-loop-age-minutes", "Max time since last loop", "min", "Warn when time since the last loop exceeds this many minutes.",
);
export const nightscoutAlwaysShowInTopBarSetting = new ConfigSettingBoolean({
id: "nightscout-always-show-in-top-bar",
label: "Always show in top bar",
storageKey: "integrations.nightscout.alwaysShowInTopBar",
defaultValue: false,
description: "Keep the Nightscout glucose graph and warnings in the top bar even when all Nightscout windows are closed.",
});
export function loadNightscoutThresholds(): NightscoutThresholds {
return {
maxCannulaAgeHours: Number(nightscoutMaxCannulaAgeSetting.get()),
cartridgeLowUnits: Number(nightscoutCartridgeLowSetting.get()),
batteryLowVoltage: Number(nightscoutBatteryLowSetting.get()),
maxLoopAgeMinutes: Number(nightscoutMaxLoopAgeSetting.get()),
};
}
// ---------------------------------------------------------------------------
// Navigate app: saved and recent destinations.