From f923e2dd262eef4e5033e1bc3ee3d2185ed7451c Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Mon, 16 Dec 2024 15:55:30 +0000 Subject: [PATCH] Disable notification non-show due to URL check --- packages/acter_notifify/lib/acter_notifify.dart | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/acter_notifify/lib/acter_notifify.dart b/packages/acter_notifify/lib/acter_notifify.dart index daec9898b85c..85260485307f 100644 --- a/packages/acter_notifify/lib/acter_notifify.dart +++ b/packages/acter_notifify/lib/acter_notifify.dart @@ -22,7 +22,7 @@ typedef HandleMessageTap = FutureOr Function(Map data); /// we should continue or not bother the user. Just a user based switch typedef IsEnabledCheck = FutureOr Function(); -/// Given the target url of the notifiction, should this notification be shown +/// Given the target url of the notification, should this notification be shown /// or just be ignored. Useful to avoid showing push notification if the user /// is on that same screen typedef ShouldShowCheck = FutureOr Function(String url); @@ -68,7 +68,18 @@ Future initializeNotifify({ if (usePush && pushServer.isNotEmpty) { await initializePush( handleMessageTap: handleMessageTap, - shouldShowCheck: shouldShowCheck, + shouldShowCheck: (a) async { + /// FIXME: to ensure we see failures after, this is being ignored for now + try { + if (shouldShowCheck != null) { + final res = await shouldShowCheck(a); + _log.info('Should show $a: $res'); + } + } catch (e, s) { + _log.severe('Checking whether $a should be shown failed', e, s); + } + return true; + }, isEnabledCheck: isEnabledCheck, currentClientsGen: currentClientsGen, appIdPrefix: appIdPrefix,