diff --git a/README.md b/README.md index 25e40ff..30a1c4b 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,3 @@ # twonly -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. - -run-as eu.twonly.testing ls /data/user/0/eu.twonly.testing/ - - -## Pro Version - -- Send and receive unlimited pictures -- This includes a free pro version for your twonly partner! -- 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. - - -## Background Notification - -The server will first try to send via an open websocket connection. -If not available then it sends a wakeup via FCM. This will trigger the app to reopen the websocket. - -### Three to rule them all. - -1. Security by design: No one except your device can access your data. -2. Privacy by design: The server only knows your username and public key. -3. User-friendliness: Decide for your own :) - -## Bug-Bounty - -twonly offers a Bug Bounty. Depending on the criticality the bounty can go up to 50€ (more later, -this is out of my own pocket :/). +run-as eu.twonly.testing ls /data/user/0/eu.twonly.testing/ \ No newline at end of file diff --git a/lib/src/providers/api/media_received.dart b/lib/src/providers/api/media_received.dart index 9c18c54..6751eaa 100644 --- a/lib/src/providers/api/media_received.dart +++ b/lib/src/providers/api/media_received.dart @@ -306,9 +306,13 @@ Future purgeMediaFiles(Directory directory) async { bool canBeDeleted = true; for (final message in messages) { - if ((message.openedAt == null && !message.errorWhileSending) || - message.mediaStored) { + if ((message.openedAt == null && !message.errorWhileSending)) { canBeDeleted = false; + } else if (message.mediaStored) { + if (!file.path.contains(".original.") && + !file.path.contains(".encrypted")) { + canBeDeleted = false; + } } } if (canBeDeleted) { diff --git a/lib/src/views/gallery/gallery_main_view.dart b/lib/src/views/gallery/gallery_main_view.dart index c72ec44..ec2d9f0 100644 --- a/lib/src/views/gallery/gallery_main_view.dart +++ b/lib/src/views/gallery/gallery_main_view.dart @@ -1,5 +1,6 @@ import 'dart:convert'; import 'dart:io'; +import 'package:drift/drift.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:intl/intl.dart'; import 'package:twonly/src/model/json/message.dart'; @@ -48,6 +49,11 @@ class GalleryItem { } else if (await File("$basePath.png").exists()) { imagePath = File("$basePath.png"); } else { + if (message.mediaStored) { + /// media file was deleted, ... remove the file + twonlyDatabase.messagesDao.updateMessageByMessageId( + message.messageId, MessagesCompanion(mediaStored: Value(false))); + } continue; } bool mirrorVideo = false;