From 88a7a9b6b13f5f4831faf8cb30b29dcccd267077 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Sun, 7 Jul 2019 15:19:21 +0100 Subject: [PATCH 1/9] upgrade to sdk 0.38.0 --- buildozer.spec.sample | 2 +- buildozer.spec.travis | 2 +- buildozer.spec.vagrant | 2 +- src/main/python/lbrynetservice.py | 14 +++++++------- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/buildozer.spec.sample b/buildozer.spec.sample index 3a1f3b3d..7d799934 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 = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, git+https://github.com/lbryio/lbry.git@v0.37.4#egg=lbrynet, git+https://github.com/lbryio/aioupnp.git@a404269d91cff5358bcffb8067b0fd1d9c6842d3#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, git+https://github.com/lbryio/torba@v0.5.4a0#egg=torba, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir +requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, git+https://github.com/lbryio/aioupnp.git@a404269d91cff5358bcffb8067b0fd1d9c6842d3#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.38.0#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.38.0#egg=torba&subdirectory=torba" # (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 3a1f3b3d..7d799934 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 = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, git+https://github.com/lbryio/lbry.git@v0.37.4#egg=lbrynet, git+https://github.com/lbryio/aioupnp.git@a404269d91cff5358bcffb8067b0fd1d9c6842d3#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, git+https://github.com/lbryio/torba@v0.5.4a0#egg=torba, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir +requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, git+https://github.com/lbryio/aioupnp.git@a404269d91cff5358bcffb8067b0fd1d9c6842d3#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.38.0#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.38.0#egg=torba&subdirectory=torba" # (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 3a1f3b3d..7d799934 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 = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, git+https://github.com/lbryio/lbry.git@v0.37.4#egg=lbrynet, git+https://github.com/lbryio/aioupnp.git@a404269d91cff5358bcffb8067b0fd1d9c6842d3#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, git+https://github.com/lbryio/torba@v0.5.4a0#egg=torba, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir +requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, git+https://github.com/lbryio/aioupnp.git@a404269d91cff5358bcffb8067b0fd1d9c6842d3#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.38.0#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.38.0#egg=torba&subdirectory=torba" # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes diff --git a/src/main/python/lbrynetservice.py b/src/main/python/lbrynetservice.py index 1fd28604..30cfd4e8 100644 --- a/src/main/python/lbrynetservice.py +++ b/src/main/python/lbrynetservice.py @@ -6,13 +6,13 @@ import platform import sys from jnius import autoclass from keyring.backend import KeyringBackend -from lbrynet import __version__ as lbrynet_version, build_type -from lbrynet.conf import Config -from lbrynet.extras.daemon.loggly_handler import get_loggly_handler -from lbrynet.extras.daemon.Components import DHT_COMPONENT, HASH_ANNOUNCER_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT -from lbrynet.extras.daemon.Daemon import Daemon -from lbrynet.extras.daemon.loggly_handler import get_loggly_handler -from lbrynet.utils import check_connection +from lbry import __version__ as lbrynet_version, build_type +from lbry.conf import Config +from lbry.extras.daemon.loggly_handler import get_loggly_handler +from lbry.extras.daemon.Components import DHT_COMPONENT, HASH_ANNOUNCER_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT +from lbry.extras.daemon.Daemon import Daemon +from lbry.extras.daemon.loggly_handler import get_loggly_handler +from lbry.utils import check_connection log = logging.getLogger(__name__) log.setLevel(logging.DEBUG) -- 2.45.2 From 01534caf1301ad663fbf06c3f104c601abcb69d0 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Sun, 7 Jul 2019 15:26:20 +0100 Subject: [PATCH 2/9] handle account unlock failure (#594) * display information to the user upon account_unlock failure * remove trailing dots in messages --- app/src/page/splash/view.js | 97 ++++++++++++++++++++++++------- app/src/styles/splash.js | 25 ++++++++ src/main/python/lbrynetservice.py | 8 +-- 3 files changed, 105 insertions(+), 25 deletions(-) diff --git a/app/src/page/splash/view.js b/app/src/page/splash/view.js index b4ae47e5..38a88f0e 100644 --- a/app/src/page/splash/view.js +++ b/app/src/page/splash/view.js @@ -6,6 +6,7 @@ import { decode as atob } from 'base-64'; import { navigateToUri } from 'utils/helper'; import moment from 'moment'; import AsyncStorage from '@react-native-community/async-storage'; +import Button from 'component/button'; import ProgressBar from 'component/progressBar'; import PropTypes from 'prop-types'; import Colors from 'styles/colors'; @@ -14,25 +15,29 @@ import splashStyle from 'styles/splash'; const BLOCK_HEIGHT_INTERVAL = 1000 * 60 * 2.5; // every 2.5 minutes +const testingNetwork = 'Testing network'; +const waitingForResolution = 'Waiting for name resolution'; + class SplashScreen extends React.PureComponent { static navigationOptions = { title: 'Splash', }; - componentWillMount() { - this.setState({ - daemonReady: false, - details: 'Starting up...', - message: 'Connecting', - isRunning: false, - isLagging: false, - launchUrl: null, - isDownloadingHeaders: false, - headersDownloadProgress: 0, - shouldAuthenticate: false, - subscriptionsFetched: false, - }); + state = { + accountUnlockFailed: false, + daemonReady: false, + details: 'Starting up', + message: 'Connecting', + isRunning: false, + isLagging: false, + launchUrl: null, + isDownloadingHeaders: false, + headersDownloadProgress: 0, + shouldAuthenticate: false, + subscriptionsFetched: false, + }; + componentWillMount() { if (NativeModules.DaemonServiceControl) { NativeModules.DaemonServiceControl.startService(); } @@ -143,6 +148,10 @@ class SplashScreen extends React.PureComponent { }); }; + handleAccountUnlockFailed() { + this.setState({ accountUnlockFailed: true }); + } + _updateStatusCallback(status) { const { fetchSubscriptions, getSync, setClientSetting } = this.props; const startupStatus = status.startup_status; @@ -155,8 +164,6 @@ class SplashScreen extends React.PureComponent { // to give us a better sense of when we are actually started this.setState({ daemonReady: true, - message: 'Testing Network', - details: 'Waiting for name resolution', isLagging: false, isRunning: true, }); @@ -164,14 +171,29 @@ class SplashScreen extends React.PureComponent { // For now, automatically unlock the wallet if a password is set so that downloads work NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(password => { if (password && password.trim().length > 0) { + this.setState({ + message: 'Unlocking account', + details: 'Decrypting wallet', + }); + // unlock the wallet and then finish the splash screen Lbry.account_unlock({ password }) - .then(() => this.finishSplashScreen()) - .catch(() => this.finishSplashScreen()); + .then(() => { + this.setState({ + message: testingNetwork, + details: waitingForResolution, + }); + this.finishSplashScreen(); + }) + .catch(() => this.handleAccountUnlockFailed()); return; + } else { + this.setState({ + message: testingNetwork, + details: waitingForResolution, + }); + this.finishSplashScreen(); } - - this.finishSplashScreen(); }); return; @@ -208,7 +230,7 @@ class SplashScreen extends React.PureComponent { } else { this.setState({ message: 'Network Loading', - details: 'Initializing LBRY service...', + details: 'Initializing LBRY service', }); } @@ -253,8 +275,41 @@ class SplashScreen extends React.PureComponent { }); } + handleContinueAnywayPressed = () => { + this.setState( + { + accountUnlockFailed: false, + message: testingNetwork, + details: waitingForResolution, + }, + () => this.finishSplashScreen() + ); + }; + render() { - const { message, details, isLagging, isRunning } = this.state; + const { accountUnlockFailed, message, details, isLagging, isRunning } = this.state; + + if (accountUnlockFailed) { + return ( + + Oops! Something went wrong. + + Your wallet failed to unlock, which means you may not be able to play any videos or access your funds. + + + You can try to fix this by tapping Stop on the LBRY service notification and starting the app again. If the + problem continues, you may have to reinstall the app and restore your account. + + +