From 833b0943c852875fcd80504bc4ec9a3948530ce1 Mon Sep 17 00:00:00 2001 From: Come Grellard Date: Fri, 18 Nov 2022 13:51:48 +0100 Subject: [PATCH 1/3] Every notifications categories are enabled by default even when updating LL to 3.11 --- .../src/logic/notifications.tsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/apps/ledger-live-mobile/src/logic/notifications.tsx b/apps/ledger-live-mobile/src/logic/notifications.tsx index d2ea815b8df..bb29b0d6db8 100644 --- a/apps/ledger-live-mobile/src/logic/notifications.tsx +++ b/apps/ledger-live-mobile/src/logic/notifications.tsx @@ -23,6 +23,8 @@ import { } from "../actions/notifications"; import { setRatingsModalLocked } from "../actions/ratings"; import { track } from "../analytics"; +import { notificationsSelector } from "../reducers/settings"; +import { setNotifications } from "../actions/settings"; export type EventTrigger = { timeout: NodeJS.Timeout; @@ -76,6 +78,7 @@ const getIsNotifEnabled = async () => { const useNotifications = () => { const pushNotificationsFeature = useFeature("brazePushNotifications"); + const notifications = useSelector(notificationsSelector); const isPushNotificationsModalOpen = useSelector( notificationsModalOpenSelector, @@ -264,6 +267,15 @@ const useNotifications = () => { ); const initPushNotificationsData = useCallback(() => { + if (notifications && !notifications.areNotificationsAllowed) { + dispatch( + setNotifications({ + areNotificationsAllowed: true, + announcementsCategory: true, + recommendationsCategory: true, + }), + ); + } getPushNotificationsDataOfUserFromStorage().then(dataOfUser => { updatePushNotificationsDataOfUserInStateAndStore({ ...dataOfUser, @@ -271,7 +283,11 @@ const useNotifications = () => { numberOfAppStarts: (dataOfUser?.numberOfAppStarts ?? 0) + 1, }); }); - }, [updatePushNotificationsDataOfUserInStateAndStore]); + }, [ + dispatch, + notifications, + updatePushNotificationsDataOfUserInStateAndStore, + ]); const triggerMarketPushNotificationModal = useCallback(() => { if ( From d2640c712331ad290f383d5f117dbbb2be5dd108 Mon Sep 17 00:00:00 2001 From: Come Grellard Date: Fri, 18 Nov 2022 13:58:20 +0100 Subject: [PATCH 2/3] Every notifications categories are enabled by default even when updating LL to 3.11 --- apps/ledger-live-mobile/src/logic/notifications.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ledger-live-mobile/src/logic/notifications.tsx b/apps/ledger-live-mobile/src/logic/notifications.tsx index bb29b0d6db8..6ad560db889 100644 --- a/apps/ledger-live-mobile/src/logic/notifications.tsx +++ b/apps/ledger-live-mobile/src/logic/notifications.tsx @@ -267,7 +267,7 @@ const useNotifications = () => { ); const initPushNotificationsData = useCallback(() => { - if (notifications && !notifications.areNotificationsAllowed) { + if (notifications && notifications.areNotificationsAllowed === undefined) { dispatch( setNotifications({ areNotificationsAllowed: true, From 984e4a7130ccdebee2c2c3fa725e81040053ed18 Mon Sep 17 00:00:00 2001 From: Come Grellard Date: Fri, 18 Nov 2022 14:14:49 +0100 Subject: [PATCH 3/3] Every notifications categories are enabled by default even when updating LL to 3.11 --- .changeset/itchy-rats-cheer.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/itchy-rats-cheer.md diff --git a/.changeset/itchy-rats-cheer.md b/.changeset/itchy-rats-cheer.md new file mode 100644 index 00000000000..eaed8a6f528 --- /dev/null +++ b/.changeset/itchy-rats-cheer.md @@ -0,0 +1,5 @@ +--- +"live-mobile": patch +--- + +Every notifications categories are enabled by default even when updating LL to 3.11