diff --git a/app/actions/notification/constants/index.ts b/app/actions/notification/constants/index.ts index f84e48a5142..c75c9eb0082 100644 --- a/app/actions/notification/constants/index.ts +++ b/app/actions/notification/constants/index.ts @@ -8,6 +8,7 @@ export enum notificationsErrors { CHECK_ACCOUNTS_PRESENCE = 'Error while trying to check accounts presence', DELETE_ON_CHAIN_TRIGGERS_BY_ACCOUNT = 'Error while trying to delete on chain triggers by account', UPDATE_ON_CHAIN_TRIGGERS_BY_ACCOUNT = 'Error while trying to update on chain triggers by account', + CREATE_ON_CHAIN_TRIGGERS_BY_ACCOUNT = 'Error while trying to create on chain triggers by account', SET_FEATURE_ANNOUNCEMENTS_ENABLED = 'Error while trying to set feature announcements enabled', SET_SNAP_NOTIFICATIONS_ENABLED = 'Error while trying to set snap notifications enabled', SET_METAMASK_NOTIFICATIONS_FEATURE_SEEN = 'Error while trying to set metamask notifications feature seen', diff --git a/app/actions/notification/helpers/index.ts b/app/actions/notification/helpers/index.ts index b613ca97691..0cd827ad3ef 100644 --- a/app/actions/notification/helpers/index.ts +++ b/app/actions/notification/helpers/index.ts @@ -113,6 +113,27 @@ export const updateOnChainTriggersByAccount = async (accounts: string[]) => { } }; +export const createOnChainTriggersByAccount = async ( + resetNotifications: boolean, +) => { + try { + const { userStorage } = + await Engine.context.NotificationServicesController.createOnChainTriggers( + { + resetNotifications, + }, + ); + + if (!userStorage) { + return getErrorMessage( + notificationsErrors.CREATE_ON_CHAIN_TRIGGERS_BY_ACCOUNT, + ); + } + } catch (error) { + return getErrorMessage(error); + } +}; + export const setFeatureAnnouncementsEnabled = async ( featureAnnouncementsEnabled: boolean, ) => { diff --git a/app/component-library/components/Buttons/Button/foundation/ButtonBase/ButtonBase.types.ts b/app/component-library/components/Buttons/Button/foundation/ButtonBase/ButtonBase.types.ts index 9d6ca4472fe..6b0fb32ca7e 100644 --- a/app/component-library/components/Buttons/Button/foundation/ButtonBase/ButtonBase.types.ts +++ b/app/component-library/components/Buttons/Button/foundation/ButtonBase/ButtonBase.types.ts @@ -51,6 +51,10 @@ export interface ButtonBaseProps extends TouchableOpacityProps { * Optional param to disable the button. */ isDisabled?: boolean; + /** + * An optional loading state of Button. + */ + loading?: boolean; } /** diff --git a/app/component-library/components/Buttons/Button/variants/ButtonPrimary/ButtonPrimary.tsx b/app/component-library/components/Buttons/Button/variants/ButtonPrimary/ButtonPrimary.tsx index d660b3a35b1..c402bd98bd8 100644 --- a/app/component-library/components/Buttons/Button/variants/ButtonPrimary/ButtonPrimary.tsx +++ b/app/component-library/components/Buttons/Button/variants/ButtonPrimary/ButtonPrimary.tsx @@ -2,7 +2,7 @@ // Third party dependencies. import React, { useCallback, useState } from 'react'; -import { GestureResponderEvent } from 'react-native'; +import { ActivityIndicator, GestureResponderEvent } from 'react-native'; // External dependencies. import { useStyles } from '../../../../../hooks'; @@ -60,10 +60,14 @@ const ButtonPrimary = ({ label ); + const renderLoading = () => ( + + ); + return (