Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

in-app camera wip

laurenspriemd6881e706f55
diff --git a/mobile/apps/photos/android/app/src/main/AndroidManifest.xml b/mobile/apps/photos/android/app/src/main/AndroidManifest.xml
index d9ccfbbe48..c0e408ce32 100644
--- a/mobile/apps/photos/android/app/src/main/AndroidManifest.xml
+++ b/mobile/apps/photos/android/app/src/main/AndroidManifest.xml
@@ -1,6 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="io.ente.photos">
+ <uses-permission android:name="android.permission.CAMERA" />
<application android:name="${applicationName}"
android:label="@string/app_name"
android:icon="@mipmap/icon_green"
@@ -210,10 +211,11 @@
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="29"
+ tools:replace="android:maxSdkVersion"
tools:ignore="ScopedStorage" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/> <!-- Needed for scheduling notifications -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <!-- Needed for scheduling notifications -->
-</manifest>
\ No newline at end of file
+</manifest>
diff --git a/mobile/apps/photos/ios/Podfile.lock b/mobile/apps/photos/ios/Podfile.lock
index 7c321d3fb1..72cf37018b 100644
--- a/mobile/apps/photos/ios/Podfile.lock
+++ b/mobile/apps/photos/ios/Podfile.lock
@@ -5,6 +5,8 @@ PODS:
- Flutter
- battery_info (0.0.1):
- Flutter
+ - camera_avfoundation (0.0.1):
+ - Flutter
- connectivity_plus (0.0.1):
- Flutter
- cupertino_http (0.0.1):
@@ -262,6 +264,7 @@ DEPENDENCIES:
- app_links (from `.symlinks/plugins/app_links/ios`)
- audio_session (from `.symlinks/plugins/audio_session/ios`)
- battery_info (from `.symlinks/plugins/battery_info/ios`)
+ - camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`)
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
- cupertino_http (from `.symlinks/plugins/cupertino_http/darwin`)
- dart_ui_isolate (from `.symlinks/plugins/dart_ui_isolate/ios`)
@@ -354,6 +357,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/audio_session/ios"
battery_info:
:path: ".symlinks/plugins/battery_info/ios"
+ camera_avfoundation:
+ :path: ".symlinks/plugins/camera_avfoundation/ios"
connectivity_plus:
:path: ".symlinks/plugins/connectivity_plus/ios"
cupertino_http:
@@ -481,6 +486,7 @@ SPEC CHECKSUMS:
app_links: 76b66b60cc809390ca1ad69bfd66b998d2387ac7
audio_session: 9bb7f6c970f21241b19f5a3658097ae459681ba0
battery_info: 83f3aae7be2fccefab1d2bf06b8aa96f11c8bcdd
+ camera_avfoundation: be3be85408cd4126f250386828e9b1dfa40ab436
connectivity_plus: cb623214f4e1f6ef8fe7403d580fdad517d2f7dd
cupertino_http: 94ac07f5ff090b8effa6c5e2c47871d48ab7c86c
dart_ui_isolate: 46f6714abe6891313267153ef6f9748d8ecfcab1
diff --git a/mobile/apps/photos/ios/Runner.xcodeproj/project.pbxproj b/mobile/apps/photos/ios/Runner.xcodeproj/project.pbxproj
index fe98091e98..17d92fa74d 100644
--- a/mobile/apps/photos/ios/Runner.xcodeproj/project.pbxproj
+++ b/mobile/apps/photos/ios/Runner.xcodeproj/project.pbxproj
@@ -528,6 +528,7 @@
"${BUILT_PRODUCTS_DIR}/app_links/app_links.framework",
"${BUILT_PRODUCTS_DIR}/audio_session/audio_session.framework",
"${BUILT_PRODUCTS_DIR}/battery_info/battery_info.framework",
+ "${BUILT_PRODUCTS_DIR}/camera_avfoundation/camera_avfoundation.framework",
"${BUILT_PRODUCTS_DIR}/connectivity_plus/connectivity_plus.framework",
"${BUILT_PRODUCTS_DIR}/cupertino_http/cupertino_http.framework",
"${BUILT_PRODUCTS_DIR}/dart_ui_isolate/dart_ui_isolate.framework",
@@ -630,6 +631,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/app_links.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/audio_session.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/battery_info.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/camera_avfoundation.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/connectivity_plus.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/cupertino_http.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/dart_ui_isolate.framework",
diff --git a/mobile/apps/photos/lib/services/activity/activity_service.dart b/mobile/apps/photos/lib/services/activity/activity_service.dart
index 2cb641d2ca..e324b9db2d 100644
--- a/mobile/apps/photos/lib/services/activity/activity_service.dart
+++ b/mobile/apps/photos/lib/services/activity/activity_service.dart
@@ -317,8 +317,14 @@ class ActivityService {
id: baseId + scheduled,
channelID: "ritual_reminders",
channelName: "Ritual reminders",
- payload:
- "ente://ritual?ritualId=${ritual.id}&albumId=${ritual.albumId ?? ""}",
+ payload: Uri(
+ scheme: "ente",
+ host: "camera",
+ queryParameters: {
+ "ritualId": ritual.id,
+ "albumId": ritual.albumId?.toString() ?? "",
+ },
+ ).toString(),
dateTime: scheduledDate,
);
scheduled += 1;
diff --git a/mobile/apps/photos/lib/ui/activity/activity_screen.dart b/mobile/apps/photos/lib/ui/activity/activity_screen.dart
index 3289e50976..cea9870718 100644
--- a/mobile/apps/photos/lib/ui/activity/activity_screen.dart
+++ b/mobile/apps/photos/lib/ui/activity/activity_screen.dart
@@ -1,8 +1,8 @@
import "dart:io";
import "dart:math" as math;
-import "dart:typed_data";
import "dart:ui" as ui;
+import "package:flutter/foundation.dart";
import "package:flutter/material.dart";
import "package:flutter/rendering.dart";
import "package:path_provider/path_provider.dart";
@@ -11,7 +11,9 @@ import "package:photos/service_locator.dart";
import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/activity/achievements_row.dart";
import "package:photos/ui/activity/activity_heatmap_card.dart";
+import "package:photos/ui/activity/ritual_camera_page.dart";
import "package:photos/ui/activity/rituals_section.dart";
+import "package:photos/utils/navigation_util.dart";
import "package:photos/utils/share_util.dart";
import "package:share_plus/share_plus.dart";
@@ -155,6 +157,14 @@ class _ActivityScreenState extends State<ActivityScreen> {
),
ActivityHeatmapCard(summary: displaySummary),
AchievementsRow(summary: displaySummary),
+ if (kDebugMode)
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 8, 16, 24),
+ child: _DebugCameraLauncher(
+ selectedRitual: selectedRitual,
+ onLaunch: _openRitualCamera,
+ ),
+ ),
],
),
);
@@ -323,6 +333,92 @@ class _ActivityScreenState extends State<ActivityScreen> {
generatedAt: summary.generatedAt,
);
}
+
+ void _openRitualCamera(Ritual ritual) {
+ final albumId = ritual.albumId;
+ if (albumId == null) {
+ ScaffoldMessenger.of(context).showSnackBar(
+ const SnackBar(
+ content: Text("Set an album for this ritual to launch the camera."),
+ ),
+ );
+ return;
+ }
+ routeToPage(
+ context,
+ RitualCameraPage(
+ ritualId: ritual.id,
+ albumId: albumId,
+ ),
+ );
+ }
+}
+
+class _DebugCameraLauncher extends StatelessWidget {
+ const _DebugCameraLauncher({
+ required this.selectedRitual,
+ required this.onLaunch,
+ });
+
+ final Ritual? selectedRitual;
+ final ValueChanged<Ritual> onLaunch;
+
+ @override
+ Widget build(BuildContext context) {
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+ final bool hasAlbum = selectedRitual?.albumId != null;
+ final bool canLaunch = selectedRitual != null && hasAlbum;
+ final String buttonLabel = canLaunch
+ ? "Open in-app camera for ${selectedRitual!.title.isEmpty ? "ritual" : selectedRitual!.title}"
+ : "Select a ritual with an album to open the camera";
+ return Container(
+ decoration: BoxDecoration(
+ color: colorScheme.fillFaint,
+ borderRadius: BorderRadius.circular(16),
+ ),
+ padding: const EdgeInsets.fromLTRB(14, 12, 14, 14),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Row(
+ children: [
+ Icon(
+ Icons.bug_report_outlined,
+ color: colorScheme.textMuted,
+ ),
+ const SizedBox(width: 8),
+ Text(
+ "Debug: launch ritual camera",
+ style: textTheme.bodyBold.copyWith(
+ color: colorScheme.textMuted,
+ ),
+ ),
+ ],
+ ),
+ const SizedBox(height: 10),
+ ElevatedButton.icon(
+ onPressed: canLaunch && selectedRitual != null
+ ? () => onLaunch(selectedRitual!)
+ : null,
+ icon: const Icon(Icons.camera_alt_outlined),
+ label: Text(buttonLabel),
+ style: ElevatedButton.styleFrom(
+ padding: const EdgeInsets.symmetric(vertical: 12),
+ ),
+ ),
+ if (!hasAlbum)
+ Padding(
+ padding: const EdgeInsets.only(top: 8),
+ child: Text(
+ "Pick a ritual (not the starter) and set an album to enable.",
+ style: textTheme.smallMuted,
+ ),
+ ),
+ ],
+ ),
+ );
+ }
}
class _ActivityShareCard extends StatelessWidget {
diff --git a/mobile/apps/photos/lib/ui/activity/ritual_camera_page.dart b/mobile/apps/photos/lib/ui/activity/ritual_camera_page.dart
index 5af4df69d5..d45748a733 100644
--- a/mobile/apps/photos/lib/ui/activity/ritual_camera_page.dart
+++ b/mobile/apps/photos/lib/ui/activity/ritual_camera_page.dart
@@ -1,13 +1,22 @@
+import "dart:io";
+
+import "package:camera/camera.dart";
import "package:flutter/material.dart";
import "package:photos/models/collection/collection.dart";
import "package:photos/models/collection/collection_items.dart";
import "package:photos/service_locator.dart";
import "package:photos/services/collections_service.dart";
+import "package:photos/theme/colors.dart";
+import "package:photos/theme/ente_theme.dart";
+import "package:photos/ui/actions/collection/collection_file_actions.dart";
+import "package:photos/ui/actions/collection/collection_sharing_actions.dart";
import "package:photos/ui/activity/activity_screen.dart";
+import "package:photos/ui/notification/toast.dart";
import "package:photos/ui/viewer/gallery/collection_page.dart";
import "package:photos/utils/navigation_util.dart";
+import "package:receive_sharing_intent/receive_sharing_intent.dart";
-class RitualCameraPage extends StatelessWidget {
+class RitualCameraPage extends StatefulWidget {
const RitualCameraPage({
super.key,
required this.ritualId,
@@ -17,6 +26,246 @@ class RitualCameraPage extends StatelessWidget {
final String ritualId;
final int? albumId;
+ @override
+ State<RitualCameraPage> createState() => _RitualCameraPageState();
+}
+
+class _RitualCameraPageState extends State<RitualCameraPage>
+ with WidgetsBindingObserver {
+ CameraController? _controller;
+ List<CameraDescription> _cameras = <CameraDescription>[];
+ CameraDescription? _activeCamera;
+ bool _initializing = true;
+ bool _capturing = false;
+ bool _saving = false;
+ String? _error;
+ List<XFile> _captures = <XFile>[];
+ Collection? _album;
+
+ @override
+ void initState() {
+ super.initState();
+ WidgetsBinding.instance.addObserver(this);
+ _loadAlbum();
+ _initializeCamera();
+ }
+
+ @override
+ void dispose() {
+ WidgetsBinding.instance.removeObserver(this);
+ _controller?.dispose();
+ _cleanupCaptures();
+ super.dispose();
+ }
+
+ @override
+ void didChangeAppLifecycleState(AppLifecycleState state) {
+ final controller = _controller;
+ if (controller == null || !controller.value.isInitialized) {
+ return;
+ }
+ if (state == AppLifecycleState.inactive ||
+ state == AppLifecycleState.paused) {
+ controller.dispose();
+ _controller = null;
+ } else if (state == AppLifecycleState.resumed && _activeCamera != null) {
+ _initializeCamera(_activeCamera);
+ }
+ }
+
+ Future<void> _loadAlbum() async {
+ if (widget.albumId == null) return;
+ final collection =
+ CollectionsService.instance.getCollectionByID(widget.albumId!);
+ if (mounted) {
+ setState(() {
+ _album = collection;
+ });
+ }
+ }
+
+ Future<void> _initializeCamera([CameraDescription? description]) async {
+ if (!flagService.ritualsFlag) return;
+ setState(() {
+ _initializing = true;
+ _error = null;
+ });
+ try {
+ _cameras = _cameras.isEmpty ? await availableCameras() : _cameras;
+ if (_cameras.isEmpty) {
+ setState(() {
+ _error = "No camera found on this device.";
+ _initializing = false;
+ });
+ return;
+ }
+ final CameraDescription target =
+ description ?? _preferredCamera() ?? _cameras.first;
+ final controller = CameraController(
+ target,
+ ResolutionPreset.high,
+ imageFormatGroup: ImageFormatGroup.jpeg,
+ enableAudio: false,
+ );
+ await controller.initialize();
+ if (!mounted) {
+ await controller.dispose();
+ return;
+ }
+ await _controller?.dispose();
+ setState(() {
+ _controller = controller;
+ _activeCamera = target;
+ _initializing = false;
+ });
+ } catch (e) {
+ setState(() {
+ _error = "Unable to start camera. Please check permissions.";
+ _initializing = false;
+ });
+ }
+ }
+
+ CameraDescription? _preferredCamera() {
+ for (final camera in _cameras) {
+ if (camera.lensDirection == CameraLensDirection.back) {
+ return camera;
+ }
+ }
+ return null;
+ }
+
+ Future<void> _switchCamera() async {
+ if (_cameras.length < 2 || _saving) return;
+ final current = _activeCamera;
+ if (current == null) return;
+ final nextIndex = (_cameras.indexOf(current) + 1) % _cameras.length;
+ await _initializeCamera(_cameras[nextIndex]);
+ }
+
+ Future<void> _takePicture() async {
+ if (_controller == null ||
+ !_controller!.value.isInitialized ||
+ _capturing ||
+ _saving) {
+ return;
+ }
+ setState(() {
+ _capturing = true;
+ });
+ try {
+ final XFile capture = await _controller!.takePicture();
+ if (!mounted) return;
+ setState(() {
+ _captures = List<XFile>.from(_captures)..add(capture);
+ });
+ } catch (_) {
+ if (!mounted) return;
+ showShortToast(context, "Unable to capture photo. Please try again.");
+ } finally {
+ if (mounted) {
+ setState(() {
+ _capturing = false;
+ });
+ }
+ }
+ }
+
+ Future<void> _onAccept() async {
+ if (_captures.isEmpty) {
+ showShortToast(context, "Capture at least one photo first.");
+ return;
+ }
+ if (widget.albumId == null) {
+ if (!mounted) return;
+ ScaffoldMessenger.of(context).showSnackBar(
+ const SnackBar(
+ content:
+ Text("Ritual album missing. Edit the ritual to set an album."),
+ ),
+ );
+ await routeToPage(context, const ActivityScreen());
+ return;
+ }
+ final List<XFile> pending = List<XFile>.from(_captures);
+ setState(() {
+ _saving = true;
+ });
+ try {
+ final shared = pending
+ .map(
+ (file) => SharedMediaFile(
+ path: file.path,
+ type: SharedMediaType.image,
+ ),
+ )
+ .toList(growable: false);
+ final actions = CollectionActions(CollectionsService.instance);
+ await actions.addToCollection(
+ context,
+ widget.albumId!,
+ true,
+ sharedFiles: shared,
+ );
+ if (!mounted) return;
+ showShortToast(
+ context,
+ _album == null ? "Added to album" : "Added to ${_album!.displayName}",
+ );
+ final collection = _album ??
+ CollectionsService.instance.getCollectionByID(widget.albumId!);
+ if (collection != null && mounted) {
+ final thumbnail =
+ await CollectionsService.instance.getCover(collection);
+ if (!mounted) return;
+ replacePage(
+ context,
+ CollectionPage(
+ CollectionWithThumbnail(
+ collection,
+ thumbnail,
+ ),
+ ),
+ );
+ }
+ } catch (e) {
+ if (mounted) {
+ ScaffoldMessenger.of(context).showSnackBar(
+ SnackBar(
+ content: Text("Couldn't add photos to the album: $e"),
+ ),
+ );
+ }
+ } finally {
+ _cleanupCaptures(pending);
+ if (mounted) {
+ setState(() {
+ _saving = false;
+ _captures = <XFile>[];
+ });
+ }
+ }
+ }
+
+ void _cleanupCaptures([List<XFile>? files]) {
+ final targets = files ?? _captures;
+ for (final capture in targets) {
+ try {
+ File(capture.path).deleteSync();
+ } catch (_) {
+ // ignore cleanup failures
+ }
+ }
+ _captures = <XFile>[];
+ }
+
+ void _onDiscard() {
+ _cleanupCaptures();
+ setState(() {
+ _captures = <XFile>[];
+ });
+ }
+
@override
Widget build(BuildContext context) {
if (!flagService.ritualsFlag) {
@@ -32,65 +281,236 @@ class RitualCameraPage extends StatelessWidget {
),
);
}
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+ final bool isReady = _controller != null &&
+ _controller!.value.isInitialized &&
+ !_initializing;
return Scaffold(
appBar: AppBar(
- title: const Text("Ritual capture"),
+ title: Text(_album?.displayName ?? "Ritual capture"),
+ actions: [
+ IconButton(
+ onPressed: _captures.isEmpty || _saving ? null : _onDiscard,
+ icon: const Icon(Icons.refresh),
+ tooltip: "Discard and retake",
+ ),
+ IconButton(
+ onPressed: (_cameras.length < 2 || _saving || _initializing)
+ ? null
+ : _switchCamera,
+ icon: const Icon(Icons.cameraswitch_rounded),
+ tooltip: "Switch camera",
+ ),
+ ],
),
- body: Padding(
- padding: const EdgeInsets.all(16),
- child: FutureBuilder<Collection?>(
- future: _loadCollection(),
- builder: (context, snapshot) {
- final collection = snapshot.data;
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const Text(
- "Ready to take today's ritual photo?",
- style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
+ body: SafeArea(
+ child: Column(
+ children: [
+ Expanded(
+ child: Container(
+ color: Colors.black,
+ child: Center(
+ child: _buildCameraArea(isReady, colorScheme),
),
- const SizedBox(height: 12),
- const Text(
- "Use your device camera to take a photo, then add it to the selected album. We will improve this with an in-app camera flow soon.",
+ ),
+ ),
+ if (_album != null || widget.albumId != null)
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 4),
+ child: Row(
+ children: [
+ Icon(
+ Icons.photo_album_outlined,
+ color: colorScheme.textMuted,
+ ),
+ const SizedBox(width: 8),
+ Expanded(
+ child: Text(
+ _album?.displayName ??
+ "Album ID ${widget.albumId ?? "-"}",
+ style: textTheme.smallMuted,
+ overflow: TextOverflow.ellipsis,
+ ),
+ ),
+ ],
),
- const SizedBox(height: 24),
- ElevatedButton.icon(
- onPressed: () {
- if (collection != null) {
- routeToPage(
- context,
- CollectionPage(
- CollectionWithThumbnail(collection, null),
- ),
- );
- } else {
- Navigator.of(context).pop();
- }
- },
- icon: const Icon(Icons.photo_camera_rounded),
- label: Text(
- collection == null
- ? "Open album"
- : "Go to ${collection.displayName}",
+ ),
+ if (_captures.isNotEmpty) _CapturedStrip(captures: _captures),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 10, 16, 18),
+ child: Row(
+ children: [
+ Expanded(
+ child: OutlinedButton(
+ onPressed: (_captures.isNotEmpty && !_saving)
+ ? _onDiscard
+ : null,
+ child: const Text("Retake"),
+ ),
),
- ),
- const SizedBox(height: 12),
- OutlinedButton(
- onPressed: () {
- routeToPage(context, const ActivityScreen());
- },
- child: const Text("View activity"),
- ),
- ],
- );
- },
+ const SizedBox(width: 12),
+ _CaptureButton(
+ onTap:
+ _capturing || _saving || !isReady ? null : _takePicture,
+ busy: _capturing,
+ ),
+ const SizedBox(width: 12),
+ Expanded(
+ child: ElevatedButton(
+ onPressed:
+ (_captures.isNotEmpty && !_saving) ? _onAccept : null,
+ style: ElevatedButton.styleFrom(
+ backgroundColor: colorScheme.primary500,
+ foregroundColor: colorScheme.backgroundBase,
+ padding: const EdgeInsets.symmetric(vertical: 14),
+ ),
+ child: _saving
+ ? SizedBox(
+ height: 20,
+ width: 20,
+ child: CircularProgressIndicator(
+ strokeWidth: 2.5,
+ color: colorScheme.backgroundBase,
+ ),
+ )
+ : const Text("Add to album"),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+
+ Widget _buildCameraArea(bool isReady, EnteColorScheme colorScheme) {
+ if (_initializing) {
+ return const CircularProgressIndicator();
+ }
+ if (_error != null) {
+ return Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 24),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Icon(
+ Icons.error_outline,
+ color: colorScheme.textMuted,
+ size: 32,
+ ),
+ const SizedBox(height: 8),
+ Text(
+ _error!,
+ style: Theme.of(context).textTheme.bodyMedium,
+ textAlign: TextAlign.center,
+ ),
+ const SizedBox(height: 12),
+ ElevatedButton(
+ onPressed: _initializing ? null : _initializeCamera,
+ child: const Text("Try again"),
+ ),
+ TextButton(
+ onPressed: () {
+ routeToPage(context, const ActivityScreen());
+ },
+ child: const Text("Back to rituals"),
+ ),
+ ],
),
+ );
+ }
+ if (!isReady || _controller == null) {
+ return const SizedBox.shrink();
+ }
+ return Center(
+ child: CameraPreview(_controller!),
+ );
+ }
+}
+
+class _CapturedStrip extends StatelessWidget {
+ const _CapturedStrip({required this.captures});
+
+ final List<XFile> captures;
+
+ @override
+ Widget build(BuildContext context) {
+ final colorScheme = getEnteColorScheme(context);
+ return SizedBox(
+ height: 96,
+ child: ListView.separated(
+ scrollDirection: Axis.horizontal,
+ padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
+ itemCount: captures.length,
+ separatorBuilder: (_, __) => const SizedBox(width: 10),
+ itemBuilder: (context, index) {
+ final file = captures[index];
+ return ClipRRect(
+ borderRadius: BorderRadius.circular(12),
+ child: Container(
+ width: 80,
+ height: 80,
+ color: colorScheme.fillFaintPressed,
+ child: Image.file(
+ File(file.path),
+ fit: BoxFit.cover,
+ ),
+ ),
+ );
+ },
),
);
}
+}
+
+class _CaptureButton extends StatelessWidget {
+ const _CaptureButton({
+ required this.onTap,
+ required this.busy,
+ });
- Future<Collection?> _loadCollection() async {
- if (albumId == null) return null;
- return CollectionsService.instance.getCollectionByID(albumId!);
+ final VoidCallback? onTap;
+ final bool busy;
+
+ @override
+ Widget build(BuildContext context) {
+ final colorScheme = getEnteColorScheme(context);
+ return GestureDetector(
+ onTap: onTap,
+ child: Container(
+ width: 72,
+ height: 72,
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ color: onTap == null
+ ? colorScheme.fillMuted
+ : colorScheme.backgroundBase,
+ border: Border.all(
+ color: colorScheme.primary500,
+ width: 3,
+ ),
+ ),
+ child: Center(
+ child: busy
+ ? CircularProgressIndicator(
+ color: colorScheme.primary500,
+ strokeWidth: 3,
+ )
+ : Container(
+ width: 48,
+ height: 48,
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ color: onTap == null
+ ? colorScheme.strokeFaint
+ : colorScheme.primary500,
+ ),
+ ),
+ ),
+ ),
+ );
}
}
diff --git a/mobile/apps/photos/lib/ui/tabs/home_widget.dart b/mobile/apps/photos/lib/ui/tabs/home_widget.dart
index 61922c4235..15eb47b01f 100644
--- a/mobile/apps/photos/lib/ui/tabs/home_widget.dart
+++ b/mobile/apps/photos/lib/ui/tabs/home_widget.dart
@@ -946,7 +946,9 @@ class _HomeWidgetState extends State<HomeWidget> {
if (payload != null) {
debugPrint('notification payload: $payload');
final uri = Uri.tryParse(payload);
- if (uri != null && uri.host.toLowerCase() == "ritual") {
+ if (uri != null &&
+ (uri.host.toLowerCase() == "ritual" ||
+ uri.host.toLowerCase() == "camera")) {
final ritualId = uri.queryParameters["ritualId"] ?? "";
final albumIdRaw = uri.queryParameters["albumId"];
final int? albumId = albumIdRaw != null && albumIdRaw.isNotEmpty
diff --git a/mobile/apps/photos/pubspec.lock b/mobile/apps/photos/pubspec.lock
index 3a79cf7cd2..fdf0503c58 100644
--- a/mobile/apps/photos/pubspec.lock
+++ b/mobile/apps/photos/pubspec.lock
@@ -266,6 +266,46 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.1"
+ camera:
+ dependency: "direct main"
+ description:
+ name: camera
+ sha256: "87a27e0553e3432119c1c2f6e4b9a1bbf7d2c660552b910bfa59185a9facd632"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.11.2+1"
+ camera_android_camerax:
+ dependency: transitive
+ description:
+ name: camera_android_camerax
+ sha256: "2c0746d55f513bed55f52e0b5d9bda18c1533bb16bb89ea93d8033f3815e6cd8"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.6.23+1"
+ camera_avfoundation:
+ dependency: transitive
+ description:
+ name: camera_avfoundation
+ sha256: "951ef122d01ebba68b7a54bfe294e8b25585635a90465c311b2f875ae72c412f"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.9.21+2"
+ camera_platform_interface:
+ dependency: transitive
+ description:
+ name: camera_platform_interface
+ sha256: "98cfc9357e04bad617671b4c1f78a597f25f08003089dd94050709ae54effc63"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.12.0"
+ camera_web:
+ dependency: transitive
+ description:
+ name: camera_web
+ sha256: "77e53acb64d9de8917424eeb32b5c7c73572d1e00954bbf54a1e609d79a751a2"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.3.5+1"
cast:
dependency: transitive
description:
@@ -3146,4 +3186,4 @@ packages:
version: "3.1.3"
sdks:
dart: ">=3.8.1 <4.0.0"
- flutter: ">=3.32.0"
+ flutter: ">=3.32.8"
diff --git a/mobile/apps/photos/pubspec.yaml b/mobile/apps/photos/pubspec.yaml
index 15b382c0aa..aad6bb3caf 100644
--- a/mobile/apps/photos/pubspec.yaml
+++ b/mobile/apps/photos/pubspec.yaml
@@ -32,6 +32,7 @@ dependencies:
ref: 95c7a9f
bip39: ^1.0.6
cached_network_image: ^3.0.0
+ camera: ^0.11.0+2
chewie: 1.13.0
collection: #dart
computer: # logged task name in verbose in fork