Merge branch 'master' into successscreen

This commit is contained in:
Overtorment 2020-06-13 16:50:18 +01:00 committed by GitHub
commit df706619df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 182 additions and 105 deletions

View file

@ -2026,7 +2026,7 @@ export class WalletsCarousel extends Component {
itemWidth={itemWidth}
inactiveSlideScale={1}
inactiveSlideOpacity={0.7}
initialNumToRender={20}
initialNumToRender={4}
onLayout={this.onLayout}
contentContainerCustomStyle={{ left: -20 }}
/>

View file

@ -50,7 +50,7 @@ async function connectMain() {
mainClient.close();
mainConnected = false;
setTimeout(connectMain, 500);
console.warn('reconnecting after socket error');
console.log('reconnecting after socket error');
return;
}
mainConnected = false;
@ -148,11 +148,15 @@ module.exports.getConfig = async function () {
return {
host: mainClient.host,
port: mainClient.port,
status: mainClient.status && mainConnected ? 1 : 0,
status: mainClient.status ? 1 : 0,
serverName,
};
};
module.exports.getSecondsSinceLastRequest = function () {
return mainClient && mainClient.timeLastCall ? (+new Date() - mainClient.timeLastCall) / 1000 : -1;
};
/**
*
* @param address {String}

View file

@ -140,7 +140,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "5.4.1"
versionName "5.4.2"
multiDexEnabled true
missingDimensionStrategy 'react-native-camera', 'general'
testBuildType System.getProperty('testBuildType', 'debug') // This will later be used to control the test apk build type

114
blue_modules/net.js Normal file
View file

@ -0,0 +1,114 @@
/**
* @fileOverview adapter for ReactNative TCP module
* This module mimics the nodejs net api and is intended to work in RN environment.
* @see https://github.com/Rapsssito/react-native-tcp-socket
*/
import TcpSocket from 'react-native-tcp-socket';
/**
* Constructor function. Resulting object has to act as it was a real socket (basically
* conform to nodejs/net api)
*
* @constructor
*/
function Socket() {
this._socket = false; // reference to socket thats gona be created later
this._listeners = {};
// functions not supported by RN module, yet:
this.setTimeout = () => {};
this.setEncoding = () => {};
this.setKeepAlive = () => {};
this.setNoDelay = () => {};
this.connect = (port, host, callback) => {
this._socket = TcpSocket.createConnection(
{
port,
host,
tls: false,
},
callback,
);
this._socket.on('data', data => {
this._passOnEvent('data', data);
});
this._socket.on('end', data => {
this._passOnEvent('end', data);
});
this._socket.on('timeout', () => {
this._passOnEvent('timeout');
});
this._socket.on('onerror', data => {
this._passOnEvent('onerror', data);
});
this._socket.on('error', data => {
this._passOnEvent('error', data);
});
this._socket.on('close', data => {
this._passOnEvent('close', data);
});
this._socket.on('connect', data => {
this._passOnEvent('connect', data);
});
this._socket.on('secureConnect', data => {
this._passOnEvent('secureConnect', data);
});
this._socket.on('connection', data => {
this._passOnEvent('connection', data);
});
};
this._passOnEvent = (event, data) => {
this._listeners[event] = this._listeners[event] || [];
for (const savedListener of this._listeners[event]) {
savedListener(data);
}
};
this.on = (event, listener) => {
this._listeners[event] = this._listeners[event] || [];
this._listeners[event].push(listener);
};
this.removeListener = (event, listener) => {
this._listeners[event] = this._listeners[event] || [];
const newListeners = [];
let found = false;
for (const savedListener of this._listeners[event]) {
if (savedListener === listener) {
// found our listener
found = true;
// we just skip it
} else {
// other listeners should go back to original array
newListeners.push(savedListener);
}
}
if (found) {
this._listeners[event] = newListeners;
} else {
// something went wrong, lets just cleanup all listeners
this._listeners[event] = [];
}
};
this.end = () => {
this._socket.end();
};
this.destroy = () => {
this._socket.destroy();
};
this.write = data => {
this._socket.write(data);
};
}
module.exports.Socket = Socket;

33
blue_modules/tls.js Normal file
View file

@ -0,0 +1,33 @@
/**
* @fileOverview adapter for ReactNative TCP module
* This module mimics the nodejs tls api and is intended to work in RN environment.
* @see https://github.com/Rapsssito/react-native-tcp-socket
*/
import TcpSocket from 'react-native-tcp-socket';
/**
* Constructor function. Mimicking nodejs/tls api
*
* @constructor
*/
function connect(config, callback) {
const client = TcpSocket.createConnection(
{
port: config.port,
host: config.host,
tls: true,
tlsCheckValidity: config.rejectUnauthorized,
},
callback,
);
// functions not supported by RN module, yet:
client.setEncoding = () => {};
client.setKeepAlive = () => {};
client.setNoDelay = () => {};
return client;
}
module.exports.connect = connect;

View file

@ -48,7 +48,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>5.4.1</string>
<string>5.4.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>

View file

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>5.4.1</string>
<string>5.4.2</string>
<key>CFBundleVersion</key>
<string>239</string>
<key>CLKComplicationPrincipalClass</key>

View file

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>5.4.1</string>
<string>5.4.2</string>
<key>CFBundleVersion</key>
<string>239</string>
<key>UISupportedInterfaceOrientations</key>

View file

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>5.4.1</string>
<string>5.4.2</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSExtension</key>

98
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "bluewallet",
"version": "5.4.1",
"version": "5.4.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -5435,8 +5435,8 @@
"integrity": "sha512-2fvco0F2bBIgqzO8GRP0Jt/91pdrf9KfZ5FsmkYkjERmIJG585cFeFZV4+CO6oTmU3HmCTgfcZuEa7kW8VUh3A=="
},
"electrum-client": {
"version": "git+https://github.com/BlueWallet/rn-electrum-client.git#2a5bb11dd9a8d89f328049d9ed59bce49d88a15d",
"from": "git+https://github.com/BlueWallet/rn-electrum-client.git#2a5bb11dd9a8d89f328049d9ed59bce49d88a15d"
"version": "git+https://github.com/BlueWallet/rn-electrum-client.git#cc018effafd2256272f348953500c4d27cef0d2f",
"from": "git+https://github.com/BlueWallet/rn-electrum-client.git#cc018effafd2256272f348953500c4d27cef0d2f"
},
"electrum-mnemonic": {
"version": "2.0.0",
@ -7900,11 +7900,6 @@
"resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz",
"integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA=="
},
"ip-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-3.0.0.tgz",
"integrity": "sha512-T8wDtjy+Qf2TAPDQmBp0eGKJ8GavlWlUnamr3wRn6vvdZlKVuJXXMlSncYFRYgVHOM3If5NR1H4+OvVQU9Idvg=="
},
"is": {
"version": "0.2.7",
"resolved": "https://registry.npmjs.org/is/-/is-0.2.7.tgz",
@ -12087,89 +12082,12 @@
"css-tree": "^1.0.0-alpha.37"
}
},
"react-native-tcp": {
"version": "git+https://github.com/BlueWallet/react-native-tcp.git#113433d505063d58a17317e925f03f65e7fc5c3d",
"from": "git+https://github.com/BlueWallet/react-native-tcp.git",
"react-native-tcp-socket": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/react-native-tcp-socket/-/react-native-tcp-socket-3.6.0.tgz",
"integrity": "sha512-lGnlklcHNCQSgdVhrF4fwslc6Xjk3nXLVqjqvJY1pSEJ9H8S4clZR4uwohfbM16VrHnUhBh4o/1wGRO/xrp7nQ==",
"requires": {
"base64-js": "1.3.0",
"buffer": "5.2.1",
"events": "3.0.0",
"ip-regex": "3.0.0",
"process": "0.11.10",
"stream-browserify": "2.0.1",
"util": "0.11.1"
},
"dependencies": {
"base64-js": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz",
"integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw=="
},
"buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz",
"integrity": "sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg==",
"requires": {
"base64-js": "^1.0.2",
"ieee754": "^1.1.4"
}
},
"events": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/events/-/events-3.0.0.tgz",
"integrity": "sha512-Dc381HFWJzEOhQ+d8pkNon++bk9h6cdAoAj4iE6Q4y6xgTzySWXlKn05/TVNpjnfRqi/X0EpJEJohPjNI3zpVA=="
},
"readable-stream": {
"version": "2.3.7",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
},
"stream-browserify": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz",
"integrity": "sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds=",
"requires": {
"inherits": "~2.0.1",
"readable-stream": "^2.0.2"
}
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"requires": {
"safe-buffer": "~5.1.0"
}
},
"util": {
"version": "0.11.1",
"resolved": "https://registry.npmjs.org/util/-/util-0.11.1.tgz",
"integrity": "sha512-HShAsny+zS2TZfaXxD9tYj4HQGlBezXZMZuM/S5PKLLoZkShZiGk9o5CzukI1LVHZvjdvZ2Sj1aW/Ndn2NB/HQ==",
"requires": {
"inherits": "2.0.3"
},
"dependencies": {
"inherits": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
}
}
}
"buffer": "^5.4.3"
}
},
"react-native-tooltip": {

View file

@ -1,6 +1,6 @@
{
"name": "bluewallet",
"version": "5.4.1",
"version": "5.4.2",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.9.6",
@ -83,7 +83,7 @@
"dayjs": "1.8.27",
"detox": "16.7.1",
"ecurve": "1.0.6",
"electrum-client": "git+https://github.com/BlueWallet/rn-electrum-client.git#2a5bb11dd9a8d89f328049d9ed59bce49d88a15d",
"electrum-client": "git+https://github.com/BlueWallet/rn-electrum-client.git#cc018effafd2256272f348953500c4d27cef0d2f",
"electrum-mnemonic": "2.0.0",
"eslint-config-prettier": "6.11.0",
"eslint-config-standard": "14.1.1",
@ -132,7 +132,7 @@
"react-native-snap-carousel": "3.9.1",
"react-native-sortable-list": "0.0.24",
"react-native-svg": "9.13.6",
"react-native-tcp": "git+https://github.com/BlueWallet/react-native-tcp.git",
"react-native-tcp-socket": "3.6.0",
"react-native-tooltip": "git+https://github.com/marcosrdz/react-native-tooltip.git",
"react-native-vector-icons": "6.6.0",
"react-native-watch-connectivity": "0.4.2",

View file

@ -109,7 +109,7 @@ export default class ElectrumSettings extends Component {
this.setState({
config: await BlueElectrum.getConfig(),
});
}, 1000);
}, 500);
this.setState({
config: await BlueElectrum.getConfig(),
@ -145,7 +145,9 @@ export default class ElectrumSettings extends Component {
await AsyncStorage.setItem(AppStorage.ELECTRUM_SSL_PORT, sslPort);
alert('Your changes have been saved successfully. Restart may be required for changes to take effect.');
}
} catch (_) {}
} catch (error) {
alert(error);
}
this.setState({ isLoading: false });
});
};

View file

@ -653,6 +653,7 @@ export default class WalletsList extends Component {
renderItem={this.renderSectionItem}
keyExtractor={this.sectionListKeyExtractor}
renderSectionHeader={this.renderSectionHeader}
initialNumToRender={20}
contentInset={styles.scrollContent}
renderSectionFooter={this.renderSectionFooter}
sections={[

View file

@ -15,8 +15,13 @@ if (typeof process === 'undefined') {
process.browser = false;
global.net = require('react-native-tcp');
global.tls = require('react-native-tcp/tls');
// global.net = require('react-native-tcp');
// global.tls = require('react-native-tcp/tls');
//
// since new TCP/TLS module for React Native has different api from what is expected from nodejs/net & nodejs/tls
// (or from old module) we wrap this module in adapter:
global.net = require('./blue_modules/net');
global.tls = require('./blue_modules/tls');
// global.location = global.location || { port: 80 }
const isDev = typeof __DEV__ === 'boolean' && __DEV__;