mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-05-25 08:32:13 +00:00
Fix: Images not shown after opening due to cleanup
Some checks are pending
Flutter analyze & test / flutter_analyze_and_test (push) Waiting to run
Some checks are pending
Flutter analyze & test / flutter_analyze_and_test (push) Waiting to run
This commit is contained in:
parent
7614da00b1
commit
d7e4da0e55
2 changed files with 13 additions and 0 deletions
|
|
@ -1,5 +1,9 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.2.16
|
||||||
|
|
||||||
|
- Fix: Images not shown after opening due to cleanup
|
||||||
|
|
||||||
## 0.2.15
|
## 0.2.15
|
||||||
|
|
||||||
- Fix: Issue with opening directly in chats
|
- Fix: Issue with opening directly in chats
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,15 @@ class MediaFileService {
|
||||||
if (message.openedAt == null) {
|
if (message.openedAt == null) {
|
||||||
// Message was not yet opened from all persons, so wait...
|
// Message was not yet opened from all persons, so wait...
|
||||||
delete = false;
|
delete = false;
|
||||||
|
} else if (message.openedAt!.isAfter(
|
||||||
|
clock.now().subtract(const Duration(minutes: 3)),
|
||||||
|
)) {
|
||||||
|
// When the message was opened in the last two minutes, do not purge.
|
||||||
|
// Bug: When the user opens an image immediately after starting the app, there is a race condition:
|
||||||
|
// The message is marked as opened, but then purgeTempFolder is run
|
||||||
|
// (it is unawaited) and deletes the file. Thi gives a grace period:
|
||||||
|
// The image must have been opened within the last two minutes, otherwise do not delete it.
|
||||||
|
delete = false;
|
||||||
} else if (mediaFile.requiresAuthentication ||
|
} else if (mediaFile.requiresAuthentication ||
|
||||||
mediaFile.displayLimitInMilliseconds != null) {
|
mediaFile.displayLimitInMilliseconds != null) {
|
||||||
// Message was opened by all persons, and they can not reopen the image.
|
// Message was opened by all persons, and they can not reopen the image.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue