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

Removed preventExit in photoCapture #912

Merged
merged 2 commits into from
Mar 3, 2025
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LoadingState, useObjectMemo, usePreventExit } from '@monkvision/common';
import { LoadingState, useObjectMemo } from '@monkvision/common';
import { useCallback, useEffect } from 'react';
import { useAnalytics } from '@monkvision/analytics';
import { useMonitoring } from '@monkvision/monitoring';
Expand Down Expand Up @@ -51,7 +51,6 @@ export function useInspectionComplete({
}: InspectionCompleteParams): InspectionCompleteHandle {
const analytics = useAnalytics();
const monitoring = useMonitoring();
const { allowRedirect } = usePreventExit(sightState.sightsTaken.length !== 0);

const handleInspectionCompleted = useCallback(() => {
startTasks()
Expand All @@ -61,7 +60,6 @@ export function useInspectionComplete({
captureCompleted: true,
sightSelected: 'inspection-completed',
});
allowRedirect();
onComplete?.();
sightState.setIsInspectionCompleted(true);
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ describe('usePhotoCaptureSightGuidelines', () => {
beforeEach(() => {
localStorage.clear();
});
afterEach(() => {
localStorage.clear();
});

it('should return showSightGuidelines as true when enableSightGuidelines is ENABLED', () => {
const { result } = renderHook(() =>
Expand Down Expand Up @@ -44,7 +47,10 @@ describe('usePhotoCaptureSightGuidelines', () => {
});

it('should return showSightGuidelines as true when enableSightGuidelines is EPHEMERAL and TTL is expired', () => {
localStorage.setItem(STORAGE_KEY_PHOTO_CAPTURE_GUIDELINES, (Date.now() - TTL_MS).toString());
localStorage.setItem(
STORAGE_KEY_PHOTO_CAPTURE_GUIDELINES,
(Date.now() - TTL_MS - 1).toString(),
);

const { result } = renderHook(() =>
usePhotoCaptureSightGuidelines({
Expand Down