From 5351226d443b3baed6a009acbd9fe2c471e47037 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Mon, 22 Oct 2018 11:20:30 +0100 Subject: [PATCH 1/7] prevent the setTimeout from being called after a download has been stopped --- app/src/redux/actions/file.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/redux/actions/file.js b/app/src/redux/actions/file.js index 892adf01..99adaaeb 100644 --- a/app/src/redux/actions/file.js +++ b/app/src/redux/actions/file.js @@ -29,7 +29,11 @@ export function doUpdateLoadStatus(uri, outpoint) { outpoint, full_status: true, }).then(([fileInfo]) => { - if (!fileInfo || fileInfo.written_bytes === 0) { + if (!fileInfo) { + return; + } + + if (fileInfo && fileInfo.written_bytes === 0) { // download hasn't started yet setTimeout(() => { dispatch(doUpdateLoadStatus(uri, outpoint)); -- 2.45.3 From 761f3c617bf258cc1704f1f17e1a7edac4bf50ab Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Mon, 22 Oct 2018 11:34:00 +0100 Subject: [PATCH 2/7] some updates to the doUpdateLoadStatus action --- app/src/redux/actions/file.js | 10 +++++----- .../bootstraps/lbry/build/templates/build.tmpl.gradle | 6 ------ 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/app/src/redux/actions/file.js b/app/src/redux/actions/file.js index 99adaaeb..2caf274b 100644 --- a/app/src/redux/actions/file.js +++ b/app/src/redux/actions/file.js @@ -29,11 +29,11 @@ export function doUpdateLoadStatus(uri, outpoint) { outpoint, full_status: true, }).then(([fileInfo]) => { - if (!fileInfo) { - return; - } + if (!fileInfo || fileInfo.written_bytes === 0) { + // if the outpoint isn't in the state, then it was probably canceled, so stop checking the load status + const { downloadingByOutpoint = {} } = state.fileInfo; + if (!downloadingByOutpoint[outpoint]) return; - if (fileInfo && fileInfo.written_bytes === 0) { // download hasn't started yet setTimeout(() => { dispatch(doUpdateLoadStatus(uri, outpoint)); @@ -137,7 +137,7 @@ export function doStopDownloadingFile(uri, fileInfo) { Lbry.file_set_status(params).then(() => { dispatch({ type: ACTIONS.DOWNLOADING_CANCELED, - data: {} + data: { uri, outpoint: fileInfo.outpoint } }); // Should also delete the file after the user stops downloading diff --git a/p4a/pythonforandroid/bootstraps/lbry/build/templates/build.tmpl.gradle b/p4a/pythonforandroid/bootstraps/lbry/build/templates/build.tmpl.gradle index e718a8c7..5d8b782c 100644 --- a/p4a/pythonforandroid/bootstraps/lbry/build/templates/build.tmpl.gradle +++ b/p4a/pythonforandroid/bootstraps/lbry/build/templates/build.tmpl.gradle @@ -1,9 +1,3 @@ -// This depends on the openjdk-8-jdk package (Ubuntu) being installed -compileJava { - options.fork = true - options.forkOptions.executable = /usr/lib/jvm/java-8-openjdk-amd64/bin/javac -} - // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { -- 2.45.3 From f034b313b3d9119d8c52548aa330f72310bac306 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 23 Oct 2018 15:52:44 +0100 Subject: [PATCH 3/7] increased button touch areas and improved soft keyboard touch handling (#335) --- .travis.yml | 2 ++ app/src/component/floatingWalletBalance/view.js | 2 +- app/src/component/walletBalance/view.js | 2 +- app/src/page/rewards/view.js | 5 ++++- app/src/page/wallet/view.js | 2 +- app/src/styles/firstRun.js | 5 +++-- .../lbry/build/gradle/wrapper/gradle-wrapper.properties | 2 +- 7 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0b7b450c..62e32797 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,8 @@ dist: xenial language: python python: - '3.6' +jdk: +- oraclejdk8 install: - deactivate - export PATH=/usr/bin:$PATH diff --git a/app/src/component/floatingWalletBalance/view.js b/app/src/component/floatingWalletBalance/view.js index 12f25fe7..f48fb184 100644 --- a/app/src/component/floatingWalletBalance/view.js +++ b/app/src/component/floatingWalletBalance/view.js @@ -20,7 +20,7 @@ class FloatingWalletBalance extends React.PureComponent { onPress={() => navigation && navigation.navigate({ routeName: 'WalletStack' })}> {isNaN(balance) && } - {(balance || balance === 0) && (formatCredits(balance, 2) + ' LBC')} + {(balance || balance === 0) && (formatCredits(parseFloat(balance), 2) + ' LBC')} ); diff --git a/app/src/component/walletBalance/view.js b/app/src/component/walletBalance/view.js index 5ca0db9d..ede0261e 100644 --- a/app/src/component/walletBalance/view.js +++ b/app/src/component/walletBalance/view.js @@ -19,7 +19,7 @@ class WalletBalance extends React.PureComponent { Balance You currently have - {(balance || balance === 0) && (formatCredits(balance, 2) + ' LBC')} + {(balance || balance === 0) && (formatCredits(parseFloat(balance), 2) + ' LBC')} ); diff --git a/app/src/page/rewards/view.js b/app/src/page/rewards/view.js index 000f0adb..d57ff467 100644 --- a/app/src/page/rewards/view.js +++ b/app/src/page/rewards/view.js @@ -142,7 +142,10 @@ class RewardsPage extends React.PureComponent { return ( - + {this.renderVerification()} {this.renderUnclaimedRewards()} {this.renderClaimedRewards()} diff --git a/app/src/page/wallet/view.js b/app/src/page/wallet/view.js index 5fcb1607..35462c2e 100644 --- a/app/src/page/wallet/view.js +++ b/app/src/page/wallet/view.js @@ -27,7 +27,7 @@ class WalletPage extends React.PureComponent { } return ( - + diff --git a/app/src/styles/firstRun.js b/app/src/styles/firstRun.js index 562e2268..5938e2e5 100644 --- a/app/src/styles/firstRun.js +++ b/app/src/styles/firstRun.js @@ -65,8 +65,9 @@ const firstRunStyle = StyleSheet.create({ }, button: { alignSelf: 'flex-end', - marginLeft: 32, - marginRight: 32 + padding: 20, + paddingLeft: 32, + paddingRight: 32 }, buttonText: { fontFamily: 'Metropolis-Regular', diff --git a/p4a/pythonforandroid/bootstraps/lbry/build/gradle/wrapper/gradle-wrapper.properties b/p4a/pythonforandroid/bootstraps/lbry/build/gradle/wrapper/gradle-wrapper.properties index ac1799fa..8733ff37 100644 --- a/p4a/pythonforandroid/bootstraps/lbry/build/gradle/wrapper/gradle-wrapper.properties +++ b/p4a/pythonforandroid/bootstraps/lbry/build/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip -- 2.45.3 From 425a83faec1476ada58c0513074a7f9fda4bb524 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 23 Oct 2018 15:53:08 +0100 Subject: [PATCH 4/7] Improved stop download handling (#342) --- app/src/redux/actions/file.js | 6 +++++- .../bootstraps/lbry/build/templates/build.tmpl.gradle | 6 ------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/src/redux/actions/file.js b/app/src/redux/actions/file.js index 892adf01..2caf274b 100644 --- a/app/src/redux/actions/file.js +++ b/app/src/redux/actions/file.js @@ -30,6 +30,10 @@ export function doUpdateLoadStatus(uri, outpoint) { full_status: true, }).then(([fileInfo]) => { if (!fileInfo || fileInfo.written_bytes === 0) { + // if the outpoint isn't in the state, then it was probably canceled, so stop checking the load status + const { downloadingByOutpoint = {} } = state.fileInfo; + if (!downloadingByOutpoint[outpoint]) return; + // download hasn't started yet setTimeout(() => { dispatch(doUpdateLoadStatus(uri, outpoint)); @@ -133,7 +137,7 @@ export function doStopDownloadingFile(uri, fileInfo) { Lbry.file_set_status(params).then(() => { dispatch({ type: ACTIONS.DOWNLOADING_CANCELED, - data: {} + data: { uri, outpoint: fileInfo.outpoint } }); // Should also delete the file after the user stops downloading diff --git a/p4a/pythonforandroid/bootstraps/lbry/build/templates/build.tmpl.gradle b/p4a/pythonforandroid/bootstraps/lbry/build/templates/build.tmpl.gradle index e718a8c7..5d8b782c 100644 --- a/p4a/pythonforandroid/bootstraps/lbry/build/templates/build.tmpl.gradle +++ b/p4a/pythonforandroid/bootstraps/lbry/build/templates/build.tmpl.gradle @@ -1,9 +1,3 @@ -// This depends on the openjdk-8-jdk package (Ubuntu) being installed -compileJava { - options.fork = true - options.forkOptions.executable = /usr/lib/jvm/java-8-openjdk-amd64/bin/javac -} - // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { -- 2.45.3 From 9b303b38c7bc52ce98c5579aff75de7115fdb4b5 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Sun, 28 Oct 2018 18:05:53 +0100 Subject: [PATCH 5/7] get Python 3 asyncio operations working --- recipes/python3crystax/__init__.py | 2 +- recipes/python3crystax/selectors.patch | 15 +++++++++++++++ src/main/python/lbrynetservice.py | 7 ++++++- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 recipes/python3crystax/selectors.patch diff --git a/recipes/python3crystax/__init__.py b/recipes/python3crystax/__init__.py index 9cc6814c..6ad59123 100644 --- a/recipes/python3crystax/__init__.py +++ b/recipes/python3crystax/__init__.py @@ -161,7 +161,7 @@ class Python3Recipe(TargetPythonRecipe): def prebuild_arch(self, arch): super(Python3Recipe, self).prebuild_arch(arch) if self.version == '3.6': - Python3Recipe.patches = ['patch_python3.6.patch'] + Python3Recipe.patches = ['patch_python3.6.patch', 'selectors.patch'] build_dir = self.get_build_dir(arch.arch) shprint(sh.ln, '-sf', realpath(join(build_dir, 'Lib/site-packages/README.txt')), diff --git a/recipes/python3crystax/selectors.patch b/recipes/python3crystax/selectors.patch new file mode 100644 index 00000000..89e49668 --- /dev/null +++ b/recipes/python3crystax/selectors.patch @@ -0,0 +1,15 @@ +--- a/Lib/selectors.py 2018-06-27 00:39:50.000000000 +0100 ++++ b/Lib/selectors.py 2018-10-28 17:39:46.027757518 +0100 +@@ -599,9 +599,9 @@ + # Choose the best implementation, roughly: + # epoll|kqueue|devpoll > poll > select. + # select() also can't accept a FD > FD_SETSIZE (usually around 1024) +-if 'KqueueSelector' in globals(): +- DefaultSelector = KqueueSelector +-elif 'EpollSelector' in globals(): ++#if 'KqueueSelector' in globals(): ++# DefaultSelector = KqueueSelector ++if 'EpollSelector' in globals(): + DefaultSelector = EpollSelector + elif 'DevpollSelector' in globals(): + DefaultSelector = DevpollSelector diff --git a/src/main/python/lbrynetservice.py b/src/main/python/lbrynetservice.py index f95ef63d..d98cce6a 100644 --- a/src/main/python/lbrynetservice.py +++ b/src/main/python/lbrynetservice.py @@ -1,10 +1,15 @@ +import sys +from twisted.internet import asyncioreactor +if 'twisted.internet.reactor' not in sys.modules: + asyncioreactor.install() + import keyring.backend import platform import ssl +from jnius import autoclass # Fixes / patches / overrides # platform.platform() in libc_ver: IOError: [Errno 21] Is a directory -from jnius import autoclass lbrynet_utils = autoclass('io.lbry.browser.Utils') service = autoclass('io.lbry.browser.LbrynetService').serviceInstance platform.platform = lambda: 'Android %s (API %s)' % (lbrynet_utils.getAndroidRelease(), lbrynet_utils.getAndroidSdk()) -- 2.45.3 From c899ae080531e0e149d0439d710ea106b522aa91 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Sun, 28 Oct 2018 19:03:32 +0100 Subject: [PATCH 6/7] add else condition for twisted reactor --- src/main/python/lbrynetservice.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/python/lbrynetservice.py b/src/main/python/lbrynetservice.py index d98cce6a..5aa1bbe6 100644 --- a/src/main/python/lbrynetservice.py +++ b/src/main/python/lbrynetservice.py @@ -2,6 +2,15 @@ import sys from twisted.internet import asyncioreactor if 'twisted.internet.reactor' not in sys.modules: asyncioreactor.install() +else: + from twisted.internet import reactor + if not isinstance(reactor, asyncioreactor.AsyncioSelectorReactor) and getattr(sys, 'frozen', False): + # pyinstaller hooks install the default reactor before + # any of our code runs, see kivy for similar problem: + # https://github.com/kivy/kivy/issues/4182 + del sys.modules['twisted.internet.reactor'] + asyncioreactor.install() + from twisted.internet import reactor import keyring.backend import platform @@ -81,7 +90,6 @@ keyring.set_keyring(LbryAndroidKeyring()) import logging.handlers from lbrynet.core import log_support -from twisted.internet import defer, reactor from lbrynet import analytics from lbrynet import conf -- 2.45.3 From ca75b0ec516dde894d04bc227c2c88c4a14630bb Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Sun, 28 Oct 2018 19:12:00 +0100 Subject: [PATCH 7/7] restore reactor import --- src/main/python/lbrynetservice.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/python/lbrynetservice.py b/src/main/python/lbrynetservice.py index 5aa1bbe6..adc3c1ee 100644 --- a/src/main/python/lbrynetservice.py +++ b/src/main/python/lbrynetservice.py @@ -90,6 +90,7 @@ keyring.set_keyring(LbryAndroidKeyring()) import logging.handlers from lbrynet.core import log_support +from twisted.internet import reactor from lbrynet import analytics from lbrynet import conf -- 2.45.3