From c77c369212ff8f257aef9c49aa1eab70b4cd76fe Mon Sep 17 00:00:00 2001 From: otsmr Date: Sun, 17 May 2026 19:25:08 +0200 Subject: [PATCH 1/3] multiple bug issues --- lib/src/services/mediafiles/mediafile.service.dart | 9 ++++++++- .../services/notifications/pushkeys.notifications.dart | 6 ++++-- lib/src/visual/views/home.view.dart | 4 +++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/src/services/mediafiles/mediafile.service.dart b/lib/src/services/mediafiles/mediafile.service.dart index c692bb45..aee30809 100644 --- a/lib/src/services/mediafiles/mediafile.service.dart +++ b/lib/src/services/mediafiles/mediafile.service.dart @@ -197,7 +197,14 @@ class MediaFileService { Future createThumbnail() async { if (!storedPath.existsSync()) { - Log.error('Could not create Thumbnail as stored media does not exists.'); + if (mediaFile.stored && + mediaFile.createdAt.isBefore( + clock.now().subtract(const Duration(days: 30)), + )) { + // media files does not exists any more so also delete the database entry + await twonlyDB.mediaFilesDao.deleteMediaFile(mediaFile.mediaId); + fullMediaRemoval(); + } return; } var success = false; diff --git a/lib/src/services/notifications/pushkeys.notifications.dart b/lib/src/services/notifications/pushkeys.notifications.dart index b5bf8b35..e950c928 100644 --- a/lib/src/services/notifications/pushkeys.notifications.dart +++ b/lib/src/services/notifications/pushkeys.notifications.dart @@ -285,7 +285,7 @@ Future getPushNotificationFromEncryptedContent( if (content.hasMediaUpdate()) { final msg = await twonlyDB.messagesDao - .getMessageById(content.reaction.targetMessageId) + .getMessageById(content.mediaUpdate.targetMessageId) .getSingleOrNull(); // These notifications should only be send to the original sender. if (msg == null || msg.senderId != toUserId) { @@ -304,7 +304,9 @@ Future getPushNotificationFromEncryptedContent( if (content.hasGroupCreate()) { kind = PushKind.ADDED_TO_GROUP; final group = await twonlyDB.groupsDao.getGroup(content.groupId); - additionalContent = group!.groupName; + if (group != null) { + additionalContent = group.groupName; + } } if (kind == null) return null; diff --git a/lib/src/visual/views/home.view.dart b/lib/src/visual/views/home.view.dart index 76ec2f61..79963a6a 100644 --- a/lib/src/visual/views/home.view.dart +++ b/lib/src/visual/views/home.view.dart @@ -91,7 +91,9 @@ class HomeViewState extends State { streamHomeViewPageIndex.add(0); }); - unawaited(_mainCameraController.selectCamera(0, true)); + if (initialPage == 1) { + unawaited(_mainCameraController.selectCamera(0, true)); + } unawaited(_initAsync()); // Subscribe to all events (initial link and further) From 5bcb3b3efe7039970ee8122b2d802e394b74dfad Mon Sep 17 00:00:00 2001 From: otsmr Date: Sun, 17 May 2026 20:23:37 +0200 Subject: [PATCH 2/3] Fix: Issue with opening directly in chats --- CHANGELOG.md | 5 +++++ .../notifications/pushkeys.notifications.dart | 22 +++++++++++++------ .../main_camera_controller.dart | 2 +- pubspec.yaml | 3 ++- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ed082a8..3d80606f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.2.14 + +- Fix: Issue with opening directly in chats +- Fix: Multipe smaller issues + ## 0.2.13 - New: Tutorial on how to use zoom. diff --git a/lib/src/services/notifications/pushkeys.notifications.dart b/lib/src/services/notifications/pushkeys.notifications.dart index e950c928..e802f0ac 100644 --- a/lib/src/services/notifications/pushkeys.notifications.dart +++ b/lib/src/services/notifications/pushkeys.notifications.dart @@ -30,7 +30,7 @@ Future setupNotificationWithUsers({ // HotFIX: Search for user with id 0 if not there remove all // and create new push keys with all users. - final pushUser = pushUsers.firstWhereOrNull((x) => x.userId == 0); + final pushUser = pushUsers.firstWhereOrNull((x) => x.userId.toInt() == 0); if (pushUser == null) { Log.info('Clearing push keys'); await setPushKeys(SecureStorageKeys.receivingPushKeys, []); @@ -51,7 +51,7 @@ Future setupNotificationWithUsers({ final contacts = await twonlyDB.contactsDao.getAllContacts(); for (final contact in contacts) { final pushUser = pushUsers.firstWhereOrNull( - (x) => x.userId == contact.userId, + (x) => x.userId.toInt() == contact.userId, ); if (pushUser != null && pushUser.pushKeys.isNotEmpty) { @@ -124,7 +124,9 @@ Future sendNewPushKey(int userId, PushKey pushKey) async { Future updatePushUser(Contact contact) async { final pushKeys = await getPushKeys(SecureStorageKeys.receivingPushKeys); - final pushUser = pushKeys.firstWhereOrNull((x) => x.userId == contact.userId); + final pushUser = pushKeys.firstWhereOrNull( + (x) => x.userId.toInt() == contact.userId, + ); if (pushUser == null) { pushKeys.add( @@ -148,7 +150,9 @@ Future updatePushUser(Contact contact) async { Future handleNewPushKey(int fromUserId, int keyId, List key) async { final pushKeys = await getPushKeys(SecureStorageKeys.sendingPushKeys); - var pushUser = pushKeys.firstWhereOrNull((x) => x.userId == fromUserId); + var pushUser = pushKeys.firstWhereOrNull( + (x) => x.userId.toInt() == fromUserId, + ); if (pushUser == null) { final contact = await twonlyDB.contactsDao @@ -164,7 +168,7 @@ Future handleNewPushKey(int fromUserId, int keyId, List key) async { lastMessageId: uuid.v7(), ), ); - pushUser = pushKeys.firstWhereOrNull((x) => x.userId == fromUserId); + pushUser = pushKeys.firstWhereOrNull((x) => x.userId.toInt() == fromUserId); } if (pushUser == null) { @@ -187,7 +191,9 @@ Future handleNewPushKey(int fromUserId, int keyId, List key) async { Future updateLastMessageId(int fromUserId, String messageId) async { final pushUsers = await getPushKeys(SecureStorageKeys.receivingPushKeys); - final pushUser = pushUsers.firstWhereOrNull((x) => x.userId == fromUserId); + final pushUser = pushUsers.firstWhereOrNull( + (x) => x.userId.toInt() == fromUserId, + ); if (pushUser == null) { unawaited(setupNotificationWithUsers()); return; @@ -341,7 +347,9 @@ Future encryptPushNotification( var key = 'InsecureOnlyUsedForAddingContact'.codeUnits; var keyId = 0; - final pushUser = pushKeys.firstWhereOrNull((x) => x.userId == toUserId); + final pushUser = pushKeys.firstWhereOrNull( + (x) => x.userId.toInt() == toUserId, + ); if (pushUser == null) { // user does not have send any push keys diff --git a/lib/src/visual/views/camera/camera_preview_components/main_camera_controller.dart b/lib/src/visual/views/camera/camera_preview_components/main_camera_controller.dart index a1cf0e27..df665c84 100644 --- a/lib/src/visual/views/camera/camera_preview_components/main_camera_controller.dart +++ b/lib/src/visual/views/camera/camera_preview_components/main_camera_controller.dart @@ -44,7 +44,7 @@ class MainCameraController { CameraController? cameraController; ScreenshotController screenshotController = ScreenshotController(); SelectedCameraDetails selectedCameraDetails = SelectedCameraDetails(); - bool initCameraStarted = true; + bool initCameraStarted = false; Map contactsVerified = {}; Map scannedNewProfiles = {}; final Set _handledProfileLinks = {}; diff --git a/pubspec.yaml b/pubspec.yaml index 091dde13..8daa25c2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: "twonly, a privacy-friendly way to connect with friends through sec publish_to: 'none' -version: 0.2.13+122 +version: 0.2.14+123 environment: sdk: ^3.11.0 @@ -185,6 +185,7 @@ dev_dependencies: in_app_purchase_platform_interface: ^1.4.0 integration_test: sdk: flutter + workmanager_platform_interface: any flutter_launcher_icons: android: true From 236d94622c44b605aa69f25b1a1e1df6f7a06f19 Mon Sep 17 00:00:00 2001 From: otsmr Date: Sun, 17 May 2026 20:30:15 +0200 Subject: [PATCH 3/3] only migrate if not yet opened --- lib/src/services/migrations.service.dart | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/src/services/migrations.service.dart b/lib/src/services/migrations.service.dart index 6e5497bb..9ba47d8e 100644 --- a/lib/src/services/migrations.service.dart +++ b/lib/src/services/migrations.service.dart @@ -158,13 +158,18 @@ Future runMigrations() async { final now = clock.now(); for (final messageId in messageIds.first.split(',')) { await (twonlyDB.update( - twonlyDB.messages, - )..where((tbl) => tbl.messageId.equals(messageId))).write( - MessagesCompanion( - openedAt: Value(now), - openedByAll: Value(now), - ), - ); + twonlyDB.messages, + )..where( + (tbl) => + tbl.messageId.equals(messageId) & + (tbl.openedByAll.isNull() | tbl.openedAt.isNull()), + )) + .write( + MessagesCompanion( + openedAt: Value(now), + openedByAll: Value(now), + ), + ); } } }