Files
streamyfin/utils/device.ts
2025-03-16 18:01:12 +01:00

20 lines
400 B
TypeScript

import uuid from "react-native-uuid";
import { storage } from "./mmkv";
export const getOrSetDeviceId = () => {
let deviceId = storage.getString("deviceId");
if (!deviceId) {
deviceId = uuid.v4() as string;
storage.set("deviceId", deviceId);
}
return deviceId;
};
export const getDeviceId = () => {
const deviceId = storage.getString("deviceId");
return deviceId || null;
};