WIP: new-activity notification #231

Draft
trentlarson wants to merge 80 commits from notify-api into master
Showing only changes of commit 4c97c578bb - Show all commits

View File

@@ -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> {