mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
[FLASK] Fix key management permission copy (#14849)
This commit is contained in:
parent
fc304680d4
commit
9ce4a8f987
4
app/_locales/de/messages.json
generated
4
app/_locales/de/messages.json
generated
@ -2989,10 +2989,6 @@
|
|||||||
"snapInstallWarningCheck": {
|
"snapInstallWarningCheck": {
|
||||||
"message": "Um zu bestätigen, dass Sie alles verstanden haben, kreuzen Sie alles an."
|
"message": "Um zu bestätigen, dass Sie alles verstanden haben, kreuzen Sie alles an."
|
||||||
},
|
},
|
||||||
"snapInstallWarningKeyAccess": {
|
|
||||||
"message": "Sie gewähren dem Snap „$1“ wichtige Zugriffsrechte. Dies kann nicht rückgängig gemacht werden und gibt „$1“ Kontrolle über Ihre Konten und Vermögenswerte. Stellen Sie sicher, dass Sie „$1“ vertrauen, bevor Sie fortfahren.",
|
|
||||||
"description": "The parameter is the name of the snap"
|
|
||||||
},
|
|
||||||
"snapRequestsPermission": {
|
"snapRequestsPermission": {
|
||||||
"message": "Für diesen Snap werden die folgenden Berechtigungen beantragt:"
|
"message": "Für diesen Snap werden die folgenden Berechtigungen beantragt:"
|
||||||
},
|
},
|
||||||
|
6
app/_locales/el/messages.json
generated
6
app/_locales/el/messages.json
generated
@ -2998,7 +2998,7 @@
|
|||||||
"message": "Υπογραφή"
|
"message": "Υπογραφή"
|
||||||
},
|
},
|
||||||
"signNotice": {
|
"signNotice": {
|
||||||
"message": "Η υπογραφή αυτού του μηνύματος μπορεί να έχει\nεπικίνδυνες παρενέργειες. Υπογράφετε μηνύματα μόνο από\nτοποθεσίες που εμπιστεύεστε πλήρως με ολόκληρο τον λογαριασμό σας.\n Αυτή η επικίνδυνη μέθοδος θα καταργηθεί σε μια μελλοντική έκδοση."
|
"message": "Η υπογραφή αυτού του μηνύματος μπορεί να έχει\nεπικίνδυνες παρενέργειες. Υπογράφετε μηνύματα μόνο από\nτοποθεσίες που εμπιστεύεστε πλήρως με ολόκληρο τον λογαριασμό σας.\n Αυτή η επικίνδυνη μέθοδος θα καταργηθεί σε μια μελλοντική έκδοση."
|
||||||
},
|
},
|
||||||
"signatureRequest": {
|
"signatureRequest": {
|
||||||
"message": "Αίτημα Υπογραφής"
|
"message": "Αίτημα Υπογραφής"
|
||||||
@ -3045,10 +3045,6 @@
|
|||||||
"snapInstallWarningCheck": {
|
"snapInstallWarningCheck": {
|
||||||
"message": "Για να επιβεβαιώσετε ότι καταλαβαίνετε, επιλέξτε όλα τα πλαίσια ελέγχου."
|
"message": "Για να επιβεβαιώσετε ότι καταλαβαίνετε, επιλέξτε όλα τα πλαίσια ελέγχου."
|
||||||
},
|
},
|
||||||
"snapInstallWarningKeyAccess": {
|
|
||||||
"message": "Παρέχετε βασική πρόσβαση στο snap \"$1\". Αυτή η ενέργεια είναι μη αναστρέψιμη και παραχωρεί στο \"$1\" τον έλεγχο των λογαριασμών και των περιουσιακών σας στοιχείων. Βεβαιωθείτε ότι εμπιστεύεστε το \"$1\" πριν συνεχίσετε.",
|
|
||||||
"description": "The parameter is the name of the snap"
|
|
||||||
},
|
|
||||||
"snapRequestsPermission": {
|
"snapRequestsPermission": {
|
||||||
"message": "Αυτό το snap αιτείται τις παρακάτω άδειες:"
|
"message": "Αυτό το snap αιτείται τις παρακάτω άδειες:"
|
||||||
},
|
},
|
||||||
|
13
app/_locales/en/messages.json
generated
13
app/_locales/en/messages.json
generated
@ -3043,11 +3043,14 @@
|
|||||||
"message": "Install Snap"
|
"message": "Install Snap"
|
||||||
},
|
},
|
||||||
"snapInstallWarningCheck": {
|
"snapInstallWarningCheck": {
|
||||||
"message": "To confirm you understand, check all."
|
"message": "To confirm that you understand, check the box."
|
||||||
|
},
|
||||||
|
"snapInstallWarningCheckPlural": {
|
||||||
|
"message": "To confirm that you understand, check all the boxes."
|
||||||
},
|
},
|
||||||
"snapInstallWarningKeyAccess": {
|
"snapInstallWarningKeyAccess": {
|
||||||
"message": "You are granting key access to the snap \"$1\". This is irrevocable and grants \"$1\" control of your accounts and assets. Make sure you trust \"$1\" before proceeding.",
|
"message": "You are granting $2 key access to the snap \"$1\". This is irrevocable and grants \"$1\" control of your $2 accounts and assets. Make sure you trust \"$1\" before proceeding.",
|
||||||
"description": "The parameter is the name of the snap"
|
"description": "The first parameter is the name of the snap and the second one is the protocol"
|
||||||
},
|
},
|
||||||
"snapRequestsPermission": {
|
"snapRequestsPermission": {
|
||||||
"message": "This snap is requesting the following permissions:"
|
"message": "This snap is requesting the following permissions:"
|
||||||
@ -3958,6 +3961,10 @@
|
|||||||
"message": "This custom network is not recognized",
|
"message": "This custom network is not recognized",
|
||||||
"description": "$1 is a clickable link with text defined by the 'unrecognizedChanLinkText' key. The link will open to instructions for users to validate custom network details."
|
"description": "$1 is a clickable link with text defined by the 'unrecognizedChanLinkText' key. The link will open to instructions for users to validate custom network details."
|
||||||
},
|
},
|
||||||
|
"unrecognizedProtocol": {
|
||||||
|
"message": "$1 (Unrecognized protocol)",
|
||||||
|
"description": "Shown when the protocol is unknown by the extension. $1 is the protocol code."
|
||||||
|
},
|
||||||
"unsendableAsset": {
|
"unsendableAsset": {
|
||||||
"message": "Sending collectible (ERC-721) tokens is not currently supported",
|
"message": "Sending collectible (ERC-721) tokens is not currently supported",
|
||||||
"description": "This is an error message we show the user if they attempt to send a collectible asset type, for which currently don't support sending"
|
"description": "This is an error message we show the user if they attempt to send a collectible asset type, for which currently don't support sending"
|
||||||
|
4
app/_locales/es/messages.json
generated
4
app/_locales/es/messages.json
generated
@ -3045,10 +3045,6 @@
|
|||||||
"snapInstallWarningCheck": {
|
"snapInstallWarningCheck": {
|
||||||
"message": "Para confirmar que comprende, marque todo."
|
"message": "Para confirmar que comprende, marque todo."
|
||||||
},
|
},
|
||||||
"snapInstallWarningKeyAccess": {
|
|
||||||
"message": "Está otorgando acceso clave al complemento \"$1\". Esto es irrevocable y le otorga a \"$1\" el control de sus cuentas y activos. Asegúrese de confiar en \"$1\" antes de continuar.",
|
|
||||||
"description": "The parameter is the name of the snap"
|
|
||||||
},
|
|
||||||
"snapRequestsPermission": {
|
"snapRequestsPermission": {
|
||||||
"message": "Este complemento solicita los siguientes permisos:"
|
"message": "Este complemento solicita los siguientes permisos:"
|
||||||
},
|
},
|
||||||
|
384
app/_locales/fr/messages.json
generated
384
app/_locales/fr/messages.json
generated
File diff suppressed because it is too large
Load Diff
4
app/_locales/hi/messages.json
generated
4
app/_locales/hi/messages.json
generated
@ -3045,10 +3045,6 @@
|
|||||||
"snapInstallWarningCheck": {
|
"snapInstallWarningCheck": {
|
||||||
"message": "ये पुष्टि करने के लिए कि आप समझते हैं, सभी पर सही का निशान लगाएं।"
|
"message": "ये पुष्टि करने के लिए कि आप समझते हैं, सभी पर सही का निशान लगाएं।"
|
||||||
},
|
},
|
||||||
"snapInstallWarningKeyAccess": {
|
|
||||||
"message": "आप स्नैप \"$1\" को महत्वपूर्ण एक्सेस प्रदान कर रहे हैं। यह अपरिवर्तनीय है और आपके अकाउंट्स और एसेट्स पर \"$1\" को नियंत्रण प्रदान करता है। आगे बढ़ने से पहले सुनिश्चित करें कि आप \"$1\" पर भरोसा करते हैं।",
|
|
||||||
"description": "The parameter is the name of the snap"
|
|
||||||
},
|
|
||||||
"snapRequestsPermission": {
|
"snapRequestsPermission": {
|
||||||
"message": "ये स्नैप निम्नलिखित अनुमतियों हेतु अनुरोध कर रहा है:"
|
"message": "ये स्नैप निम्नलिखित अनुमतियों हेतु अनुरोध कर रहा है:"
|
||||||
},
|
},
|
||||||
|
4
app/_locales/id/messages.json
generated
4
app/_locales/id/messages.json
generated
@ -3045,10 +3045,6 @@
|
|||||||
"snapInstallWarningCheck": {
|
"snapInstallWarningCheck": {
|
||||||
"message": "Untuk mengonfirmasikan Anda sudah paham, centang semua."
|
"message": "Untuk mengonfirmasikan Anda sudah paham, centang semua."
|
||||||
},
|
},
|
||||||
"snapInstallWarningKeyAccess": {
|
|
||||||
"message": "Anda memberikan akses kunci ke snap \"$1\". Tindakan ini tidak dapat dibatalkan dan memberikan kendali \"$1\" atas akun dan aset Anda. Sebelum melanjutkan, pastikan \"$1\" aman.",
|
|
||||||
"description": "The parameter is the name of the snap"
|
|
||||||
},
|
|
||||||
"snapRequestsPermission": {
|
"snapRequestsPermission": {
|
||||||
"message": "Snap ini meminta izin berikut:"
|
"message": "Snap ini meminta izin berikut:"
|
||||||
},
|
},
|
||||||
|
4
app/_locales/ja/messages.json
generated
4
app/_locales/ja/messages.json
generated
@ -3045,10 +3045,6 @@
|
|||||||
"snapInstallWarningCheck": {
|
"snapInstallWarningCheck": {
|
||||||
"message": "理解したことを確認するために、すべての項目にチェックを入れてください。"
|
"message": "理解したことを確認するために、すべての項目にチェックを入れてください。"
|
||||||
},
|
},
|
||||||
"snapInstallWarningKeyAccess": {
|
|
||||||
"message": "スナップ「$1」に重要なアクセス権を付与しようとしています。これは取り消し不可能で、「$1」によるアカウントとアセットのコントロールが可能になります。続行する前に、「$1」が信頼できることを確認してください。",
|
|
||||||
"description": "The parameter is the name of the snap"
|
|
||||||
},
|
|
||||||
"snapRequestsPermission": {
|
"snapRequestsPermission": {
|
||||||
"message": "このスナップが次のパーミッションをリクエストしています:"
|
"message": "このスナップが次のパーミッションをリクエストしています:"
|
||||||
},
|
},
|
||||||
|
4
app/_locales/ko/messages.json
generated
4
app/_locales/ko/messages.json
generated
@ -3045,10 +3045,6 @@
|
|||||||
"snapInstallWarningCheck": {
|
"snapInstallWarningCheck": {
|
||||||
"message": "이해하셨으면 모두 체크해 주세요."
|
"message": "이해하셨으면 모두 체크해 주세요."
|
||||||
},
|
},
|
||||||
"snapInstallWarningKeyAccess": {
|
|
||||||
"message": "'$1' 스냅 이용에 필요한 키 액세스 권한을 부여하고 있습니다. 이 작업은 사용자의 계정과 자산에 '$1' 제어 권한을 부여하며 취소가 불가능합니다. '$1의 신뢰성을 확인한 후에 진행하세요.",
|
|
||||||
"description": "The parameter is the name of the snap"
|
|
||||||
},
|
|
||||||
"snapRequestsPermission": {
|
"snapRequestsPermission": {
|
||||||
"message": "이 스냅이 다음 권한을 요청하고 있습니다."
|
"message": "이 스냅이 다음 권한을 요청하고 있습니다."
|
||||||
},
|
},
|
||||||
|
4
app/_locales/pt/messages.json
generated
4
app/_locales/pt/messages.json
generated
@ -3045,10 +3045,6 @@
|
|||||||
"snapInstallWarningCheck": {
|
"snapInstallWarningCheck": {
|
||||||
"message": "Para confirmar que você entende, marque todas."
|
"message": "Para confirmar que você entende, marque todas."
|
||||||
},
|
},
|
||||||
"snapInstallWarningKeyAccess": {
|
|
||||||
"message": "Você está concedendo ao snap \"$1\" acesso à sua chave. Isso é irrevogável e concede a \"$1\" controle sobre suas contas e ativos. Certifique-se de que confia em \"$1\" antes de prosseguir.",
|
|
||||||
"description": "The parameter is the name of the snap"
|
|
||||||
},
|
|
||||||
"snapRequestsPermission": {
|
"snapRequestsPermission": {
|
||||||
"message": "Esse snap está solicitando as seguintes permissões:"
|
"message": "Esse snap está solicitando as seguintes permissões:"
|
||||||
},
|
},
|
||||||
|
4
app/_locales/ru/messages.json
generated
4
app/_locales/ru/messages.json
generated
@ -3045,10 +3045,6 @@
|
|||||||
"snapInstallWarningCheck": {
|
"snapInstallWarningCheck": {
|
||||||
"message": "Чтобы подтвердить, что вы понимаете, отметьте все."
|
"message": "Чтобы подтвердить, что вы понимаете, отметьте все."
|
||||||
},
|
},
|
||||||
"snapInstallWarningKeyAccess": {
|
|
||||||
"message": "Вы предоставляете ключевой доступ к снапу «$1». Это действие является безотзывным и предоставляет «$1» контроль над вашими счетами и активами. Прежде чем продолжить, убедитесь, что вы доверяете «$1».",
|
|
||||||
"description": "The parameter is the name of the snap"
|
|
||||||
},
|
|
||||||
"snapRequestsPermission": {
|
"snapRequestsPermission": {
|
||||||
"message": "Этот снап запрашивает следующие разрешения:"
|
"message": "Этот снап запрашивает следующие разрешения:"
|
||||||
},
|
},
|
||||||
|
4
app/_locales/tl/messages.json
generated
4
app/_locales/tl/messages.json
generated
@ -3045,10 +3045,6 @@
|
|||||||
"snapInstallWarningCheck": {
|
"snapInstallWarningCheck": {
|
||||||
"message": "Para kumpirmahing naunawaan mo, tsekan lahat."
|
"message": "Para kumpirmahing naunawaan mo, tsekan lahat."
|
||||||
},
|
},
|
||||||
"snapInstallWarningKeyAccess": {
|
|
||||||
"message": "Ipinagkakaloob mo ang key access sa snap \"$1\". Hindi ito maaaring bawiin at ipinagkakaloob sa \"$1\" ang kontrol sa iyong mga account at mga asset. Tiyaking pinagkakatiwalaan mo ang \"$1\" bago magpatuloy.",
|
|
||||||
"description": "The parameter is the name of the snap"
|
|
||||||
},
|
|
||||||
"snapRequestsPermission": {
|
"snapRequestsPermission": {
|
||||||
"message": "Hinihiling ng snap na ito ang mga sumusunod na pahintulot:"
|
"message": "Hinihiling ng snap na ito ang mga sumusunod na pahintulot:"
|
||||||
},
|
},
|
||||||
|
4
app/_locales/tr/messages.json
generated
4
app/_locales/tr/messages.json
generated
@ -3045,10 +3045,6 @@
|
|||||||
"snapInstallWarningCheck": {
|
"snapInstallWarningCheck": {
|
||||||
"message": "Anladığını doğrulamak için hepsini kontrol et."
|
"message": "Anladığını doğrulamak için hepsini kontrol et."
|
||||||
},
|
},
|
||||||
"snapInstallWarningKeyAccess": {
|
|
||||||
"message": "\"$1\" snap'ine anahtar erişimi veriyorsun. Bu geri alınamaz ve hesapların ve varlıkların üzerinde \"1$\" kontrol sağlar. Devam etmeden önce \"$1\" öğesine güvendiğinden emin ol.",
|
|
||||||
"description": "The parameter is the name of the snap"
|
|
||||||
},
|
|
||||||
"snapRequestsPermission": {
|
"snapRequestsPermission": {
|
||||||
"message": "Bu ek, aşağıdaki izinleri istiyor:"
|
"message": "Bu ek, aşağıdaki izinleri istiyor:"
|
||||||
},
|
},
|
||||||
|
4
app/_locales/vi/messages.json
generated
4
app/_locales/vi/messages.json
generated
@ -3045,10 +3045,6 @@
|
|||||||
"snapInstallWarningCheck": {
|
"snapInstallWarningCheck": {
|
||||||
"message": "Để xác nhận rằng bạn hiểu, hãy đánh dấu vào tất cả."
|
"message": "Để xác nhận rằng bạn hiểu, hãy đánh dấu vào tất cả."
|
||||||
},
|
},
|
||||||
"snapInstallWarningKeyAccess": {
|
|
||||||
"message": "Bạn đang cấp quyền truy cập khóa cho Snap \"$1\". Hành động này không thể hủy bỏ và sẽ cấp quyền kiểm soát tài khoản và tài sản của bạn cho \"$1\". Đảm bảo bạn tin tưởng \"$1\" trước khi tiếp tục.",
|
|
||||||
"description": "The parameter is the name of the snap"
|
|
||||||
},
|
|
||||||
"snapRequestsPermission": {
|
"snapRequestsPermission": {
|
||||||
"message": "Snap này đang yêu cầu các quyền sau:"
|
"message": "Snap này đang yêu cầu các quyền sau:"
|
||||||
},
|
},
|
||||||
|
4
app/_locales/zh/messages.json
generated
4
app/_locales/zh/messages.json
generated
@ -3045,10 +3045,6 @@
|
|||||||
"snapInstallWarningCheck": {
|
"snapInstallWarningCheck": {
|
||||||
"message": "请勾选全部以确认您理解。"
|
"message": "请勾选全部以确认您理解。"
|
||||||
},
|
},
|
||||||
"snapInstallWarningKeyAccess": {
|
|
||||||
"message": "您正在向snap \"$1\"授予密钥访问权限。此操作不可撤销,并会向\"$1\"授予对您的账户和资产的控制权。在继续之前,请确保您信任\"$1\"。",
|
|
||||||
"description": "The parameter is the name of the snap"
|
|
||||||
},
|
|
||||||
"snapRequestsPermission": {
|
"snapRequestsPermission": {
|
||||||
"message": "此Snap正在请求以下权限:"
|
"message": "此Snap正在请求以下权限:"
|
||||||
},
|
},
|
||||||
|
@ -69,7 +69,7 @@ describe('Test Snap bip-44', function () {
|
|||||||
});
|
});
|
||||||
// deal with permissions popover
|
// deal with permissions popover
|
||||||
await driver.delay(1000);
|
await driver.delay(1000);
|
||||||
await driver.press('#warning-accept', driver.Key.SPACE);
|
await driver.press('#key-access-0', driver.Key.SPACE);
|
||||||
await driver.clickElement({
|
await driver.clickElement({
|
||||||
text: 'Confirm',
|
text: 'Confirm',
|
||||||
tag: 'button',
|
tag: 'button',
|
||||||
|
@ -5,6 +5,11 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
gap: 0 16px;
|
gap: 0 16px;
|
||||||
|
margin-top: 16px;
|
||||||
|
|
||||||
|
&--first {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__footer {
|
&__footer {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import React, { useCallback, useState } from 'react';
|
import React, { useCallback, useReducer } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import { produce } from 'immer';
|
||||||
|
import classnames from 'classnames';
|
||||||
import { useI18nContext } from '../../../../hooks/useI18nContext';
|
import { useI18nContext } from '../../../../hooks/useI18nContext';
|
||||||
import CheckBox from '../../../ui/check-box/check-box.component';
|
import CheckBox from '../../../ui/check-box/check-box.component';
|
||||||
import Typography from '../../../ui/typography/typography';
|
import Typography from '../../../ui/typography/typography';
|
||||||
@ -7,14 +9,34 @@ import { TYPOGRAPHY } from '../../../../helpers/constants/design-system';
|
|||||||
import Popover from '../../../ui/popover';
|
import Popover from '../../../ui/popover';
|
||||||
import Button from '../../../ui/button';
|
import Button from '../../../ui/button';
|
||||||
|
|
||||||
export default function SnapInstallWarning({ onCancel, onSubmit, snapName }) {
|
/**
|
||||||
const t = useI18nContext();
|
* a very simple reducer using produce from Immer to keep checkboxes state manipulation
|
||||||
const [isConfirmed, setIsConfirmed] = useState(false);
|
* immutable and painless.
|
||||||
|
*/
|
||||||
|
const checkboxStateReducer = produce((state, action) => {
|
||||||
|
switch (action.type) {
|
||||||
|
case 'check':
|
||||||
|
state[action.checkboxId] = state[action.checkboxId]
|
||||||
|
? !state[action.checkboxId]
|
||||||
|
: true;
|
||||||
|
|
||||||
const onCheckboxClicked = useCallback(
|
break;
|
||||||
() => setIsConfirmed((confirmedState) => !confirmedState),
|
default:
|
||||||
[],
|
throw new Error(
|
||||||
);
|
'You must provide a type when dispatching an action for checkboxState',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default function SnapInstallWarning({ onCancel, onSubmit, warnings }) {
|
||||||
|
const t = useI18nContext();
|
||||||
|
const [checkboxState, dispatch] = useReducer(checkboxStateReducer, {});
|
||||||
|
|
||||||
|
const isAllChecked = warnings.every((warning) => checkboxState[warning.id]);
|
||||||
|
|
||||||
|
const onCheckboxClicked = useCallback((checkboxId) => {
|
||||||
|
dispatch({ type: 'check', checkboxId });
|
||||||
|
}, []);
|
||||||
|
|
||||||
const SnapInstallWarningFooter = () => {
|
const SnapInstallWarningFooter = () => {
|
||||||
return (
|
return (
|
||||||
@ -29,7 +51,7 @@ export default function SnapInstallWarning({ onCancel, onSubmit, snapName }) {
|
|||||||
<Button
|
<Button
|
||||||
className="snap-install-warning__footer-button"
|
className="snap-install-warning__footer-button"
|
||||||
type="primary"
|
type="primary"
|
||||||
disabled={!isConfirmed}
|
disabled={!isAllChecked}
|
||||||
onClick={onSubmit}
|
onClick={onSubmit}
|
||||||
>
|
>
|
||||||
{t('confirm')}
|
{t('confirm')}
|
||||||
@ -48,18 +70,25 @@ export default function SnapInstallWarning({ onCancel, onSubmit, snapName }) {
|
|||||||
footerProps={{ padding: [4, 6] }}
|
footerProps={{ padding: [4, 6] }}
|
||||||
>
|
>
|
||||||
<Typography variant={TYPOGRAPHY.H6} boxProps={{ paddingBottom: 4 }}>
|
<Typography variant={TYPOGRAPHY.H6} boxProps={{ paddingBottom: 4 }}>
|
||||||
{t('snapInstallWarningCheck')}
|
{warnings.length > 1
|
||||||
|
? t('snapInstallWarningCheckPlural')
|
||||||
|
: t('snapInstallWarningCheck')}
|
||||||
</Typography>
|
</Typography>
|
||||||
<div className="checkbox-label">
|
{warnings.map((warning, i) => (
|
||||||
<CheckBox
|
<div
|
||||||
checked={isConfirmed}
|
className={classnames('checkbox-label', {
|
||||||
id="warning-accept"
|
'checkbox-label--first': i === 0,
|
||||||
onClick={onCheckboxClicked}
|
})}
|
||||||
/>
|
key={warning.id}
|
||||||
<label htmlFor="warning-accept">
|
>
|
||||||
{t('snapInstallWarningKeyAccess', [snapName])}
|
<CheckBox
|
||||||
</label>
|
checked={checkboxState[warning.id] ?? false}
|
||||||
</div>
|
id={warning.id}
|
||||||
|
onClick={() => onCheckboxClicked(warning.id)}
|
||||||
|
/>
|
||||||
|
<label htmlFor={warning.id}>{warning.message}</label>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
</Popover>
|
</Popover>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -74,7 +103,10 @@ SnapInstallWarning.propTypes = {
|
|||||||
*/
|
*/
|
||||||
onSubmit: PropTypes.func,
|
onSubmit: PropTypes.func,
|
||||||
/**
|
/**
|
||||||
* Name of snap
|
* warnings list
|
||||||
*/
|
*/
|
||||||
snapName: PropTypes.string,
|
warnings: PropTypes.arrayOf({
|
||||||
|
message: PropTypes.node,
|
||||||
|
id: PropTypes.string,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { useCallback, useMemo, useState } from 'react';
|
import React, { useCallback, useState } from 'react';
|
||||||
import { PageContainerFooter } from '../../../../components/ui/page-container';
|
import { PageContainerFooter } from '../../../../components/ui/page-container';
|
||||||
import PermissionsConnectPermissionList from '../../../../components/app/permissions-connect-permission-list';
|
import PermissionsConnectPermissionList from '../../../../components/app/permissions-connect-permission-list';
|
||||||
import PermissionsConnectFooter from '../../../../components/app/permissions-connect-footer';
|
import PermissionsConnectFooter from '../../../../components/app/permissions-connect-footer';
|
||||||
@ -16,6 +16,7 @@ import {
|
|||||||
TYPOGRAPHY,
|
TYPOGRAPHY,
|
||||||
} from '../../../../helpers/constants/design-system';
|
} from '../../../../helpers/constants/design-system';
|
||||||
import Typography from '../../../../components/ui/typography';
|
import Typography from '../../../../components/ui/typography';
|
||||||
|
import { coinTypeToProtocolName } from '../../../../helpers/utils/util';
|
||||||
|
|
||||||
export default function SnapInstall({
|
export default function SnapInstall({
|
||||||
request,
|
request,
|
||||||
@ -37,16 +38,16 @@ export default function SnapInstall({
|
|||||||
[request, approveSnapInstall],
|
[request, approveSnapInstall],
|
||||||
);
|
);
|
||||||
|
|
||||||
const shouldShowWarning = useMemo(
|
const bip44EntropyPermissions =
|
||||||
() =>
|
request.permissions &&
|
||||||
Boolean(
|
Object.keys(request.permissions).filter((v) =>
|
||||||
request.permissions &&
|
v.startsWith('snap_getBip44Entropy_'),
|
||||||
Object.keys(request.permissions).find((v) =>
|
);
|
||||||
v.startsWith('snap_getBip44Entropy_'),
|
|
||||||
),
|
const shouldShowWarning = bip44EntropyPermissions?.length > 0;
|
||||||
),
|
|
||||||
[request.permissions],
|
const getCoinType = (bip44EntropyPermission) =>
|
||||||
);
|
bip44EntropyPermission?.split('_').slice(-1);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
@ -128,7 +129,17 @@ export default function SnapInstall({
|
|||||||
<SnapInstallWarning
|
<SnapInstallWarning
|
||||||
onCancel={() => setIsShowingWarning(false)}
|
onCancel={() => setIsShowingWarning(false)}
|
||||||
onSubmit={onSubmit}
|
onSubmit={onSubmit}
|
||||||
snapName={targetSubjectMetadata.name}
|
warnings={bip44EntropyPermissions.map((permission, i) => {
|
||||||
|
const coinType = getCoinType(permission);
|
||||||
|
return {
|
||||||
|
id: `key-access-${i}`,
|
||||||
|
message: t('snapInstallWarningKeyAccess', [
|
||||||
|
targetSubjectMetadata.name,
|
||||||
|
coinTypeToProtocolName(coinType) ||
|
||||||
|
t('unrecognizedProtocol', [coinType]),
|
||||||
|
]),
|
||||||
|
};
|
||||||
|
})}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
Loading…
Reference in New Issue
Block a user