Skip to content
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
1 change: 0 additions & 1 deletion assets/images/camera-flip.svg

This file was deleted.

7 changes: 0 additions & 7 deletions jest/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,3 @@ jest.mock('@src/hooks/useDomainDocumentTitle', () => ({
__esModule: true,
default: jest.fn(),
}));

jest.mock('react-native-vision-camera', () => ({
Camera: 'Camera',
useCameraDevice: jest.fn(() => null),
useCameraFormat: jest.fn(() => null),
useCameraPermission: jest.fn(() => ({hasPermission: false, requestPermission: jest.fn()})),
}));
1 change: 0 additions & 1 deletion src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,6 @@ const CONST = {
SHUTTER_SIZE: 90,
MAX_REPORT_PREVIEW_RECEIPTS: 3,
FLASH_DELAY_MS: 2000,
PHOTO_ASPECT_RATIO: 4 / 3,
},
RECEIPT_PREVIEW_TOP_BOTTOM_MARGIN: 120,
REPORT: {
Expand Down
253 changes: 0 additions & 253 deletions src/components/AttachmentPicker/AttachmentCamera.tsx

This file was deleted.

55 changes: 3 additions & 52 deletions src/components/AttachmentPicker/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import type {FileObject, ImagePickerResponse as FileResponse} from '@src/types/utils/Attachment';
import type IconAsset from '@src/types/utils/IconAsset';
import AttachmentCamera from './AttachmentCamera';
import type {CapturedPhoto} from './AttachmentCamera';
import launchCamera from './launchCamera/launchCamera';
import type AttachmentPickerProps from './types';

type LocalCopy = {
Expand Down Expand Up @@ -137,10 +136,6 @@ function AttachmentPicker({
const onClosed = useRef<() => void>(() => {});
const popoverRef = useRef(null);

// In-app camera state — uses VisionCamera to keep the app in the foreground during photo capture
const [showAttachmentCamera, setShowAttachmentCamera] = useState(false);
const cameraResolveRef = useRef<((photos?: CapturedPhoto[]) => void) | null>(null);

const {translate} = useLocalize();
const {shouldUseNarrowLayout} = useResponsiveLayout();

Expand All @@ -154,43 +149,6 @@ function AttachmentPicker({
[translate],
);

/**
* Launch the in-app camera using VisionCamera.
* Returns a Promise that resolves with the captured photo as an Asset-compatible object,
* or resolves with void if the user closes the camera without capturing.
*/
const launchInAppCamera = (): Promise<Asset[] | void> => {
return new Promise((resolve) => {
cameraResolveRef.current = (photos?: CapturedPhoto[]) => {
if (!photos || photos.length === 0) {
resolve();
return;
}
const assets: Asset[] = photos.map((photo) => ({
uri: photo.uri,
fileName: photo.fileName,
type: photo.type,
width: photo.width,
height: photo.height,
}));
resolve(assets);
};
setShowAttachmentCamera(true);
});
};

const handleCameraCapture = (photos: CapturedPhoto[]) => {
setShowAttachmentCamera(false);
cameraResolveRef.current?.(photos);
cameraResolveRef.current = null;
};

const handleCameraClose = () => {
setShowAttachmentCamera(false);
cameraResolveRef.current?.();
cameraResolveRef.current = null;
};

/**
* Common image picker handling
*
Expand Down Expand Up @@ -343,12 +301,12 @@ function AttachmentPicker({
data.unshift({
icon: icons.Camera,
textTranslationKey: 'attachmentPicker.takePhoto',
pickAttachment: launchInAppCamera,
pickAttachment: () => showImagePicker(launchCamera),
});
}

return data;
}, [icons.Camera, icons.Paperclip, icons.Gallery, showDocumentPicker, shouldHideGalleryOption, shouldHideCameraOption, showImagePicker, launchInAppCamera]);
}, [icons.Camera, icons.Paperclip, icons.Gallery, showDocumentPicker, shouldHideGalleryOption, shouldHideCameraOption, showImagePicker]);

const [focusedIndex, setFocusedIndex] = useArrowKeyFocusManager({initialFocusedIndex: -1, maxIndex: menuItemData.length - 1, isActive: isVisible});

Expand Down Expand Up @@ -570,13 +528,6 @@ function AttachmentPicker({
))}
</View>
</Popover>
{showAttachmentCamera && (
<AttachmentCamera
isVisible={showAttachmentCamera}
onCapture={handleCameraCapture}
onClose={handleCameraClose}
/>
)}
{renderChildren()}
</>
);
Expand Down
2 changes: 0 additions & 2 deletions src/components/Icon/chunks/expensify-icons.chunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import Building from '@assets/images/building.svg';
import Buildings from '@assets/images/buildings.svg';
import CalendarSolid from '@assets/images/calendar-solid.svg';
import Calendar from '@assets/images/calendar.svg';
import CameraFlip from '@assets/images/camera-flip.svg';
import Camera from '@assets/images/camera.svg';
import CarCircleSlash from '@assets/images/car-circle-slash.svg';
import CarPlus from '@assets/images/car-plus.svg';
Expand Down Expand Up @@ -289,7 +288,6 @@ const Expensicons = {
Buildings,
Calendar,
Camera,
CameraFlip,
Car,
CarPlus,
Cash,
Expand Down
1 change: 0 additions & 1 deletion src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,6 @@ const translations: TranslationDeepObject<typeof en> = {
flash: 'Blitz',
multiScan: 'Mehrfachscan',
shutter: 'Verschluss',
flipCamera: 'Kamera wechseln',
gallery: 'Galerie',
deleteReceipt: 'Beleg löschen',
deleteConfirmation: 'Sind Sie sicher, dass Sie diesen Beleg löschen möchten?',
Expand Down
Loading
Loading