refactor: 收口创作恢复身份匹配
This commit is contained in:
@@ -408,9 +408,16 @@ import {
|
||||
buildVisualNovelCreationUrlState,
|
||||
buildWoodenFishCreationUrlState,
|
||||
hasPuzzleRuntimeUrlStateValue,
|
||||
matchesBabyObjectMatchCreationUrlRestoreTarget,
|
||||
matchesBarkBattleCreationUrlRestoreTarget,
|
||||
matchesBigFishCreationUrlRestoreTarget,
|
||||
matchesSessionProfileWorkCreationUrlRestoreTarget,
|
||||
matchesVisualNovelCreationUrlRestoreTarget,
|
||||
normalizeCreationUrlValue,
|
||||
resolveCreationUrlRestoreTarget,
|
||||
resolveInitialCreationUrlRestoreDecision,
|
||||
resolveJumpHopCreationUrlRestoreStage,
|
||||
resolveWoodenFishCreationUrlRestoreStage,
|
||||
} from './platformCreationUrlStateModel';
|
||||
import { resolvePlatformCreationWorkDeleteConfirmationModel } from './platformCreationWorkDeleteFlow';
|
||||
import {
|
||||
@@ -12150,7 +12157,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
if (!target) {
|
||||
return;
|
||||
}
|
||||
const { sessionId, profileId, draftId, workId } = target;
|
||||
const { sessionId, profileId } = target;
|
||||
|
||||
if (target.kind === 'big-fish') {
|
||||
const targetSessionId = target.bigFishSessionId;
|
||||
@@ -12159,10 +12166,8 @@ export function PlatformEntryFlowShellImpl({
|
||||
(bigFishWorks.length > 0
|
||||
? bigFishWorks
|
||||
: (await listBigFishWorks().catch(() => ({ items: [] }))).items
|
||||
).find(
|
||||
(item) =>
|
||||
item.sourceSessionId === targetSessionId ||
|
||||
item.workId === workId,
|
||||
).find((item) =>
|
||||
matchesBigFishCreationUrlRestoreTarget(item, target),
|
||||
) ?? null;
|
||||
if (matchedWork) {
|
||||
await openBigFishDraft(matchedWork);
|
||||
@@ -12180,11 +12185,8 @@ export function PlatformEntryFlowShellImpl({
|
||||
: mapMatch3DWorksForRuntimeUi(
|
||||
(await listMatch3DWorks().catch(() => ({ items: [] }))).items,
|
||||
)
|
||||
).find(
|
||||
(item) =>
|
||||
item.sourceSessionId === sessionId ||
|
||||
item.profileId === profileId ||
|
||||
item.workId === workId,
|
||||
).find((item) =>
|
||||
matchesSessionProfileWorkCreationUrlRestoreTarget(item, target),
|
||||
) ?? null;
|
||||
if (matchedWork) {
|
||||
await openMatch3DDraft(matchedWork, { forceDraft: true });
|
||||
@@ -12201,11 +12203,8 @@ export function PlatformEntryFlowShellImpl({
|
||||
(squareHoleWorks.length > 0
|
||||
? squareHoleWorks
|
||||
: (await listSquareHoleWorks().catch(() => ({ items: [] }))).items
|
||||
).find(
|
||||
(item) =>
|
||||
item.sourceSessionId === sessionId ||
|
||||
item.profileId === profileId ||
|
||||
item.workId === workId,
|
||||
).find((item) =>
|
||||
matchesSessionProfileWorkCreationUrlRestoreTarget(item, target),
|
||||
) ?? null;
|
||||
if (matchedWork) {
|
||||
await openSquareHoleDraft(matchedWork, { forceDraft: true });
|
||||
@@ -12222,11 +12221,8 @@ export function PlatformEntryFlowShellImpl({
|
||||
(puzzleWorks.length > 0
|
||||
? puzzleWorks
|
||||
: (await listPuzzleWorks().catch(() => ({ items: [] }))).items
|
||||
).find(
|
||||
(item) =>
|
||||
item.sourceSessionId === sessionId ||
|
||||
item.profileId === profileId ||
|
||||
item.workId === workId,
|
||||
).find((item) =>
|
||||
matchesSessionProfileWorkCreationUrlRestoreTarget(item, target),
|
||||
) ?? null;
|
||||
if (matchedWork) {
|
||||
await openPuzzleDraft(matchedWork);
|
||||
@@ -12243,7 +12239,9 @@ export function PlatformEntryFlowShellImpl({
|
||||
(visualNovelWorks.length > 0
|
||||
? visualNovelWorks
|
||||
: (await listVisualNovelWorks().catch(() => ({ works: [] }))).works
|
||||
).find((item) => item.profileId === profileId) ?? null;
|
||||
).find((item) =>
|
||||
matchesVisualNovelCreationUrlRestoreTarget(item, target),
|
||||
) ?? null;
|
||||
if (matchedWork) {
|
||||
await openVisualNovelDraft(matchedWork, { forceDraft: true });
|
||||
return;
|
||||
@@ -12259,8 +12257,8 @@ export function PlatformEntryFlowShellImpl({
|
||||
(barkBattleWorks.length > 0
|
||||
? barkBattleWorks
|
||||
: (await listBarkBattleWorks().catch(() => ({ items: [] }))).items
|
||||
).find(
|
||||
(item) => item.workId === workId || item.draftId === draftId,
|
||||
).find((item) =>
|
||||
matchesBarkBattleCreationUrlRestoreTarget(item, target),
|
||||
) ?? null;
|
||||
if (matchedWork) {
|
||||
openBarkBattleDraft(matchedWork, { forceDraft: true });
|
||||
@@ -12273,11 +12271,8 @@ export function PlatformEntryFlowShellImpl({
|
||||
(babyObjectMatchDrafts.length > 0
|
||||
? babyObjectMatchDrafts
|
||||
: await listLocalBabyObjectMatchDrafts().catch(() => [])
|
||||
).find(
|
||||
(item) =>
|
||||
item.profileId === profileId ||
|
||||
item.draftId === draftId ||
|
||||
item.profileId === workId,
|
||||
).find((item) =>
|
||||
matchesBabyObjectMatchCreationUrlRestoreTarget(item, target),
|
||||
) ?? null;
|
||||
if (matchedDraft) {
|
||||
openBabyObjectMatchDraft(matchedDraft);
|
||||
@@ -12313,11 +12308,11 @@ export function PlatformEntryFlowShellImpl({
|
||||
);
|
||||
enterCreateTab();
|
||||
setSelectionStage(
|
||||
target.isGeneratingPath
|
||||
? 'jump-hop-generating'
|
||||
: session?.draft || work
|
||||
? 'jump-hop-result'
|
||||
: 'jump-hop-workspace',
|
||||
resolveJumpHopCreationUrlRestoreStage({
|
||||
isGeneratingPath: target.isGeneratingPath,
|
||||
hasRestoredDraft: Boolean(session?.draft),
|
||||
hasRestoredWork: Boolean(work),
|
||||
}),
|
||||
);
|
||||
} catch (error) {
|
||||
setJumpHopError(
|
||||
@@ -12344,11 +12339,10 @@ export function PlatformEntryFlowShellImpl({
|
||||
);
|
||||
enterCreateTab();
|
||||
setSelectionStage(
|
||||
target.isGeneratingPath
|
||||
? 'wooden-fish-generating'
|
||||
: session.draft
|
||||
? 'wooden-fish-result'
|
||||
: 'wooden-fish-workspace',
|
||||
resolveWoodenFishCreationUrlRestoreStage({
|
||||
isGeneratingPath: target.isGeneratingPath,
|
||||
hasRestoredDraft: Boolean(session.draft),
|
||||
}),
|
||||
);
|
||||
} catch (error) {
|
||||
setWoodenFishError(
|
||||
|
||||
Reference in New Issue
Block a user