diff --git a/app/src/page/settings/view.js b/app/src/page/settings/view.js
index 86a3e34e..101e0738 100644
--- a/app/src/page/settings/view.js
+++ b/app/src/page/settings/view.js
@@ -17,6 +17,9 @@ class SettingsPage extends React.PureComponent {
setClientSetting
} = this.props;
+ // default to true if the setting is null or undefined
+ const actualKeepDaemonRunning = (keepDaemonRunning === null || keepDaemonRunning === undefined) ? true : keepDaemonRunning;
+
return (
Enable this option for quicker app launch and to keep the synchronisation with the blockchain up to date.
- {
+ {
setClientSetting(SETTINGS.KEEP_DAEMON_RUNNING, value);
if (NativeModules.DaemonServiceControl) {
NativeModules.DaemonServiceControl.setKeepDaemonRunning(value);
diff --git a/app/src/page/splash/view.js b/app/src/page/splash/view.js
index bbefcf41..d8af7049 100644
--- a/app/src/page/splash/view.js
+++ b/app/src/page/splash/view.js
@@ -49,13 +49,19 @@ class SplashScreen extends React.PureComponent {
updateStatus() {
Lbry.status().then(status => {
+ console.log(status);
this._updateStatusCallback(status);
});
}
_updateStatusCallback(status) {
const startupStatus = status.startup_status;
- if (startupStatus.code == 'started') {
+ // At the minimum, database, stream_identifier and wallet should be started before calling resolve
+ const hasStarted = startupStatus.database &&
+ startupStatus.wallet &&
+ startupStatus.stream_identifier &&
+ status.wallet.blocks_behind == 0;
+ if (hasStarted) {
// Wait until we are able to resolve a name before declaring
// that we are done.
// TODO: This is a hack, and the logic should live in the daemon
@@ -88,37 +94,36 @@ class SplashScreen extends React.PureComponent {
return;
}
- const blockchainStatus = status.blockchain_status;
- if (blockchainStatus) {
+ const blockchainHeaders = status.blockchain_headers;
+ const walletStatus = status.wallet;
+
+ if (blockchainHeaders) {
this.setState({
- isDownloadingHeaders: blockchainStatus.is_downloading_headers,
- headersDownloadProgress: blockchainStatus.headers_download_progress
+ isDownloadingHeaders: blockchainHeaders.downloading_headers,
+ headersDownloadProgress: blockchainHeaders.download_progress
});
}
- if (blockchainStatus && (blockchainStatus.is_downloading_headers ||
- (this.state.didDownloadHeaders && 'loading_wallet' === startupStatus.code))) {
+ if (blockchainHeaders && blockchainHeaders.downloading_headers && blockchainHeaders.download_progress < 100) {
if (!this.state.didDownloadHeaders) {
this.setState({ didDownloadHeaders: true });
}
+ const downloadProgress = blockchainHeaders.download_progress ? blockchainHeaders.download_progress : 0;
this.setState({
message: 'Blockchain Sync',
- details: `Catching up with the blockchain (${blockchainStatus.headers_download_progress}%)`,
- isLagging: startupStatus.is_lagging
+ details: `Catching up with the blockchain (${downloadProgress}%)`,
});
- } else if (blockchainStatus && blockchainStatus.blocks_behind > 0) {
- const behind = blockchainStatus.blocks_behind;
+ } else if (walletStatus && walletStatus.blocks_behind > 0) {
+ const behind = walletStatus.blocks_behind;
const behindText = behind + ' block' + (behind == 1 ? '' : 's') + ' behind';
this.setState({
message: 'Blockchain Sync',
details: behindText,
- isLagging: startupStatus.is_lagging,
});
} else {
this.setState({
message: 'Network Loading',
- details: startupStatus.message + (startupStatus.is_lagging ? '' : '...'),
- isLagging: startupStatus.is_lagging,
+ details: 'Initializing LBRY service...'
});
}
setTimeout(() => {
diff --git a/app/src/redux/reducers/settings.js b/app/src/redux/reducers/settings.js
index 8d3db6a7..b4bd1b97 100644
--- a/app/src/redux/reducers/settings.js
+++ b/app/src/redux/reducers/settings.js
@@ -1,22 +1,10 @@
import { AsyncStorage } from 'react-native';
import { ACTIONS, SETTINGS } from 'lbry-redux';
-getAsyncStorageItem = key => {
- return AsyncStorage.getItem(key).then(value => {
- if (['true', 'false'].indexOf(value) > -1) {
- return value === 'true';
- }
- return value;
- });
-};
const reducers = {};
const defaultState = {
- clientSettings: {
- backgroundPlayEnabled: getAsyncStorageItem(SETTINGS.BACKGROUND_PLAY_ENABLED),
- keepDaemonRunning: getAsyncStorageItem(SETTINGS.KEEP_DAEMON_RUNNING),
- showNsfw: getAsyncStorageItem(SETTINGS.SHOW_NSFW)
- }
+ clientSettings: {}
};
reducers[ACTIONS.CLIENT_SETTING_CHANGED] = (state, action) => {
@@ -24,7 +12,6 @@ reducers[ACTIONS.CLIENT_SETTING_CHANGED] = (state, action) => {
const clientSettings = Object.assign({}, state.clientSettings);
clientSettings[key] = value;
- AsyncStorage.setItem(key, String(value));
return Object.assign({}, state, {
clientSettings,
diff --git a/buildozer.spec.sample b/buildozer.spec.sample
index 91603859..dc8de34c 100644
--- a/buildozer.spec.sample
+++ b/buildozer.spec.sample
@@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py
# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
-requirements = openssl, sqlite3, hostpython2, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, functools32, miniupnpc==1.9, gmpy==1.17, twisted==16.6.0, appdirs==1.4.3, argparse==1.2.1, docopt==0.6.2, base58==0.2.2, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse==0.2.0, jsonrpc==1.2, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2==1.3, pyyaml==3.12, qrcode==5.2.2, requests==2.9.1, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, slowaes==0.1a1, txJSON-RPC==0.5, wsgiref==0.1.2, zope.interface==4.3.3, protobuf==3.2.0, keyring==10.4.0, git+https://github.com/lbryio/lbryschema.git@v0.0.16#egg=lbryschema, git+https://github.com/lbryio/lbryum.git#egg=lbryum, git+https://github.com/lbryio/lbry.git@v0.20.4#egg=lbrynet, asn1crypto, cryptography==2.2.2, pyopenssl==17.4.0, treq==17.8.0, funcsigs, mock, pbr, unqlite
+requirements = openssl, sqlite3, hostpython2, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, functools32, miniupnpc==1.9, gmpy==1.17, twisted==16.6.0, appdirs==1.4.3, argparse==1.2.1, docopt==0.6.2, base58==0.2.2, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse==0.2.0, jsonrpc==1.2, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2==1.3, pyyaml==3.12, qrcode==5.2.2, requests==2.9.1, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, slowaes==0.1a1, txJSON-RPC==0.5, wsgiref==0.1.2, zope.interface==4.3.3, protobuf==3.2.0, keyring==10.4.0, netifaces, txupnp==0.0.1a10, git+https://github.com/lbryio/lbryschema.git@v0.0.16#egg=lbryschema, git+https://github.com/lbryio/lbryum.git#egg=lbryum, git+https://github.com/lbryio/lbry.git#egg=lbrynet, asn1crypto, cryptography==2.2.2, pyopenssl==17.4.0, treq==17.8.0, funcsigs, mock, pbr, unqlite
# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
diff --git a/buildozer.spec.travis b/buildozer.spec.travis
index 91603859..dc8de34c 100644
--- a/buildozer.spec.travis
+++ b/buildozer.spec.travis
@@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py
# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
-requirements = openssl, sqlite3, hostpython2, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, functools32, miniupnpc==1.9, gmpy==1.17, twisted==16.6.0, appdirs==1.4.3, argparse==1.2.1, docopt==0.6.2, base58==0.2.2, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse==0.2.0, jsonrpc==1.2, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2==1.3, pyyaml==3.12, qrcode==5.2.2, requests==2.9.1, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, slowaes==0.1a1, txJSON-RPC==0.5, wsgiref==0.1.2, zope.interface==4.3.3, protobuf==3.2.0, keyring==10.4.0, git+https://github.com/lbryio/lbryschema.git@v0.0.16#egg=lbryschema, git+https://github.com/lbryio/lbryum.git#egg=lbryum, git+https://github.com/lbryio/lbry.git@v0.20.4#egg=lbrynet, asn1crypto, cryptography==2.2.2, pyopenssl==17.4.0, treq==17.8.0, funcsigs, mock, pbr, unqlite
+requirements = openssl, sqlite3, hostpython2, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, functools32, miniupnpc==1.9, gmpy==1.17, twisted==16.6.0, appdirs==1.4.3, argparse==1.2.1, docopt==0.6.2, base58==0.2.2, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse==0.2.0, jsonrpc==1.2, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2==1.3, pyyaml==3.12, qrcode==5.2.2, requests==2.9.1, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, slowaes==0.1a1, txJSON-RPC==0.5, wsgiref==0.1.2, zope.interface==4.3.3, protobuf==3.2.0, keyring==10.4.0, netifaces, txupnp==0.0.1a10, git+https://github.com/lbryio/lbryschema.git@v0.0.16#egg=lbryschema, git+https://github.com/lbryio/lbryum.git#egg=lbryum, git+https://github.com/lbryio/lbry.git#egg=lbrynet, asn1crypto, cryptography==2.2.2, pyopenssl==17.4.0, treq==17.8.0, funcsigs, mock, pbr, unqlite
# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
diff --git a/buildozer.spec.vagrant b/buildozer.spec.vagrant
index 7d78a459..01a7d25b 100644
--- a/buildozer.spec.vagrant
+++ b/buildozer.spec.vagrant
@@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py
# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
-requirements = openssl, sqlite3, hostpython2, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, functools32, miniupnpc==1.9, gmpy==1.17, twisted==16.6.0, appdirs==1.4.3, argparse==1.2.1, docopt==0.6.2, base58==0.2.2, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse==0.2.0, jsonrpc==1.2, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2==1.3, pyyaml==3.12, qrcode==5.2.2, requests==2.9.1, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, slowaes==0.1a1, txJSON-RPC==0.5, wsgiref==0.1.2, zope.interface==4.3.3, protobuf==3.2.0, keyring==10.4.0, git+https://github.com/lbryio/lbryschema.git@v0.0.16#egg=lbryschema, git+https://github.com/lbryio/lbryum.git#egg=lbryum, git+https://github.com/lbryio/lbry.git@v0.20.4#egg=lbrynet, asn1crypto, cryptography==2.2.2, pyopenssl==17.4.0, treq==17.8.0, funcsigs, mock, pbr, unqlite
+requirements = openssl, sqlite3, hostpython2, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, functools32, miniupnpc==1.9, gmpy==1.17, twisted==16.6.0, appdirs==1.4.3, argparse==1.2.1, docopt==0.6.2, base58==0.2.2, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse==0.2.0, jsonrpc==1.2, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2==1.3, pyyaml==3.12, qrcode==5.2.2, requests==2.9.1, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, slowaes==0.1a1, txJSON-RPC==0.5, wsgiref==0.1.2, zope.interface==4.3.3, protobuf==3.2.0, keyring==10.4.0, netifaces, txupnp==0.0.1a10, git+https://github.com/lbryio/lbryschema.git@v0.0.16#egg=lbryschema, git+https://github.com/lbryio/lbryum.git#egg=lbryum, git+https://github.com/lbryio/lbry.git#egg=lbrynet, asn1crypto, cryptography==2.2.2, pyopenssl==17.4.0, treq==17.8.0, funcsigs, mock, pbr, unqlite
# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
diff --git a/recipes/netifaces/__init__.py b/recipes/netifaces/__init__.py
new file mode 100644
index 00000000..0c651887
--- /dev/null
+++ b/recipes/netifaces/__init__.py
@@ -0,0 +1,25 @@
+
+import glob
+from pythonforandroid.toolchain import CompiledComponentsPythonRecipe, Recipe
+from os.path import join
+import sh
+
+
+class NetifacesRecipe(CompiledComponentsPythonRecipe):
+ version = '0.10.7'
+ url = 'https://files.pythonhosted.org/packages/81/39/4e9a026265ba944ddf1fea176dbb29e0fe50c43717ba4fcf3646d099fe38/netifaces-{version}.tar.gz'
+ depends = ['python2', 'setuptools']
+ call_hostpython_via_targetpython = False
+
+ def get_recipe_env(self, arch):
+ env = super(NetifacesRecipe, self).get_recipe_env(arch)
+
+ target_python = Recipe.get_recipe('python2', self.ctx).get_build_dir(arch.arch)
+ env['PYTHON_ROOT'] = join(target_python, 'python-install')
+ env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
+ env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python2.7'
+ env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + ' -lpython2.7'
+
+ return env
+
+recipe = NetifacesRecipe()
diff --git a/recipes/sqlite3/Android.mk b/recipes/sqlite3/Android.mk
new file mode 100644
index 00000000..fab4b67e
--- /dev/null
+++ b/recipes/sqlite3/Android.mk
@@ -0,0 +1,11 @@
+LOCAL_PATH := $(call my-dir)/..
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := sqlite3.c
+
+LOCAL_MODULE := sqlite3
+
+LOCAL_CFLAGS := -DSQLITE_ENABLE_FTS4
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/recipes/sqlite3/__init__.py b/recipes/sqlite3/__init__.py
new file mode 100644
index 00000000..2be8215f
--- /dev/null
+++ b/recipes/sqlite3/__init__.py
@@ -0,0 +1,32 @@
+from pythonforandroid.toolchain import NDKRecipe, shprint, shutil, current_directory
+from os.path import join, exists
+import sh
+
+class Sqlite3Recipe(NDKRecipe):
+ version = '3.24.0'
+ # Don't forget to change the URL when changing the version
+ url = 'https://www.sqlite.org/2018/sqlite-amalgamation-3240000.zip'
+ generated_libraries = ['sqlite3']
+
+ def should_build(self, arch):
+ return not self.has_libs(arch, 'libsqlite3.so')
+
+ def prebuild_arch(self, arch):
+ super(Sqlite3Recipe, self).prebuild_arch(arch)
+ # Copy the Android make file
+ sh.mkdir('-p', join(self.get_build_dir(arch.arch), 'jni'))
+ shutil.copyfile(join(self.get_recipe_dir(), 'Android.mk'),
+ join(self.get_build_dir(arch.arch), 'jni/Android.mk'))
+
+ def build_arch(self, arch, *extra_args):
+ super(Sqlite3Recipe, self).build_arch(arch)
+ # Copy the shared library
+ shutil.copyfile(join(self.get_build_dir(arch.arch), 'libs', arch.arch, 'libsqlite3.so'),
+ join(self.ctx.get_libs_dir(arch.arch), 'libsqlite3.so'))
+
+ def get_recipe_env(self, arch):
+ env = super(Sqlite3Recipe, self).get_recipe_env(arch)
+ env['NDK_PROJECT_PATH'] = self.get_build_dir(arch.arch)
+ return env
+
+recipe = Sqlite3Recipe()
diff --git a/src/main/python/lbrynetservice.py b/src/main/python/lbrynetservice.py
index 2574786e..e61a3cad 100644
--- a/src/main/python/lbrynetservice.py
+++ b/src/main/python/lbrynetservice.py
@@ -81,8 +81,7 @@ from jsonrpc.proxy import JSONRPCProxy
from lbrynet import analytics
from lbrynet import conf
from lbrynet.core import utils, system_info
-from lbrynet.daemon.auth.client import LBRYAPIClient
-from lbrynet.daemon.DaemonServer import DaemonServer
+from lbrynet.daemon.Daemon import Daemon
# https certificate verification
# TODO: this is bad. Need to find a way to properly verify https requests
@@ -124,34 +123,22 @@ def start():
lbrynet_log = conf.settings.get_log_filename()
log_support.configure_logging(lbrynet_log, True, [])
- log.debug('Final Settings: %s', conf.settings.get_current_settings_dict())
+
+ # TODO: specify components, initialise auth
+ conf.settings.update({
+ 'components_to_skip': ['peer_protocol_server']
+ })
+
+ log.info('Final Settings: %s', conf.settings.get_current_settings_dict())
log.info("Starting lbrynet-daemon")
if test_internet_connection():
- analytics_manager = analytics.Manager.new_instance()
- start_server_and_listen(False, analytics_manager)
+ daemon = Daemon()
+ daemon.start_listening()
reactor.run()
else:
log.info("Not connected to internet, unable to start")
-@defer.inlineCallbacks
-def start_server_and_listen(use_auth, analytics_manager, max_tries=5):
- """The primary entry point for launching the daemon.
- Args:
- use_auth: set to true to enable http authentication
- analytics_manager: to send analytics
- """
- analytics_manager.send_server_startup()
- daemon_server = DaemonServer(analytics_manager)
- try:
- yield daemon_server.start(use_auth)
- analytics_manager.send_server_startup_success()
- except Exception as e:
- log.exception('Failed to startup')
- yield daemon_server.stop()
- analytics_manager.send_server_startup_error(str(e))
- reactor.fireSystemEvent("shutdown")
-
if __name__ == '__main__':
start()