WIP: new-activity notification #231
@@ -3,7 +3,16 @@ import { Preferences } from "@capacitor/preferences";
|
||||
const DEVICE_ID_KEY = "stable_device_id";
|
||||
|
||||
function generateDeviceId(): string {
|
||||
return crypto.randomUUID();
|
||||
if (typeof crypto !== "undefined" && crypto.randomUUID) {
|
||||
return crypto.randomUUID();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
"[DeviceId] crypto.randomUUID unavailable, using fallback generator",
|
||||
);
|
||||
|
||||
return `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
||||
}
|
||||
|
||||
export async function getOrCreateDeviceId(): Promise<string> {
|
||||
|
||||
Reference in New Issue
Block a user