From 4bedbc7933d7b93c10fed316b68ba81f0f1e32c5 Mon Sep 17 00:00:00 2001 From: otsmr Date: Mon, 10 Feb 2025 20:51:25 +0100 Subject: [PATCH] remove cached images --- README.md | 32 +---------------- lib/src/providers/api/api.dart | 6 +++- .../camera_to_share/camera_preview_view.dart | 35 ++----------------- 3 files changed, 8 insertions(+), 65 deletions(-) diff --git a/README.md b/README.md index e3a92ba..25e40ff 100644 --- a/README.md +++ b/README.md @@ -2,35 +2,7 @@ Don't be lonely, get twonly! Send pictures to a friend in real time and be sure you are the only two people who can see them. - -## TODOS bevor first beta -- Real deployment aufsetzen, direkt auf Netcup? -- Firebase Push Notification - - -## Maybe -- Send a picture first to only one person -> Kamera button -- Response to a image -- MediaView: - - Bei weiteren geladenen Bildern -> Direkt anzeigen ohne pop - -## TODOS bevor first release -- Settings - - Subscription - - Notification -- Webpage -- Instagam & Marketing vorbereiten -- IT-Startup der TU Darmstadt anschreiben -- iOS version - -## Later todos -- Videos -- Sealed Sender -- Settings - - Profilbilder erstellen. -- Pro Version -- Media Shower -> Recap of the day -- Send normal images via twonly +run-as eu.twonly.testing ls /data/user/0/eu.twonly.testing/ ## Pro Version @@ -40,8 +12,6 @@ Don't be lonely, get twonly! Send pictures to a friend in real time and be sure - Get up to 3 tokens - Get for your twonly partner a second a additional pro version - - ## Features This app was started because of the three main features I missed out by popular alternatives. diff --git a/lib/src/providers/api/api.dart b/lib/src/providers/api/api.dart index 2f65d9f..26023f2 100644 --- a/lib/src/providers/api/api.dart +++ b/lib/src/providers/api/api.dart @@ -135,8 +135,12 @@ Future uploadMediaFile( if (offset + fragmentedTransportSize < encryptedMedia.length) { end = offset + fragmentedTransportSize; } + bool wasSend = await apiProvider.uploadData( - uploadToken, encryptedMedia.sublist(offset, end), offset); + uploadToken, + encryptedMedia.sublist(offset, end), + offset, + ); if (!wasSend) { Logger("api.dart").shout("error while uploading media"); diff --git a/lib/src/views/camera_to_share/camera_preview_view.dart b/lib/src/views/camera_to_share/camera_preview_view.dart index 17b13a6..441d3d5 100644 --- a/lib/src/views/camera_to_share/camera_preview_view.dart +++ b/lib/src/views/camera_to_share/camera_preview_view.dart @@ -77,6 +77,8 @@ class _CameraPreviewViewState extends State { single: (single) async { final imageBytes = await single.file?.readAsBytes(); if (imageBytes == null || !context.mounted) return; + debugPrint("Delete ${single.path!}"); + File(single.path!).delete(); setState(() { sharePreviewIsShown = true; }); @@ -199,7 +201,6 @@ class _CameraPreviewViewState extends State { isFlashOn = true; } setState(() {}); - //cameraState.sensorConfig.switchCameraFlash(); }, ), ], @@ -258,40 +259,8 @@ class _CameraPreviewViewState extends State { final String filePath = '${testDir.path}/${DateTime.now().millisecondsSinceEpoch}.jpg'; return SingleCaptureRequest(filePath, sensors.first); - // // Separate pictures taken with front and back camera - // return MultipleCaptureRequest( - // { - // for (final sensor in sensors) - // sensor: - // '${testDir.path}/${sensor.position == SensorPosition.front ? 'front_' : "back_"}${DateTime.now().millisecondsSinceEpoch}.jpg', - // }, - // ); }, ), - // onPreviewTapBuilder: (state) => OnPreviewTap( - // onTap: (Offset position, PreviewSize flutterPreviewSize, - // PreviewSize pixelPreviewSize) { - // state.when(onPhotoMode: (picState) => picState.takePhoto()); - // }, - // onTapPainter: (tapPosition) => TweenAnimationBuilder( - // key: ValueKey(tapPosition), - // tween: Tween(begin: 1.0, end: 0.0), - // duration: const Duration(milliseconds: 500), - // builder: (context, anim, child) { - // return Transform.rotate( - // angle: anim * 2 * pi, - // child: Transform.scale( - // scale: 4 * anim, - // child: child, - // ), - // ); - // }, - // child: const Icon( - // Icons.camera, - // color: Colors.white, - // ), - // ), - // ), ), ), if (sharePreviewIsShown)