Files
buzz/mobile/lib/features/channels/camera_capture_cleanup.dart
klopez4212 a3b097745a Refine mobile attachment picking (#3313)
## What
- morph the composer plus button into the attachment menu, camera, and
photo surfaces
- add ordered multi-select with inline recent photos and system picker
fallback
- add native iOS attachment/photo popovers and align the Android camera
treatment

## Stack
- follows #3312

## Validation
- `just mobile-check`
- `flutter test test/features/channels/compose_bar_test.dart`
- full mobile pre-push suite

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
2026-07-28 18:05:43 +01:00

32 lines
789 B
Dart

import 'dart:io';
import 'package:image_picker/image_picker.dart';
Future<void> processCapturedImage(
XFile image,
Future<void> Function(XFile image) onCapture,
) async {
await processTemporaryImages([image], (images) => onCapture(images.single));
}
/// Processes native-owned [images], then removes their temporary files.
Future<void> processTemporaryImages(
List<XFile> images,
Future<void> Function(List<XFile> images) process,
) async {
try {
await process(images);
} finally {
for (final image in images) {
final path = image.path;
if (path.isNotEmpty) {
try {
await File(path).delete();
} on FileSystemException {
// The native picker may already have removed its temporary file.
}
}
}
}
}