mirror of
https://github.com/block/buzz.git
synced 2026-11-01 23:11:58 +00:00
## 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>
32 lines
789 B
Dart
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.
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|