refactor(app): tighten feature boundaries

This commit is contained in:
2026-06-30 14:50:31 +08:00
parent 1fed21fa2f
commit ba6ce57e62
17 changed files with 126 additions and 52 deletions
+8 -7
View File
@@ -3,10 +3,13 @@ import { useEffect, useMemo, useRef, useState } from "react";
import { useRouter } from "next/navigation";
import { BackButton } from "@/app/_components";
import { consumePendingChatImageReturn } from "@/app/chat/chat-image-return-session";
import { Checkbox, MobileShell } from "@/app/_components/core";
import { AppConstants } from "@/core/app_constants";
import { PendingPaymentOrderStorage } from "@/data/storage";
import { consumePendingChatImageReturn } from "@/lib/navigation/chat_image_return_session";
import {
clearPendingPaymentOrder,
getPendingPaymentOrderForType,
} from "@/lib/payment/pending_payment_order";
import {
usePaymentDispatch,
usePaymentState,
@@ -85,13 +88,11 @@ export function SubscriptionScreen({
let cancelled = false;
const handlePendingOrder = async () => {
const result = await PendingPaymentOrderStorage.getPendingOrderForType(
subscriptionType,
);
const result = await getPendingPaymentOrderForType(subscriptionType);
if (cancelled || !result.success || result.data === null) return;
if (!shouldResumePendingOrder) {
await PendingPaymentOrderStorage.clearPendingOrder();
await clearPendingPaymentOrder();
if (
payment.currentOrderId === result.data.orderId &&
(payment.isPollingOrder || payment.isPaid || payment.status === "failed")
@@ -130,7 +131,7 @@ export function SubscriptionScreen({
if (!payment.currentOrderId) return;
if (!payment.isPaid && payment.status !== "failed") return;
void PendingPaymentOrderStorage.clearPendingOrder();
void clearPendingPaymentOrder();
}, [payment.currentOrderId, payment.isPaid, payment.status]);
const vipOfferPlans = useMemo(