fix: Notifications on web correctly managed when tab not focused
This commit is contained in:
parent
03109371dc
commit
a0aeab34ea
3 changed files with 2 additions and 9 deletions
|
|
@ -523,9 +523,7 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
}
|
||||
|
||||
// Do not send read markers when app is not in foreground
|
||||
if (kIsWeb && !Matrix.of(context).webHasFocus) return;
|
||||
if (!kIsWeb &&
|
||||
WidgetsBinding.instance.lifecycleState != AppLifecycleState.resumed) {
|
||||
if (WidgetsBinding.instance.lifecycleState != AppLifecycleState.resumed) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import 'package:fluffychat/config/setting_keys.dart';
|
|||
import 'package:fluffychat/l10n/l10n.dart';
|
||||
import 'package:fluffychat/utils/client_download_content_extension.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:fluffychat/utils/push_helper.dart';
|
||||
import 'package:fluffychat/widgets/fluffy_chat_app.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
|
|
@ -26,9 +25,7 @@ extension LocalNotificationsExtension on MatrixState {
|
|||
void showLocalNotification(Event event) async {
|
||||
final roomId = event.room.id;
|
||||
if (activeRoomId == roomId) {
|
||||
if (kIsWeb && webHasFocus) return;
|
||||
if (PlatformInfos.isDesktop &&
|
||||
WidgetsBinding.instance.lifecycleState == AppLifecycleState.resumed) {
|
||||
if (WidgetsBinding.instance.lifecycleState == AppLifecycleState.resumed) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -197,8 +197,6 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|||
});
|
||||
}
|
||||
|
||||
bool webHasFocus = true;
|
||||
|
||||
String? get activeRoomId {
|
||||
final route = FluffyChatApp.router.routeInformationProvider.value.uri.path;
|
||||
if (!route.startsWith('/rooms/')) return null;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue