REF: Throw alert

This commit is contained in:
Marcos Rodriguez Vélez 2021-08-28 03:08:58 -04:00
parent b9d188c1d1
commit 3f6e3b5408
3 changed files with 10 additions and 9 deletions

View File

@ -246,7 +246,7 @@
"about_release_notes": "Release notes",
"about_review": "Leave us a review",
"about_selftest": "Run self-test",
"about_selftest_electrum_disabled": "Offline mode enabled. Unable to proceed with tests. Please disable Offline Mode and try again.",
"about_selftest_electrum_disabled": "Self testing is not available with Electrum Offline Mode. Please disable offline mode and try again.",
"about_selftest_ok": "All internal tests have passed successfully. The wallet works well.",
"about_sm_github": "GitHub",
"about_sm_discord": "Discord Server",

View File

@ -15,7 +15,6 @@ import {
HDAezeedWallet,
SLIP39LegacyP2PKHWallet,
} from '../class';
import { BlueStorageContext } from '../blue_modules/storage-context';
const bitcoin = require('bitcoinjs-lib');
const BlueCrypto = require('react-native-blue-crypto');
const encryption = require('../blue_modules/encryption');
@ -28,7 +27,6 @@ const styles = StyleSheet.create({
});
export default class Selftest extends Component {
static contextType = BlueStorageContext;
constructor(props) {
super(props);
this.state = {
@ -57,10 +55,6 @@ export default class Selftest extends Component {
//
if (this.context.isElectrumDisabled) {
throw new Error(loc.settings.about_selftest_electrum_disabled);
}
if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
await BlueElectrum.ping();
await BlueElectrum.waitTillConnected();

View File

@ -1,4 +1,5 @@
import React from 'react';
/* global alert */
import React, { useContext } from 'react';
import { TouchableOpacity, ScrollView, Linking, Image, View, Text, StyleSheet, useWindowDimensions, Platform } from 'react-native';
import { useNavigation, useTheme } from '@react-navigation/native';
import { Icon } from 'react-native-elements';
@ -10,11 +11,13 @@ import navigationStyle from '../../components/navigationStyle';
import loc, { formatStringAddTwoWhiteSpaces } from '../../loc';
import Clipboard from '@react-native-clipboard/clipboard';
import Bugsnag from '@bugsnag/react-native';
import { BlueStorageContext } from '../../blue_modules/storage-context';
const About = () => {
const { navigate } = useNavigation();
const { colors } = useTheme();
const { width, height } = useWindowDimensions();
const { isElectrumDisabled } = useContext(BlueStorageContext);
const styles = StyleSheet.create({
copyToClipboard: {
justifyContent: 'center',
@ -75,7 +78,11 @@ const About = () => {
};
const handleOnSelfTestPress = () => {
navigate('Selftest');
if (isElectrumDisabled) {
alert(loc.settings.about_selftest_electrum_disabled);
} else {
navigate('Selftest');
}
};
const handleOnLicensingPress = () => {