Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gruve-p committed Dec 16, 2023
2 parents 4f4107c + fb80ca5 commit 4b38fc0
Show file tree
Hide file tree
Showing 58 changed files with 115 additions and 768 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
44 changes: 23 additions & 21 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto">
xmlns:tools="http://schemas.android.com/tools"
android:installLocation="auto">

<uses-feature
android:name="android.hardware.camera"
android:required="false" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
Expand Down Expand Up @@ -79,26 +84,23 @@
<data android:scheme="http" />
<data android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:mimeType="application/octet-stream"
android:host="*"
android:pathPattern=".*\\.psbt"
/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:mimeType="text/plain"
android:host="*"
android:pathPattern=".*\\.psbt"
/>
</intent-filter>
<intent-filter tools:ignore="AppLinkUrlError">
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:mimeType="application/octet-stream"
android:pathPattern=".*\\.psbt" />
</intent-filter>
<intent-filter tools:ignore="AppLinkUrlError">
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:mimeType="text/plain"
android:pathPattern=".*\\.psbt" />
</intent-filter>

</activity>

<meta-data android:name="com.bugsnag.android.API_KEY" android:value="17ba9059f676f1cc4f45d98182388b01" />
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('groestlcoinjs-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 @@ -157,13 +155,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 @@ -975,21 +967,14 @@ module.exports.calculateBlockTime = function (height) {
* @returns {Promise<boolean>} Whether provided host:port is a valid electrum-grs 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 4b38fc0

Please sign in to comment.