Merge pull request #5257 from BlueWallet/add-performance-measure

ADD: performance measure button on settings/about screen
This commit is contained in:
GLaDOS 2023-01-05 18:00:32 +00:00 committed by GitHub
commit 0bcceb6a3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 1 deletions

View File

@ -211,6 +211,8 @@
"about_license": "MIT License",
"about_release_notes": "Release notes",
"about_review": "Leave us a review",
"performance_score": "Performance score: {num}",
"run_performance_test": "Test performance",
"about_selftest": "Run self-test",
"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.",

View File

@ -1,5 +1,5 @@
import React, { useContext } from 'react';
import { TouchableOpacity, ScrollView, Linking, Image, View, Text, StyleSheet, useWindowDimensions, Platform } from 'react-native';
import { TouchableOpacity, ScrollView, Linking, Image, View, Text, StyleSheet, useWindowDimensions, Platform, Alert } from 'react-native';
import { useNavigation, useTheme } from '@react-navigation/native';
import { Icon } from 'react-native-elements';
import { getApplicationName, getVersion, getBundleId, getBuildNumber, getUniqueId, hasGmsSync } from 'react-native-device-info';
@ -10,6 +10,7 @@ import loc, { formatStringAddTwoWhiteSpaces } from '../../loc';
import Clipboard from '@react-native-clipboard/clipboard';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import alert from '../../components/Alert';
import { HDSegwitBech32Wallet } from '../../class';
const A = require('../../blue_modules/analytics');
const branch = require('../../current-branch.json');
@ -208,6 +209,31 @@ const About = () => {
testID="RunSelfTestButton"
title={loc.settings.about_selftest}
/>
<BlueListItem
leftIcon={{
name: 'flask',
type: 'font-awesome',
color: '#FC0D44',
}}
chevron
onPress={async () => {
const secret = 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about';
const w = new HDSegwitBech32Wallet();
w.setSecret(secret);
const start = Date.now();
let num;
for (num = 0; num < 1000; num++) {
w._getExternalAddressByIndex(num);
if (Date.now() - start > 10 * 1000) {
break;
}
}
Alert.alert(loc.formatString(loc.settings.performance_score, { num }));
}}
title={loc.settings.run_performance_test}
/>
<BlueSpacing20 />
<BlueSpacing20 />
<BlueTextCentered>