From 24c45731dc15d41dd491d0a978c50f404b18ce55 Mon Sep 17 00:00:00 2001 From: Jay Sheen Date: Wed, 5 Nov 2025 14:28:16 +0900 Subject: [PATCH] Add checkAlarmLink feature to handle alarm links on first access MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add CHECK_ALARM_LINK to BridgeMessageType enum - Implement checkAlarmLink method in appBridge class - Add checkAlarmLink to useAppBridge hook - Call checkAlarmLink on HomePage when firstAccess is true - Clean up unused imports and minor code formatting ๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/hooks/useAppBridge.tsx | 13 ++++++++++++- src/pages/home/home-page.tsx | 32 ++++++++++++++++---------------- src/types/bridge.ts | 5 ++++- src/utils/appBridge.ts | 5 +++++ 4 files changed, 37 insertions(+), 18 deletions(-) diff --git a/src/hooks/useAppBridge.tsx b/src/hooks/useAppBridge.tsx index 180d54f..27b9a16 100644 --- a/src/hooks/useAppBridge.tsx +++ b/src/hooks/useAppBridge.tsx @@ -72,6 +72,9 @@ interface UseAppBridgeReturn { // ์–ธ์–ด ์„ค์ • ์กฐํšŒ getLanguage: () => Promise; + + // ์•Œ๋ฆผ ๋งํฌ ํ™•์ธ + checkAlarmLink: () => Promise; } export const useAppBridge = (): UseAppBridgeReturn => { @@ -315,6 +318,13 @@ export const useAppBridge = (): UseAppBridgeReturn => { return appBridge.safeCall(() => appBridge.setLoginType(type)); }, [isNativeEnvironment]); + const checkAlarmLink = useCallback(async (): Promise => { + if (!isNativeEnvironment) { + return; + } + return appBridge.safeCall(() => appBridge.checkAlarmLink()); + }, [isNativeEnvironment]); + return { isNativeEnvironment, isAndroid, @@ -342,6 +352,7 @@ export const useAppBridge = (): UseAppBridgeReturn => { setLoginType, getNotificationSetting, setNotificationSetting, - getLanguage + getLanguage, + checkAlarmLink }; }; \ No newline at end of file diff --git a/src/pages/home/home-page.tsx b/src/pages/home/home-page.tsx index 58cb191..9b269ec 100644 --- a/src/pages/home/home-page.tsx +++ b/src/pages/home/home-page.tsx @@ -18,11 +18,11 @@ import { import { useStore } from '@/shared/model/store'; import { UserFavorite } from '@/entities/user/model/types'; import { useHomeBannerListMutation } from '@/entities/home/api/use-home-banner-list-mutation'; -import { - BannerList, - BannerType, - HomeBannerListParams, - HomeBannerListResponse +import { + BannerList, + BannerType, + HomeBannerListParams, + HomeBannerListResponse } from '@/entities/home/model/types'; export let homeReloadKey = 1; @@ -31,7 +31,7 @@ export const setHomeReloadKey = () => { }; export const HomePage = () => { - const { openBiometricRegistrationPopup } = useAppBridge(); + const { openBiometricRegistrationPopup, checkAlarmLink } = useAppBridge(); const { mutateAsync: homeBannerList } = useHomeBannerListMutation(); useSetHeaderTitle(''); @@ -44,7 +44,7 @@ export const HomePage = () => { const [bottomBannerOn, setBottomBannerOn] = useState(false); const [authRegisterOn, setAuthRegisterOn] = useState(false); - const [favoriteItems, setFavoriteItems] = useState>([]); + const [, setFavoriteItems] = useState>([]); const [bannerList, setBannerList] = useState>([]); const callHomeBannerList = () => { @@ -75,7 +75,7 @@ export const HomePage = () => { const checkBottomBannerOpen = () => { - if(!!bannerToday){ + if(bannerToday){ bannerToday = bannerToday.toString(); } let sw = (today !== bannerToday); @@ -87,31 +87,31 @@ export const HomePage = () => { setAuthRegisterOn(true); } }).catch((e) => { - console.log('catch', e); - + console.log('catch', e); + }).finally(() => { console.log('finally'); setAuthRegisterOn(true); }); }; - - useEffect(() => { let firstAccess = useStore.getState().UserStore.firstAccess; checkBottomBannerOpen(); - - if(!!firstAccess){ + + if(firstAccess){ checkAuthRegisterOpen(); + // ์•Œ๋ฆผ ๋งํฌ ํ™•์ธ + checkAlarmLink(); } else{ useStore.getState().UserStore.setFirstAccess(false); } - + let userFavorite = useStore.getState().UserStore.userFavorite; setFavoriteItems(userFavorite); callHomeBannerList(); - + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const setBottomBannerEffect = (mode: boolean) => { diff --git a/src/types/bridge.ts b/src/types/bridge.ts index f5fa197..5279adb 100644 --- a/src/types/bridge.ts +++ b/src/types/bridge.ts @@ -79,7 +79,10 @@ export enum BridgeMessageType { // ์•Œ๋ฆผ ์ˆ˜์‹  ์„ค์ • (Android only) GET_NOTIFICATION_SETTING = 'getNotificationSetting', - SET_NOTIFICATION_SETTING = 'setNotificationSetting' + SET_NOTIFICATION_SETTING = 'setNotificationSetting', + + // ์•Œ๋ฆผ ๋งํฌ ํ™•์ธ + CHECK_ALARM_LINK = 'checkAlarmLink' } export interface DeviceInfo { diff --git a/src/utils/appBridge.ts b/src/utils/appBridge.ts index 0527e5e..021bafa 100644 --- a/src/utils/appBridge.ts +++ b/src/utils/appBridge.ts @@ -225,6 +225,11 @@ class AppBridge { return this.sendMessage(BridgeMessageType.SET_NOTIFICATION_SETTING, { enabled }); } + // ์•Œ๋ฆผ ๋งํฌ ํ™•์ธ + async checkAlarmLink(): Promise { + return this.sendMessage(BridgeMessageType.CHECK_ALARM_LINK); + } + // ๋„ค์ดํ‹ฐ๋ธŒ ํ™˜๊ฒฝ ์ฒดํฌ isNativeEnvironment(): boolean { return !!(