The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import type { Wakeups } from "@t3tools/client-runtime/connection"; |
| 2 | |
| 3 | const MOBILE_LONG_BACKGROUND_AFTER_MS = 10_000; |
| 4 | |
| 5 | export type MobileApplicationActiveWakeup = Extract< |
| 6 | Wakeups.ConnectionWakeup, |
| 7 | "application-active-probe" | "application-active-long" |
| 8 | >; |
| 9 | |
| 10 | export function mobileApplicationActiveWakeup( |
| 11 | backgroundedAtMs: number | null, |
| 12 | activeAtMs: number, |
| 13 | ): MobileApplicationActiveWakeup { |
| 14 | return backgroundedAtMs !== null && |
| 15 | activeAtMs - backgroundedAtMs >= MOBILE_LONG_BACKGROUND_AFTER_MS |
| 16 | ? "application-active-long" |
| 17 | : "application-active-probe"; |
| 18 | } |