Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat/#46] 모니터링 진입 시, 알림 권한 바로 확인하도록 수정 #85

Merged
merged 3 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading