mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 18:10:43 +00:00
* feat: add iOS background presence beacon Co-authored-by: ngutman <1540134+ngutman@users.noreply.github.com> * fix: keep iOS background reconnects ahead of beacon throttle * build: refresh gateway protocol swift models * fix: emit swift protocol string enums --------- Co-authored-by: ngutman <1540134+ngutman@users.noreply.github.com>
25 lines
770 B
TypeScript
25 lines
770 B
TypeScript
import { normalizeOptionalString } from "./string-coerce.js";
|
|
|
|
export const NODE_PRESENCE_ALIVE_EVENT = "node.presence.alive";
|
|
|
|
export const NODE_PRESENCE_ALIVE_REASONS = [
|
|
"background",
|
|
"silent_push",
|
|
"bg_app_refresh",
|
|
"significant_location",
|
|
"manual",
|
|
"connect",
|
|
] as const;
|
|
|
|
export type NodePresenceAliveReason = (typeof NODE_PRESENCE_ALIVE_REASONS)[number];
|
|
|
|
const NODE_PRESENCE_ALIVE_REASON_SET = new Set<string>(NODE_PRESENCE_ALIVE_REASONS);
|
|
|
|
export function normalizeNodePresenceAliveReason(value: unknown): NodePresenceAliveReason {
|
|
const normalized = normalizeOptionalString(value)?.toLowerCase();
|
|
if (normalized && NODE_PRESENCE_ALIVE_REASON_SET.has(normalized)) {
|
|
return normalized as NodePresenceAliveReason;
|
|
}
|
|
return "background";
|
|
}
|