mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 09:08:40 +00:00
fix #151
This commit is contained in:
parent
a7e57fd7d1
commit
7e7ac832e8
2 changed files with 8 additions and 5 deletions
|
|
@ -321,17 +321,20 @@ Future<void> purgeMediaFiles(Directory directory) async {
|
|||
final match = RegExp(r'(\d+)').firstMatch(filename);
|
||||
if (match != null) {
|
||||
// Parse the integer and add it to the list
|
||||
int messageId = int.parse(match.group(0)!);
|
||||
int fileId = int.parse(match.group(0)!);
|
||||
|
||||
Message? message = (directory.path.endsWith("send"))
|
||||
? await twonlyDatabase.messagesDao
|
||||
.getMessageByMediaUploadId(messageId)
|
||||
.getMessageByMediaUploadId(fileId)
|
||||
.getSingleOrNull()
|
||||
: await twonlyDatabase.messagesDao
|
||||
.getMessageByMessageId(messageId)
|
||||
.getMessageByMessageId(fileId)
|
||||
.getSingleOrNull();
|
||||
|
||||
if ((message == null) ||
|
||||
(message.openedAt != null && !message.mediaStored) ||
|
||||
(message.openedAt != null &&
|
||||
!message.mediaStored &&
|
||||
message.acknowledgeByServer == true) ||
|
||||
message.errorWhileSending) {
|
||||
try {
|
||||
file.deleteSync();
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ class ApiProvider {
|
|||
Future<server.ServerToClient?> _waitForResponse(Int64 seq) async {
|
||||
final startTime = DateTime.now();
|
||||
|
||||
final timeout = Duration(seconds: 5);
|
||||
final timeout = Duration(seconds: 10);
|
||||
|
||||
while (true) {
|
||||
if (messagesV0[seq] != null) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue