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>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user