Skip to content

Commit

Permalink
fix: 웹, RN 에서의 푸시 알림 동작 분기 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
gihwan-dev committed Oct 3, 2024
1 parent 618dac8 commit 45b2f88
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/pages/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ import { useToken } from '@/hooks/useToken.ts';
import { SECOND } from '@/constants/day.ts';
import { useQueryClient } from '@tanstack/react-query';
import { keyStore } from '@/queries/keyStore.ts';
import { useNotification } from '@/hooks/useNotification.tsx';

const Main = () => {
const { data: homeData } = useGetHomeData();
const { mutate: refreshAccessToken } = useRefreshAccessToken();
const { getRefreshToken, isValidToken, setRefreshToken, setAccessToken, getAccessToken } =
useToken();
// const { RequestPermissionModal, isPermissionChecked, openPermissionModal } = useNotification();
const { RequestPermissionModal, isPermissionChecked, openPermissionModal } = useNotification();

const queryClient = useQueryClient();

Expand All @@ -45,10 +46,13 @@ const Main = () => {
}, []);

useEffect(() => {
// if (!isPermissionChecked) {
// openPermissionModal();
// }
window.ReactNativeWebView.postMessage(getAccessToken());
if (window.ReactNativeWebView) {
window?.ReactNativeWebView?.postMessage?.(getAccessToken());
} else {
if (!isPermissionChecked) {
openPermissionModal();
}
}
}, []);

useEffect(() => {
Expand All @@ -67,7 +71,7 @@ const Main = () => {
<BloomingWeather register={register} />
<HeightBox height={100} />
<TabBar />
{/*<RequestPermissionModal />*/}
<RequestPermissionModal />
</Screen>
);
};
Expand Down

0 comments on commit 45b2f88

Please sign in to comment.