fix(chat): isolate pending flows and cancel stale requests

This commit is contained in:
2026-07-17 19:22:01 +08:00
parent 2fc312b5c7
commit 8bb1e21886
27 changed files with 501 additions and 92 deletions
+17 -9
View File
@@ -18,6 +18,7 @@ export type {
};
export async function savePendingChatUnlock(input: {
characterId: string;
displayMessageId?: string;
messageId?: string;
kind: PendingChatUnlockKind;
@@ -30,16 +31,20 @@ export async function savePendingChatUnlock(input: {
await NavigationStorage.savePendingChatUnlock(input);
}
export async function consumePendingChatUnlock(): Promise<PendingChatUnlock | null> {
return NavigationStorage.consumePendingChatUnlock();
export async function consumePendingChatUnlock(
characterId: string,
): Promise<PendingChatUnlock | null> {
return NavigationStorage.consumePendingChatUnlock(characterId);
}
export async function peekPendingChatUnlock(): Promise<PendingChatUnlock | null> {
return NavigationStorage.peekPendingChatUnlock();
export async function peekPendingChatUnlock(
characterId: string,
): Promise<PendingChatUnlock | null> {
return NavigationStorage.peekPendingChatUnlock(characterId);
}
export async function hasPendingChatUnlock(): Promise<boolean> {
return NavigationStorage.hasPendingChatUnlock();
export async function hasPendingChatUnlock(characterId: string): Promise<boolean> {
return NavigationStorage.hasPendingChatUnlock(characterId);
}
export async function clearPendingChatUnlock(): Promise<void> {
@@ -48,12 +53,15 @@ export async function clearPendingChatUnlock(): Promise<void> {
export async function savePendingChatPromotion(
promotionType: PendingChatPromotionType,
characterId: string,
): Promise<PendingChatPromotion> {
return NavigationStorage.savePendingChatPromotion(promotionType);
return NavigationStorage.savePendingChatPromotion(promotionType, characterId);
}
export async function consumePendingChatPromotion(): Promise<PendingChatPromotion | null> {
return NavigationStorage.consumePendingChatPromotion();
export async function consumePendingChatPromotion(
characterId: string,
): Promise<PendingChatPromotion | null> {
return NavigationStorage.consumePendingChatPromotion(characterId);
}
export async function clearPendingChatPromotion(): Promise<void> {