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:
@@ -72,6 +72,9 @@ interface UseAppBridgeReturn {
|
||||
|
||||
// 언어 설정 조회
|
||||
getLanguage: () => Promise<string>;
|
||||
|
||||
// 알림 링크 확인
|
||||
checkAlarmLink: () => Promise<void>;
|
||||
}
|
||||
|
||||
export const useAppBridge = (): UseAppBridgeReturn => {
|
||||
@@ -315,6 +318,13 @@ export const useAppBridge = (): UseAppBridgeReturn => {
|
||||
return appBridge.safeCall(() => appBridge.setLoginType(type));
|
||||
}, [isNativeEnvironment]);
|
||||
|
||||
const checkAlarmLink = useCallback(async (): Promise<void> => {
|
||||
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
|
||||
};
|
||||
};
|
||||
@@ -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<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 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) => {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -225,6 +225,11 @@ class AppBridge {
|
||||
return this.sendMessage(BridgeMessageType.SET_NOTIFICATION_SETTING, { enabled });
|
||||
}
|
||||
|
||||
// 알림 링크 확인
|
||||
async checkAlarmLink(): Promise<void> {
|
||||
return this.sendMessage(BridgeMessageType.CHECK_ALARM_LINK);
|
||||
}
|
||||
|
||||
// 네이티브 환경 체크
|
||||
isNativeEnvironment(): boolean {
|
||||
return !!(
|
||||
|
||||
Reference in New Issue
Block a user