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 { AuthClientPresentationMetadata } from "@t3tools/contracts"; |
| 2 | import * as Device from "expo-device"; |
| 3 | import { Platform } from "react-native"; |
| 4 | |
| 5 | export function authClientMetadata(appVersion?: string): AuthClientPresentationMetadata { |
| 6 | const osMajorVersion = Number.parseInt(Device.osVersion?.split(".")[0] ?? "", 10); |
| 7 | const deviceModel = Device.modelName?.trim(); |
| 8 | |
| 9 | return { |
| 10 | // oxlint-disable-next-line t3code/no-untranslated-copy -- product name |
| 11 | label: "T3 Code Mobile", |
| 12 | deviceType: |
| 13 | Device.deviceType === Device.DeviceType.TABLET |
| 14 | ? "tablet" |
| 15 | : Device.deviceType === Device.DeviceType.PHONE |
| 16 | ? "mobile" |
| 17 | : "unknown", |
| 18 | ...(Platform.OS === "ios" ? { os: "iOS" } : Platform.OS === "android" ? { os: "Android" } : {}), |
| 19 | ...(Number.isFinite(osMajorVersion) && osMajorVersion > 0 ? { osMajorVersion } : {}), |
| 20 | ...(deviceModel ? { deviceModel } : {}), |
| 21 | surface: "mobile", |
| 22 | ...(appVersion ? { appVersion } : {}), |
| 23 | }; |
| 24 | } |