2021-02-04 19:15:23 +01:00
|
|
|
import React, { PureComponent } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2023-08-04 13:33:47 +02:00
|
|
|
import { Box, BannerAlert } from '../../../components/component-library';
|
2021-02-04 19:15:23 +01:00
|
|
|
import ToggleButton from '../../../components/ui/toggle-button';
|
|
|
|
import TextField from '../../../components/ui/text-field';
|
|
|
|
import Button from '../../../components/ui/button';
|
2021-10-21 21:17:03 +02:00
|
|
|
import Dropdown from '../../../components/ui/dropdown';
|
2021-10-29 01:38:58 +02:00
|
|
|
import Dialog from '../../../components/ui/dialog';
|
2023-08-04 13:33:47 +02:00
|
|
|
import {
|
|
|
|
Display,
|
|
|
|
FlexDirection,
|
|
|
|
JustifyContent,
|
2023-08-24 15:11:38 +02:00
|
|
|
Severity,
|
2023-08-04 13:33:47 +02:00
|
|
|
TextVariant,
|
|
|
|
} from '../../../helpers/constants/design-system';
|
2021-11-02 08:24:24 +01:00
|
|
|
import { getPlatform } from '../../../../app/scripts/lib/util';
|
|
|
|
|
|
|
|
import { PLATFORM_FIREFOX } from '../../../../shared/constants/app';
|
2022-02-22 21:58:21 +01:00
|
|
|
import {
|
2022-04-06 22:27:08 +02:00
|
|
|
getNumberOfSettingsInSection,
|
2022-02-22 21:58:21 +01:00
|
|
|
handleSettingsRefs,
|
|
|
|
} from '../../../helpers/utils/settings-search';
|
2021-11-02 08:24:24 +01:00
|
|
|
|
2021-10-21 21:17:03 +02:00
|
|
|
import {
|
2023-01-20 16:14:40 +01:00
|
|
|
LedgerTransportTypes,
|
2021-10-21 21:17:03 +02:00
|
|
|
LEDGER_USB_VENDOR_ID,
|
|
|
|
} from '../../../../shared/constants/hardware-wallets';
|
2023-04-03 17:31:04 +02:00
|
|
|
import {
|
|
|
|
MetaMetricsEventCategory,
|
|
|
|
MetaMetricsEventName,
|
|
|
|
} from '../../../../shared/constants/metametrics';
|
2023-06-22 18:29:24 +02:00
|
|
|
import { DEFAULT_AUTO_LOCK_TIME_LIMIT } from '../../../../shared/constants/preferences';
|
2023-07-27 19:33:36 +02:00
|
|
|
import {
|
|
|
|
exportAsFile,
|
|
|
|
ExportableContentType,
|
|
|
|
} from '../../../helpers/utils/export-utils';
|
2022-08-09 20:36:32 +02:00
|
|
|
import ActionableMessage from '../../../components/ui/actionable-message';
|
2022-08-23 16:19:31 +02:00
|
|
|
import ZENDESK_URLS from '../../../helpers/constants/zendesk-url';
|
2021-05-24 23:11:17 +02:00
|
|
|
|
2022-09-14 02:59:04 +02:00
|
|
|
const CORRUPT_JSON_FILE = 'CORRUPT_JSON_FILE';
|
|
|
|
|
2019-03-25 17:13:23 +01:00
|
|
|
export default class AdvancedTab extends PureComponent {
|
|
|
|
static contextTypes = {
|
|
|
|
t: PropTypes.func,
|
2022-03-29 15:46:24 +02:00
|
|
|
trackEvent: PropTypes.func,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-03-25 17:13:23 +01:00
|
|
|
|
|
|
|
static propTypes = {
|
2019-09-27 06:30:36 +02:00
|
|
|
setUseNonceField: PropTypes.func,
|
|
|
|
useNonceField: PropTypes.bool,
|
2019-03-25 17:13:23 +01:00
|
|
|
setHexDataFeatureFlag: PropTypes.func,
|
|
|
|
displayWarning: PropTypes.func,
|
|
|
|
showResetAccountConfirmationModal: PropTypes.func,
|
2023-05-04 13:14:07 +02:00
|
|
|
showEthSignModal: PropTypes.func,
|
2019-03-25 17:13:23 +01:00
|
|
|
warning: PropTypes.string,
|
|
|
|
sendHexData: PropTypes.bool,
|
|
|
|
showFiatInTestnets: PropTypes.bool,
|
2021-10-28 21:31:05 +02:00
|
|
|
showTestNetworks: PropTypes.bool,
|
2020-01-21 23:09:53 +01:00
|
|
|
autoLockTimeLimit: PropTypes.number,
|
|
|
|
setAutoLockTimeLimit: PropTypes.func.isRequired,
|
2019-03-25 17:13:23 +01:00
|
|
|
setShowFiatConversionOnTestnetsPreference: PropTypes.func.isRequired,
|
2021-10-28 21:31:05 +02:00
|
|
|
setShowTestNetworks: PropTypes.func.isRequired,
|
2023-01-20 16:14:40 +01:00
|
|
|
ledgerTransportType: PropTypes.oneOf(Object.values(LedgerTransportTypes)),
|
2021-11-08 16:28:40 +01:00
|
|
|
setLedgerTransportPreference: PropTypes.func.isRequired,
|
2021-05-05 15:58:29 +02:00
|
|
|
setDismissSeedBackUpReminder: PropTypes.func.isRequired,
|
|
|
|
dismissSeedBackUpReminder: PropTypes.bool.isRequired,
|
2021-10-21 21:17:03 +02:00
|
|
|
userHasALedgerAccount: PropTypes.bool.isRequired,
|
2022-08-09 20:36:32 +02:00
|
|
|
backupUserData: PropTypes.func.isRequired,
|
|
|
|
restoreUserData: PropTypes.func.isRequired,
|
2023-02-06 17:47:50 +01:00
|
|
|
setDisabledRpcMethodPreference: PropTypes.func.isRequired,
|
|
|
|
disabledRpcMethodPreferences: PropTypes.shape({
|
|
|
|
eth_sign: PropTypes.bool.isRequired,
|
|
|
|
}),
|
2023-04-25 16:32:51 +02:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(desktop)
|
2023-02-23 17:39:48 +01:00
|
|
|
desktopEnabled: PropTypes.bool,
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-03-25 17:13:23 +01:00
|
|
|
|
2019-10-17 17:25:37 +02:00
|
|
|
state = {
|
2020-01-21 23:09:53 +01:00
|
|
|
autoLockTimeLimit: this.props.autoLockTimeLimit,
|
2023-06-22 18:29:24 +02:00
|
|
|
autoLockTimeLimitBeforeNormalization: this.props.autoLockTimeLimit,
|
2020-01-21 23:09:53 +01:00
|
|
|
lockTimeError: '',
|
2021-10-29 01:38:58 +02:00
|
|
|
showLedgerTransportWarning: false,
|
2022-08-09 20:36:32 +02:00
|
|
|
showResultMessage: false,
|
|
|
|
restoreSuccessful: true,
|
2022-09-14 02:59:04 +02:00
|
|
|
restoreMessage: null,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-03-25 17:13:23 +01:00
|
|
|
|
2022-02-22 21:58:21 +01:00
|
|
|
settingsRefs = Array(
|
2022-04-06 22:27:08 +02:00
|
|
|
getNumberOfSettingsInSection(this.context.t, this.context.t('advanced')),
|
2022-02-22 21:58:21 +01:00
|
|
|
)
|
|
|
|
.fill(undefined)
|
|
|
|
.map(() => {
|
|
|
|
return React.createRef();
|
|
|
|
});
|
|
|
|
|
|
|
|
componentDidUpdate() {
|
|
|
|
const { t } = this.context;
|
|
|
|
handleSettingsRefs(t, t('advanced'), this.settingsRefs);
|
|
|
|
}
|
2021-11-16 01:00:23 +01:00
|
|
|
|
|
|
|
componentDidMount() {
|
2022-02-22 21:58:21 +01:00
|
|
|
const { t } = this.context;
|
|
|
|
handleSettingsRefs(t, t('advanced'), this.settingsRefs);
|
2021-11-16 01:00:23 +01:00
|
|
|
}
|
|
|
|
|
2022-08-09 20:36:32 +02:00
|
|
|
async getTextFromFile(file) {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
const reader = new window.FileReader();
|
|
|
|
reader.onload = (e) => {
|
|
|
|
const text = e.target.result;
|
|
|
|
resolve(text);
|
|
|
|
};
|
|
|
|
|
|
|
|
reader.onerror = (e) => {
|
|
|
|
reject(e);
|
|
|
|
};
|
|
|
|
|
|
|
|
reader.readAsText(file);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
async handleFileUpload(event) {
|
|
|
|
/**
|
|
|
|
* we need this to be able to access event.target after
|
|
|
|
* the event handler has been called. [Synthetic Event Pooling, pre React 17]
|
|
|
|
*
|
|
|
|
* @see https://fb.me/react-event-pooling
|
|
|
|
*/
|
|
|
|
event.persist();
|
|
|
|
const file = event.target.files[0];
|
|
|
|
const jsonString = await this.getTextFromFile(file);
|
|
|
|
/**
|
|
|
|
* so that we can restore same file again if we want to.
|
|
|
|
* chrome blocks uploading same file twice.
|
|
|
|
*/
|
|
|
|
event.target.value = '';
|
2022-09-14 02:59:04 +02:00
|
|
|
try {
|
|
|
|
const result = await this.props.restoreUserData(jsonString);
|
|
|
|
this.setState({
|
|
|
|
showResultMessage: true,
|
|
|
|
restoreSuccessful: result,
|
|
|
|
restoreMessage: null,
|
|
|
|
});
|
|
|
|
} catch (e) {
|
2022-09-14 19:16:21 +02:00
|
|
|
if (e.message.match(/Unexpected.+JSON/iu)) {
|
2022-09-14 02:59:04 +02:00
|
|
|
this.setState({
|
|
|
|
showResultMessage: true,
|
|
|
|
restoreSuccessful: false,
|
|
|
|
restoreMessage: CORRUPT_JSON_FILE,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2022-08-09 20:36:32 +02:00
|
|
|
}
|
|
|
|
|
2022-09-29 05:34:20 +02:00
|
|
|
backupUserData = async () => {
|
|
|
|
const { fileName, data } = await this.props.backupUserData();
|
2023-07-27 19:33:36 +02:00
|
|
|
exportAsFile(fileName, data, ExportableContentType.JSON);
|
2022-09-29 05:34:20 +02:00
|
|
|
|
|
|
|
this.context.trackEvent({
|
|
|
|
event: 'User Data Exported',
|
|
|
|
category: 'Backup',
|
|
|
|
properties: {},
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2022-12-19 18:46:36 +01:00
|
|
|
renderStateLogs() {
|
2022-08-09 20:36:32 +02:00
|
|
|
const { t } = this.context;
|
2022-12-19 18:46:36 +01:00
|
|
|
const { displayWarning } = this.props;
|
|
|
|
|
2022-08-09 20:36:32 +02:00
|
|
|
return (
|
2023-08-04 13:33:47 +02:00
|
|
|
<Box
|
2022-08-09 20:36:32 +02:00
|
|
|
className="settings-page__content-row"
|
2023-08-04 13:33:47 +02:00
|
|
|
display={Display.Flex}
|
|
|
|
flexDirection={FlexDirection.Column}
|
|
|
|
ref={this.settingsRefs[0]}
|
2022-12-19 18:46:36 +01:00
|
|
|
data-testid="advanced-setting-state-logs"
|
2022-08-09 20:36:32 +02:00
|
|
|
>
|
|
|
|
<div className="settings-page__content-item">
|
2022-12-19 18:46:36 +01:00
|
|
|
<span>{t('stateLogs')}</span>
|
2022-08-09 20:36:32 +02:00
|
|
|
<span className="settings-page__content-description">
|
2022-12-19 18:46:36 +01:00
|
|
|
{t('stateLogsDescription')}
|
2022-08-09 20:36:32 +02:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div className="settings-page__content-item">
|
|
|
|
<div className="settings-page__content-item-col">
|
|
|
|
<Button
|
|
|
|
type="secondary"
|
|
|
|
large
|
2022-12-19 18:46:36 +01:00
|
|
|
onClick={() => {
|
|
|
|
window.logStateString((err, result) => {
|
|
|
|
if (err) {
|
|
|
|
displayWarning(t('stateLogError'));
|
|
|
|
} else {
|
2023-07-27 19:33:36 +02:00
|
|
|
exportAsFile(
|
|
|
|
`${t('stateLogFileName')}.json`,
|
|
|
|
result,
|
|
|
|
ExportableContentType.JSON,
|
|
|
|
);
|
2022-12-19 18:46:36 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}}
|
2022-08-09 20:36:32 +02:00
|
|
|
>
|
2022-12-19 18:46:36 +01:00
|
|
|
{t('downloadStateLogs')}
|
2022-08-09 20:36:32 +02:00
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-08-04 13:33:47 +02:00
|
|
|
</Box>
|
2022-08-09 20:36:32 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
renderResetAccount() {
|
2021-02-04 19:15:23 +01:00
|
|
|
const { t } = this.context;
|
|
|
|
const { showResetAccountConfirmationModal } = this.props;
|
2019-03-25 17:13:23 +01:00
|
|
|
|
|
|
|
return (
|
2023-08-04 13:33:47 +02:00
|
|
|
<Box
|
2023-07-11 08:05:58 +02:00
|
|
|
ref={this.settingsRefs[1]}
|
2020-11-03 00:41:28 +01:00
|
|
|
className="settings-page__content-row"
|
2023-08-04 13:33:47 +02:00
|
|
|
display={Display.Flex}
|
|
|
|
flexDirection={FlexDirection.Column}
|
2020-11-03 00:41:28 +01:00
|
|
|
data-testid="advanced-setting-reset-account"
|
|
|
|
>
|
2019-03-25 17:13:23 +01:00
|
|
|
<div className="settings-page__content-item">
|
2023-02-10 22:50:12 +01:00
|
|
|
<span>{t('clearActivity')}</span>
|
2019-12-12 16:40:30 +01:00
|
|
|
<span className="settings-page__content-description">
|
2023-02-10 22:50:12 +01:00
|
|
|
{t('clearActivityDescription')}
|
2019-12-12 16:40:30 +01:00
|
|
|
</span>
|
2019-03-25 17:13:23 +01:00
|
|
|
</div>
|
|
|
|
<div className="settings-page__content-item">
|
|
|
|
<div className="settings-page__content-item-col">
|
|
|
|
<Button
|
2022-03-11 18:09:15 +01:00
|
|
|
type="danger"
|
2019-03-25 17:13:23 +01:00
|
|
|
large
|
2019-12-12 21:33:05 +01:00
|
|
|
className="settings-tab__button--red"
|
2020-02-15 21:34:12 +01:00
|
|
|
onClick={(event) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
event.preventDefault();
|
2022-03-29 15:46:24 +02:00
|
|
|
this.context.trackEvent({
|
2023-04-03 17:31:04 +02:00
|
|
|
category: MetaMetricsEventCategory.Settings,
|
|
|
|
event: MetaMetricsEventName.AccountReset,
|
2022-08-16 18:39:23 +02:00
|
|
|
properties: {},
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
showResetAccountConfirmationModal();
|
2019-03-25 17:13:23 +01:00
|
|
|
}}
|
|
|
|
>
|
2023-02-10 22:50:12 +01:00
|
|
|
{t('clearActivityButton')}
|
2019-03-25 17:13:23 +01:00
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-08-04 13:33:47 +02:00
|
|
|
</Box>
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2019-03-25 17:13:23 +01:00
|
|
|
}
|
|
|
|
|
2022-12-19 18:46:36 +01:00
|
|
|
renderHexDataOptIn() {
|
2021-02-04 19:15:23 +01:00
|
|
|
const { t } = this.context;
|
2022-12-19 18:46:36 +01:00
|
|
|
const { sendHexData, setHexDataFeatureFlag } = this.props;
|
2019-03-25 17:13:23 +01:00
|
|
|
|
|
|
|
return (
|
2023-08-04 13:33:47 +02:00
|
|
|
<Box
|
2023-07-11 08:05:58 +02:00
|
|
|
ref={this.settingsRefs[2]}
|
2020-11-03 00:41:28 +01:00
|
|
|
className="settings-page__content-row"
|
2023-08-04 13:33:47 +02:00
|
|
|
display={Display.Flex}
|
|
|
|
flexDirection={FlexDirection.Row}
|
|
|
|
justifyContent={JustifyContent.spaceBetween}
|
2023-08-24 12:27:42 +02:00
|
|
|
gap={4}
|
2022-12-19 18:46:36 +01:00
|
|
|
data-testid="advanced-setting-hex-data"
|
2020-11-03 00:41:28 +01:00
|
|
|
>
|
2019-03-25 17:13:23 +01:00
|
|
|
<div className="settings-page__content-item">
|
2022-12-19 18:46:36 +01:00
|
|
|
<span>{t('showHexData')}</span>
|
2019-03-25 17:13:23 +01:00
|
|
|
<div className="settings-page__content-description">
|
2022-12-19 18:46:36 +01:00
|
|
|
{t('showHexDataDescription')}
|
2019-03-25 17:13:23 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-08-04 13:33:47 +02:00
|
|
|
<div className="settings-page__content-item-col">
|
|
|
|
<ToggleButton
|
|
|
|
value={sendHexData}
|
|
|
|
onToggle={(value) => setHexDataFeatureFlag(!value)}
|
|
|
|
offLabel={t('off')}
|
|
|
|
onLabel={t('on')}
|
|
|
|
/>
|
2019-03-25 17:13:23 +01:00
|
|
|
</div>
|
2023-08-04 13:33:47 +02:00
|
|
|
</Box>
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2019-03-25 17:13:23 +01:00
|
|
|
}
|
|
|
|
|
2022-12-19 18:46:36 +01:00
|
|
|
renderShowConversionInTestnets() {
|
2021-10-28 21:31:05 +02:00
|
|
|
const { t } = this.context;
|
2022-12-19 18:46:36 +01:00
|
|
|
const { showFiatInTestnets, setShowFiatConversionOnTestnetsPreference } =
|
|
|
|
this.props;
|
2021-10-28 21:31:05 +02:00
|
|
|
|
|
|
|
return (
|
2023-08-04 13:33:47 +02:00
|
|
|
<Box
|
2023-07-11 08:05:58 +02:00
|
|
|
ref={this.settingsRefs[3]}
|
2021-10-28 21:31:05 +02:00
|
|
|
className="settings-page__content-row"
|
2023-08-04 13:33:47 +02:00
|
|
|
display={Display.Flex}
|
|
|
|
flexDirection={FlexDirection.Row}
|
|
|
|
justifyContent={JustifyContent.spaceBetween}
|
2023-08-24 12:27:42 +02:00
|
|
|
gap={4}
|
2021-10-28 21:31:05 +02:00
|
|
|
data-testid="advanced-setting-show-testnet-conversion"
|
|
|
|
>
|
|
|
|
<div className="settings-page__content-item">
|
2022-12-19 18:46:36 +01:00
|
|
|
<span>{t('showFiatConversionInTestnets')}</span>
|
2021-10-28 21:31:05 +02:00
|
|
|
<div className="settings-page__content-description">
|
2022-12-19 18:46:36 +01:00
|
|
|
{t('showFiatConversionInTestnetsDescription')}
|
2021-10-28 21:31:05 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-08-04 13:33:47 +02:00
|
|
|
|
|
|
|
<div className="settings-page__content-item-col">
|
|
|
|
<ToggleButton
|
|
|
|
value={showFiatInTestnets}
|
|
|
|
onToggle={(value) =>
|
|
|
|
setShowFiatConversionOnTestnetsPreference(!value)
|
|
|
|
}
|
|
|
|
offLabel={t('off')}
|
|
|
|
onLabel={t('on')}
|
|
|
|
/>
|
2021-10-28 21:31:05 +02:00
|
|
|
</div>
|
2023-08-04 13:33:47 +02:00
|
|
|
</Box>
|
2021-10-28 21:31:05 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-12-19 18:46:36 +01:00
|
|
|
renderToggleTestNetworks() {
|
2021-02-04 19:15:23 +01:00
|
|
|
const { t } = this.context;
|
2022-12-19 18:46:36 +01:00
|
|
|
const { showTestNetworks, setShowTestNetworks } = this.props;
|
2019-03-25 17:13:23 +01:00
|
|
|
|
|
|
|
return (
|
2023-08-04 13:33:47 +02:00
|
|
|
<Box
|
2023-07-11 08:05:58 +02:00
|
|
|
ref={this.settingsRefs[4]}
|
2020-11-03 00:41:28 +01:00
|
|
|
className="settings-page__content-row"
|
|
|
|
data-testid="advanced-setting-show-testnet-conversion"
|
2023-08-04 13:33:47 +02:00
|
|
|
display={Display.Flex}
|
|
|
|
flexDirection={FlexDirection.Row}
|
|
|
|
justifyContent={JustifyContent.spaceBetween}
|
2023-08-24 12:27:42 +02:00
|
|
|
gap={4}
|
2020-11-03 00:41:28 +01:00
|
|
|
>
|
2019-03-25 17:13:23 +01:00
|
|
|
<div className="settings-page__content-item">
|
2022-12-19 18:46:36 +01:00
|
|
|
<span>{t('showTestnetNetworks')}</span>
|
2019-03-25 17:13:23 +01:00
|
|
|
<div className="settings-page__content-description">
|
2022-12-19 18:46:36 +01:00
|
|
|
{t('showTestnetNetworksDescription')}
|
2019-03-25 17:13:23 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-08-04 13:33:47 +02:00
|
|
|
|
|
|
|
<div className="settings-page__content-item-col">
|
|
|
|
<ToggleButton
|
|
|
|
value={showTestNetworks}
|
|
|
|
onToggle={(value) => setShowTestNetworks(!value)}
|
|
|
|
offLabel={t('off')}
|
|
|
|
onLabel={t('on')}
|
|
|
|
/>
|
2019-03-25 17:13:23 +01:00
|
|
|
</div>
|
2023-08-04 13:33:47 +02:00
|
|
|
</Box>
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2019-03-25 17:13:23 +01:00
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
renderUseNonceOptIn() {
|
2021-02-04 19:15:23 +01:00
|
|
|
const { t } = this.context;
|
|
|
|
const { useNonceField, setUseNonceField } = this.props;
|
2019-09-27 06:30:36 +02:00
|
|
|
|
|
|
|
return (
|
2023-08-04 13:33:47 +02:00
|
|
|
<Box
|
2023-07-11 08:05:58 +02:00
|
|
|
ref={this.settingsRefs[5]}
|
2020-11-03 00:41:28 +01:00
|
|
|
className="settings-page__content-row"
|
|
|
|
data-testid="advanced-setting-custom-nonce"
|
2023-08-04 13:33:47 +02:00
|
|
|
display={Display.Flex}
|
|
|
|
flexDirection={FlexDirection.Row}
|
|
|
|
justifyContent={JustifyContent.spaceBetween}
|
2023-08-24 12:27:42 +02:00
|
|
|
gap={4}
|
2020-11-03 00:41:28 +01:00
|
|
|
>
|
2019-09-27 06:30:36 +02:00
|
|
|
<div className="settings-page__content-item">
|
2021-05-05 15:58:29 +02:00
|
|
|
<span>{t('nonceField')}</span>
|
2019-09-27 06:30:36 +02:00
|
|
|
<div className="settings-page__content-description">
|
2020-11-03 00:41:28 +01:00
|
|
|
{t('nonceFieldDescription')}
|
2019-09-27 06:30:36 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-08-04 13:33:47 +02:00
|
|
|
|
|
|
|
<div className="settings-page__content-item-col">
|
|
|
|
<ToggleButton
|
|
|
|
value={useNonceField}
|
|
|
|
onToggle={(value) => setUseNonceField(!value)}
|
|
|
|
offLabel={t('off')}
|
|
|
|
onLabel={t('on')}
|
|
|
|
/>
|
2019-09-27 06:30:36 +02:00
|
|
|
</div>
|
2023-08-04 13:33:47 +02:00
|
|
|
</Box>
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2019-09-27 06:30:36 +02:00
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
renderAutoLockTimeLimit() {
|
2021-02-04 19:15:23 +01:00
|
|
|
const { t } = this.context;
|
|
|
|
const { lockTimeError } = this.state;
|
2022-05-10 18:57:11 +02:00
|
|
|
const { setAutoLockTimeLimit } = this.props;
|
2019-05-08 20:57:21 +02:00
|
|
|
|
|
|
|
return (
|
2023-08-04 13:33:47 +02:00
|
|
|
<Box
|
2023-07-11 08:05:58 +02:00
|
|
|
ref={this.settingsRefs[6]}
|
2020-11-03 00:41:28 +01:00
|
|
|
className="settings-page__content-row"
|
|
|
|
data-testid="advanced-setting-auto-lock"
|
2023-08-04 13:33:47 +02:00
|
|
|
display={Display.Flex}
|
|
|
|
flexDirection={FlexDirection.Column}
|
2020-11-03 00:41:28 +01:00
|
|
|
>
|
2019-05-08 20:57:21 +02:00
|
|
|
<div className="settings-page__content-item">
|
2020-11-03 00:41:28 +01:00
|
|
|
<span>{t('autoLockTimeLimit')}</span>
|
2019-05-08 20:57:21 +02:00
|
|
|
<div className="settings-page__content-description">
|
2020-11-03 00:41:28 +01:00
|
|
|
{t('autoLockTimeLimitDescription')}
|
2019-05-08 20:57:21 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="settings-page__content-item">
|
|
|
|
<div className="settings-page__content-item-col">
|
|
|
|
<TextField
|
|
|
|
id="autoTimeout"
|
2022-11-09 18:20:10 +01:00
|
|
|
data-testid="auto-lockout-time"
|
2023-06-22 18:29:24 +02:00
|
|
|
placeholder="0"
|
|
|
|
value={this.state.autoLockTimeLimitBeforeNormalization}
|
2020-02-15 21:34:12 +01:00
|
|
|
onChange={(e) => this.handleLockChange(e.target.value)}
|
2020-01-21 23:09:53 +01:00
|
|
|
error={lockTimeError}
|
2019-05-08 20:57:21 +02:00
|
|
|
fullWidth
|
|
|
|
margin="dense"
|
|
|
|
min={0}
|
|
|
|
/>
|
2019-10-17 17:25:37 +02:00
|
|
|
<Button
|
|
|
|
type="primary"
|
2022-11-09 18:20:10 +01:00
|
|
|
data-testid="auto-lockout-button"
|
2019-10-17 17:25:37 +02:00
|
|
|
className="settings-tab__rpc-save-button"
|
2020-01-21 23:09:53 +01:00
|
|
|
disabled={lockTimeError !== ''}
|
2019-05-08 20:57:21 +02:00
|
|
|
onClick={() => {
|
2021-02-04 19:15:23 +01:00
|
|
|
setAutoLockTimeLimit(this.state.autoLockTimeLimit);
|
2019-05-08 20:57:21 +02:00
|
|
|
}}
|
|
|
|
>
|
2020-11-03 00:41:28 +01:00
|
|
|
{t('save')}
|
2019-10-17 17:25:37 +02:00
|
|
|
</Button>
|
2019-05-08 20:57:21 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-08-04 13:33:47 +02:00
|
|
|
</Box>
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2019-05-08 20:57:21 +02:00
|
|
|
}
|
|
|
|
|
2021-04-26 20:05:48 +02:00
|
|
|
renderLedgerLiveControl() {
|
|
|
|
const { t } = this.context;
|
2021-10-21 21:17:03 +02:00
|
|
|
const {
|
|
|
|
ledgerTransportType,
|
2021-11-08 16:28:40 +01:00
|
|
|
setLedgerTransportPreference,
|
2021-10-21 21:17:03 +02:00
|
|
|
userHasALedgerAccount,
|
2023-04-25 16:32:51 +02:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(desktop)
|
2023-02-23 17:39:48 +01:00
|
|
|
desktopEnabled,
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
2021-10-21 21:17:03 +02:00
|
|
|
} = this.props;
|
|
|
|
|
2023-04-25 16:32:51 +02:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(desktop)
|
2023-02-23 17:39:48 +01:00
|
|
|
if (desktopEnabled) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
|
|
|
|
2021-10-21 21:17:03 +02:00
|
|
|
const LEDGER_TRANSPORT_NAMES = {
|
|
|
|
LIVE: t('ledgerLive'),
|
|
|
|
WEBHID: t('webhid'),
|
|
|
|
U2F: t('u2f'),
|
|
|
|
};
|
|
|
|
|
|
|
|
const transportTypeOptions = [
|
|
|
|
{
|
|
|
|
name: LEDGER_TRANSPORT_NAMES.LIVE,
|
2023-01-20 16:14:40 +01:00
|
|
|
value: LedgerTransportTypes.live,
|
2021-10-21 21:17:03 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: LEDGER_TRANSPORT_NAMES.U2F,
|
2023-01-20 16:14:40 +01:00
|
|
|
value: LedgerTransportTypes.u2f,
|
2021-10-21 21:17:03 +02:00
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
if (window.navigator.hid) {
|
|
|
|
transportTypeOptions.push({
|
|
|
|
name: LEDGER_TRANSPORT_NAMES.WEBHID,
|
2023-01-20 16:14:40 +01:00
|
|
|
value: LedgerTransportTypes.webhid,
|
2021-10-21 21:17:03 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
const recommendedLedgerOption = window.navigator.hid
|
|
|
|
? LEDGER_TRANSPORT_NAMES.WEBHID
|
|
|
|
: LEDGER_TRANSPORT_NAMES.U2F;
|
2021-04-26 20:05:48 +02:00
|
|
|
|
|
|
|
return (
|
2023-08-04 13:33:47 +02:00
|
|
|
<Box
|
2023-07-11 08:05:58 +02:00
|
|
|
ref={this.settingsRefs[7]}
|
2023-02-23 17:39:48 +01:00
|
|
|
className="settings-page__content-row"
|
2023-08-04 13:33:47 +02:00
|
|
|
data-testid="ledger-live-control"
|
|
|
|
display={Display.Flex}
|
|
|
|
flexDirection={FlexDirection.Column}
|
2023-02-23 17:39:48 +01:00
|
|
|
>
|
2021-04-26 20:05:48 +02:00
|
|
|
<div className="settings-page__content-item">
|
2021-10-21 21:17:03 +02:00
|
|
|
<span>{t('preferredLedgerConnectionType')}</span>
|
2021-04-26 20:05:48 +02:00
|
|
|
<div className="settings-page__content-description">
|
2021-10-21 21:17:03 +02:00
|
|
|
{t('ledgerConnectionPreferenceDescription', [
|
|
|
|
recommendedLedgerOption,
|
|
|
|
<Button
|
|
|
|
key="ledger-connection-settings-learn-more"
|
|
|
|
type="link"
|
2022-08-23 16:19:31 +02:00
|
|
|
href={ZENDESK_URLS.HARDWARE_CONNECTION}
|
2021-10-21 21:17:03 +02:00
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
className="settings-page__inline-link"
|
|
|
|
>
|
|
|
|
{t('learnMore')}
|
|
|
|
</Button>,
|
|
|
|
])}
|
2021-04-26 20:05:48 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="settings-page__content-item">
|
|
|
|
<div className="settings-page__content-item-col">
|
2021-10-21 21:17:03 +02:00
|
|
|
<Dropdown
|
|
|
|
id="select-ledger-transport-type"
|
|
|
|
options={transportTypeOptions}
|
|
|
|
selectedOption={ledgerTransportType}
|
|
|
|
onChange={async (transportType) => {
|
2021-10-29 01:38:58 +02:00
|
|
|
if (
|
2023-01-20 16:14:40 +01:00
|
|
|
ledgerTransportType === LedgerTransportTypes.live &&
|
|
|
|
transportType === LedgerTransportTypes.webhid
|
2021-10-29 01:38:58 +02:00
|
|
|
) {
|
|
|
|
this.setState({ showLedgerTransportWarning: true });
|
|
|
|
}
|
2021-11-08 16:28:40 +01:00
|
|
|
setLedgerTransportPreference(transportType);
|
2021-10-21 21:17:03 +02:00
|
|
|
if (
|
2023-01-20 16:14:40 +01:00
|
|
|
transportType === LedgerTransportTypes.webhid &&
|
2021-10-21 21:17:03 +02:00
|
|
|
userHasALedgerAccount
|
|
|
|
) {
|
|
|
|
await window.navigator.hid.requestDevice({
|
|
|
|
filters: [{ vendorId: LEDGER_USB_VENDOR_ID }],
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}}
|
2021-04-26 20:05:48 +02:00
|
|
|
/>
|
2021-10-29 01:38:58 +02:00
|
|
|
{this.state.showLedgerTransportWarning ? (
|
|
|
|
<Dialog type="message">
|
|
|
|
<div className="settings-page__content-item-dialog">
|
|
|
|
{t('ledgerTransportChangeWarning')}
|
|
|
|
</div>
|
|
|
|
</Dialog>
|
|
|
|
) : null}
|
2021-04-26 20:05:48 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-08-04 13:33:47 +02:00
|
|
|
</Box>
|
2021-04-26 20:05:48 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-12-19 18:46:36 +01:00
|
|
|
renderDismissSeedBackupReminderControl() {
|
2021-02-04 19:15:23 +01:00
|
|
|
const { t } = this.context;
|
2022-12-19 18:46:36 +01:00
|
|
|
const { dismissSeedBackUpReminder, setDismissSeedBackUpReminder } =
|
|
|
|
this.props;
|
2019-12-12 20:28:07 +01:00
|
|
|
|
|
|
|
return (
|
2023-08-04 13:33:47 +02:00
|
|
|
<Box
|
2023-07-11 08:05:58 +02:00
|
|
|
ref={this.settingsRefs[8]}
|
2020-11-03 00:41:28 +01:00
|
|
|
className="settings-page__content-row"
|
2022-12-19 18:46:36 +01:00
|
|
|
data-testid="advanced-setting-dismiss-reminder"
|
2023-08-04 13:33:47 +02:00
|
|
|
display={Display.Flex}
|
|
|
|
flexDirection={FlexDirection.Row}
|
|
|
|
justifyContent={JustifyContent.spaceBetween}
|
2023-08-24 12:27:42 +02:00
|
|
|
gap={4}
|
2020-11-03 00:41:28 +01:00
|
|
|
>
|
2019-12-12 20:28:07 +01:00
|
|
|
<div className="settings-page__content-item">
|
2022-12-19 18:46:36 +01:00
|
|
|
<span>{t('dismissReminderField')}</span>
|
2019-12-12 20:28:07 +01:00
|
|
|
<div className="settings-page__content-description">
|
2022-12-19 18:46:36 +01:00
|
|
|
{t('dismissReminderDescriptionField')}
|
2019-12-12 20:28:07 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-08-04 13:33:47 +02:00
|
|
|
|
|
|
|
<div className="settings-page__content-item-col">
|
|
|
|
<ToggleButton
|
|
|
|
value={dismissSeedBackUpReminder}
|
|
|
|
onToggle={(value) => setDismissSeedBackUpReminder(!value)}
|
|
|
|
offLabel={t('off')}
|
|
|
|
onLabel={t('on')}
|
|
|
|
/>
|
2019-12-12 20:28:07 +01:00
|
|
|
</div>
|
2023-08-04 13:33:47 +02:00
|
|
|
</Box>
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2019-12-12 20:28:07 +01:00
|
|
|
}
|
|
|
|
|
2023-02-06 17:47:50 +01:00
|
|
|
renderToggleEthSignControl() {
|
2023-05-04 13:14:07 +02:00
|
|
|
const { t, trackEvent } = this.context;
|
|
|
|
const {
|
|
|
|
disabledRpcMethodPreferences,
|
|
|
|
showEthSignModal,
|
|
|
|
setDisabledRpcMethodPreference,
|
|
|
|
} = this.props;
|
|
|
|
const toggleOff = (value) => {
|
|
|
|
setDisabledRpcMethodPreference('eth_sign', !value);
|
|
|
|
trackEvent({
|
|
|
|
category: MetaMetricsEventCategory.Settings,
|
|
|
|
event: MetaMetricsEventName.OnboardingWalletAdvancedSettings,
|
|
|
|
properties: {
|
|
|
|
location: 'Settings',
|
|
|
|
enable_eth_sign: false,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
2023-02-06 17:47:50 +01:00
|
|
|
return (
|
2023-08-04 13:33:47 +02:00
|
|
|
<Box
|
2023-07-11 08:05:58 +02:00
|
|
|
ref={this.settingsRefs[9]}
|
2023-02-06 17:47:50 +01:00
|
|
|
className="settings-page__content-row"
|
|
|
|
data-testid="advanced-setting-toggle-ethsign"
|
2023-08-04 13:33:47 +02:00
|
|
|
display={Display.Flex}
|
2023-08-24 15:11:38 +02:00
|
|
|
flexDirection={FlexDirection.Column}
|
2023-02-06 17:47:50 +01:00
|
|
|
>
|
|
|
|
<div className="settings-page__content-item">
|
|
|
|
<span>{t('toggleEthSignField')}</span>
|
|
|
|
<div className="settings-page__content-description">
|
|
|
|
{t('toggleEthSignDescriptionField')}
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-08-04 13:33:47 +02:00
|
|
|
{disabledRpcMethodPreferences?.eth_sign ? (
|
2023-05-04 13:14:07 +02:00
|
|
|
<BannerAlert
|
2023-08-24 15:11:38 +02:00
|
|
|
severity={Severity.Danger}
|
|
|
|
marginTop={3}
|
|
|
|
marginBottom={4}
|
2023-05-04 13:14:07 +02:00
|
|
|
descriptionProps={{ variant: TextVariant.bodyMd }}
|
|
|
|
>
|
|
|
|
{t('toggleEthSignBannerDescription')}
|
|
|
|
</BannerAlert>
|
|
|
|
) : null}
|
2023-08-04 13:33:47 +02:00
|
|
|
|
|
|
|
<div className="settings-page__content-item-col">
|
|
|
|
<ToggleButton
|
|
|
|
className="eth-sign-toggle"
|
|
|
|
value={disabledRpcMethodPreferences?.eth_sign || false}
|
|
|
|
onToggle={(value) => {
|
|
|
|
value ? toggleOff(value) : showEthSignModal();
|
|
|
|
}}
|
|
|
|
offLabel={t('toggleEthSignOff')}
|
|
|
|
onLabel={t('toggleEthSignOn')}
|
|
|
|
/>
|
2023-02-06 17:47:50 +01:00
|
|
|
</div>
|
2023-08-04 13:33:47 +02:00
|
|
|
</Box>
|
2023-02-06 17:47:50 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-06-22 18:29:24 +02:00
|
|
|
handleLockChange(autoLockTimeLimitBeforeNormalization) {
|
2021-05-05 15:58:29 +02:00
|
|
|
const { t } = this.context;
|
|
|
|
|
2023-06-22 18:29:24 +02:00
|
|
|
if (autoLockTimeLimitBeforeNormalization === '') {
|
|
|
|
this.setState({
|
|
|
|
autoLockTimeLimitBeforeNormalization,
|
|
|
|
autoLockTimeLimit: DEFAULT_AUTO_LOCK_TIME_LIMIT.toString(),
|
|
|
|
lockTimeError: '',
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
2022-12-19 18:46:36 +01:00
|
|
|
|
2023-06-22 18:29:24 +02:00
|
|
|
const autoLockTimeLimitAfterNormalization = Number(
|
|
|
|
autoLockTimeLimitBeforeNormalization,
|
|
|
|
);
|
2022-12-19 18:46:36 +01:00
|
|
|
|
2023-06-22 18:29:24 +02:00
|
|
|
if (
|
|
|
|
Number.isNaN(autoLockTimeLimitAfterNormalization) ||
|
|
|
|
autoLockTimeLimitAfterNormalization < 0 ||
|
|
|
|
autoLockTimeLimitAfterNormalization > 10080
|
|
|
|
) {
|
|
|
|
this.setState({
|
|
|
|
autoLockTimeLimitBeforeNormalization,
|
|
|
|
autoLockTimeLimit: null,
|
|
|
|
lockTimeError: t('lockTimeInvalid'),
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const autoLockTimeLimit = autoLockTimeLimitAfterNormalization;
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
autoLockTimeLimitBeforeNormalization,
|
|
|
|
autoLockTimeLimit,
|
|
|
|
lockTimeError: '',
|
2022-12-19 18:46:36 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
renderUserDataBackup() {
|
|
|
|
const { t } = this.context;
|
2021-05-05 15:58:29 +02:00
|
|
|
return (
|
2023-08-04 13:33:47 +02:00
|
|
|
<Box
|
2023-07-11 08:05:58 +02:00
|
|
|
ref={this.settingsRefs[10]}
|
2021-05-05 15:58:29 +02:00
|
|
|
className="settings-page__content-row"
|
2022-12-19 18:46:36 +01:00
|
|
|
data-testid="advanced-setting-data-backup"
|
2023-08-04 13:33:47 +02:00
|
|
|
display={Display.Flex}
|
|
|
|
flexDirection={FlexDirection.Column}
|
2021-05-05 15:58:29 +02:00
|
|
|
>
|
|
|
|
<div className="settings-page__content-item">
|
2022-12-19 18:46:36 +01:00
|
|
|
<span>{t('backupUserData')}</span>
|
|
|
|
<span className="settings-page__content-description">
|
|
|
|
{t('backupUserDataDescription')}
|
|
|
|
</span>
|
2021-05-05 15:58:29 +02:00
|
|
|
</div>
|
|
|
|
<div className="settings-page__content-item">
|
|
|
|
<div className="settings-page__content-item-col">
|
2022-12-19 18:46:36 +01:00
|
|
|
<Button
|
|
|
|
data-testid="backup-button"
|
|
|
|
type="secondary"
|
|
|
|
large
|
|
|
|
onClick={() => this.backupUserData()}
|
|
|
|
>
|
|
|
|
{t('backup')}
|
|
|
|
</Button>
|
2021-05-05 15:58:29 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-08-04 13:33:47 +02:00
|
|
|
</Box>
|
2021-05-05 15:58:29 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-12-19 18:46:36 +01:00
|
|
|
renderRestoreUserData() {
|
2022-03-22 20:14:59 +01:00
|
|
|
const { t } = this.context;
|
2022-12-19 18:46:36 +01:00
|
|
|
const { showResultMessage, restoreSuccessful, restoreMessage } = this.state;
|
|
|
|
|
|
|
|
const defaultRestoreMessage = restoreSuccessful
|
|
|
|
? t('restoreSuccessful')
|
|
|
|
: t('restoreFailed');
|
|
|
|
const restoreMessageToRender =
|
|
|
|
restoreMessage === CORRUPT_JSON_FILE
|
|
|
|
? t('dataBackupSeemsCorrupt')
|
|
|
|
: defaultRestoreMessage;
|
2022-03-22 20:14:59 +01:00
|
|
|
|
|
|
|
return (
|
2023-08-04 13:33:47 +02:00
|
|
|
<Box
|
2023-07-11 08:05:58 +02:00
|
|
|
ref={this.settingsRefs[11]}
|
2022-03-22 20:14:59 +01:00
|
|
|
className="settings-page__content-row"
|
2022-12-19 18:46:36 +01:00
|
|
|
data-testid="advanced-setting-data-restore"
|
2023-08-04 13:33:47 +02:00
|
|
|
display={Display.Flex}
|
|
|
|
flexDirection={FlexDirection.Column}
|
2022-03-22 20:14:59 +01:00
|
|
|
>
|
|
|
|
<div className="settings-page__content-item">
|
2022-12-19 18:46:36 +01:00
|
|
|
<span>{t('restoreUserData')}</span>
|
|
|
|
<span className="settings-page__content-description">
|
|
|
|
{t('restoreUserDataDescription')}
|
|
|
|
</span>
|
2022-03-22 20:14:59 +01:00
|
|
|
</div>
|
|
|
|
<div className="settings-page__content-item">
|
|
|
|
<div className="settings-page__content-item-col">
|
2022-12-19 18:46:36 +01:00
|
|
|
<label
|
|
|
|
htmlFor="restore-file"
|
|
|
|
className="button btn btn--rounded btn-secondary btn--large settings-page__button"
|
|
|
|
>
|
|
|
|
{t('restore')}
|
|
|
|
</label>
|
|
|
|
<input
|
|
|
|
id="restore-file"
|
|
|
|
data-testid="restore-file"
|
|
|
|
style={{ visibility: 'hidden' }}
|
|
|
|
type="file"
|
|
|
|
accept=".json"
|
|
|
|
onChange={(e) => this.handleFileUpload(e)}
|
2022-03-22 20:14:59 +01:00
|
|
|
/>
|
|
|
|
</div>
|
2022-12-19 18:46:36 +01:00
|
|
|
{showResultMessage && (
|
|
|
|
<ActionableMessage
|
|
|
|
type={restoreSuccessful ? 'success' : 'danger'}
|
|
|
|
message={restoreMessageToRender}
|
|
|
|
primaryActionV2={{
|
|
|
|
label: t('dismiss'),
|
|
|
|
onClick: () => {
|
|
|
|
this.setState({
|
|
|
|
showResultMessage: false,
|
|
|
|
restoreSuccessful: true,
|
|
|
|
restoreMessage: null,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)}
|
2022-03-22 20:14:59 +01:00
|
|
|
</div>
|
2023-08-04 13:33:47 +02:00
|
|
|
</Box>
|
2022-03-22 20:14:59 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
render() {
|
2021-02-04 19:15:23 +01:00
|
|
|
const { warning } = this.props;
|
2019-03-25 17:13:23 +01:00
|
|
|
|
2021-11-02 08:24:24 +01:00
|
|
|
const notUsingFirefox = getPlatform() !== PLATFORM_FIREFOX;
|
|
|
|
|
2019-03-25 17:13:23 +01:00
|
|
|
return (
|
|
|
|
<div className="settings-page__body">
|
2021-10-21 18:11:31 +02:00
|
|
|
{warning ? <div className="settings-tab__error">{warning}</div> : null}
|
2020-11-03 00:41:28 +01:00
|
|
|
{this.renderStateLogs()}
|
|
|
|
{this.renderResetAccount()}
|
|
|
|
{this.renderHexDataOptIn()}
|
|
|
|
{this.renderShowConversionInTestnets()}
|
2021-10-28 21:31:05 +02:00
|
|
|
{this.renderToggleTestNetworks()}
|
2020-11-03 00:41:28 +01:00
|
|
|
{this.renderUseNonceOptIn()}
|
|
|
|
{this.renderAutoLockTimeLimit()}
|
2022-08-09 20:36:32 +02:00
|
|
|
{this.renderUserDataBackup()}
|
|
|
|
{this.renderRestoreUserData()}
|
2021-11-02 08:24:24 +01:00
|
|
|
{notUsingFirefox ? this.renderLedgerLiveControl() : null}
|
2021-05-05 15:58:29 +02:00
|
|
|
{this.renderDismissSeedBackupReminderControl()}
|
2023-02-06 17:47:50 +01:00
|
|
|
{this.renderToggleEthSignControl()}
|
2019-03-25 17:13:23 +01:00
|
|
|
</div>
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2019-03-25 17:13:23 +01:00
|
|
|
}
|
|
|
|
}
|