feat(chat): implement external browser prompt logic and update tests

This commit is contained in:
2026-07-09 19:10:12 +08:00
parent a99db98ace
commit 270e84385b
4 changed files with 88 additions and 9 deletions
+7 -2
View File
@@ -28,7 +28,7 @@ import {
} from "./chat-image-overlay-url";
import {
deriveIsGuest,
isChatDevelopmentEnvironment,
shouldStartExternalBrowserPrompt,
} from "./chat-screen.helpers";
import { useFirstRechargeOfferBanner } from "./hooks/use-first-recharge-offer-banner";
import { useChatUnlockNavigationFlow } from "./hooks/use-chat-unlock-navigation-flow";
@@ -90,6 +90,11 @@ export function ChatScreen() {
loginStatus: authState.loginStatus,
});
const shouldShowPwaInstall = state.historyLoaded && state.messages.length >= 10;
const shouldShowBrowserHint = shouldStartExternalBrowserPrompt({
hasInitialized: authState.hasInitialized,
isLoading: authState.isLoading,
loginStatus: authState.loginStatus,
});
useChatGuestLogin({
dispatch: authDispatch,
@@ -186,7 +191,7 @@ export function ChatScreen() {
</div>
{/* 浏览器提示(应用内浏览器检测) */}
<BrowserHintOverlay forceShow={isChatDevelopmentEnvironment()} />
{shouldShowBrowserHint ? <BrowserHintOverlay forceShow /> : null}
{/* PWA 安装提示触发器(聊天消息数量达到阈值后才允许弹出) */}
<PwaInstallOverlay enabled={shouldShowPwaInstall} />