Skip to content

Commit ca673eb

Browse files
committed
feat: 안드로이드 비활성화 및 웹으로 연결
1 parent 2f18597 commit ca673eb

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

src/components/StartButton.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,27 @@ import {
77
DropdownMenuTrigger,
88
} from "@/components/ui/dropdown-menu";
99
import { ChevronDown } from "lucide-react";
10+
import { useToast } from "@/hooks/use-toast";
1011

1112
interface StartButtonProps {
1213
location: string;
1314
}
1415

1516
export const StartButton = ({ location }: StartButtonProps) => {
17+
const { toast } = useToast();
18+
1619
const handleClick = (platform?: Platform) => {
1720
trackButtonClick("start_btn", location);
21+
22+
if (platform === "android") {
23+
toast({
24+
title: "출시 준비 중",
25+
description: "안드로이드 앱은 현재 출시 준비 중입니다.",
26+
});
27+
28+
return;
29+
}
30+
1831
openKanataApp(platform);
1932
};
2033

src/lib/utils.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,32 @@ export function cn(...inputs: ClassValue[]) {
88

99
export type Platform = "android" | "ios" | "web" | "auto";
1010

11-
export type DeviceType = "mobile" | "desktop";
11+
export type DeviceType = "android" | "ios" | "desktop";
1212

13+
// TODO: 안드로이드 출시 후 ONE_LINK 연결
1314
const ONE_LINK = "https://kanata.onelink.me/dYmZ/vukegfoa";
1415

1516
export function getPlatformUrl(platform: Platform): string {
1617
switch (platform) {
17-
case "android":
18-
return ONE_LINK;
1918
case "ios":
2019
return ONE_LINK;
21-
case "web":
20+
default:
2221
return "https://kanata.live";
2322
}
2423
}
2524

26-
function getDeviceType() {
25+
function getDeviceType(): DeviceType {
2726
const userAgent = navigator.userAgent || navigator.vendor || "";
28-
const isMobile = /android|iPad|iPhone|iPod/i.test(userAgent);
29-
return isMobile ? "mobile" : "desktop";
27+
28+
if (/android/i.test(userAgent)) {
29+
return "android";
30+
}
31+
32+
if (/iPad|iPhone|iPod/i.test(userAgent)) {
33+
return "ios";
34+
}
35+
36+
return "desktop";
3037
}
3138

3239
export function openKanataApp(platform?: Platform) {
@@ -36,7 +43,7 @@ export function openKanataApp(platform?: Platform) {
3643
if (platform) {
3744
url = getPlatformUrl(platform);
3845
} else {
39-
url = deviceType === "mobile" ? ONE_LINK : "https://kanata.live";
46+
url = deviceType === "ios" ? ONE_LINK : "https://kanata.live";
4047
}
4148

4249
trackAppOpen(deviceType, platform);

0 commit comments

Comments
 (0)