diff --git a/app/scripts/controllers/metamask-notifications/metamask-notifications.test.ts b/app/scripts/controllers/metamask-notifications/metamask-notifications.test.ts index b0375d5f7d4e..ed635cdc937e 100644 --- a/app/scripts/controllers/metamask-notifications/metamask-notifications.test.ts +++ b/app/scripts/controllers/metamask-notifications/metamask-notifications.test.ts @@ -198,51 +198,6 @@ describe('metamask-notifications - setFeatureAnnouncementsEnabled()', () => { expect(controller.state.isFeatureAnnouncementsEnabled).toBe(true); }); - - test('does not update if auth is not enabled', async () => { - const { messenger, mockIsSignedIn } = mockNotificationMessenger(); - mockIsSignedIn.mockReturnValue(false); // state is off. - - const controller = new MetamaskNotificationsController({ - messenger, - state: { ...defaultState, isFeatureAnnouncementsEnabled: false }, - }); - - await expect(() => - controller.setFeatureAnnouncementsEnabled(false), - ).rejects.toThrow(); - expect(controller.state.isFeatureAnnouncementsEnabled).toBe(false); // this flag was never flipped - }); -}); - -describe('metamask-notifications - setSnapNotificationsEnabled()', () => { - test('flips state when the method is called', async () => { - const { messenger, mockIsSignedIn } = mockNotificationMessenger(); - mockIsSignedIn.mockReturnValue(true); - - const controller = new MetamaskNotificationsController({ - messenger, - state: { ...defaultState, isSnapNotificationsEnabled: false }, - }); - - await controller.setSnapNotificationsEnabled(true); - - expect(controller.state.isSnapNotificationsEnabled).toBe(true); - }); - - test('does not update if auth is not enabled', async () => { - const { messenger, mockIsSignedIn } = mockNotificationMessenger(); - mockIsSignedIn.mockReturnValue(false); // state is off. - - const controller = new MetamaskNotificationsController({ - messenger, - state: { ...defaultState, isSnapNotificationsEnabled: false }, - }); - - await controller.setSnapNotificationsEnabled(false); - - expect(controller.state.isSnapNotificationsEnabled).toBe(false); // this flag was never flipped - }); }); describe('metamask-notifications - createOnChainTriggers()', () => { diff --git a/app/scripts/controllers/metamask-notifications/metamask-notifications.ts b/app/scripts/controllers/metamask-notifications/metamask-notifications.ts index cc5a4807dfea..f19da5b934c8 100644 --- a/app/scripts/controllers/metamask-notifications/metamask-notifications.ts +++ b/app/scripts/controllers/metamask-notifications/metamask-notifications.ts @@ -66,11 +66,6 @@ export type MetamaskNotificationsControllerState = { */ isFeatureAnnouncementsEnabled: boolean; - /** - * Flag that indicates if the Snap notifications are enabled - */ - isSnapNotificationsEnabled: boolean; - /** * List of metamask notifications */ @@ -113,10 +108,6 @@ const metadata: StateMetadata = { persist: true, anonymous: false, }, - isSnapNotificationsEnabled: { - persist: true, - anonymous: false, - }, metamaskNotificationsList: { persist: true, anonymous: true, @@ -146,7 +137,6 @@ export const defaultState: MetamaskNotificationsControllerState = { isMetamaskNotificationsFeatureSeen: false, isMetamaskNotificationsEnabled: false, isFeatureAnnouncementsEnabled: false, - isSnapNotificationsEnabled: false, metamaskNotificationsList: [], metamaskNotificationsReadList: [], isUpdatingMetamaskNotifications: false, @@ -619,16 +609,14 @@ export class MetamaskNotificationsController extends BaseController< * * @param featureAnnouncementsEnabled - A boolean value indicating the desired enabled state of the feature announcements. * @async - * @throws {Error} If the BearerToken token or storage key is missing. + * @throws {Error} If fails to update */ public async setFeatureAnnouncementsEnabled( featureAnnouncementsEnabled: boolean, ) { try { - this.#assertAuthEnabled(); - - this.update((state) => { - state.isFeatureAnnouncementsEnabled = featureAnnouncementsEnabled; + this.update((s) => { + s.isFeatureAnnouncementsEnabled = featureAnnouncementsEnabled; }); } catch (e) { log.error('Unable to toggle feature announcements', e); @@ -636,27 +624,6 @@ export class MetamaskNotificationsController extends BaseController< } } - /** - * Sets the enabled state of Snap notifications. - * - * **Action** - used in the notifications settings page to enable/disable snap notifications. - * - * @param snapNotificationsEnabled - A boolean value indicating the desired enabled state of the snap notifications. - * @async - * @throws {Error} If the BearerToken token or storage key is missing. - */ - public async setSnapNotificationsEnabled(snapNotificationsEnabled: boolean) { - try { - this.#assertAuthEnabled(); - - this.update((state) => { - state.isSnapNotificationsEnabled = snapNotificationsEnabled; - }); - } catch (e) { - log.error('Unable to toggle snap notifications', e); - } - } - /** * This creates/re-creates on-chain triggers defined in User Storage. * @@ -711,7 +678,6 @@ export class MetamaskNotificationsController extends BaseController< this.update((state) => { state.isMetamaskNotificationsEnabled = true; state.isFeatureAnnouncementsEnabled = true; - state.isSnapNotificationsEnabled = true; state.isMetamaskNotificationsFeatureSeen = true; }); @@ -750,7 +716,7 @@ export class MetamaskNotificationsController extends BaseController< * Disables all MetaMask notifications for the user. * This method ensures that the user is authenticated, retrieves all linked accounts, * and disables on-chain triggers for each account. It also sets the global notification - * settings for MetaMask, feature announcements, and Snap notifications to false. + * settings for MetaMask, feature announcements to false. * * @throws {Error} If the user is not authenticated or if there is an error during the process. */ @@ -768,7 +734,6 @@ export class MetamaskNotificationsController extends BaseController< this.update((state) => { state.isMetamaskNotificationsEnabled = false; state.isFeatureAnnouncementsEnabled = false; - state.isSnapNotificationsEnabled = false; state.metamaskNotificationsList = []; }); } catch (e) { diff --git a/app/scripts/lib/setupSentry.js b/app/scripts/lib/setupSentry.js index 685bed10c135..e5b14dcbab3d 100644 --- a/app/scripts/lib/setupSentry.js +++ b/app/scripts/lib/setupSentry.js @@ -152,7 +152,6 @@ export const SENTRY_BACKGROUND_STATE = { isMetamaskNotificationsFeatureSeen: false, isMetamaskNotificationsEnabled: false, isFeatureAnnouncementsEnabled: false, - isSnapNotificationsEnabled: false, metamaskNotificationsList: false, metamaskNotificationsReadList: false, isCheckingAccountsPresence: false, diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 61dd347ec0de..18add92cfab8 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -3678,10 +3678,6 @@ export default class MetamaskController extends EventEmitter { metamaskNotificationsController.markMetamaskNotificationsAsRead.bind( metamaskNotificationsController, ), - setSnapNotificationsEnabled: - metamaskNotificationsController.setSnapNotificationsEnabled.bind( - metamaskNotificationsController, - ), setFeatureAnnouncementsEnabled: metamaskNotificationsController.setFeatureAnnouncementsEnabled.bind( metamaskNotificationsController, diff --git a/test/e2e/fixture-builder.js b/test/e2e/fixture-builder.js index 7c20b2531feb..3db6a2c2c457 100644 --- a/test/e2e/fixture-builder.js +++ b/test/e2e/fixture-builder.js @@ -24,7 +24,6 @@ function defaultFixture(inputChainId = CHAIN_IDS.LOCALHOST) { isFeatureAnnouncementsEnabled: false, isMetamaskNotificationsEnabled: false, isMetamaskNotificationsFeatureSeen: false, - isSnapNotificationsEnabled: false, metamaskNotificationsList: [], metamaskNotificationsReadList: [], }, diff --git a/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-background-state.json b/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-background-state.json index 2f2822a97b37..f3ff636806c0 100644 --- a/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-background-state.json +++ b/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-background-state.json @@ -106,7 +106,6 @@ "isMetamaskNotificationsFeatureSeen": "boolean", "isMetamaskNotificationsEnabled": "boolean", "isFeatureAnnouncementsEnabled": "boolean", - "isSnapNotificationsEnabled": "boolean", "metamaskNotificationsList": "object", "metamaskNotificationsReadList": "object", "isUpdatingMetamaskNotifications": "boolean", diff --git a/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-ui-state.json b/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-ui-state.json index 8260695021a6..498a1ce87b34 100644 --- a/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-ui-state.json +++ b/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-ui-state.json @@ -193,7 +193,6 @@ "isMetamaskNotificationsFeatureSeen": "boolean", "isMetamaskNotificationsEnabled": "boolean", "isFeatureAnnouncementsEnabled": "boolean", - "isSnapNotificationsEnabled": "boolean", "metamaskNotificationsList": "object", "metamaskNotificationsReadList": "object", "isUpdatingMetamaskNotifications": "boolean", diff --git a/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-background-state.json b/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-background-state.json index b412212b8421..156359f066cd 100644 --- a/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-background-state.json +++ b/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-background-state.json @@ -6,7 +6,6 @@ "isFeatureAnnouncementsEnabled": "boolean", "isMetamaskNotificationsEnabled": "boolean", "isMetamaskNotificationsFeatureSeen": "boolean", - "isSnapNotificationsEnabled": "boolean", "metamaskNotificationsList": "object", "metamaskNotificationsReadList": "object" }, diff --git a/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-ui-state.json b/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-ui-state.json index 0dcc6b19e91c..1b78ddeb4ff0 100644 --- a/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-ui-state.json +++ b/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-ui-state.json @@ -6,7 +6,6 @@ "isFeatureAnnouncementsEnabled": "boolean", "isMetamaskNotificationsEnabled": "boolean", "isMetamaskNotificationsFeatureSeen": "boolean", - "isSnapNotificationsEnabled": "boolean", "metamaskNotificationsList": "object", "metamaskNotificationsReadList": "object" }, diff --git a/ui/components/multichain/notifications-tag-counter/notifications-tag-counter.tsx b/ui/components/multichain/notifications-tag-counter/notifications-tag-counter.tsx index f415774313f7..8c7434495397 100644 --- a/ui/components/multichain/notifications-tag-counter/notifications-tag-counter.tsx +++ b/ui/components/multichain/notifications-tag-counter/notifications-tag-counter.tsx @@ -2,7 +2,6 @@ import React from 'react'; import { useSelector } from 'react-redux'; import { selectIsMetamaskNotificationsEnabled, - selectIsSnapNotificationsEnabled, selectIsFeatureAnnouncementsEnabled, getFeatureAnnouncementsUnreadCount, getOnChainMetamaskNotificationsUnreadCount, @@ -27,12 +26,8 @@ type NotificationsTagCounterProps = { }; const useSnapNotificationCount = () => { - const isSnapNotificationsEnabled = useSelector( - selectIsSnapNotificationsEnabled, - ); const unreadNotificationsCount = useSelector(getUnreadNotificationsCount); - - return isSnapNotificationsEnabled ? unreadNotificationsCount : 0; + return unreadNotificationsCount; }; const useFeatureAnnouncementCount = () => { diff --git a/ui/hooks/metamask-notifications/useNotifications.test.tsx b/ui/hooks/metamask-notifications/useNotifications.test.tsx index 7f1d59346a50..b89bade7befb 100644 --- a/ui/hooks/metamask-notifications/useNotifications.test.tsx +++ b/ui/hooks/metamask-notifications/useNotifications.test.tsx @@ -18,7 +18,6 @@ jest.mock('../../store/actions', () => ({ createOnChainTriggers: jest.fn(), deleteOnChainTriggersByAccount: jest.fn(), fetchAndUpdateMetamaskNotifications: jest.fn(), - setSnapNotificationsEnabled: jest.fn(), setFeatureAnnouncementsEnabled: jest.fn(), markMetamaskNotificationsAsRead: jest.fn(), showLoadingIndication: jest.fn(), diff --git a/ui/hooks/metamask-notifications/useSwitchNotifications.test.tsx b/ui/hooks/metamask-notifications/useSwitchNotifications.test.tsx index 1aa66ba77ee8..d0b78f43ced9 100644 --- a/ui/hooks/metamask-notifications/useSwitchNotifications.test.tsx +++ b/ui/hooks/metamask-notifications/useSwitchNotifications.test.tsx @@ -7,7 +7,6 @@ import type { Store } from 'redux'; import * as actions from '../../store/actions'; import { MetamaskNotificationsProvider } from '../../contexts/metamask-notifications/metamask-notifications'; import { - useSwitchSnapNotificationsChange, useSwitchFeatureAnnouncementsChange, useSwitchAccountNotifications, useSwitchAccountNotificationsChange, @@ -17,7 +16,6 @@ const middlewares = [thunk]; const mockStore = configureStore(middlewares); jest.mock('../../store/actions', () => ({ - setSnapNotificationsEnabled: jest.fn(), setFeatureAnnouncementsEnabled: jest.fn(), checkAccountsPresence: jest.fn(), updateOnChainTriggersByAccount: jest.fn(), @@ -33,7 +31,6 @@ describe('useSwitchNotifications', () => { beforeEach(() => { store = mockStore({ metamask: { - isSnapNotificationsEnabled: false, isFeatureAnnouncementsEnabled: false, internalAccounts: { accounts: { @@ -60,24 +57,6 @@ describe('useSwitchNotifications', () => { jest.clearAllMocks(); }); - it('should toggle snap notifications', async () => { - const { result } = renderHook(() => useSwitchSnapNotificationsChange(), { - wrapper: ({ children }) => ( - - - {children} - - - ), - }); - - act(() => { - result.current.onChange(true); - }); - - expect(actions.setSnapNotificationsEnabled).toHaveBeenCalledWith(true); - }); - it('should toggle feature announcements', async () => { const { result } = renderHook(() => useSwitchFeatureAnnouncementsChange(), { wrapper: ({ children }) => ( diff --git a/ui/hooks/metamask-notifications/useSwitchNotifications.ts b/ui/hooks/metamask-notifications/useSwitchNotifications.ts index 60691b2a01ec..0d60b16714a2 100644 --- a/ui/hooks/metamask-notifications/useSwitchNotifications.ts +++ b/ui/hooks/metamask-notifications/useSwitchNotifications.ts @@ -2,7 +2,6 @@ import { useState, useCallback } from 'react'; import { useDispatch } from 'react-redux'; import log from 'loglevel'; import { - setSnapNotificationsEnabled, setFeatureAnnouncementsEnabled, checkAccountsPresence, deleteOnChainTriggersByAccount, @@ -10,37 +9,6 @@ import { hideLoadingIndication, } from '../../store/actions'; -export function useSwitchSnapNotificationsChange(): { - onChange: (state: boolean) => Promise; - error: null | string; -} { - const dispatch = useDispatch(); - - const [error, setError] = useState(null); - - const onChange = useCallback( - async (state: boolean) => { - setError(null); - - try { - await dispatch(setSnapNotificationsEnabled(state)); - } catch (e) { - const errorMessage = - e instanceof Error ? e.message : JSON.stringify(e ?? ''); - setError(errorMessage); - log.error(errorMessage); - throw e; - } - }, - [dispatch], - ); - - return { - onChange, - error, - }; -} - export function useSwitchFeatureAnnouncementsChange(): { onChange: (state: boolean) => Promise; error: null | string; diff --git a/ui/pages/notifications-settings/notifications-settings-types.tsx b/ui/pages/notifications-settings/notifications-settings-types.tsx index 5b2ebfa0e06e..f05b854e5803 100644 --- a/ui/pages/notifications-settings/notifications-settings-types.tsx +++ b/ui/pages/notifications-settings/notifications-settings-types.tsx @@ -2,10 +2,7 @@ import React, { useState } from 'react'; import { useSelector } from 'react-redux'; import { useI18nContext } from '../../hooks/useI18nContext'; import { useMetamaskNotificationsContext } from '../../contexts/metamask-notifications/metamask-notifications'; -import { - useSwitchFeatureAnnouncementsChange, - useSwitchSnapNotificationsChange, -} from '../../hooks/metamask-notifications/useSwitchNotifications'; +import { useSwitchFeatureAnnouncementsChange } from '../../hooks/metamask-notifications/useSwitchNotifications'; import { Box, IconName, Text } from '../../components/component-library'; import { BlockSize, @@ -21,10 +18,7 @@ import { NotificationsSettingsBox, NotificationsSettingsType, } from '../../components/multichain'; -import { - selectIsSnapNotificationsEnabled, - selectIsFeatureAnnouncementsEnabled, -} from '../../selectors/metamask-notifications/metamask-notifications'; +import { selectIsFeatureAnnouncementsEnabled } from '../../selectors/metamask-notifications/metamask-notifications'; export function NotificationsSettingsTypes({ disabled, @@ -36,37 +30,20 @@ export function NotificationsSettingsTypes({ const { listNotifications } = useMetamaskNotificationsContext(); // Selectors - const isSnapNotificationsEnabled = useSelector( - selectIsSnapNotificationsEnabled, - ); const isFeatureAnnouncementsEnabled = useSelector( selectIsFeatureAnnouncementsEnabled, ); // Hooks - const { onChange: onChangeSnapNotifications, error: errorSnapNotifications } = - useSwitchSnapNotificationsChange(); const { onChange: onChangeFeatureAnnouncements, error: errorFeatureAnnouncements, } = useSwitchFeatureAnnouncementsChange(); // States - const [snapNotificationsEnabled, setSnapNotificationsEnabled] = - useState(isSnapNotificationsEnabled); const [featureAnnouncementsEnabled, setFeatureAnnouncementsEnabled] = useState(isFeatureAnnouncementsEnabled); - const onToggleSnapNotifications = async () => { - setSnapNotificationsEnabled(!snapNotificationsEnabled); - try { - onChangeSnapNotifications(!snapNotificationsEnabled); - listNotifications(); - } catch (error) { - setSnapNotificationsEnabled(snapNotificationsEnabled); - } - }; - const onToggleFeatureAnnouncements = async () => { setFeatureAnnouncementsEnabled(!featureAnnouncementsEnabled); try { @@ -103,16 +80,6 @@ export function NotificationsSettingsTypes({ paddingRight={8} paddingBottom={4} > - {/* Snap notifications */} - - - - {/* Product announcements */} { }; const useSnapNotifications = () => { - const isSnapNotificationsEnabled = useSelector( - selectIsSnapNotificationsEnabled, - ); - const snapNotifications = useSelector(getNotifications); const processedSnapNotifications: SnapNotification[] = useMemo(() => { - return isSnapNotificationsEnabled - ? processSnapNotifications(snapNotifications) - : []; - }, [isSnapNotificationsEnabled, snapNotifications]); + return processSnapNotifications(snapNotifications); + }, [snapNotifications]); return processedSnapNotifications; }; diff --git a/ui/selectors/metamask-notifications/metamask-notifications.test.ts b/ui/selectors/metamask-notifications/metamask-notifications.test.ts index 18a5282c7801..fce6d0cfdbeb 100644 --- a/ui/selectors/metamask-notifications/metamask-notifications.test.ts +++ b/ui/selectors/metamask-notifications/metamask-notifications.test.ts @@ -5,7 +5,6 @@ import { getMetamaskNotifications, getMetamaskNotificationsReadList, getMetamaskNotificationsUnreadCount, - selectIsSnapNotificationsEnabled, selectIsFeatureAnnouncementsEnabled, } from './metamask-notifications'; @@ -44,7 +43,6 @@ describe('Metamask Notifications Selectors', () => { isMetamaskNotificationsFeatureSeen: true, isMetamaskNotificationsEnabled: true, isFeatureAnnouncementsEnabled: true, - isSnapNotificationsEnabled: true, metamaskNotificationsList: mockNotifications, metamaskNotificationsReadList: [], isProfileSyncingUpdateLoading: false, @@ -80,10 +78,6 @@ describe('Metamask Notifications Selectors', () => { ); }); - it('should select the isSnapNotificationsEnabled state', () => { - expect(selectIsSnapNotificationsEnabled(mockState)).toBe(true); - }); - it('should select the isFeatureAnnouncementsEnabled state', () => { expect(selectIsFeatureAnnouncementsEnabled(mockState)).toBe(true); }); diff --git a/ui/selectors/metamask-notifications/metamask-notifications.ts b/ui/selectors/metamask-notifications/metamask-notifications.ts index af56d5502ac6..c26c2a7dfeae 100644 --- a/ui/selectors/metamask-notifications/metamask-notifications.ts +++ b/ui/selectors/metamask-notifications/metamask-notifications.ts @@ -123,25 +123,6 @@ export const selectIsMetamaskNotificationsEnabled = createSelector( (metamask) => metamask.isMetamaskNotificationsEnabled, ); -/** - * Selector to determine if Snap notifications are enabled. - * - * @param {AppState} state - The current state of the Redux store. - * @returns {boolean} Returns true if Snap notifications are enabled, false otherwise. - */ -export const selectIsSnapNotificationsEnabled = createSelector( - [getMetamask, selectIsMetamaskNotificationsEnabled], - (metamask, isMetamaskNotificationsEnabled) => { - // The snap enabled state is managed by the unified notifications controller. - // If this controller is not setup, use defaults (true) - if (!isMetamaskNotificationsEnabled) { - return true; - } - - return metamask.isSnapNotificationsEnabled; - }, -); - /** * Selector to determine if feature announcements are enabled. * diff --git a/ui/store/actions.test.js b/ui/store/actions.test.js index 9a6580974e96..7aa1e340bbb5 100644 --- a/ui/store/actions.test.js +++ b/ui/store/actions.test.js @@ -2551,48 +2551,6 @@ describe('Actions', () => { }); }); - describe('#setSnapNotificationsEnabled', () => { - afterEach(() => { - sinon.restore(); - }); - - it('calls setSnapNotificationsEnabled in the background with correct parameters', async () => { - const store = mockStore(); - const state = true; - - const setSnapNotificationsEnabledStub = sinon - .stub() - .callsFake((_, cb) => cb()); - - background.getApi.returns({ - setSnapNotificationsEnabled: setSnapNotificationsEnabledStub, - }); - setBackgroundConnection(background.getApi()); - - await store.dispatch(actions.setSnapNotificationsEnabled(state)); - expect(setSnapNotificationsEnabledStub.calledOnceWith(state)).toBe(true); - }); - - it('handles errors when setSnapNotificationsEnabled fails', async () => { - const store = mockStore(); - const state = false; - const error = new Error('Failed to set snap notifications enabled state'); - - const setSnapNotificationsEnabledStub = sinon - .stub() - .callsFake((_, cb) => cb(error)); - - background.getApi.returns({ - setSnapNotificationsEnabled: setSnapNotificationsEnabledStub, - }); - setBackgroundConnection(background.getApi()); - - await expect( - store.dispatch(actions.setSnapNotificationsEnabled(state)), - ).rejects.toThrow(error); - }); - }); - describe('#setFeatureAnnouncementsEnabled', () => { afterEach(() => { sinon.restore(); diff --git a/ui/store/actions.ts b/ui/store/actions.ts index 11b65eb5e5fd..c8a00ca7a5e1 100644 --- a/ui/store/actions.ts +++ b/ui/store/actions.ts @@ -5398,29 +5398,6 @@ export function markMetamaskNotificationsAsRead( }; } -/** - * Enables or disables Snap notifications. - * - * This function sends a request to the background script to toggle the enabled state of Snap notifications. - * Upon success, it dispatches an action with type `SET_SNAP_NOTIFICATIONS_ENABLED` to update the Redux state. - * If the operation encounters an error, it logs the error message and rethrows the error to ensure it is handled appropriately. - * - * @param state - A boolean indicating whether to enable (true) or disable (false) Snap notifications. - * @returns A thunk action that, when dispatched, attempts to set the enabled state of Snap notifications. - */ -export function setSnapNotificationsEnabled( - state: boolean, -): ThunkAction { - return async () => { - try { - await submitRequestToBackground('setSnapNotificationsEnabled', [state]); - } catch (error) { - logErrorWithMessage(error); - throw error; - } - }; -} - /** * Enables or disables feature announcements. *