fix(chat): restore direct voice unlock subscription
This commit is contained in:
@@ -23,7 +23,6 @@ import {
|
||||
ChatQuotaExhaustedBanner,
|
||||
ExternalBrowserDialog,
|
||||
PwaInstallOverlay,
|
||||
VoiceUnlockOptionsDialog,
|
||||
} from "./components";
|
||||
import styles from "./components/chat-screen.module.css";
|
||||
|
||||
@@ -41,7 +40,6 @@ export function ChatScreen() {
|
||||
const router = useRouter();
|
||||
const [showExternalBrowserDialog, setShowExternalBrowserDialog] =
|
||||
useState(false);
|
||||
const [showVoiceUnlockDialog, setShowVoiceUnlockDialog] = useState(false);
|
||||
|
||||
// isGuest 派生(chat-screen 是唯一知道这个值的地方 —— chat 机器无 isGuest 字段)
|
||||
const isGuest = deriveIsGuest(authState.loginStatus);
|
||||
@@ -62,20 +60,6 @@ export function ChatScreen() {
|
||||
returnTo: "chat",
|
||||
});
|
||||
|
||||
function navigateToSubscription(type: "vip" | "voice"): void {
|
||||
const subscriptionUrl = ROUTE_BUILDERS.subscription(type, {
|
||||
returnTo: "chat",
|
||||
});
|
||||
|
||||
setShowVoiceUnlockDialog(false);
|
||||
if (isGuest) {
|
||||
router.push(ROUTE_BUILDERS.authWithRedirect(subscriptionUrl));
|
||||
return;
|
||||
}
|
||||
|
||||
router.push(subscriptionUrl);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (!authState.hasInitialized || authState.isLoading) return;
|
||||
const isDev = AppEnvUtil.isDevelopment();
|
||||
@@ -170,7 +154,11 @@ export function ChatScreen() {
|
||||
}
|
||||
|
||||
function handleUnlockVoiceMessage(): void {
|
||||
setShowVoiceUnlockDialog(true);
|
||||
if (isGuest) {
|
||||
router.push(ROUTE_BUILDERS.authWithRedirect(chatPaywallSubscriptionUrl));
|
||||
return;
|
||||
}
|
||||
router.push(chatPaywallSubscriptionUrl);
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -230,12 +218,6 @@ export function ChatScreen() {
|
||||
onClose={() => setShowExternalBrowserDialog(false)}
|
||||
onConfirm={() => void handleOpenExternalBrowser()}
|
||||
/>
|
||||
<VoiceUnlockOptionsDialog
|
||||
open={showVoiceUnlockDialog}
|
||||
onClose={() => setShowVoiceUnlockDialog(false)}
|
||||
onBuyVoicePackage={() => navigateToSubscription("voice")}
|
||||
onActivateVip={() => navigateToSubscription("vip")}
|
||||
/>
|
||||
</div>
|
||||
</MobileShell>
|
||||
);
|
||||
|
||||
@@ -13,14 +13,12 @@ import {
|
||||
UserHeader,
|
||||
type SidebarUserState,
|
||||
VipBenefitsCard,
|
||||
VoicePackageCard,
|
||||
} from "./components";
|
||||
|
||||
import styles from "./components/sidebar-screen.module.css";
|
||||
|
||||
const FALLBACK_USERNAME = "User name";
|
||||
const VIP_SUBSCRIPTION_URL = `${ROUTES.subscription}?type=vip`;
|
||||
const VOICE_SUBSCRIPTION_URL = `${ROUTES.subscription}?type=voice`;
|
||||
|
||||
/**
|
||||
* 侧边栏主屏幕
|
||||
@@ -82,6 +80,7 @@ export function SidebarScreen() {
|
||||
/>
|
||||
</section>
|
||||
|
||||
{/*
|
||||
<section className={styles.cardSlot}>
|
||||
<VoicePackageCard
|
||||
usedMinutes={0}
|
||||
@@ -89,6 +88,7 @@ export function SidebarScreen() {
|
||||
onBuyPackage={() => router.push(VOICE_SUBSCRIPTION_URL)}
|
||||
/>
|
||||
</section>
|
||||
*/}
|
||||
|
||||
{sidebarState !== "guest" ? (
|
||||
<section className={styles.settingsSlot}>
|
||||
|
||||
Reference in New Issue
Block a user