fix(chat): route private unlocks to subscription
This commit is contained in:
@@ -9,7 +9,7 @@ import type { LoginStatus } from "@/data/dto/auth";
|
|||||||
import { AppStorage } from "@/data/storage/app/app_storage";
|
import { AppStorage } from "@/data/storage/app/app_storage";
|
||||||
import { AuthStorage } from "@/data/storage/auth/auth_storage";
|
import { AuthStorage } from "@/data/storage/auth/auth_storage";
|
||||||
import { UserStorage } from "@/data/storage/user/user_storage";
|
import { UserStorage } from "@/data/storage/user/user_storage";
|
||||||
import { useChatDispatch, useChatState } from "@/stores/chat/chat-context";
|
import { useChatState } from "@/stores/chat/chat-context";
|
||||||
import { AppEnvUtil, BrowserDetector, todayString, UrlLauncherUtil } from "@/utils";
|
import { AppEnvUtil, BrowserDetector, todayString, UrlLauncherUtil } from "@/utils";
|
||||||
import { ROUTE_BUILDERS, ROUTES } from "@/router/routes";
|
import { ROUTE_BUILDERS, ROUTES } from "@/router/routes";
|
||||||
|
|
||||||
@@ -36,7 +36,6 @@ function deriveIsGuest(loginStatus: LoginStatus): boolean {
|
|||||||
|
|
||||||
export function ChatScreen() {
|
export function ChatScreen() {
|
||||||
const state = useChatState();
|
const state = useChatState();
|
||||||
const chatDispatch = useChatDispatch();
|
|
||||||
const authState = useAuthState();
|
const authState = useAuthState();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [showExternalBrowserDialog, setShowExternalBrowserDialog] =
|
const [showExternalBrowserDialog, setShowExternalBrowserDialog] =
|
||||||
@@ -127,8 +126,13 @@ export function ChatScreen() {
|
|||||||
UrlLauncherUtil.openUrlWithExternalBrowser(ROUTES.splash);
|
UrlLauncherUtil.openUrlWithExternalBrowser(ROUTES.splash);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleUnlockPrivateMessage(messageId: string): void {
|
function handleUnlockPrivateMessage(): void {
|
||||||
chatDispatch({ type: "ChatUnlockPrivateMessage", messageId });
|
const subscriptionUrl = ROUTE_BUILDERS.subscription("vip");
|
||||||
|
if (isGuest) {
|
||||||
|
router.push(ROUTE_BUILDERS.authWithRedirect(subscriptionUrl));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
router.push(subscriptionUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleUnlockImagePaywall(): void {
|
function handleUnlockImagePaywall(): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user