Add match notification digests

This commit is contained in:
jjbrunton committed 2026-01-17 20:16:05 +00:00
1 parent b070a6f6a2
commit 3e70669a27
5 files changed
+324 -33

No files matched your search

+29 -17
View File
@@ -17,11 +17,13 @@ Notifications.setNotificationHandler({
});
// Types
export interface NotificationData {
type: "match" | "message";
match_id?: string;
message_id?: string;
}
export interface NotificationData {
type: "match" | "message" | "match_digest";
match_id?: string;
message_id?: string;
count?: number;
}
/**
* Request notification permissions and get Expo push token.
@@ -219,18 +221,28 @@ export async function checkAndRegisterPushToken(userId: string): Promise<boolean
/**
* Handle notification tap - navigate to appropriate screen.
*/
export function handleNotificationResponse(
response: Notifications.NotificationResponse
): void {
const data = response.notification.request.content.data as NotificationData;
if (!data?.match_id) {
return;
}
// Both match and message notifications navigate to chat
router.push(`/(app)/chat/${data.match_id}`);
}
export function handleNotificationResponse(
response: Notifications.NotificationResponse
): void {
const data = response.notification.request.content.data as NotificationData;
if (!data) {
return;
}
if (data.type === "match_digest") {
router.push("/(app)/matches");
return;
}
if (!data.match_id) {
return;
}
// Both match and message notifications navigate to chat
router.push(`/(app)/chat/${data.match_id}`);
}
/**
* Set up listener for notification taps (when app is running).