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)