퀘스트 완료 햅틱 · HOME 행성 반응 · Push·라이브 띠 중복 제어 · 알림함 위계 · Push 탭 화면 이동

This commit is contained in:
Sn-Kinos
2026-10-08 15:48:56 +09:00
parent 0b95454b28
commit 93150a0d5b
28 changed files with 619 additions and 52 deletions
+13 -4
View File
@@ -25,6 +25,10 @@ export interface InboxItem {
title: string;
source: string;
targetPath?: string;
/** 「내 행성」 사건의 팬덤 — Push 탭 시 그 행성 · 이클립스로 가고, 라이브 띠와 같은 사건인지 가린다. */
fandomId?: string;
/** 이클립스 단계 — `start`(C-78 위기) · `defended`(결과, 통보 N-9). */
phase?: 'start' | 'defended';
}
export async function notifyOnce(uid: string, id: string, item: InboxItem): Promise<boolean> {
@@ -74,7 +78,7 @@ export async function notifyEclipseTransition(
await notifyMembers(fandomId, `eclipse_${fandomId}_${roundId}_${started ? 'start' : 'defended'}`, {
eventType: 'eclipse', type: 'fandomEvent',
title: started ? '내 행성의 이클립스가 발생했어요.' : '내 행성의 이클립스를 방어했어요.',
source: name,
source: name, fandomId, phase: started ? 'start' : 'defended',
});
return started ? 'started' : 'defended';
}
@@ -84,7 +88,7 @@ export async function notifyHeroDrop(fandomId: string, dropId: string, heroNickn
const hero = typeof heroNickname === 'string' && heroNickname ? heroNickname : '팬';
return notifyMembers(fandomId, `herodrop_${fandomId}_${dropId}`, {
eventType: 'item_used', type: 'fandomEvent',
title: `${hero}님의 고귀한 기여로 영웅의 선물이 발동되었습니다!`, source: '아이템',
title: `${hero}님의 고귀한 기여로 영웅의 선물이 발동되었습니다!`, source: '아이템', fandomId,
});
}
@@ -120,16 +124,21 @@ export async function notifyQuestDone(
* 트리거가 한 번만 돈다. 재시도는 두지 않는다 — 재전달 시 같은 Push 가 두 번 갈 수 있다.
* ponytail: 회원 전원 알림(이클립스 · 영웅의 선물)은 회원 수만큼 함수가 돈다. 수십만이 되면 토큰 묶음 발송으로.
*/
export async function pushInboxItem(uid: string, item: Partial<InboxItem>): Promise<UserPushOutcome | null> {
export async function pushInboxItem(
uid: string, item: Partial<InboxItem> & { campaignId?: string },
): Promise<UserPushOutcome | null> {
const category = item.type;
if (!category || !PUSH_CATEGORIES.includes(category) || !item.title) return null;
// 앱이 탭 시 실제 화면으로 가고(v1.5 8장 Deep Link) C-78 단계를 가르는 값만 싣는다.
const extra = { targetPath: item.targetPath, campaignId: item.campaignId, phase: item.phase };
return sendUserPush(uid, {
category,
title: 'FANUZU',
body: item.title,
...(item.fandomId ? { fandomId: item.fandomId } : {}),
data: {
kind: item.eventType ?? '',
...(item.targetPath ? { targetPath: item.targetPath } : {}),
...Object.fromEntries(Object.entries(extra).filter((e): e is [string, string] => typeof e[1] === 'string' && e[1] !== '')),
},
});
}