From 9e63a9a449985224246096b84ade68d1f05f8f14 Mon Sep 17 00:00:00 2001 From: ryanml Date: Thu, 14 Jul 2022 11:08:32 -0700 Subject: [PATCH] Adding "What's New" Notification for Add Popular networks (#15121) * Adding "What's New" Notification for Add Popular networks * Adding action text to notification * Addressing review feedback * Flag removal --- app/_locales/en/messages.json | 10 ++++++++++ shared/notifications/index.js | 13 +++++++++++++ test/e2e/fixtures/address-entry/state.json | 3 +++ test/e2e/fixtures/connected-state/state.json | 3 +++ test/e2e/fixtures/custom-rpc/state.json | 3 +++ test/e2e/fixtures/custom-token/state.json | 3 +++ test/e2e/fixtures/eip-1559-v2-dapp/state.json | 3 +++ test/e2e/fixtures/eip-1559-v2/state.json | 3 +++ test/e2e/fixtures/import-ui/state.json | 3 +++ test/e2e/fixtures/imported-account/state.json | 3 +++ test/e2e/fixtures/localization/state.json | 3 +++ test/e2e/fixtures/metrics-enabled/state.json | 3 +++ test/e2e/fixtures/navigate-transactions/state.json | 3 +++ test/e2e/fixtures/onboarding/state.json | 3 +++ test/e2e/fixtures/send-edit-v2/state.json | 3 +++ test/e2e/fixtures/send-edit/state.json | 3 +++ test/e2e/fixtures/special-settings/state.json | 3 +++ test/e2e/fixtures/threebox-enabled/state.json | 3 +++ .../app/whats-new-popup/whats-new-popup.js | 4 ++++ ui/selectors/selectors.js | 1 + 20 files changed, 76 insertions(+) diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 4e3a7ec46..bab52e11f 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -2190,6 +2190,16 @@ "notifications12Title": { "message": "Wen dark mode? Now dark mode! 🕶️🦊" }, + "notifications13ActionText": { + "message": "Show custom network list" + }, + "notifications13Description": { + "message": "You can now add the following popular custom networks easily: Arbitrum, Avalanche, Binance Smart Chain, Fantom, Harmony, Optimism, Palm and Polygon! To enable this feature, go to Settings -> Experimental and turn \"Show custom network list\" on!", + "description": "Description of a notification in the 'See What's New' popup. Describes popular network feature." + }, + "notifications13Title": { + "message": "Add Popular Networks" + }, "notifications1Description": { "message": "MetaMask Mobile users can now swap tokens inside their mobile wallet. Scan the QR code to get the mobile app and start swapping.", "description": "Description of a notification in the 'See What's New' popup. Describes the swapping on mobile feature." diff --git a/shared/notifications/index.js b/shared/notifications/index.js index 65fc49fde..55ab28b3d 100644 --- a/shared/notifications/index.js +++ b/shared/notifications/index.js @@ -66,6 +66,10 @@ export const UI_NOTIFICATIONS = { width: '100%', }, }, + 13: { + id: 13, + date: '2022-07-12', + }, }; export const getTranslatedUINoficiations = (t, locale) => { @@ -182,5 +186,14 @@ export const getTranslatedUINoficiations = (t, locale) => { new Date(UI_NOTIFICATIONS[12].date), ), }, + 13: { + ...UI_NOTIFICATIONS[13], + title: t('notifications13Title'), + description: t('notifications13Description'), + actionText: t('notifications13ActionText'), + date: new Intl.DateTimeFormat(formattedLocale).format( + new Date(UI_NOTIFICATIONS[13].date), + ), + }, }; }; diff --git a/test/e2e/fixtures/address-entry/state.json b/test/e2e/fixtures/address-entry/state.json index 96b17cdb1..1ce7f2d95 100644 --- a/test/e2e/fixtures/address-entry/state.json +++ b/test/e2e/fixtures/address-entry/state.json @@ -69,6 +69,9 @@ }, "12": { "isShown": true + }, + "13": { + "isShown": true } } }, diff --git a/test/e2e/fixtures/connected-state/state.json b/test/e2e/fixtures/connected-state/state.json index 4d48df472..11af1d9b2 100644 --- a/test/e2e/fixtures/connected-state/state.json +++ b/test/e2e/fixtures/connected-state/state.json @@ -59,6 +59,9 @@ }, "12": { "isShown": true + }, + "13": { + "isShown": true } } }, diff --git a/test/e2e/fixtures/custom-rpc/state.json b/test/e2e/fixtures/custom-rpc/state.json index 222eb0159..02cc6d5f8 100644 --- a/test/e2e/fixtures/custom-rpc/state.json +++ b/test/e2e/fixtures/custom-rpc/state.json @@ -55,6 +55,9 @@ }, "12": { "isShown": true + }, + "13": { + "isShown": true } } }, diff --git a/test/e2e/fixtures/custom-token/state.json b/test/e2e/fixtures/custom-token/state.json index ae1fcd1b4..baf7c2984 100644 --- a/test/e2e/fixtures/custom-token/state.json +++ b/test/e2e/fixtures/custom-token/state.json @@ -73,6 +73,9 @@ }, "12": { "isShown": true + }, + "13": { + "isShown": true } } }, diff --git a/test/e2e/fixtures/eip-1559-v2-dapp/state.json b/test/e2e/fixtures/eip-1559-v2-dapp/state.json index 839484240..dc889b1e5 100644 --- a/test/e2e/fixtures/eip-1559-v2-dapp/state.json +++ b/test/e2e/fixtures/eip-1559-v2-dapp/state.json @@ -56,6 +56,9 @@ }, "12": { "isShown": true + }, + "13": { + "isShown": true } } }, diff --git a/test/e2e/fixtures/eip-1559-v2/state.json b/test/e2e/fixtures/eip-1559-v2/state.json index 0c79d8c61..6ac0aa7ad 100644 --- a/test/e2e/fixtures/eip-1559-v2/state.json +++ b/test/e2e/fixtures/eip-1559-v2/state.json @@ -56,6 +56,9 @@ }, "12": { "isShown": true + }, + "13": { + "isShown": true } } }, diff --git a/test/e2e/fixtures/import-ui/state.json b/test/e2e/fixtures/import-ui/state.json index 20c6bf87c..c5f3da004 100644 --- a/test/e2e/fixtures/import-ui/state.json +++ b/test/e2e/fixtures/import-ui/state.json @@ -110,6 +110,9 @@ }, "12": { "isShown": true + }, + "13": { + "isShown": true } } }, diff --git a/test/e2e/fixtures/imported-account/state.json b/test/e2e/fixtures/imported-account/state.json index cb5c96950..7a79d293b 100644 --- a/test/e2e/fixtures/imported-account/state.json +++ b/test/e2e/fixtures/imported-account/state.json @@ -55,6 +55,9 @@ }, "12": { "isShown": true + }, + "13": { + "isShown": true } } }, diff --git a/test/e2e/fixtures/localization/state.json b/test/e2e/fixtures/localization/state.json index 4b32460b5..45d09cf57 100644 --- a/test/e2e/fixtures/localization/state.json +++ b/test/e2e/fixtures/localization/state.json @@ -55,6 +55,9 @@ }, "12": { "isShown": true + }, + "13": { + "isShown": true } } }, diff --git a/test/e2e/fixtures/metrics-enabled/state.json b/test/e2e/fixtures/metrics-enabled/state.json index 43b345204..58c7c5109 100644 --- a/test/e2e/fixtures/metrics-enabled/state.json +++ b/test/e2e/fixtures/metrics-enabled/state.json @@ -59,6 +59,9 @@ }, "12": { "isShown": true + }, + "13": { + "isShown": true } } }, diff --git a/test/e2e/fixtures/navigate-transactions/state.json b/test/e2e/fixtures/navigate-transactions/state.json index 1613c7f58..e5774eed6 100644 --- a/test/e2e/fixtures/navigate-transactions/state.json +++ b/test/e2e/fixtures/navigate-transactions/state.json @@ -55,6 +55,9 @@ }, "12": { "isShown": true + }, + "13": { + "isShown": true } } }, diff --git a/test/e2e/fixtures/onboarding/state.json b/test/e2e/fixtures/onboarding/state.json index 6a4c94b96..06582c443 100644 --- a/test/e2e/fixtures/onboarding/state.json +++ b/test/e2e/fixtures/onboarding/state.json @@ -30,6 +30,9 @@ "notifications": { "12": { "isShown": true + }, + "13": { + "isShown": true } } }, diff --git a/test/e2e/fixtures/send-edit-v2/state.json b/test/e2e/fixtures/send-edit-v2/state.json index 9de073c00..90a8dc1d9 100644 --- a/test/e2e/fixtures/send-edit-v2/state.json +++ b/test/e2e/fixtures/send-edit-v2/state.json @@ -56,6 +56,9 @@ }, "12": { "isShown": true + }, + "13": { + "isShown": true } } }, diff --git a/test/e2e/fixtures/send-edit/state.json b/test/e2e/fixtures/send-edit/state.json index 1272fbd04..19dc61b39 100644 --- a/test/e2e/fixtures/send-edit/state.json +++ b/test/e2e/fixtures/send-edit/state.json @@ -56,6 +56,9 @@ }, "12": { "isShown": true + }, + "13": { + "isShown": true } } }, diff --git a/test/e2e/fixtures/special-settings/state.json b/test/e2e/fixtures/special-settings/state.json index 6163d7621..8b66b9155 100644 --- a/test/e2e/fixtures/special-settings/state.json +++ b/test/e2e/fixtures/special-settings/state.json @@ -55,6 +55,9 @@ }, "12": { "isShown": true + }, + "13": { + "isShown": true } } }, diff --git a/test/e2e/fixtures/threebox-enabled/state.json b/test/e2e/fixtures/threebox-enabled/state.json index 78b6f1226..549ddb635 100644 --- a/test/e2e/fixtures/threebox-enabled/state.json +++ b/test/e2e/fixtures/threebox-enabled/state.json @@ -66,6 +66,9 @@ }, "12": { "isShown": true + }, + "13": { + "isShown": true } } }, diff --git a/ui/components/app/whats-new-popup/whats-new-popup.js b/ui/components/app/whats-new-popup/whats-new-popup.js index 59b171102..ffee9c8cf 100644 --- a/ui/components/app/whats-new-popup/whats-new-popup.js +++ b/ui/components/app/whats-new-popup/whats-new-popup.js @@ -54,6 +54,10 @@ function getActionFunctionById(id, history) { updateViewedNotifications({ 12: true }); history.push(EXPERIMENTAL_ROUTE); }, + 13: () => { + updateViewedNotifications({ 13: true }); + history.push(`${EXPERIMENTAL_ROUTE}#show-custom-network`); + }, }; return actionFunctions[id]; diff --git a/ui/selectors/selectors.js b/ui/selectors/selectors.js index 5256c3756..f338813a9 100644 --- a/ui/selectors/selectors.js +++ b/ui/selectors/selectors.js @@ -826,6 +826,7 @@ function getAllowedAnnouncementIds(state) { 10: Boolean(process.env.TOKEN_DETECTION_V2) && !process.env.IN_TEST, 11: Boolean(process.env.TOKEN_DETECTION_V2) && !process.env.IN_TEST, 12: true, + 13: true, }; }