From d2b7e4cf9ee55536f665a8864b10e5e8d7057a9a Mon Sep 17 00:00:00 2001 From: otsmr Date: Sun, 30 Nov 2025 09:19:38 +0100 Subject: [PATCH] fix #318 --- lib/src/views/components/flame.dart | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/src/views/components/flame.dart b/lib/src/views/components/flame.dart index dc83b12..3e33ba3 100644 --- a/lib/src/views/components/flame.dart +++ b/lib/src/views/components/flame.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:twonly/globals.dart'; +import 'package:twonly/src/database/twonly.db.dart'; import 'package:twonly/src/views/components/animate_icon.dart'; class FlameCounterWidget extends StatefulWidget { @@ -38,18 +39,20 @@ class _FlameCounterWidgetState extends State { Future initAsync() async { var groupId = widget.groupId; + late Group? group; if (widget.groupId == null && widget.contactId != null) { - final group = await twonlyDB.groupsDao.getDirectChat(widget.contactId!); + group = await twonlyDB.groupsDao.getDirectChat(widget.contactId!); groupId = group?.groupId; } else if (groupId != null) { // do not display the flame counter for groups - final group = await twonlyDB.groupsDao.getGroup(groupId); + group = await twonlyDB.groupsDao.getGroup(groupId); if (!(group?.isDirectChat ?? false)) { return; } } - if (groupId != null) { - isBestFriend = gUser.myBestFriendGroupId == groupId; + if (groupId != null && group != null) { + isBestFriend = + gUser.myBestFriendGroupId == groupId && group.alsoBestFriend; final stream = twonlyDB.groupsDao.watchFlameCounter(groupId); flameCounterSub = stream.listen((counter) { if (mounted) {