From df1edd5b79c969b787b474390c0dd35d08fb3666 Mon Sep 17 00:00:00 2001 From: ekzyis <27162016+ekzyis@users.noreply.github.com> Date: Wed, 10 Jan 2024 16:25:30 +0100 Subject: [PATCH] Fix push notification counting on iOS devices (#739) Co-authored-by: ekzyis --- sw/eventListener.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sw/eventListener.js b/sw/eventListener.js index d40dafca..7a579b5c 100644 --- a/sw/eventListener.js +++ b/sw/eventListener.js @@ -117,7 +117,8 @@ const mergeAndShowNotification = async (sw, payload, currentNotifications, tag, // tags that need to know the sum of sats of notifications with same tag for merging const SUM_SATS_TAGS = ['DEPOSIT'] // this should reflect the amount of notifications that were already merged before - const initialAmount = currentNotifications[0].data?.amount || 1 + let initialAmount = currentNotifications[0]?.data?.amount || 1 + if (iOS()) initialAmount = 1 log(`[sw:push] ${nid} - initial amount: ${initialAmount}`) const mergedPayload = currentNotifications.reduce((acc, { data }) => { let newAmount, newSats