refactor: Check if app is in foreground on pushhelper
This commit is contained in:
parent
085bb19da5
commit
c6007a3c3d
9 changed files with 4 additions and 25 deletions
|
|
@ -81,10 +81,8 @@ Future<void> _tryPushHelper(
|
|||
notification.toJson(),
|
||||
);
|
||||
|
||||
if (!isBackgroundMessage &&
|
||||
if (notification.roomId != null &&
|
||||
activeRoomId == notification.roomId &&
|
||||
activeRoomId != null &&
|
||||
client.syncPresence == null &&
|
||||
WidgetsBinding.instance.lifecycleState == AppLifecycleState.resumed) {
|
||||
Logs().v('Room is in foreground. Stop push helper here.');
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ import 'dart:io';
|
|||
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import 'package:desktop_lifecycle/desktop_lifecycle.dart';
|
||||
import 'package:desktop_notifications/desktop_notifications.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
|
@ -25,7 +25,8 @@ extension LocalNotificationsExtension on MatrixState {
|
|||
final roomId = eventUpdate.roomID;
|
||||
if (activeRoomId == roomId) {
|
||||
if (kIsWeb && webHasFocus) return;
|
||||
if (PlatformInfos.isLinux && DesktopLifecycle.instance.isActive.value) {
|
||||
if (PlatformInfos.isDesktop &&
|
||||
WidgetsBinding.instance.lifecycleState == AppLifecycleState.resumed) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue