Open History to see the last commit
1import type { AuthClientPresentationMetadata } from "@t3tools/contracts";
2import * as Device from "expo-device";
3import { Platform } from "react-native";
4
5export 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 label: "T3 Code Mobile",
11 deviceType: "mobile",
12 ...(Platform.OS === "ios" ? { os: "iOS" } : Platform.OS === "android" ? { os: "Android" } : {}),
13 ...(Number.isFinite(osMajorVersion) && osMajorVersion > 0 ? { osMajorVersion } : {}),
14 ...(deviceModel ? { deviceModel } : {}),
15 surface: "mobile",
16 ...(appVersion ? { appVersion } : {}),
17 };
18}