Skip to content

Commit

Permalink
Merge branch 'master' into usereducer
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosrdz committed Dec 16, 2023
2 parents 4865633 + 49cb843 commit bc534ef
Show file tree
Hide file tree
Showing 61 changed files with 9,012 additions and 6,368 deletions.
2 changes: 0 additions & 2 deletions Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import EncryptStorage from './screen/settings/encryptStorage';
import PlausibleDeniability from './screen/plausibledeniability';
import LightningSettings from './screen/settings/lightningSettings';
import ElectrumSettings from './screen/settings/electrumSettings';
import TorSettings from './screen/settings/torSettings';
import Tools from './screen/settings/tools';
import GeneralSettings from './screen/settings/GeneralSettings';
import NetworkSettings from './screen/settings/NetworkSettings';
Expand Down Expand Up @@ -130,7 +129,6 @@ const WalletsRoot = () => {
/>
<WalletsStack.Screen name="LightningSettings" component={LightningSettings} options={LightningSettings.navigationOptions(theme)} />
<WalletsStack.Screen name="ElectrumSettings" component={ElectrumSettings} options={ElectrumSettings.navigationOptions(theme)} />
<WalletsStack.Screen name="TorSettings" component={TorSettings} options={TorSettings.navigationOptions(theme)} />
<WalletsStack.Screen name="SettingsPrivacy" component={SettingsPrivacy} options={SettingsPrivacy.navigationOptions(theme)} />
<WalletsStack.Screen name="Tools" component={Tools} options={Tools.navigationOptions(theme)} />
<WalletsStack.Screen name="LNDViewInvoice" component={LNDViewInvoice} options={LNDViewInvoice.navigationOptions(theme)} />
Expand Down
1 change: 0 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ dependencies {
implementation("com.facebook.react:react-android")
implementation files("../../node_modules/rn-ldk/android/libs/LDK-release.aar")
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")
implementation files("../../node_modules/react-native-tor/android/libs/sifir_android.aar")

if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
Expand Down
21 changes: 3 additions & 18 deletions blue_modules/BlueElectrum.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ import { LegacyWallet, SegwitBech32Wallet, SegwitP2SHWallet, TaprootWallet } fro
import DefaultPreference from 'react-native-default-preference';
import loc from '../loc';
import WidgetCommunication from './WidgetCommunication';
import { isTorCapable, isTorDaemonDisabled } from './environment';
import alert from '../components/Alert';
const bitcoin = require('bitcoinjs-lib');
const ElectrumClient = require('electrum-client');
const reverse = require('buffer-reverse');
const BigNumber = require('bignumber.js');
const torrific = isTorCapable ? require('./torrific') : require('../scripts/maccatalystpatches/torrific.js');

const Realm = require('realm');

Expand Down Expand Up @@ -123,13 +121,7 @@ async function connectMain() {

try {
console.log('begin connection:', JSON.stringify(usingPeer));
mainClient = new ElectrumClient(
usingPeer.host.endsWith('.onion') && !(await isTorDaemonDisabled()) ? torrific : global.net,
global.tls,
usingPeer.ssl || usingPeer.tcp,
usingPeer.host,
usingPeer.ssl ? 'tls' : 'tcp',
);
mainClient = new ElectrumClient(global.net, global.tls, usingPeer.ssl || usingPeer.tcp, usingPeer.host, usingPeer.ssl ? 'tls' : 'tcp');

mainClient.onError = function (e) {
console.log('electrum mainClient.onError():', e.message);
Expand Down Expand Up @@ -941,21 +933,14 @@ module.exports.calculateBlockTime = function (height) {
* @returns {Promise<boolean>} Whether provided host:port is a valid electrum server
*/
module.exports.testConnection = async function (host, tcpPort, sslPort) {
const isTorDisabled = await isTorDaemonDisabled();
const client = new ElectrumClient(
host.endsWith('.onion') && !isTorDisabled ? torrific : global.net,
global.tls,
sslPort || tcpPort,
host,
sslPort ? 'tls' : 'tcp',
);
const client = new ElectrumClient(global.net, global.tls, sslPort || tcpPort, host, sslPort ? 'tls' : 'tcp');

client.onError = () => {}; // mute
let timeoutId = false;
try {
const rez = await Promise.race([
new Promise(resolve => {
timeoutId = setTimeout(() => resolve('timeout'), host.endsWith('.onion') && !isTorDisabled ? 21000 : 5000);
timeoutId = setTimeout(() => resolve('timeout'), 5000);
}),
client.connect(),
]);
Expand Down
9 changes: 0 additions & 9 deletions blue_modules/storage-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { FiatUnit } from '../models/fiatUnit';
import Notifications from '../blue_modules/notifications';
import loc, { STORAGE_KEY as LOC_STORAGE_KEY } from '../loc';
import { LegacyWallet, WatchOnlyWallet } from '../class';
import { isTorDaemonDisabled, setIsTorDaemonDisabled } from './environment';
import alert from '../components/Alert';
const BlueApp = require('../BlueApp');
const BlueElectrum = require('./BlueElectrum');
Expand All @@ -28,13 +27,11 @@ export const BlueStorageProvider = ({ children }) => {
const getLanguageAsyncStorage = useAsyncStorage(LOC_STORAGE_KEY).getItem;
const [isHandOffUseEnabled, setIsHandOffUseEnabled] = useState(false);
const [isElectrumDisabled, setIsElectrumDisabled] = useState(true);
const [isTorDisabled, setIsTorDisabled] = useState(false);
const [isPrivacyBlurEnabled, setIsPrivacyBlurEnabled] = useState(true);
const [currentSharedCosigner, setCurrentSharedCosigner] = useState('');

useEffect(() => {
BlueElectrum.isDisabled().then(setIsElectrumDisabled);
isTorDaemonDisabled().then(setIsTorDisabled);
}, []);

useEffect(() => {
Expand All @@ -44,10 +41,6 @@ export const BlueStorageProvider = ({ children }) => {
}
}, [isPrivacyBlurEnabled]);

useEffect(() => {
setIsTorDaemonDisabled(isTorDisabled);
}, [isTorDisabled]);

const setIsHandOffUseEnabledAsyncStorage = value => {
setIsHandOffUseEnabled(value);
return BlueApp.setIsHandoffEnabled(value);
Expand Down Expand Up @@ -283,8 +276,6 @@ export const BlueStorageProvider = ({ children }) => {
isDoNotTrackEnabled,
isElectrumDisabled,
setIsElectrumDisabled,
isTorDisabled,
setIsTorDisabled,
isPrivacyBlurEnabled,
setIsPrivacyBlurEnabled,
}}
Expand Down
Loading

0 comments on commit bc534ef

Please sign in to comment.