cynarAI 6c7eed7580 Initial clean evOo-local from f00577b
Fresh history cut from cynarAI/evoo antigravity-handoff/project-timeline
(Voice First + project timeline). Brand docs/titles as evOo; keep @rakazo/*
packages as tech debt. Excludes node_modules, caches, secrets, voice blobs.
2026-09-20 17:15:16 +02:00

23 lines
858 B
TypeScript

import Constants from "expo-constants";
import * as Notifications from "expo-notifications";
import { rpc } from "./api";
export async function registerPushToken() {
const existing = await Notifications.getPermissionsAsync();
const granted = existing.granted || (await Notifications.requestPermissionsAsync()).granted;
if (!granted) return;
try {
const projectId = Constants.easConfig?.projectId ?? Constants.expoConfig?.extra?.eas?.projectId;
if (!projectId) return;
const token = (await Notifications.getExpoPushTokenAsync({ projectId })).data;
if (!token) return;
await rpc("notifications/registerPush", { token });
} catch {
// Expo Go cannot mint an ExponentPushToken without an EAS project id.
}
}
export async function unregisterPushToken() {
await rpc("notifications/unregisterPush").catch(() => undefined);
}