Skip to content

Commit

Permalink
chore: revert 10266 (#10525)
Browse files Browse the repository at this point in the history
## **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>
  • Loading branch information
sethkfman and metamaskbot authored Aug 1, 2024
1 parent dc0cec4 commit 07b38e3
Show file tree
Hide file tree
Showing 19 changed files with 86 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,16 @@ const styleSheet = (_params: {
marginBottom: 20,
},
bannerSectionSmall: {
flexDirection: 'row',
alignItems: 'center',
marginTop: 10,
marginBottom: 10,
borderWidth: 1,
borderRadius: 4,
borderColor: _params.theme.colors.border.default,
marginTop: 20,
marginLeft: 10,
marginRight: 10,
marginBottom: 20,
padding: 10,
},
bannerSectionSmallSpaced: {
flexDirection: 'row',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,19 +201,16 @@ describe('BlockaidBanner', () => {
});

it('should render loader if reason is requestInProgress', async () => {
const wrapper = renderWithProvider(
<BlockaidBanner
securityAlertResponse={{
result_type: ResultType.RequestInProgress,
reason: Reason.requestInProgress,
}}
/>,
{
state: mockState,
},
);
const wrapper = renderWithProvider(<BlockaidBanner />, {
state: mockState,
});

expect(wrapper).toMatchSnapshot();
expect(
await wrapper.queryByText(
'We’re still evaluating the safety of this request. Wait or proceed with caution.',
),
).toBeDefined();
});

it('should not render if resultType is benign', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ import Accordion from '../../../../../component-library/components/Accordions/Ac
import { BannerAlertSeverity } from '../../../../../component-library/components/Banners/Banner';
import { DEFAULT_BANNERBASE_DESCRIPTION_TEXTVARIANT } from '../../../../../component-library/components/Banners/Banner/foundation/BannerBase/BannerBase.constants';
import BannerAlert from '../../../../../component-library/components/Banners/Banner/variants/BannerAlert/BannerAlert';
import {
IconName,
IconSize,
} from '../../../../../component-library/components/Icons/Icon';
import Icon from '../../../../../component-library/components/Icons/Icon/Icon';
import Text from '../../../../../component-library/components/Texts/Text/Text';
import { useStyles } from '../../../../../component-library/hooks/useStyles';
import { isBlockaidFeatureEnabled } from '../../../../../util/blockaid';
Expand All @@ -31,6 +36,9 @@ import {
} from '../../../../../constants/urls';
import { BLOCKAID_SUPPORTED_NETWORK_NAMES } from '../../../../../util/networks';
import BlockaidVersionInfo from '../../../../../lib/ppom/blockaid-version';
import ButtonIcon, {
ButtonIconSizes,
} from '../../../../../component-library/components/Buttons/ButtonIcon';
import { WALLET_CONNECT_ORIGIN } from '../../../../../util/walletconnect';
import AppConstants from '../../../../../core/AppConstants';

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

useEffect(() => {
if (securityAlertResponse?.reason === Reason.requestInProgress) {
setDisplayPositiveResponse(true);
}
}, [securityAlertResponse]);

useEffect(() => {
if (!securityAlertResponse) {
return;
Expand Down Expand Up @@ -102,15 +117,33 @@ const BlockaidBanner = (bannerProps: BlockaidBannerProps) => {

if (securityAlertResponse.reason === Reason.requestInProgress) {
return (
<ActivityIndicator
style={styles.bannerSectionSmall}
size="small"
color={theme.colors.warning.default}
/>
<View style={styles.bannerSectionSmall}>
<ActivityIndicator size="small" color={theme.colors.icon.default} />
<Text style={styles.infoText}>
{strings('blockaid_banner.loading_title')}
</Text>
</View>
);
}

if (result_type === ResultType.Benign) {
if (displayPositiveResponse) {
return (
<View style={styles.bannerSectionSmallSpaced}>
<View style={styles.flexRowSection}>
<Icon name={IconName.Info} size={IconSize.Lg} />
<Text style={styles.infoText}>
{strings('blockaid_banner.loading_complete_title')}
</Text>
</View>
<ButtonIcon
size={ButtonIconSizes.Sm}
onPress={() => setDisplayPositiveResponse(false)}
iconName={IconName.Close}
/>
</View>
);
}
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,19 +467,7 @@ exports[`BlockaidBanner should render correctly with reason "raw_signature_farmi
</View>
`;

exports[`BlockaidBanner should render loader if reason is requestInProgress 1`] = `
<ActivityIndicator
color="#bf5208"
size="small"
style={
{
"alignItems": "center",
"marginBottom": 10,
"marginTop": 10,
}
}
/>
`;
exports[`BlockaidBanner should render loader if reason is requestInProgress 1`] = `null`;

exports[`BlockaidBanner should render normal banner alert if resultType is failed 1`] = `
<View
Expand Down
2 changes: 2 additions & 0 deletions locales/languages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"deceptive_request_title": "Dies ist eine betrügerische Anfrage.",
"failed_title": "Anfrage ist möglicherweise nicht sicher",
"failed_description": "Aufgrund eines Fehlers wurde diese Anfrage vom Sicherheitsanbieter nicht überprüft. Gehen Sie mit Bedacht vor.",
"loading_title": "Suche nach Sicherheitsbenachrichtigungen ...",
"loading_complete_title": "Führen Sie immer Ihre eigene Due-Diligence-Prüfung durch, bevor Sie Anfragen genehmigen.",
"malicious_domain_description": "Sie haben es mit einer bösartigen Domain zu tun. Wenn Sie diese Anfrage genehmigen, könnten Sie Ihre Assets verlieren.",
"other_description": "Wenn Sie diese Anfrage genehmigen, könnten Sie Ihre Assets verlieren.",
"raw_signature_farming_description": "Wenn Sie diese Anfrage genehmigen, könnten Sie Ihre Assets verlieren.",
Expand Down
2 changes: 2 additions & 0 deletions locales/languages/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"deceptive_request_title": "Πρόκειται για παραπλανητικό αίτημα",
"failed_title": "Το αίτημα μπορεί να μην είναι ασφαλές",
"failed_description": "Λόγω σφάλματος, αυτό το αίτημα δεν επαληθεύτηκε από τον πάροχο ασφαλείας. Προχωρήστε με προσοχή.",
"loading_title": "Έλεγχος για ειδοποιήσεις ασφαλείας...",
"loading_complete_title": "Δεν λαβαμε ειδοποιήσεις. Κάνετε πάντα τη δική σας ενδελεχή έρευνα προτού εγκρίνετε τα αιτήματα.",
"malicious_domain_description": "Αλληλεπιδράτε με έναν κακόβουλο τομέα. Εάν εγκρίνετε αυτό το αίτημα, ενδέχεται να χάσετε τα περιουσιακά σας στοιχεία.",
"other_description": "Εάν εγκρίνετε αυτό το αίτημα, ενδέχεται να χάσετε τα περιουσιακά σας στοιχεία.",
"raw_signature_farming_description": "Εάν εγκρίνετε αυτό το αίτημα, ενδέχεται να χάσετε τα περιουσιακά σας στοιχεία.",
Expand Down
2 changes: 2 additions & 0 deletions locales/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"deceptive_request_title": "This is a deceptive request",
"failed_title": "Request may not be safe",
"failed_description": "Because of an error, this request was not verified by the security provider. Proceed with caution.",
"loading_title": "Checking for security alerts...",
"loading_complete_title": "No alerts received. Always do your own due diligence before approving requests.",
"malicious_domain_description": "You're interacting with a malicious domain. If you approve this request, you might lose your assets.",
"other_description": "If you approve this request, you might lose your assets.",
"raw_signature_farming_description": "If you approve this request, you might lose your assets.",
Expand Down
2 changes: 2 additions & 0 deletions locales/languages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"deceptive_request_title": "Esta es una solicitud engañosa",
"failed_title": "Es posible que la solicitud no sea segura",
"failed_description": "Debido a un error, el proveedor de seguridad no verificó esta solicitud. Proceda con precaución.",
"loading_title": "Comprobando alertas de seguridad...",
"loading_complete_title": "No se recibió ninguna. Siempre asegúrese de hacer su propia diligencia debida antes de aprobar cualquier solicitud.",
"malicious_domain_description": "Está interactuando con un dominio malicioso. Si aprueba esta solicitud, podría perder sus activos.",
"other_description": "Si aprueba esta solicitud, podría perder sus activos.",
"raw_signature_farming_description": "Si aprueba esta solicitud, podría perder sus activos.",
Expand Down
2 changes: 2 additions & 0 deletions locales/languages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"deceptive_request_title": "Cette demande est trompeuse",
"failed_title": "Cette demande peut présenter des risques",
"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.",
"loading_title": "En train de vérifier s’il y a des alertes de sécurité…",
"loading_complete_title": "Aucune alerte n’a été reçue. Faites toujours preuve de diligence raisonnable avant d’approuver les demandes.",
"malicious_domain_description": "Vous interagissez avec un domaine malveillant. Si vous approuvez cette demande, vous risquez de perdre vos actifs.",
"other_description": "Si vous approuvez cette demande, vous risquez de perdre vos actifs.",
"raw_signature_farming_description": "Si vous approuvez cette demande, vous risquez de perdre vos actifs.",
Expand Down
2 changes: 2 additions & 0 deletions locales/languages/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"deceptive_request_title": "इस अनुरोध को धोखेबाजी के उद्देश्य से भेजा गया है",
"failed_title": "हो सकता है कि अनुरोध सुरक्षित न हो",
"failed_description": "किसी गड़बड़ी के कारण, इस अनुरोध को सिक्यूरिटी प्रोवाइडर द्वारा सत्यापित नहीं किया गया। सावधानी से आगे बढ़ें।",
"loading_title": "सुरक्षा एलर्ट की जाँच की जा रही है...",
"loading_complete_title": "कोई एलर्ट प्राप्त नहीं हुआ। किसी भी अनुरोध को एप्रूव करने से पहले हमेशा पूरी जांच-पड़ताल ज़रूर करें।",
"malicious_domain_description": "आप एक बुरी नीयत वाले डोमेन से इंटरैक्ट कर रहे हैं। यदि आप इस रिक्वेस्ट को एप्रूव करते हैं, तो आप अपने सारे एसेट गंवा सकते हैं।",
"other_description": "यदि आप इस अनुरोध को एप्रूव करते हैं, तो आप अपने सारे एसेट गंवा सकते हैं।",
"raw_signature_farming_description": "यदि आप इस अनुरोध को एप्रूव करते हैं, तो आप अपने सारे एसेट गंवा सकते हैं।",
Expand Down
2 changes: 2 additions & 0 deletions locales/languages/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"deceptive_request_title": "Ini adalah permintaan tipuan",
"failed_title": "Permintaan mungkin tidak aman",
"failed_description": "Karena terjadi kesalahan, permintaan ini tidak diverifikasi oleh penyedia keamanan. Lanjutkan dengan hati-hati.",
"loading_title": "Memeriksa peringatan keamanan...",
"loading_complete_title": "Tidak menerima peringatan. Selalu lakukan uji tuntas sendiri sebelum menyetujui permintaan.",
"malicious_domain_description": "Anda berinteraksi dengan domain berbahaya. Jika Anda menyetujui permintaan ini, aset Anda kemungkinan akan hilang.",
"other_description": "Jika Anda menyetujui permintaan ini, aset Anda kemungkinan akan hilang.",
"raw_signature_farming_description": "Jika Anda menyetujui permintaan ini, aset Anda kemungkinan akan hilang.",
Expand Down
2 changes: 2 additions & 0 deletions locales/languages/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"deceptive_request_title": "これは虚偽のリクエストです",
"failed_title": "リクエストが安全でない可能性があります",
"failed_description": "エラーが発生したため、このリクエストはセキュリティプロバイダーにより確認されませんでした。慎重に進めてください。",
"loading_title": "セキュリティアラートを確認中...",
"loading_complete_title": "アラートはありません。要求を承認する前に、必ず独自のデューデリジェンスを行ってください。",
"malicious_domain_description": "悪質なドメインとやり取りしています。このリクエストを承認すると、資産を失う可能性があります。",
"other_description": "このリクエストを承認すると、資産を失う可能性があります。",
"raw_signature_farming_description": "このリクエストを承認すると、資産を失う可能性があります。",
Expand Down
2 changes: 2 additions & 0 deletions locales/languages/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"deceptive_request_title": "사기성 요청입니다",
"failed_title": "안전하지 않은 요청일 수 있습니다",
"failed_description": "오류로 인해 보안업체에서 이 요청을 확인하지 못했습니다. 주의하여 진행하세요.",
"loading_title": "보안 경고 확인하는 중...",
"loading_complete_title": "수신한 경고가 없습니다. 요청을 승인하기 전에 항상 직접 확인하세요.",
"malicious_domain_description": "악성 도메인과 인터렉션하고 있습니다. 이 요청을 승인하면 본인의 자산을 잃을 수도 있습니다.",
"other_description": "이 요청을 승인하면, 자산을 잃을 수 있습니다.",
"raw_signature_farming_description": "이 요청을 승인하면, 자산을 잃을 수 있습니다.",
Expand Down
2 changes: 2 additions & 0 deletions locales/languages/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"deceptive_request_title": "Essa solicitação é enganosa",
"failed_title": "A solicitação pode não ser segura",
"failed_description": "Em razão de um erro, essa solicitação não foi confirmada pelo provedor de segurança. Prossiga com cautela.",
"loading_title": "Verificando se há alertas de segurança...",
"loading_complete_title": "Nenhum alerta recebido. Sempre faça sua própria devida diligência antes de aprovar solicitações.",
"malicious_domain_description": "Você está interagindo com um domínio mal-intencionado. Se você aprovar essa solicitação, poderá perder seus ativos.",
"other_description": "Se você aprovar essa solicitação, poderá perder seus ativos.",
"raw_signature_farming_description": "Se você aprovar essa solicitação, poderá perder seus ativos.",
Expand Down
2 changes: 2 additions & 0 deletions locales/languages/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"deceptive_request_title": "Это запрос с целью обмана",
"failed_title": "Запрос может быть небезопасным",
"failed_description": "Из-за ошибки этот запрос не был подтвержден поставщиком услуг безопасности. Действуйте осторожно.",
"loading_title": "Проверка оповещений безопасности...",
"loading_complete_title": "Оповещения не получены. Всегда проводите собственную комплексную проверку перед утверждением запросов.",
"malicious_domain_description": "Вы взаимодействуете с вредоносным доменом. Если вы одобрите этот запрос, вы можете потерять свои активы.",
"other_description": "Если вы одобрите этот запрос, вы можете потерять свои активы.",
"raw_signature_farming_description": "Если вы одобрите этот запрос, вы можете потерять свои активы.",
Expand Down
2 changes: 2 additions & 0 deletions locales/languages/tl.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"deceptive_request_title": "Isa itong mapanlinlang na kahilingan",
"failed_title": "Baka hindi ligtas ang kahilingan",
"failed_description": "Dahil sa pagkakamali, ang kahilingang ito ay hindi na-verify ng tagapaglaan ng seguridad. Magpatuloy nang may pag-iingat.",
"loading_title": "Sinusuri ang mga alertong pangseguridad...",
"loading_complete_title": "Walang alerto na natanggap. Palaging gumawa ng sarili mong pagsusuri bago aprubahan ang mga kahilingan.",
"malicious_domain_description": "Nakikipag-ugnayan ka sa isang mapaminsalang domain. Kung aaprubahan mo ang kahilingang ito, posibleng mawala sa iyo ang mga asset mo.",
"other_description": "Kung aaprubahan mo ang kahilingang ito, posibleng mawala sa iyo ang mga asset mo.",
"raw_signature_farming_description": "Kung aaprubahan mo ang kahilingang ito, posibleng mawala sa iyo ang mga asset mo.",
Expand Down
2 changes: 2 additions & 0 deletions locales/languages/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"deceptive_request_title": "Bu, aldatıcı bir taleptir",
"failed_title": "Talep güvenli olmayabilir",
"failed_description": "Bu talep bir hatadan dolayı güvenlik sağlayıcısı tarafından doğrulanmadı. Dikkatli bir şekilde ilerleyin.",
"loading_title": "Güvenlik uyarıları kontrol ediliyor...",
"loading_complete_title": "Herhangi bir uyarı alınmadı. Talepleri onaylamadan önce kendiniz her zaman gerekli özeni gösterin.",
"malicious_domain_description": "Kötü niyetli bir alanla etkileşimde bulunuyorsunuz. Bu talebi onaylarsanız varlıklarınızı kaybedebilirsiniz.",
"other_description": "Bu talebi onaylarsanız varlıklarınızı kaybedebilirsiniz.",
"raw_signature_farming_description": "Bu talebi onaylarsanız varlıklarınızı kaybedebilirsiniz.",
Expand Down
2 changes: 2 additions & 0 deletions locales/languages/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"deceptive_request_title": "Đây là một yêu cầu lừa đảo",
"failed_title": "Yêu cầu có thể không an toàn",
"failed_description": "Do có lỗi, yêu cầu này đã không được nhà cung cấp dịch vụ bảo mật xác minh. Hãy thực hiện cẩn thận.",
"loading_title": "Đang kiểm tra cảnh báo bảo mật...",
"loading_complete_title": "Không nhận được cảnh báo nào. Luôn tự thẩm định trước khi chấp thuận các yêu cầu.",
"malicious_domain_description": "Bạn đang tương tác với một tên miền độc hại. Nếu bạn chấp thuận yêu cầu này, bạn có thể mất tài sản của mình.",
"other_description": "Nếu bạn chấp thuận yêu cầu này, bạn có thể mất tài sản của mình.",
"raw_signature_farming_description": "Nếu bạn chấp thuận yêu cầu này, bạn có thể mất tài sản của mình.",
Expand Down
2 changes: 2 additions & 0 deletions locales/languages/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"deceptive_request_title": "此请求属欺骗性质",
"failed_title": "此请求可能不安全",
"failed_description": "由于出现错误,安全服务提供商未验证此请求。请谨慎操作。",
"loading_title": "正在检查安全提醒......",
"loading_complete_title": "未收到提醒。在批准请求之前,请务必自行作出审慎调查。",
"malicious_domain_description": "您正在与恶意网域交互。如果您批准此请求,可能会遭受资产损失。",
"other_description": "如果您批准此请求,可能会遭受资产损失。",
"raw_signature_farming_description": "如果您批准此请求,可能会有资产损失。",
Expand Down

0 comments on commit 07b38e3

Please sign in to comment.