Skip to content

Commit

Permalink
Merge pull request #85 from DDD-Community/feat/#46
Browse files Browse the repository at this point in the history
[feat/#46] 모니터링 진입 시, 알림 권한 바로 확인하도록 수정
  • Loading branch information
lkhoony authored Sep 25, 2024
2 parents 8601243 + b74054d commit bf49668
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/components/PoseDetector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { useGuidePopup } from "@/hooks/useGuidePopup"
import { useSendPose } from "@/hooks/usePoseMutation"
import usePushNotification from "@/hooks/usePushNotification"
import { useCreateSnaphot } from "@/hooks/useSnapshotMutation"
import { useNotificationStore } from "@/store/NotificationStore"
import { useSnapShotStore } from "@/store/SnapshotStore"
import type { pose } from "@/utils/detector"
import { detectHandOnChin, detectSlope, detectTailboneSit, detectTextNeck } from "@/utils/detector"
Expand Down Expand Up @@ -125,9 +124,7 @@ const PoseDetector: React.FC = () => {
): void => {
if (condition && isSnapShotSaved) {
if (!timerRef.current) {
console.log(poseType, "start")
timerRef.current = setInterval(() => {
console.log("start")
if (resultRef.current) {
const { keypoints, score } = resultRef.current[0]
const req = { snapshot: { keypoints, score }, type: poseType }
Expand Down Expand Up @@ -336,6 +333,9 @@ const PoseDetector: React.FC = () => {
openPopup()
}

useEffect(() => {
console.log(notification)
}, [notification])
return (
<>
{isScriptError ? (
Expand Down
3 changes: 1 addition & 2 deletions src/hooks/usePushNotification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ const usePushNotification = (): UsePushNotificationResult => {
useEffect(() => {
// 컴포넌트가 마운트될 때 권한 상태 확인
if ("Notification" in window) {
handlePermissionChange(Notification.permission)

requestNotificationPermission()
// 권한 변경 감지
navigator.permissions
.query({ name: "notifications" as PermissionName })
Expand Down

0 comments on commit bf49668

Please sign in to comment.