Skip to content

Commit 07b38e3

Browse files
chore: revert 10266 (#10525)
## **Description** chore: revert 10266 ## **Related issues** Fixes: #10266 ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. Co-authored-by: metamaskbot <metamaskbot@users.noreply.github.com>
1 parent dc0cec4 commit 07b38e3

File tree

19 files changed

+86
-31
lines changed

19 files changed

+86
-31
lines changed

app/components/Views/confirmations/components/BlockaidBanner/BlockaidBanner.styles.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,16 @@ const styleSheet = (_params: {
3636
marginBottom: 20,
3737
},
3838
bannerSectionSmall: {
39+
flexDirection: 'row',
3940
alignItems: 'center',
40-
marginTop: 10,
41-
marginBottom: 10,
41+
borderWidth: 1,
42+
borderRadius: 4,
43+
borderColor: _params.theme.colors.border.default,
44+
marginTop: 20,
45+
marginLeft: 10,
46+
marginRight: 10,
47+
marginBottom: 20,
48+
padding: 10,
4249
},
4350
bannerSectionSmallSpaced: {
4451
flexDirection: 'row',

app/components/Views/confirmations/components/BlockaidBanner/BlockaidBanner.test.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -201,19 +201,16 @@ describe('BlockaidBanner', () => {
201201
});
202202

203203
it('should render loader if reason is requestInProgress', async () => {
204-
const wrapper = renderWithProvider(
205-
<BlockaidBanner
206-
securityAlertResponse={{
207-
result_type: ResultType.RequestInProgress,
208-
reason: Reason.requestInProgress,
209-
}}
210-
/>,
211-
{
212-
state: mockState,
213-
},
214-
);
204+
const wrapper = renderWithProvider(<BlockaidBanner />, {
205+
state: mockState,
206+
});
215207

216208
expect(wrapper).toMatchSnapshot();
209+
expect(
210+
await wrapper.queryByText(
211+
'We’re still evaluating the safety of this request. Wait or proceed with caution.',
212+
),
213+
).toBeDefined();
217214
});
218215

219216
it('should not render if resultType is benign', async () => {

app/components/Views/confirmations/components/BlockaidBanner/BlockaidBanner.tsx

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ import Accordion from '../../../../../component-library/components/Accordions/Ac
1010
import { BannerAlertSeverity } from '../../../../../component-library/components/Banners/Banner';
1111
import { DEFAULT_BANNERBASE_DESCRIPTION_TEXTVARIANT } from '../../../../../component-library/components/Banners/Banner/foundation/BannerBase/BannerBase.constants';
1212
import BannerAlert from '../../../../../component-library/components/Banners/Banner/variants/BannerAlert/BannerAlert';
13+
import {
14+
IconName,
15+
IconSize,
16+
} from '../../../../../component-library/components/Icons/Icon';
17+
import Icon from '../../../../../component-library/components/Icons/Icon/Icon';
1318
import Text from '../../../../../component-library/components/Texts/Text/Text';
1419
import { useStyles } from '../../../../../component-library/hooks/useStyles';
1520
import { isBlockaidFeatureEnabled } from '../../../../../util/blockaid';
@@ -31,6 +36,9 @@ import {
3136
} from '../../../../../constants/urls';
3237
import { BLOCKAID_SUPPORTED_NETWORK_NAMES } from '../../../../../util/networks';
3338
import BlockaidVersionInfo from '../../../../../lib/ppom/blockaid-version';
39+
import ButtonIcon, {
40+
ButtonIconSizes,
41+
} from '../../../../../component-library/components/Buttons/ButtonIcon';
3442
import { WALLET_CONNECT_ORIGIN } from '../../../../../util/walletconnect';
3543
import AppConstants from '../../../../../core/AppConstants';
3644

@@ -59,8 +67,15 @@ const BlockaidBanner = (bannerProps: BlockaidBannerProps) => {
5967
onContactUsClicked,
6068
} = bannerProps;
6169
const { styles, theme } = useStyles(styleSheet, { style });
70+
const [displayPositiveResponse, setDisplayPositiveResponse] = useState(false);
6271
const [reportUrl, setReportUrl] = useState<string>('');
6372

73+
useEffect(() => {
74+
if (securityAlertResponse?.reason === Reason.requestInProgress) {
75+
setDisplayPositiveResponse(true);
76+
}
77+
}, [securityAlertResponse]);
78+
6479
useEffect(() => {
6580
if (!securityAlertResponse) {
6681
return;
@@ -102,15 +117,33 @@ const BlockaidBanner = (bannerProps: BlockaidBannerProps) => {
102117

103118
if (securityAlertResponse.reason === Reason.requestInProgress) {
104119
return (
105-
<ActivityIndicator
106-
style={styles.bannerSectionSmall}
107-
size="small"
108-
color={theme.colors.warning.default}
109-
/>
120+
<View style={styles.bannerSectionSmall}>
121+
<ActivityIndicator size="small" color={theme.colors.icon.default} />
122+
<Text style={styles.infoText}>
123+
{strings('blockaid_banner.loading_title')}
124+
</Text>
125+
</View>
110126
);
111127
}
112128

113129
if (result_type === ResultType.Benign) {
130+
if (displayPositiveResponse) {
131+
return (
132+
<View style={styles.bannerSectionSmallSpaced}>
133+
<View style={styles.flexRowSection}>
134+
<Icon name={IconName.Info} size={IconSize.Lg} />
135+
<Text style={styles.infoText}>
136+
{strings('blockaid_banner.loading_complete_title')}
137+
</Text>
138+
</View>
139+
<ButtonIcon
140+
size={ButtonIconSizes.Sm}
141+
onPress={() => setDisplayPositiveResponse(false)}
142+
iconName={IconName.Close}
143+
/>
144+
</View>
145+
);
146+
}
114147
return null;
115148
}
116149

app/components/Views/confirmations/components/BlockaidBanner/__snapshots__/BlockaidBanner.test.tsx.snap

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -467,19 +467,7 @@ exports[`BlockaidBanner should render correctly with reason "raw_signature_farmi
467467
</View>
468468
`;
469469

470-
exports[`BlockaidBanner should render loader if reason is requestInProgress 1`] = `
471-
<ActivityIndicator
472-
color="#bf5208"
473-
size="small"
474-
style={
475-
{
476-
"alignItems": "center",
477-
"marginBottom": 10,
478-
"marginTop": 10,
479-
}
480-
}
481-
/>
482-
`;
470+
exports[`BlockaidBanner should render loader if reason is requestInProgress 1`] = `null`;
483471

484472
exports[`BlockaidBanner should render normal banner alert if resultType is failed 1`] = `
485473
<View

locales/languages/de.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"deceptive_request_title": "Dies ist eine betrügerische Anfrage.",
66
"failed_title": "Anfrage ist möglicherweise nicht sicher",
77
"failed_description": "Aufgrund eines Fehlers wurde diese Anfrage vom Sicherheitsanbieter nicht überprüft. Gehen Sie mit Bedacht vor.",
8+
"loading_title": "Suche nach Sicherheitsbenachrichtigungen ...",
9+
"loading_complete_title": "Führen Sie immer Ihre eigene Due-Diligence-Prüfung durch, bevor Sie Anfragen genehmigen.",
810
"malicious_domain_description": "Sie haben es mit einer bösartigen Domain zu tun. Wenn Sie diese Anfrage genehmigen, könnten Sie Ihre Assets verlieren.",
911
"other_description": "Wenn Sie diese Anfrage genehmigen, könnten Sie Ihre Assets verlieren.",
1012
"raw_signature_farming_description": "Wenn Sie diese Anfrage genehmigen, könnten Sie Ihre Assets verlieren.",

locales/languages/el.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"deceptive_request_title": "Πρόκειται για παραπλανητικό αίτημα",
66
"failed_title": "Το αίτημα μπορεί να μην είναι ασφαλές",
77
"failed_description": "Λόγω σφάλματος, αυτό το αίτημα δεν επαληθεύτηκε από τον πάροχο ασφαλείας. Προχωρήστε με προσοχή.",
8+
"loading_title": "Έλεγχος για ειδοποιήσεις ασφαλείας...",
9+
"loading_complete_title": "Δεν λαβαμε ειδοποιήσεις. Κάνετε πάντα τη δική σας ενδελεχή έρευνα προτού εγκρίνετε τα αιτήματα.",
810
"malicious_domain_description": "Αλληλεπιδράτε με έναν κακόβουλο τομέα. Εάν εγκρίνετε αυτό το αίτημα, ενδέχεται να χάσετε τα περιουσιακά σας στοιχεία.",
911
"other_description": "Εάν εγκρίνετε αυτό το αίτημα, ενδέχεται να χάσετε τα περιουσιακά σας στοιχεία.",
1012
"raw_signature_farming_description": "Εάν εγκρίνετε αυτό το αίτημα, ενδέχεται να χάσετε τα περιουσιακά σας στοιχεία.",

locales/languages/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"deceptive_request_title": "This is a deceptive request",
66
"failed_title": "Request may not be safe",
77
"failed_description": "Because of an error, this request was not verified by the security provider. Proceed with caution.",
8+
"loading_title": "Checking for security alerts...",
9+
"loading_complete_title": "No alerts received. Always do your own due diligence before approving requests.",
810
"malicious_domain_description": "You're interacting with a malicious domain. If you approve this request, you might lose your assets.",
911
"other_description": "If you approve this request, you might lose your assets.",
1012
"raw_signature_farming_description": "If you approve this request, you might lose your assets.",

locales/languages/es.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"deceptive_request_title": "Esta es una solicitud engañosa",
66
"failed_title": "Es posible que la solicitud no sea segura",
77
"failed_description": "Debido a un error, el proveedor de seguridad no verificó esta solicitud. Proceda con precaución.",
8+
"loading_title": "Comprobando alertas de seguridad...",
9+
"loading_complete_title": "No se recibió ninguna. Siempre asegúrese de hacer su propia diligencia debida antes de aprobar cualquier solicitud.",
810
"malicious_domain_description": "Está interactuando con un dominio malicioso. Si aprueba esta solicitud, podría perder sus activos.",
911
"other_description": "Si aprueba esta solicitud, podría perder sus activos.",
1012
"raw_signature_farming_description": "Si aprueba esta solicitud, podría perder sus activos.",

locales/languages/fr.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"deceptive_request_title": "Cette demande est trompeuse",
66
"failed_title": "Cette demande peut présenter des risques",
77
"failed_description": "À cause d’une erreur, cette demande n’a pas été vérifiée par le fournisseur de services de sécurité. Veuillez agir avec prudence.",
8+
"loading_title": "En train de vérifier s’il y a des alertes de sécurité…",
9+
"loading_complete_title": "Aucune alerte n’a été reçue. Faites toujours preuve de diligence raisonnable avant d’approuver les demandes.",
810
"malicious_domain_description": "Vous interagissez avec un domaine malveillant. Si vous approuvez cette demande, vous risquez de perdre vos actifs.",
911
"other_description": "Si vous approuvez cette demande, vous risquez de perdre vos actifs.",
1012
"raw_signature_farming_description": "Si vous approuvez cette demande, vous risquez de perdre vos actifs.",

locales/languages/hi.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"deceptive_request_title": "इस अनुरोध को धोखेबाजी के उद्देश्य से भेजा गया है",
66
"failed_title": "हो सकता है कि अनुरोध सुरक्षित न हो",
77
"failed_description": "किसी गड़बड़ी के कारण, इस अनुरोध को सिक्यूरिटी प्रोवाइडर द्वारा सत्यापित नहीं किया गया। सावधानी से आगे बढ़ें।",
8+
"loading_title": "सुरक्षा एलर्ट की जाँच की जा रही है...",
9+
"loading_complete_title": "कोई एलर्ट प्राप्त नहीं हुआ। किसी भी अनुरोध को एप्रूव करने से पहले हमेशा पूरी जांच-पड़ताल ज़रूर करें।",
810
"malicious_domain_description": "आप एक बुरी नीयत वाले डोमेन से इंटरैक्ट कर रहे हैं। यदि आप इस रिक्वेस्ट को एप्रूव करते हैं, तो आप अपने सारे एसेट गंवा सकते हैं।",
911
"other_description": "यदि आप इस अनुरोध को एप्रूव करते हैं, तो आप अपने सारे एसेट गंवा सकते हैं।",
1012
"raw_signature_farming_description": "यदि आप इस अनुरोध को एप्रूव करते हैं, तो आप अपने सारे एसेट गंवा सकते हैं।",

0 commit comments

Comments
 (0)