fixes some more issues

This commit is contained in:
otsmr 2026-05-13 15:27:08 +02:00
parent 0818fd0a75
commit dda3677907
7 changed files with 23 additions and 13 deletions

View file

@ -32,5 +32,5 @@ class AppState {
static bool isInBackgroundTask = false;
static bool allowErrorTrackingViaSentry = false;
static bool gotMessageFromServer = false;
static int latestAppVersionId = 112;
static int latestAppVersionId = 113;
}

View file

@ -1,5 +1,6 @@
import 'dart:async';
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:mutex/mutex.dart';
@ -246,6 +247,16 @@ Future<void> runMigrations() async {
});
}
}
if (kDebugMode) {
assert(
AppState.latestAppVersionId == 113,
'Forgot to update the target version in runMigrations() after incrementing AppState.latestAppVersionId.',
);
assert(
AppState.latestAppVersionId == userService.currentUser.appVersion,
"Migration incomplete: currentUser.appVersion (${userService.currentUser.appVersion}) does not match AppState.latestAppVersionId (${AppState.latestAppVersionId}). Ensure the user's appVersion is updated in the migration block.",
);
}
}
Future<void> postStartupTasks() async {

View file

@ -139,15 +139,10 @@ class GroupsDao extends DatabaseAccessor<TwonlyDB> with _$GroupsDaoMixin {
}
Future<Group?> _insertGroup(GroupsCompanion group) async {
try {
await into(groups).insert(group);
return await (select(
await into(groups).insertOnConflictUpdate(group);
return (select(
groups,
)..where((t) => t.groupId.equals(group.groupId.value))).getSingle();
} catch (e) {
Log.error('Could not insert group: $e');
return null;
}
)..where((t) => t.groupId.equals(group.groupId.value))).getSingleOrNull();
}
Future<List<Contact>> getGroupContact(String groupId) async {

View file

@ -356,8 +356,6 @@ Future<void> handleEncryptedFile(String mediaId) async {
Log.info('Decryption of $mediaId was successful');
mediaService.encryptedPath.deleteSync();
unawaited(apiService.downloadDone(mediaService.mediaFile.downloadToken!));
},
);
}

View file

@ -341,7 +341,7 @@ class BackupService {
return (null, RecoveryError.noInternet);
}
Log.warn('Backup downlaod status: ${response.statusCode}');
Log.info('Backup downlaod status: ${response.statusCode}');
switch (response.statusCode) {
case 200:

View file

@ -148,6 +148,7 @@ class MainCameraController {
await cameraController?.initialize();
} catch (e) {
Log.error(e);
cameraController = null; // ensure uninitialized controller is not reused
return;
}
await cameraController?.startImageStream(_processCameraImage);

View file

@ -352,6 +352,11 @@ class _MediaViewerViewState extends State<MediaViewerView> {
return nextMediaOrExit();
}
// The server can now delete the encrypted bytes, as the users has sucessfully opened it.
unawaited(
apiService.downloadDone(currentMediaLocal.mediaFile.downloadToken!),
);
var timerRequired = false;
if (currentMediaLocal.mediaFile.type == MediaType.video) {