同步草稿未读原生角标
平台壳按可见作品架未读完成草稿同步 app.setBadgeCount 新增草稿未读更新计数模型并覆盖多恢复ID去重 更新原生壳方案、HostBridge 协议和共享决策记录
This commit is contained in:
@@ -1111,6 +1111,79 @@ export function hasUnreadDraftGenerationUpdates(
|
||||
});
|
||||
}
|
||||
|
||||
export function countUnreadDraftGenerationUpdates(
|
||||
notices: DraftGenerationNoticeMap,
|
||||
sources: PlatformDraftGenerationVisibleShelfSources,
|
||||
) {
|
||||
const hasUnreadNotice = (keys: readonly string[]) =>
|
||||
keys.some((key) => {
|
||||
const notice = notices[key];
|
||||
return notice?.status === 'ready' && !notice.seen;
|
||||
});
|
||||
|
||||
return [
|
||||
...sources.rpgItems.map((item) =>
|
||||
collectDraftNoticeKeys('rpg', [
|
||||
item.workId,
|
||||
item.sessionId,
|
||||
item.profileId,
|
||||
]),
|
||||
),
|
||||
...sources.bigFishItems.map((item) =>
|
||||
collectDraftNoticeKeys('big-fish', [item.workId, item.sourceSessionId]),
|
||||
),
|
||||
...sources.jumpHopItems.map((item) =>
|
||||
collectDraftNoticeKeys('jump-hop', [
|
||||
item.workId,
|
||||
item.profileId,
|
||||
item.sourceSessionId,
|
||||
]),
|
||||
),
|
||||
...sources.woodenFishItems.map((item) =>
|
||||
collectDraftNoticeKeys('wooden-fish', [
|
||||
item.workId,
|
||||
item.profileId,
|
||||
item.sourceSessionId,
|
||||
]),
|
||||
),
|
||||
...sources.match3dItems.map((item) =>
|
||||
collectDraftNoticeKeys('match3d', [
|
||||
item.workId,
|
||||
item.profileId,
|
||||
item.sourceSessionId,
|
||||
]),
|
||||
),
|
||||
...sources.squareHoleItems.map((item) =>
|
||||
collectDraftNoticeKeys('square-hole', [
|
||||
item.workId,
|
||||
item.profileId,
|
||||
item.sourceSessionId,
|
||||
]),
|
||||
),
|
||||
...sources.puzzleItems.map((item) =>
|
||||
collectDraftNoticeKeys('puzzle', [
|
||||
item.workId,
|
||||
item.profileId,
|
||||
item.sourceSessionId,
|
||||
buildPuzzleResultWorkId(item.sourceSessionId),
|
||||
buildPuzzleResultProfileId(item.sourceSessionId),
|
||||
]),
|
||||
),
|
||||
...sources.visualNovelItems.map((item) =>
|
||||
collectDraftNoticeKeys('visual-novel', [item.profileId]),
|
||||
),
|
||||
...sources.barkBattleItems.map((item) =>
|
||||
collectDraftNoticeKeys('bark-battle', [item.workId, item.draftId]),
|
||||
),
|
||||
...sources.babyObjectMatchItems.map((item) =>
|
||||
collectDraftNoticeKeys('baby-object-match', [
|
||||
item.profileId,
|
||||
item.draftId,
|
||||
]),
|
||||
),
|
||||
].filter(hasUnreadNotice).length;
|
||||
}
|
||||
|
||||
export function mergeBigFishWorkSummary(
|
||||
current: BigFishWorkSummary,
|
||||
updated: BigFishWorkSummary,
|
||||
|
||||
Reference in New Issue
Block a user