Add checkAlarmLink feature to handle alarm links on first access

- 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 <noreply@anthropic.com>
This commit is contained in:
Jay Sheen
2025-11-05 14:28:16 +09:00
parent a61f0bc2ff
commit 24c45731dc
4 changed files with 37 additions and 18 deletions

View File

@@ -72,6 +72,9 @@ interface UseAppBridgeReturn {
// 언어 설정 조회 // 언어 설정 조회
getLanguage: () => Promise<string>; getLanguage: () => Promise<string>;
// 알림 링크 확인
checkAlarmLink: () => Promise<void>;
} }
export const useAppBridge = (): UseAppBridgeReturn => { export const useAppBridge = (): UseAppBridgeReturn => {
@@ -315,6 +318,13 @@ export const useAppBridge = (): UseAppBridgeReturn => {
return appBridge.safeCall(() => appBridge.setLoginType(type)); return appBridge.safeCall(() => appBridge.setLoginType(type));
}, [isNativeEnvironment]); }, [isNativeEnvironment]);
const checkAlarmLink = useCallback(async (): Promise<void> => {
if (!isNativeEnvironment) {
return;
}
return appBridge.safeCall(() => appBridge.checkAlarmLink());
}, [isNativeEnvironment]);
return { return {
isNativeEnvironment, isNativeEnvironment,
isAndroid, isAndroid,
@@ -342,6 +352,7 @@ export const useAppBridge = (): UseAppBridgeReturn => {
setLoginType, setLoginType,
getNotificationSetting, getNotificationSetting,
setNotificationSetting, setNotificationSetting,
getLanguage getLanguage,
checkAlarmLink
}; };
}; };

View File

@@ -31,7 +31,7 @@ export const setHomeReloadKey = () => {
}; };
export const HomePage = () => { export const HomePage = () => {
const { openBiometricRegistrationPopup } = useAppBridge(); const { openBiometricRegistrationPopup, checkAlarmLink } = useAppBridge();
const { mutateAsync: homeBannerList } = useHomeBannerListMutation(); const { mutateAsync: homeBannerList } = useHomeBannerListMutation();
useSetHeaderTitle(''); useSetHeaderTitle('');
@@ -44,7 +44,7 @@ export const HomePage = () => {
const [bottomBannerOn, setBottomBannerOn] = useState<boolean>(false); const [bottomBannerOn, setBottomBannerOn] = useState<boolean>(false);
const [authRegisterOn, setAuthRegisterOn] = useState<boolean>(false); const [authRegisterOn, setAuthRegisterOn] = useState<boolean>(false);
const [favoriteItems, setFavoriteItems] = useState<Array<UserFavorite>>([]); const [, setFavoriteItems] = useState<Array<UserFavorite>>([]);
const [bannerList, setBannerList] = useState<Array<BannerList>>([]); const [bannerList, setBannerList] = useState<Array<BannerList>>([]);
const callHomeBannerList = () => { const callHomeBannerList = () => {
@@ -75,7 +75,7 @@ export const HomePage = () => {
const checkBottomBannerOpen = () => { const checkBottomBannerOpen = () => {
if(!!bannerToday){ if(bannerToday){
bannerToday = bannerToday.toString(); bannerToday = bannerToday.toString();
} }
let sw = (today !== bannerToday); let sw = (today !== bannerToday);
@@ -95,14 +95,14 @@ export const HomePage = () => {
}); });
}; };
useEffect(() => { useEffect(() => {
let firstAccess = useStore.getState().UserStore.firstAccess; let firstAccess = useStore.getState().UserStore.firstAccess;
checkBottomBannerOpen(); checkBottomBannerOpen();
if(!!firstAccess){ if(firstAccess){
checkAuthRegisterOpen(); checkAuthRegisterOpen();
// 알림 링크 확인
checkAlarmLink();
} }
else{ else{
useStore.getState().UserStore.setFirstAccess(false); useStore.getState().UserStore.setFirstAccess(false);
@@ -111,7 +111,7 @@ export const HomePage = () => {
let userFavorite = useStore.getState().UserStore.userFavorite; let userFavorite = useStore.getState().UserStore.userFavorite;
setFavoriteItems(userFavorite); setFavoriteItems(userFavorite);
callHomeBannerList(); callHomeBannerList();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []); }, []);
const setBottomBannerEffect = (mode: boolean) => { const setBottomBannerEffect = (mode: boolean) => {

View File

@@ -79,7 +79,10 @@ export enum BridgeMessageType {
// 알림 수신 설정 (Android only) // 알림 수신 설정 (Android only)
GET_NOTIFICATION_SETTING = 'getNotificationSetting', GET_NOTIFICATION_SETTING = 'getNotificationSetting',
SET_NOTIFICATION_SETTING = 'setNotificationSetting' SET_NOTIFICATION_SETTING = 'setNotificationSetting',
// 알림 링크 확인
CHECK_ALARM_LINK = 'checkAlarmLink'
} }
export interface DeviceInfo { export interface DeviceInfo {

View File

@@ -225,6 +225,11 @@ class AppBridge {
return this.sendMessage(BridgeMessageType.SET_NOTIFICATION_SETTING, { enabled }); return this.sendMessage(BridgeMessageType.SET_NOTIFICATION_SETTING, { enabled });
} }
// 알림 링크 확인
async checkAlarmLink(): Promise<void> {
return this.sendMessage(BridgeMessageType.CHECK_ALARM_LINK);
}
// 네이티브 환경 체크 // 네이티브 환경 체크
isNativeEnvironment(): boolean { isNativeEnvironment(): boolean {
return !!( return !!(