From 085bb19da5bcf4f17650fa01aa24330f49a9d2a9 Mon Sep 17 00:00:00 2001 From: krille-chan Date: Mon, 27 Nov 2023 17:00:16 +0100 Subject: [PATCH] fix: Do not hide push if app romm in foreground but is in background --- lib/utils/push_helper.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/utils/push_helper.dart b/lib/utils/push_helper.dart index 1e7d5f82..e96a250d 100644 --- a/lib/utils/push_helper.dart +++ b/lib/utils/push_helper.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'dart:io'; import 'dart:ui'; +import 'package:flutter/material.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; @@ -83,7 +84,8 @@ Future _tryPushHelper( if (!isBackgroundMessage && activeRoomId == notification.roomId && activeRoomId != null && - client.syncPresence == null) { + client.syncPresence == null && + WidgetsBinding.instance.lifecycleState == AppLifecycleState.resumed) { Logs().v('Room is in foreground. Stop push helper here.'); return; }