Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd378d16e3 | ||
|
|
e951fabf1c | ||
|
|
48543a48fb | ||
|
|
2699893581 | ||
|
|
21914a0bd7 | ||
|
|
d83667682d | ||
|
|
a5dc01f589 | ||
|
|
fb497cebfe | ||
|
|
9ffaba4358 | ||
|
|
be85307fe8 | ||
|
|
b55961bd83 | ||
|
|
f4911394ba | ||
|
|
42cf11358e | ||
|
|
6e6ed07890 | ||
|
|
22327bf33e | ||
|
|
57d8bc3311 | ||
|
|
6589799a2a | ||
|
|
7d6370163b | ||
|
|
9a5d63b7fc | ||
|
|
2d872a57ee | ||
|
|
f9c0850acd | ||
|
|
994ec732a4 | ||
|
|
b44770c77f | ||
|
|
7ea836e249 | ||
|
|
16d2401e38 | ||
|
|
259dc4c7cc | ||
|
|
3bcd67b8fb | ||
|
|
648d9103b7 | ||
|
|
faac434d33 | ||
|
|
f558cc49f7 | ||
|
|
5add227e55 | ||
|
|
4519a5d174 | ||
|
|
095bed4482 | ||
|
|
07dc95b639 | ||
|
|
edc3ebcff1 | ||
|
|
0f7055ca5b | ||
|
|
f426321e15 | ||
|
|
70d5cb3e2b | ||
|
|
15e4dca984 | ||
|
|
3a7221d71b | ||
|
|
e8cb3afb34 | ||
|
|
2b7a580001 | ||
|
|
b5d327581b | ||
|
|
c0ca45e949 | ||
|
|
4acc107d3a | ||
|
|
1070dba0ae | ||
|
|
7ae5d48767 | ||
|
|
e5c05fac48 | ||
|
|
f7c4b94546 | ||
|
|
a58af97216 | ||
|
|
3759a9703a | ||
|
|
2d3ed191fd | ||
|
|
425817b896 | ||
|
|
aaf3be2f7b | ||
|
|
bc810c80d6 | ||
|
|
e7a6f6f921 | ||
|
|
26542abc4d | ||
|
|
46fd7f40d4 | ||
|
|
40eaa80f4b | ||
|
|
ea8f93061d | ||
|
|
2ec2593704 | ||
|
|
c4949c7794 | ||
|
|
7572a0da5a | ||
|
|
678b9c3184 | ||
|
|
2900b18cce | ||
|
|
580e78afab | ||
|
|
ace430abe6 | ||
|
|
54c6089bdc | ||
|
|
8b308abfb8 | ||
|
|
53696970a7 | ||
|
|
18e2d8ad5e | ||
|
|
46cf9ad4ad | ||
|
|
a11f560183 | ||
|
|
23fbde6df4 | ||
|
|
512e4988d2 | ||
|
|
eb41a5e529 | ||
|
|
cefc126ffe | ||
|
|
29286efbd4 | ||
|
|
ea30ad5974 | ||
|
|
5f30cca79b | ||
|
|
d76cf4457e | ||
|
|
88d58f4344 | ||
|
|
93819b3afd | ||
|
|
7b438db34f | ||
|
|
f526d797f8 | ||
|
|
05f7b07449 | ||
|
|
ddf7c66933 | ||
|
|
715a52b291 | ||
|
|
660adb4a6f | ||
|
|
e47a1e0bf2 | ||
|
|
7b2044d2a4 | ||
|
|
1d3c961c3c | ||
|
|
dc59a1270f | ||
|
|
7452efa047 | ||
|
|
8517f74c6d | ||
|
|
637a62ea21 | ||
|
|
16f270fb9f | ||
|
|
c4f016c912 | ||
|
|
e63bc44055 | ||
|
|
99c8e14773 | ||
|
|
d84fb51f6f | ||
|
|
a8309ffaf5 | ||
|
|
fd97ba3ae9 | ||
|
|
305e62746c | ||
|
|
bf57de9d96 | ||
|
|
07e52d2a83 | ||
|
|
36a0450c1d | ||
|
|
f49e8134dd | ||
|
|
a54037270b | ||
|
|
4a6b091496 | ||
|
|
03addf41c7 | ||
|
|
9440855bf2 | ||
|
|
d53b1b94e5 | ||
|
|
16ebf7bb11 | ||
|
|
c8e7194a94 | ||
|
|
c6527fc57a | ||
|
|
bf906479d8 | ||
|
|
938512f826 | ||
|
|
bbc068b889 | ||
|
|
0ae9fd44d2 | ||
|
|
d266b9f55b |
No files matched your search
@@ -0,0 +1,32 @@
|
||||
## PR Checklist
|
||||
|
||||
<!-- For the checkbox formatting to work properly, make sure there are no spaces on either side of the "x" -->
|
||||
|
||||
Please check all that apply to this PR using "x":
|
||||
|
||||
- [ ] I have checked that this PR is not a duplicate of an existing PR (open, closed or merged)
|
||||
- [ ] I have checked that this PR does not introduce a breaking change
|
||||
- [ ] This PR introduces breaking changes and I have provided a detailed explanation below
|
||||
|
||||
## PR Type
|
||||
|
||||
What kind of change does this PR introduce?
|
||||
|
||||
- [ ] Bugfix
|
||||
- [ ] Feature
|
||||
- [ ] Code style update (formatting)
|
||||
- [ ] Refactoring (no functional changes)
|
||||
- [ ] Documentation changes
|
||||
- [ ] Other - Please describe:
|
||||
|
||||
## Fixes
|
||||
|
||||
Issue Number:
|
||||
|
||||
## What is the current behavior?
|
||||
|
||||
## What is the new behavior?
|
||||
|
||||
## Other information
|
||||
|
||||
<!-- If this PR contains a breaking change, please describe the impact and solution strategy for existing applications below. -->
|
||||
@@ -1,9 +1,10 @@
|
||||
stages:
|
||||
- build
|
||||
- build2
|
||||
- deploy
|
||||
- release
|
||||
|
||||
build apk:
|
||||
|
||||
build arm64 apk:
|
||||
stage: build
|
||||
image: lbry/android-base:latest
|
||||
before_script:
|
||||
@@ -12,7 +13,7 @@ build apk:
|
||||
- git submodule update --init --force --recursive
|
||||
artifacts:
|
||||
paths:
|
||||
- bin/browser-*-release.apk
|
||||
- bin/browser-*-release__arm64.apk
|
||||
expire_in: 1 week
|
||||
script:
|
||||
- export PATH=/usr/bin:$PATH
|
||||
@@ -25,26 +26,60 @@ build apk:
|
||||
- rm -rf ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
|
||||
- ln -s ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21 ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
|
||||
- cp -f $CI_PROJECT_DIR/scripts/build-target-python.sh ~/.buildozer/android/crystax-ndk-10.3.2/build/tools/build-target-python.sh
|
||||
- cp -f $CI_PROJECT_DIR/scripts/mangled-glibc-syscalls.h ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21/arch-arm/usr/include/crystax/bionic/libc/include/sys/mangled-glibc-syscalls.h
|
||||
- cp -f $CI_PROJECT_DIR/scripts/mangled-glibc-syscalls__arm64.h ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21/arch-arm64/usr/include/crystax/bionic/libc/include/sys/mangled-glibc-syscalls.h
|
||||
- rm ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz
|
||||
- git secret reveal
|
||||
- mv buildozer.spec.ci buildozer.spec
|
||||
- mv buildozer.spec.arm64.ci buildozer.spec
|
||||
- "./release.sh | grep -Fv -e 'working:' -e 'copy' -e 'Compiling' --line-buffered"
|
||||
- cp $CI_PROJECT_DIR/bin/browser-$BUILD_VERSION-release.apk $CI_PROJECT_DIR/bin/browser-$BUILD_VERSION-release__arm64.apk
|
||||
- cp $CI_PROJECT_DIR/bin/browser-$BUILD_VERSION-release.apk /dev/null
|
||||
|
||||
build arm apk:
|
||||
stage: build2
|
||||
image: lbry/android-base:latest
|
||||
before_script:
|
||||
- export BUILD_VERSION=$(cat $CI_PROJECT_DIR/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+')
|
||||
- git submodule sync --recursive
|
||||
- git submodule update --init --force --recursive
|
||||
artifacts:
|
||||
paths:
|
||||
- bin/browser-*-release__arm.apk
|
||||
expire_in: 1 week
|
||||
script:
|
||||
- export PATH=/usr/bin:$PATH
|
||||
- echo "$PGP_PRIVATE_KEY" | gpg --batch --import
|
||||
- cd app
|
||||
- npm install
|
||||
- cd ..
|
||||
- wget -q 'https://eu.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz' -P ~/.buildozer/android/
|
||||
- tar -xf ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz -C ~/.buildozer/android/
|
||||
- rm -rf ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
|
||||
- ln -s ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21 ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
|
||||
- cp -f $CI_PROJECT_DIR/p4a/pythonforandroid/bootstraps/lbry/build/templates/build.tmpl.gradle.arm $CI_PROJECT_DIR/p4a/pythonforandroid/bootstraps/lbry/build/templates/build.tmpl.gradle
|
||||
- cp -f $CI_PROJECT_DIR/scripts/build-target-python.sh ~/.buildozer/android/crystax-ndk-10.3.2/build/tools/build-target-python.sh
|
||||
- cp -f $CI_PROJECT_DIR/scripts/mangled-glibc-syscalls.h ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21/arch-arm/usr/include/crystax/bionic/libc/include/sys/mangled-glibc-syscalls.h
|
||||
- rm ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz
|
||||
- git secret reveal
|
||||
- mv buildozer.spec.arm.ci buildozer.spec
|
||||
- "./release.sh | grep -Fv -e 'working:' -e 'copy' -e 'Compiling' --line-buffered"
|
||||
- cp $CI_PROJECT_DIR/bin/browser-$BUILD_VERSION-release.apk $CI_PROJECT_DIR/bin/browser-$BUILD_VERSION-release__arm.apk
|
||||
- cp $CI_PROJECT_DIR/bin/browser-$BUILD_VERSION-release.apk /dev/null
|
||||
|
||||
deploy build.lbry.io:
|
||||
image: python:latest
|
||||
stage: deploy
|
||||
dependencies:
|
||||
- build apk
|
||||
- build arm apk
|
||||
- build arm64 apk
|
||||
before_script:
|
||||
- pip install awscli
|
||||
- export BUILD_VERSION=$(cat $CI_PROJECT_DIR/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+')
|
||||
- export BUILD_APK_FILENAME=browser-$BUILD_VERSION-release.apk
|
||||
- export BUILD_APK_FILENAME__32=browser-$BUILD_VERSION-release__arm.apk
|
||||
- export BUILD_APK_FILENAME__64=browser-$BUILD_VERSION-release__arm64.apk
|
||||
script:
|
||||
- aws s3 cp bin/$BUILD_APK_FILENAME s3://build.lbry.io/android/build-${CI_PIPELINE_IID}_commit-${CI_COMMIT_SHA:0:7}/$BUILD_APK_FILENAME
|
||||
- aws s3 cp bin/$BUILD_APK_FILENAME s3://build.lbry.io/android/push.apk
|
||||
- aws s3 cp bin/$BUILD_APK_FILENAME__64 s3://build.lbry.io/android/build-${CI_PIPELINE_IID}_commit-${CI_COMMIT_SHA:0:7}/$BUILD_APK_FILENAME__64
|
||||
- aws s3 cp bin/$BUILD_APK_FILENAME__32 s3://build.lbry.io/android/build-${CI_PIPELINE_IID}_commit-${CI_COMMIT_SHA:0:7}/$BUILD_APK_FILENAME__32
|
||||
- aws s3 cp bin/$BUILD_APK_FILENAME__64 s3://build.lbry.io/android/push.apk
|
||||
|
||||
release apk:
|
||||
image: python:latest
|
||||
@@ -52,11 +87,14 @@ release apk:
|
||||
only:
|
||||
- tags
|
||||
dependencies:
|
||||
- build apk
|
||||
- build arm apk
|
||||
- build arm64 apk
|
||||
before_script:
|
||||
- pip install awscli githubrelease
|
||||
- export BUILD_VERSION=$(cat $CI_PROJECT_DIR/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+')
|
||||
- export BUILD_APK_FILENAME=browser-$BUILD_VERSION-release.apk
|
||||
- export BUILD_APK_FILENAME__32=browser-$BUILD_VERSION-release__arm.apk
|
||||
- export BUILD_APK_FILENAME__64=browser-$BUILD_VERSION-release__arm64.apk
|
||||
script:
|
||||
- githubrelease release lbryio/lbry-android create $CI_COMMIT_TAG --publish bin/$BUILD_APK_FILENAME
|
||||
- aws s3 cp bin/$BUILD_APK_FILENAME s3://build.lbry.io/android/latest.apk
|
||||
- githubrelease release lbryio/lbry-android create $CI_COMMIT_TAG --publish bin/$BUILD_APK_FILENAME__64 bin/$BUILD_APK_FILENAME__32
|
||||
- githubrelease release lbryio/lbry-android edit $CI_COMMIT_TAG --draft
|
||||
- aws s3 cp bin/$BUILD_APK_FILENAME__64 s3://build.lbry.io/android/latest.apk
|
||||
@@ -1,95 +0,0 @@
|
||||
sudo: required
|
||||
dist: xenial
|
||||
language: python
|
||||
python:
|
||||
- '3.7'
|
||||
install:
|
||||
- deactivate
|
||||
- export PATH=/usr/bin:$PATH
|
||||
- export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
|
||||
- sudo dpkg --add-architecture i386
|
||||
- sudo add-apt-repository ppa:deadsnakes/ppa -y
|
||||
- sudo apt-get -qq update
|
||||
- sudo apt-get -qq install build-essential python3.7 python3.7-dev python3.7-venv python3-pip ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 m4 libc6-dev-i386
|
||||
- sudo pip install --upgrade cython==0.28.1 pip setuptools
|
||||
- wget -q https://nodejs.org/dist/v8.11.1/node-v8.11.1-linux-x64.tar.xz
|
||||
- tar -xf node-v8.11.1-linux-x64.tar.xz
|
||||
- sudo ln -s $TRAVIS_BUILD_DIR/node-v8.11.1-linux-x64/bin/node /usr/bin/node
|
||||
- sudo ln -s $TRAVIS_BUILD_DIR/node-v8.11.1-linux-x64/bin/npm /usr/bin/npm
|
||||
- git clone https://github.com/lbryio/buildozer.git
|
||||
- cd app
|
||||
- npm config set registry="http://registry.npmjs.org/"
|
||||
- npm install
|
||||
- sudo npm install -g react-native-cli
|
||||
- sudo ln -s $TRAVIS_BUILD_DIR/node-v8.11.1-linux-x64/bin/react-native /usr/bin/react-native
|
||||
- cd ..
|
||||
- cd buildozer
|
||||
- sudo python setup.py install
|
||||
- cd ..
|
||||
- mv buildozer.spec.travis buildozer.spec
|
||||
- mkdir -p cd ~/.buildozer/android/platform/
|
||||
- wget -q 'https://dist.testnet.lbry.tech/crystax-ndk-10.3.2-linux-x86_64.tar.xz' -P ~/.buildozer/android/
|
||||
- wget -q 'https://dl.google.com/android/android-sdk_r23-linux.tgz' -P ~/.buildozer/android/platform/
|
||||
- wget -q 'https://dl.google.com/android/repository/platform-27_r01.zip' -P ~/.buildozer/android/platform/
|
||||
- wget -q 'https://dl.google.com/android/repository/build-tools_r26.0.2-linux.zip' -P ~/.buildozer/android/platform/
|
||||
- tar -xf ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz -C ~/.buildozer/android/
|
||||
- cp -f $TRAVIS_BUILD_DIR/scripts/build-target-python.sh ~/.buildozer/android/crystax-ndk-10.3.2/build/tools/build-target-python.sh
|
||||
- rm -rf ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
|
||||
- ln -s ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21 ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
|
||||
- tar -xf ~/.buildozer/android/platform/android-sdk_r23-linux.tgz -C ~/.buildozer/android/platform/
|
||||
- mv ~/.buildozer/android/platform/android-sdk-linux ~/.buildozer/android/platform/android-sdk-23
|
||||
- unzip -qq ~/.buildozer/android/platform/platform-27_r01.zip -d ~/.buildozer/android/platform/android-sdk-23/platforms
|
||||
- mv ~/.buildozer/android/platform/android-sdk-23/platforms/android-8.1.0 ~/.buildozer/android/platform/android-sdk-23/platforms/android-27
|
||||
- mkdir -p ~/.buildozer/android/platform/android-sdk-23/build-tools
|
||||
- unzip -qq ~/.buildozer/android/platform/build-tools_r26.0.2-linux.zip -d ~/.buildozer/android/platform/android-sdk-23/build-tools
|
||||
- mv ~/.buildozer/android/platform/android-sdk-23/build-tools/android-8.1.0 ~/.buildozer/android/platform/android-sdk-23/build-tools/26.0.2
|
||||
- mkdir -p ~/.buildozer/android/platform/android-sdk-23/licenses
|
||||
- echo $'\nd56f5187479451eabf01fb78af6dfcb131a6481e' > ~/.buildozer/android/platform/android-sdk-23/licenses/android-sdk-license
|
||||
- echo $'\n84831b9409646a918e30573bab4c9c91346d8abd' > ~/.buildozer/android/platform/android-sdk-23/licenses/android-sdk-preview-license
|
||||
script:
|
||||
- "./release.sh | grep -Fv -e 'working:' -e 'copy' -e 'Compiling' --line-buffered"
|
||||
- cp $TRAVIS_BUILD_DIR/bin/*.apk /dev/null
|
||||
before_deploy:
|
||||
- cd $TRAVIS_BUILD_DIR/bin
|
||||
- export BUILD_VERSION=$(cat ../src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+')
|
||||
- cp browser-$BUILD_VERSION-release.apk latest.apk
|
||||
deploy:
|
||||
- provider: releases
|
||||
api_key:
|
||||
secure: m+FYX7vHZoiLSHHiJ2d3y8Fm4qSRoIVjEei+5BV17awiow/U8UKvy/5J1n8qfBdq+dpst5z58pTHCKWPbJz84C3z/posJ5mwEcOAaD/kxSAMHbtlaPW90pRWHUu3aW86UM/ggqtljE9Qz8KS/9a0xNUDfcXLkLgxuxgwodMcacEulAAc9TIOCUeR3IFI+KN0ptTCVahCu2JN8DCHKomaR+yKZHdo/9v9XCAcvmImSDu9nUDLH3+A7xQeRpPJqSspk1dadgdXP76kU8t3OKsYuM7DS5AoKvMIc9lZot4UYYKAx7/zavbzeEmqnyskULgsmV8/UDI1AV9U7uFBdrR6dSjISA1k6EHnCgqzasF+lp0hz5iE/0yPxlE9Z1kLW9gZgxSJtjr6Kv2uqAjHYYmpkjtTwHPwBugRM7PWMTxHNcPwkIHpBSRkXjpyDjkWd/LY4X866Y1g2BdIhbGshjy/9Fb2vnYxNZW6drLHn+wWeHJ41Vfgtg1cn01yZGJqgIkcTkhzNL6Bi++y8EBJXDr4L870s336SpbqRuIrO/C16ZFB+XnOg4Ty50Fk5zkbySMHII58iWqSyDYWNvhqo9zU9jn1XQQeok12129Y4t9TUOcJRbxhQ+511lCmVcFIkWHsXDK2QSZ7TeMK5GQUA8OvcNe+WLCJaQ/YD7OZvwlPTvc=
|
||||
file_glob: true
|
||||
file: browser-*-release.apk
|
||||
overwrite: true
|
||||
skip_cleanup: true
|
||||
on:
|
||||
tags: true
|
||||
- provider: s3
|
||||
access_key_id:
|
||||
secure: qEZZ73DWBn9+M2pS4VwsyX8YZjZOENIMP/eoU1A9Vbn155oZpbUaJ7k+4cAXqmBm0WBMKZDqpzCRSGehLAxHFH5rjkj9gLSgd8fY9cveABHkl50HeuxxNsQM+ytk9sCtP8bWOqf7rT/iCgM1soyF2pYmfHM3tU9l0fWK8oZ7pFRIg91hXxUvhvYY2u6B9D1NqSN9T3xtrwEkVjvmkmyKMLCtoIdyB7QdeQciFdGFhZC9DYJVRLxa3BlzZ1T8Qv4MCyIxPjxIugNvVR64VgGjdBdq0BEIyoRqbeIvtqQjlnne4DfJFeCmbDrSva1wDP1UyFoxsRhiWQ/jXXgIyN2CisI6QRD0J+a2LgmbmtkUzhRMuVQJmBrIauulOzcowwRV2J4TtUaAJK9iSHT9D3RLzpazCOnjvJZV9CK5w252Vs5eHnisCSCQk8Ozox96Sg6XW580NEXfkYoGzXLSGiy9zrZs813blUjssEY+jIQmJEby80C3guK7/G4lzthv57psqBWcYd0tFR+vTestS+EFlC02ToUngJhW7I7lPA2G2yrJ5319jFxUSniijb1n72TQthnbqTBahepvKvuG1iWZnCKxS5sWkutFoqEcpQyhXdf7QdR/VrOr8N5xrhK1B8dCYZM6h8eMZbBvOLH49+N6L9jiJz5x+Lk32wcssv1oOgI=
|
||||
secret_access_key:
|
||||
secure: lPygaaJdjFgWY4GcXUXC4Oc5op/TE85Md8lX2bzW19058lbcqYSdM0WySQCxoU/4rlM4Q0N8du0qQ3kZXDpP9XSqvFTVnTGTuB4yghUR1yXcpt6u3JOeOX+YAc3wyQ/pmod6VGO0n8pm8hBVsSFXufdBTjD2W+tNrDoa8RYnlWrt7BbICGltB7PcqYh1Qw6S1wDyZt8I4B5JHDhyJmX6FT5KfOb5cJyynpxlKUstUfy1rh81KuGkEcuEVOLg1s7HE1/IUkVIgezAuCrMHjc86qbNcHULJMFCVYntvvs07+tctrPxA/cfS24WkW7smyij+gdZAZWNNgkIDCuwqpex1v1nKn56mC8xXyUl4CnSCuubQtqUBzTmd4T5sF7trTtpVr9NInwy+4mUoCpz2UKZekTjZkqpzCAuC/cBVWE1/k3wsNat6dGyc9QnKXBqLVhuwYsCOteqLW50ToMMMW0ccDV6FXodwZmrunGd5wIX+UgZkf4l32vzKUxHtIupfYbsjylcPc3VO0OzMMKP/3sYLAN6QntVDFc30k1uqqpgJN4t0nV7vvjMI+b0Qr+o7GzUV2d+QulQXOySJgB2pH0kV1EoPAJ8KbqDOy8KgCJl0YIbOaz14+SiRQhotJ2hrLdtsvyVYXMX+d/CKHJSWa2MQq+jD7lMCwVaGg82PFN1gI4=
|
||||
bucket: "build.lbry.io"
|
||||
upload-dir: android
|
||||
region: us-east-1
|
||||
overwrite: true
|
||||
skip_cleanup: true
|
||||
on:
|
||||
tags: true
|
||||
- provider: s3
|
||||
access_key_id:
|
||||
secure: qEZZ73DWBn9+M2pS4VwsyX8YZjZOENIMP/eoU1A9Vbn155oZpbUaJ7k+4cAXqmBm0WBMKZDqpzCRSGehLAxHFH5rjkj9gLSgd8fY9cveABHkl50HeuxxNsQM+ytk9sCtP8bWOqf7rT/iCgM1soyF2pYmfHM3tU9l0fWK8oZ7pFRIg91hXxUvhvYY2u6B9D1NqSN9T3xtrwEkVjvmkmyKMLCtoIdyB7QdeQciFdGFhZC9DYJVRLxa3BlzZ1T8Qv4MCyIxPjxIugNvVR64VgGjdBdq0BEIyoRqbeIvtqQjlnne4DfJFeCmbDrSva1wDP1UyFoxsRhiWQ/jXXgIyN2CisI6QRD0J+a2LgmbmtkUzhRMuVQJmBrIauulOzcowwRV2J4TtUaAJK9iSHT9D3RLzpazCOnjvJZV9CK5w252Vs5eHnisCSCQk8Ozox96Sg6XW580NEXfkYoGzXLSGiy9zrZs813blUjssEY+jIQmJEby80C3guK7/G4lzthv57psqBWcYd0tFR+vTestS+EFlC02ToUngJhW7I7lPA2G2yrJ5319jFxUSniijb1n72TQthnbqTBahepvKvuG1iWZnCKxS5sWkutFoqEcpQyhXdf7QdR/VrOr8N5xrhK1B8dCYZM6h8eMZbBvOLH49+N6L9jiJz5x+Lk32wcssv1oOgI=
|
||||
secret_access_key:
|
||||
secure: lPygaaJdjFgWY4GcXUXC4Oc5op/TE85Md8lX2bzW19058lbcqYSdM0WySQCxoU/4rlM4Q0N8du0qQ3kZXDpP9XSqvFTVnTGTuB4yghUR1yXcpt6u3JOeOX+YAc3wyQ/pmod6VGO0n8pm8hBVsSFXufdBTjD2W+tNrDoa8RYnlWrt7BbICGltB7PcqYh1Qw6S1wDyZt8I4B5JHDhyJmX6FT5KfOb5cJyynpxlKUstUfy1rh81KuGkEcuEVOLg1s7HE1/IUkVIgezAuCrMHjc86qbNcHULJMFCVYntvvs07+tctrPxA/cfS24WkW7smyij+gdZAZWNNgkIDCuwqpex1v1nKn56mC8xXyUl4CnSCuubQtqUBzTmd4T5sF7trTtpVr9NInwy+4mUoCpz2UKZekTjZkqpzCAuC/cBVWE1/k3wsNat6dGyc9QnKXBqLVhuwYsCOteqLW50ToMMMW0ccDV6FXodwZmrunGd5wIX+UgZkf4l32vzKUxHtIupfYbsjylcPc3VO0OzMMKP/3sYLAN6QntVDFc30k1uqqpgJN4t0nV7vvjMI+b0Qr+o7GzUV2d+QulQXOySJgB2pH0kV1EoPAJ8KbqDOy8KgCJl0YIbOaz14+SiRQhotJ2hrLdtsvyVYXMX+d/CKHJSWa2MQq+jD7lMCwVaGg82PFN1gI4=
|
||||
bucket: "build.lbry.io"
|
||||
upload-dir: "android/build-${TRAVIS_BUILD_NUMBER}_commit-${TRAVIS_COMMIT:0:7}"
|
||||
region: us-east-1
|
||||
overwrite: true
|
||||
skip_cleanup: true
|
||||
on:
|
||||
all_branches: true
|
||||
env:
|
||||
global:
|
||||
- secure: GS3Cp1QXiX8UPye3kdk2A2f3iFRr02sHKpY+RE+Zvx3Q7GDmhDuepHKzx6Hq5Os5fZN9Y/Bdds+XH+vLIRtT6XsWR7AONPhSifVY3XB5/2F+lDcZ538W8P8GZvXejpY4VecMUWHoWbuyt0s3PpaGXZJcHp8ir+CUJ0NUmU3I9w449pqj9/de2LHtG3qKH1lG0Xz58iOC0mmEeH451cQv3dDw851ihA4ak9vCTV1KKuMJUcv+2u6PxXGVX0mrJLEssjL6ze6G5iZUB4PM1vUpe3HqcVw8CSOa8O79BQxoB00qyA3WD+LpZDPpI0wh6gmBsR/2nCFyMJndJr3CjyB6lHdK7PgBoK0CJjszKawiZqg74O9DOjzTJTO2v9bnkfPrNxu4/3D/tbDg+whY8k5oV1sgDue9KAo/2aEEO0LGlKP4W3Qqt/lzRKsfpMVrMTdCNKJ8rG/wUFWw8ehOCmAsJaQ1saDOZDMNPLLuYpxFgmXFqWV5ThbUHgEJVj+G7qt6CMEussKvuZJoJZx24Pdk5Prr7ENzTyPmE5gk4b8WNfVNleOEC09xu5tFk2yOdzF1dawKsa1Mog6gImirTQ/INC/3BANdKoG9/cLJEIt9boJaFDXE1dpqoLVzoez9znHKOGSAU/1PaH3thjVnbUyO5z24PpPZ12zM3+3P8DbI454=
|
||||
before_install:
|
||||
- openssl aes-256-cbc -K $encrypted_b4c9b905b12e_key -iv $encrypted_b4c9b905b12e_iv
|
||||
-in lbry-android.keystore.enc -out lbry-android.keystore -d
|
||||
@@ -71,7 +71,7 @@ Assuming `lbry-android` as the current working folder:
|
||||
The `google-services.json` file is required for the build to be successful due to the Firebase implementation. Simply copy the provided sample file into the same destination folder.
|
||||
```
|
||||
cd lbry-android
|
||||
cp p4a/pythonforandroid/bootstraps/lbry/templates/google-services.sample.json p4a/pythonforandroid/bootstraps/lbry/templates/google-services.json
|
||||
cp p4a/pythonforandroid/bootstraps/lbry/build/templates/google-services.sample.json p4a/pythonforandroid/bootstraps/lbry/build/templates/google-services.json
|
||||
```
|
||||
|
||||
#### Setup Android SDK for buildozer
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2018 LBRY Inc
|
||||
Copyright (c) 2017-2019 LBRY Inc
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
### Introduction
|
||||
# Introduction
|
||||
If you would like to contribute to the Android app, but find the build documentation a little daunting, this guide lets you copy-paste your way to a successful APK build.
|
||||
|
||||
#### Estimated build time
|
||||
### Estimated build time
|
||||
25 - 40 minutes (depending on Internet connection speeds)
|
||||
|
||||
#### What do you need?
|
||||
* A computer running Ubuntu 18.04
|
||||
### What do you need?
|
||||
* A computer running [Ubuntu 18.04](https://ubuntu.com/download/desktop)
|
||||
* Internet access to download modules and packages.
|
||||
* At least 15GB of free disk space.
|
||||
* Alternatively, Docker. You can skip steps 1 through 5 if you make use of the `lbry/android-base` Docker base image. Scroll down to Fast track if you would prefer to use Docker.
|
||||
* Alternatively, Docker. You can skip steps 1 through 5 if you make use of the `lbry/android-base` Docker base image. Scroll down to [Fast Track](#Fast-Track) at the bottom of the page if you would prefer to use Docker.
|
||||
|
||||
### Step 1 of 10
|
||||
Install all the apt packages required by running the following commands. You can copy-paste directly to your terminal.
|
||||
Install all the apt packages required by running the following commands. You can copy-paste this directly to your terminal.
|
||||
```
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt-get -y update
|
||||
@@ -32,7 +32,7 @@ sudo -H pip install --upgrade cython==0.28.1 setuptools
|
||||
```
|
||||
|
||||
### Step 3 of 10
|
||||
Install buildozer, a tool for creating the apk package using the python for android toolcahin.
|
||||
Install [buildozer](https://github.com/lbryio/buildozer.git), a tool for creating the apk package using the python for android toolchain.
|
||||
```
|
||||
git clone https://github.com/lbryio/buildozer.git
|
||||
cd buildozer && python2.7 setup.py install && cd ..
|
||||
@@ -72,7 +72,7 @@ wget 'https://www.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz' -
|
||||
```
|
||||
|
||||
### Step 7 of 10
|
||||
Clone the lbryio/lbry-android git repository, initialise submodules and create your `buildozer.spec` and `google-services.json` files. The provided `buildozer.spec.sample` contains defaults provided you followed steps 1 through 5 exactly as described. You can also customise the spec file if you want to. The `google-services.sample.json` can be used to ensure the build completes successfully.
|
||||
Clone the [lbryio/lbry-android git repository](https://github.com/lbryio/lbry-android), initialise submodules and create your `buildozer.spec` and `google-services.json` files. The provided `buildozer.spec.sample` contains defaults provided you followed steps 1 through 5 exactly as described. You can also customise the spec file if you want to. The `google-services.sample.json` can be used to ensure the build completes successfully.
|
||||
```
|
||||
git clone https://github.com/lbryio/lbry-android
|
||||
cd lbry-android
|
||||
@@ -103,11 +103,11 @@ If you made it this far, you're finally ready to build the package! You just hav
|
||||
buildozer android debug
|
||||
```
|
||||
|
||||
### Fast Track
|
||||
### Fast Track {#Fast-Track}
|
||||
Install Docker and start a container using the `lbry/android-base` image, which is about 1.72GB in size. Run the following commands for Ubuntu and then follow steps 6 through 10 in the container's bash prompt.
|
||||
```
|
||||
sudo apt-get install docker-ce
|
||||
docker run -it lbry/android-base:latest /bin/bash
|
||||
```
|
||||
|
||||
**Protip:** You can also make use of Docker to run your builds on macOS or Windows.
|
||||
**Pro Tip:** You can also make use of Docker to run your builds on macOS or Windows.
|
||||
@@ -1,9 +1,12 @@
|
||||
# LBRY Android
|
||||
[](https://ci.lbry.tech/lbry/lbry-android/commits/master)
|
||||
[](https://github.com/lbryio/lbry-android/blob/master/LICENSE)
|
||||
|
||||
An Android browser and wallet for the [LBRY](https://lbry.com) network. This app bundles [lbrynet-daemon](https://github.com/lbryio/lbry) as a background service with a UI layer built with React Native. The APK is built using buildozer and the Gradle build tool.
|
||||
|
||||
<img src="https://spee.ch/8/lbry-android.png" alt="LBRY Android Screenshot" width="384px" />
|
||||
|
||||
<img src="https://spee.ch/@lbry:3f/android-08-homepage.gif" alt="LBRY Android GIF" width="384px" />
|
||||
|
||||
|
||||
## Installation
|
||||
The minimum supported Android version is 5.0 Lollipop. There are two ways to install:
|
||||
|
||||
@@ -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/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.5#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.38.5#egg=torba&subdirectory=torba"
|
||||
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.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#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.43.4#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=torba&subdirectory=torba"
|
||||
|
||||
# (str) Custom source folders for requirements
|
||||
# Sets custom source for any requirements with recipes
|
||||
@@ -148,7 +148,7 @@ android.react_src = ./app
|
||||
|
||||
# (list) Gradle dependencies to add (currently works only with sdl2_gradle
|
||||
# bootstrap)
|
||||
android.gradle_dependencies = com.android.support:support-v4:27.1.1, com.android.support:support-media-compat:27.1.1, com.android.support:appcompat-v7:27.1.1, com.facebook.react:react-native:0.59.10, com.google.android.gms:play-services-gcm:11.0.4+, com.facebook.fresco:fresco:1.9.0, com.facebook.fresco:animated-gif:1.9.0, com.squareup.picasso:picasso:2.71828, com.google.firebase:firebase-core:16.0.1, com.google.android.gms:play-services-base:16.1.0, com.android.support:exifinterface:27.1.1
|
||||
android.gradle_dependencies = com.android.support:support-v4:28.0.0, com.android.support:support-media-compat:28.0.0, com.android.support:appcompat-v7:28.0.0, com.facebook.react:react-native:0.59.10, com.google.android.gms:play-services-gcm:11.0.4+, com.facebook.fresco:fresco:1.9.0, com.facebook.fresco:animated-gif:1.9.0, com.squareup.picasso:picasso:2.71828, com.google.firebase:firebase-core:16.0.1, com.google.android.gms:play-services-base:16.1.0, com.android.support:exifinterface:28.0.0, com.facebook.fresco:animated-base-support:1.3.0, com.facebook.fresco:animated-gif:1.10.0, com.google.firebase:firebase-messaging:18.0.0
|
||||
|
||||
# (str) python-for-android branch to use, defaults to master
|
||||
#p4a.branch = stable
|
||||
@@ -187,7 +187,7 @@ android.gradle_dependencies = com.android.support:support-v4:27.1.1, com.android
|
||||
#android.copy_libs = 1
|
||||
|
||||
# (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86
|
||||
android.arch = arm64-v8a
|
||||
android.arch = armeabi-v7a
|
||||
|
||||
#
|
||||
# Python for android (p4a) specific
|
||||
@@ -0,0 +1,274 @@
|
||||
[app]
|
||||
|
||||
# (str) Title of your application
|
||||
title = LBRY
|
||||
|
||||
# (str) Package name
|
||||
package.name = browser
|
||||
|
||||
# (str) Package domain (needed for android/ios packaging)
|
||||
package.domain = io.lbry
|
||||
|
||||
# (str) Source code where the main.py live
|
||||
source.dir = ./src/main/python
|
||||
|
||||
# (list) Source files to include (let empty to include all the files)
|
||||
source.include_exts = py,png,jpg,kv,atlas
|
||||
|
||||
# (list) List of inclusions using pattern matching
|
||||
#source.include_patterns = assets/*, res/*
|
||||
|
||||
# (list) Source files to exclude (let empty to not exclude anything)
|
||||
#source.exclude_exts = spec
|
||||
|
||||
# (list) List of directory to exclude (let empty to not exclude anything)
|
||||
#source.exclude_dirs = tests, bin
|
||||
|
||||
# (list) List of exclusions using pattern matching
|
||||
#source.exclude_patterns = license,images/*/*.jpg
|
||||
|
||||
# (str) Application versioning (method 1)
|
||||
#version = 0.1
|
||||
|
||||
# (str) Application versioning (method 2)
|
||||
version.regex = __version__ = ['"](.*)['"]
|
||||
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.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#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.43.4#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=torba&subdirectory=torba"
|
||||
|
||||
# (str) Custom source folders for requirements
|
||||
# Sets custom source for any requirements with recipes
|
||||
# requirements.source.kivy = ../../kivy
|
||||
|
||||
# (list) Garden requirements
|
||||
#garden_requirements =
|
||||
|
||||
# (str) Presplash of the application
|
||||
#presplash.filename = %(source.dir)s/data/presplash.png
|
||||
|
||||
# (str) Icon of the application
|
||||
#icon.filename = %(source.dir)s/data/icon.png
|
||||
|
||||
# (str) Supported orientation (one of landscape, portrait or all)
|
||||
orientation = portrait
|
||||
|
||||
# (list) List of service to declare
|
||||
#services = NAME:ENTRYPOINT_TO_PY,NAME2:ENTRYPOINT2_TO_PY
|
||||
services = lbrynetservice:./lbrynetservice.py
|
||||
|
||||
#
|
||||
# OSX Specific
|
||||
#
|
||||
|
||||
#
|
||||
# author = © Copyright Info
|
||||
|
||||
# change the major version of python used by the app
|
||||
osx.python_version = 3
|
||||
|
||||
# Kivy version to use
|
||||
osx.kivy_version = 1.9.1
|
||||
|
||||
#
|
||||
# Android specific
|
||||
#
|
||||
|
||||
# (bool) Indicate if the application should be fullscreen or not
|
||||
fullscreen = 0
|
||||
|
||||
# (string) Presplash background color (for new android toolchain)
|
||||
# Supported formats are: #RRGGBB #AARRGGBB or one of the following names:
|
||||
# red, blue, green, black, white, gray, cyan, magenta, yellow, lightgray,
|
||||
# darkgray, grey, lightgrey, darkgrey, aqua, fuchsia, lime, maroon, navy,
|
||||
# olive, purple, silver, teal.
|
||||
#android.presplash_color = #FFFFFF
|
||||
|
||||
# (list) Permissions
|
||||
android.permissions = CAMERA,INTERNET,READ_EXTERNAL_STORAGE,RECORD_AUDIO,WRITE_EXTERNAL_STORAGE
|
||||
|
||||
# (int) Android API to use
|
||||
android.api = 28
|
||||
|
||||
# (int) Minimum API required
|
||||
android.minapi = 21
|
||||
|
||||
# (int) Android SDK version to use
|
||||
android.sdk = 23
|
||||
|
||||
# (str) Android NDK version to use
|
||||
#android.ndk = 13b
|
||||
|
||||
# (bool) Use --private data storage (True) or --dir public storage (False)
|
||||
#android.private_storage = True
|
||||
|
||||
# (str) Android NDK directory (if empty, it will be automatically downloaded.)
|
||||
android.ndk_path = ~/.buildozer/android/crystax-ndk-10.3.2
|
||||
|
||||
# (str) Android SDK directory (if empty, it will be automatically downloaded.)
|
||||
#android.sdk_path = ~/.buildozer/android
|
||||
|
||||
# (str) ANT directory (if empty, it will be automatically downloaded.)
|
||||
#android.ant_path =
|
||||
|
||||
# (bool) If True, then skip trying to update the Android sdk
|
||||
# This can be useful to avoid excess Internet downloads or save time
|
||||
# when an update is due and you just want to test/build your package
|
||||
#android.skip_update = False
|
||||
|
||||
# (str) Android entry point, default is ok for Kivy-based app
|
||||
#android.entrypoint = org.renpy.android.PythonActivity
|
||||
|
||||
# (list) Pattern to whitelist for the whole project
|
||||
#android.whitelist =
|
||||
|
||||
# (str) Path to a custom whitelist file
|
||||
#android.whitelist_src =
|
||||
|
||||
# (str) Path to a custom blacklist file
|
||||
#android.blacklist_src =
|
||||
|
||||
# (list) List of Java .jar files to add to the libs so that pyjnius can access
|
||||
# their classes. Don't add jars that you do not need, since extra jars can slow
|
||||
# down the build process. Allows wildcards matching, for example:
|
||||
# OUYA-ODK/libs/*.jar3
|
||||
#android.add_jars = foo.jar,bar.jar,path/to/more/*.jar
|
||||
|
||||
# (list) List of Java files to add to the android project (can be java or a
|
||||
# directory containing the files)
|
||||
android.add_src = ./src/main
|
||||
|
||||
# (str) Path to the React files and node_modules for building3
|
||||
android.react_src = ./app
|
||||
|
||||
# (list) Android AAR archives to add (currently works only with sdl2_gradle
|
||||
# bootstrap)
|
||||
#android.add_aars =
|
||||
|
||||
# (list) Gradle dependencies to add (currently works only with sdl2_gradle
|
||||
# bootstrap)
|
||||
android.gradle_dependencies = com.android.support:support-v4:28.0.0, com.android.support:support-media-compat:28.0.0, com.android.support:appcompat-v7:28.0.0, com.facebook.react:react-native:0.59.10, com.google.android.gms:play-services-gcm:11.0.4+, com.facebook.fresco:fresco:1.9.0, com.facebook.fresco:animated-gif:1.9.0, com.squareup.picasso:picasso:2.71828, com.google.firebase:firebase-core:16.0.1, com.google.android.gms:play-services-base:16.1.0, com.android.support:exifinterface:28.0.0, com.facebook.fresco:animated-base-support:1.3.0, com.facebook.fresco:animated-gif:1.10.0, com.google.firebase:firebase-messaging:18.0.0
|
||||
|
||||
# (str) python-for-android branch to use, defaults to master
|
||||
#p4a.branch = stable
|
||||
|
||||
# (str) OUYA Console category. Should be one of GAME or APP
|
||||
# If you leave this blank, OUYA support will not be enabled
|
||||
#android.ouya.category = GAME
|
||||
|
||||
# (str) Filename of OUYA Console icon. It must be a 732x412 png image.
|
||||
#android.ouya.icon.filename = %(source.dir)s/data/ouya_icon.png
|
||||
|
||||
# (str) XML file to include as an intent filters in <activity> tag
|
||||
#android.manifest.intent_filters =
|
||||
|
||||
# (list) Android additionnal libraries to copy into libs/armeabi
|
||||
#android.add_libs_armeabi = libs/android-v7/*
|
||||
#android.add_libs_armeabi_v7a = libs/android-v7/*
|
||||
#android.add_libs_x86 = libs/android-x86/*.so
|
||||
#android.add_libs_mips = libs/android-mips/*.so
|
||||
|
||||
# (bool) Indicate whether the screen should stay on
|
||||
# Don't forget to add the WAKE_LOCK permission if you set this to True
|
||||
#android.wakelock = False
|
||||
|
||||
# (list) Android application meta-data to set (key=value format)
|
||||
#android.meta_data =
|
||||
|
||||
# (list) Android library project to add (will be added in the
|
||||
# project.properties automatically.)
|
||||
#android.library_references =
|
||||
|
||||
# (str) Android logcat filters to use
|
||||
#android.logcat_filters = *:S python:D
|
||||
|
||||
# (bool) Copy library instead of making a libpymodules.so
|
||||
#android.copy_libs = 1
|
||||
|
||||
# (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86
|
||||
android.arch = arm64-v8a
|
||||
|
||||
#
|
||||
# Python for android (p4a) specific
|
||||
#
|
||||
|
||||
# (str) python-for-android git clone directory (if empty, it will be automatically cloned from github)
|
||||
p4a.source_dir = ./p4a
|
||||
|
||||
# (str) The directory in which python-for-android should look for your own build recipes (if any)
|
||||
p4a.local_recipes = ./recipes
|
||||
|
||||
# (str) Filename to the hook for p4a
|
||||
#p4a.hook =
|
||||
|
||||
# (str) Bootstrap to use for android builds
|
||||
p4a.bootstrap = lbry
|
||||
|
||||
|
||||
#
|
||||
# iOS specific
|
||||
#
|
||||
|
||||
# (str) Path to a custom kivy-ios folder
|
||||
#ios.kivy_ios_dir = ../kivy-ios
|
||||
|
||||
# (str) Name of the certificate to use for signing the debug version
|
||||
# Get a list of available identities: buildozer ios list_identities
|
||||
#ios.codesign.debug = "iPhone Developer: <lastname> <firstname> (<hexstring>)"
|
||||
|
||||
# (str) Name of the certificate to use for signing the release version
|
||||
#ios.codesign.release = %(ios.codesign.debug)s
|
||||
|
||||
|
||||
[buildozer]
|
||||
|
||||
# (int) Log level (0 = error only, 1 = info, 2 = debug (with command output))
|
||||
log_level = 2
|
||||
|
||||
# (int) Display warning if buildozer is run as root (0 = False, 1 = True)
|
||||
warn_on_root = 1
|
||||
|
||||
# (str) Path to build artifact storage, absolute or relative to spec file
|
||||
# build_dir = ./.buildozer
|
||||
|
||||
# (str) Path to build output (i.e. .apk, .ipa) storage
|
||||
# bin_dir = ./bin
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# List as sections
|
||||
#
|
||||
# You can define all the "list" as [section:key].
|
||||
# Each line will be considered as a option to the list.
|
||||
# Let's take [app] / source.exclude_patterns.
|
||||
# Instead of doing:
|
||||
#
|
||||
#[app]
|
||||
#source.exclude_patterns = license,data/audio/*.wav,data/images/original/*
|
||||
#
|
||||
# This can be translated into:
|
||||
#
|
||||
#[app:source.exclude_patterns]
|
||||
#license
|
||||
#data/audio/*.wav
|
||||
#data/images/original/*
|
||||
#
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Profiles
|
||||
#
|
||||
# You can extend section / key with a profile
|
||||
# For example, you want to deploy a demo version of your application without
|
||||
# HD content. You could first change the title to add "(demo)" in the name
|
||||
# and extend the excluded directories to remove the HD content.
|
||||
#
|
||||
#[app@demo]
|
||||
#title = My Application (demo)
|
||||
#
|
||||
#[app:source.exclude_patterns@demo]
|
||||
#images/hd/*
|
||||
#
|
||||
# Then, invoke the command line with the "demo" profile:
|
||||
#
|
||||
#buildozer --profile demo android debug
|
||||
@@ -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/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.5#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.38.5#egg=torba&subdirectory=torba"
|
||||
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.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#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.43.4#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=torba&subdirectory=torba"
|
||||
|
||||
# (str) Custom source folders for requirements
|
||||
# Sets custom source for any requirements with recipes
|
||||
@@ -148,7 +148,7 @@ android.react_src = ./app
|
||||
|
||||
# (list) Gradle dependencies to add (currently works only with sdl2_gradle
|
||||
# bootstrap)
|
||||
android.gradle_dependencies = com.android.support:support-v4:27.1.1, com.android.support:support-media-compat:27.1.1, com.android.support:appcompat-v7:27.1.1, com.facebook.react:react-native:0.59.10, com.google.android.gms:play-services-gcm:11.0.4+, com.facebook.fresco:fresco:1.9.0, com.facebook.fresco:animated-gif:1.9.0, com.squareup.picasso:picasso:2.71828, com.google.firebase:firebase-core:16.0.1, com.google.android.gms:play-services-base:16.1.0, com.android.support:exifinterface:27.1.1
|
||||
android.gradle_dependencies = com.android.support:support-v4:28.0.0, com.android.support:support-media-compat:28.0.0, com.android.support:appcompat-v7:28.0.0, com.facebook.react:react-native:0.59.10, com.google.android.gms:play-services-gcm:11.0.4+, com.facebook.fresco:fresco:1.9.0, com.facebook.fresco:animated-gif:1.9.0, com.squareup.picasso:picasso:2.71828, com.google.firebase:firebase-core:16.0.1, com.google.android.gms:play-services-base:16.1.0, com.android.support:exifinterface:28.0.0, com.facebook.fresco:animated-base-support:1.3.0, com.facebook.fresco:animated-gif:1.10.0, com.google.firebase:firebase-messaging:18.0.0
|
||||
|
||||
# (str) python-for-android branch to use, defaults to master
|
||||
#p4a.branch = stable
|
||||
|
||||
@@ -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/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.3#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.38.3#egg=torba&subdirectory=torba"
|
||||
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.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#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.43.4#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=torba&subdirectory=torba"
|
||||
|
||||
# (str) Custom source folders for requirements
|
||||
# Sets custom source for any requirements with recipes
|
||||
@@ -148,7 +148,7 @@ android.react_src = ./app
|
||||
|
||||
# (list) Gradle dependencies to add (currently works only with sdl2_gradle
|
||||
# bootstrap)
|
||||
android.gradle_dependencies = com.android.support:support-v4:27.1.1, com.android.support:support-media-compat:27.1.1, com.android.support:appcompat-v7:27.1.1, com.facebook.react:react-native:0.59.10, com.google.android.gms:play-services-gcm:11.0.4+, com.facebook.fresco:fresco:1.9.0, com.facebook.fresco:animated-gif:1.9.0, com.squareup.picasso:picasso:2.71828, com.google.firebase:firebase-core:16.0.1, com.google.android.gms:play-services-base:16.1.0, com.android.support:exifinterface:27.1.1
|
||||
android.gradle_dependencies = com.android.support:support-v4:28.0.0, com.android.support:support-media-compat:28.0.0, com.android.support:appcompat-v7:28.0.0, com.facebook.react:react-native:0.59.10, com.google.android.gms:play-services-gcm:11.0.4+, com.facebook.fresco:fresco:1.9.0, com.facebook.fresco:animated-gif:1.9.0, com.squareup.picasso:picasso:2.71828, com.google.firebase:firebase-core:16.0.1, com.google.android.gms:play-services-base:16.1.0, com.android.support:exifinterface:28.0.0, com.facebook.fresco:animated-base-support:1.3.0, com.facebook.fresco:animated-gif:1.10.0, com.google.firebase:firebase-messaging:18.0.0
|
||||
|
||||
# (str) python-for-android branch to use, defaults to master
|
||||
#p4a.branch = stable
|
||||
@@ -272,4 +272,4 @@ warn_on_root = 1
|
||||
# Then, invoke the command line with the "demo" profile:
|
||||
#
|
||||
#buildozer --profile demo android debug
|
||||
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.5#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.38.5#egg=torba&subdirectory=torba"
|
||||
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, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#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.43.3#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.3#egg=torba&subdirectory=torba"
|
||||
@@ -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-4.6-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
|
||||
@@ -58,6 +58,16 @@
|
||||
android:hardwareAccelerated="true"
|
||||
android:usesCleartextTraffic="true">
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.firebase.messaging.default_notification_icon"
|
||||
android:resource="@drawable/ic_lbry" />
|
||||
<meta-data
|
||||
android:name="com.google.firebase.messaging.default_notification_color"
|
||||
android:resource="@color/lbryGreen" />
|
||||
<meta-data
|
||||
android:name="com.google.firebase.messaging.default_notification_channel_id"
|
||||
android:value="@string/default_notification_channel_id"/>
|
||||
|
||||
{% for m in args.meta_data %}
|
||||
<meta-data android:name="{{ m.split('=', 1)[0] }}" android:value="{{ m.split('=', 1)[-1] }}"/>{% endfor %}
|
||||
<meta-data android:name="wakelock" android:value="{% if args.wakelock %}1{% else %}0{% endif %}"/>
|
||||
@@ -131,6 +141,14 @@
|
||||
<service android:name="{{ args.package }}.LbrynetTestRunnerService"
|
||||
android:process=":service_lbrynet_testrunner" />
|
||||
|
||||
<service
|
||||
android:name="{{ args.package }}.LbrynetMessagingService"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
{% if args.billing_pubkey %}
|
||||
<service android:name="org.kivy.android.billing.BillingReceiver"
|
||||
android:process=":pythonbilling" />
|
||||
|
||||
@@ -6,7 +6,7 @@ buildscript {
|
||||
maven { url "https://jitpack.io" }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.0.0'
|
||||
classpath 'com.android.tools.build:gradle:3.3.0'
|
||||
classpath 'com.google.gms:google-services:4.2.0'
|
||||
}
|
||||
}
|
||||
@@ -35,13 +35,13 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion {{ args.min_sdk_version }}
|
||||
targetSdkVersion {{ android_api }}
|
||||
versionCode {{ args.numeric_version }}
|
||||
versionCode {{ args.numeric_version }} * 10 + 2
|
||||
versionName '{{ args.version }}'
|
||||
missingDimensionStrategy 'react-native-camera', 'general'
|
||||
multiDexEnabled true
|
||||
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a", "arm64-v8a"
|
||||
abiFilters "arm64-v8a"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ ext {
|
||||
buildToolsVersion = '{{ build_tools_version }}'
|
||||
minSdkVersion = {{ args.min_sdk_version }}
|
||||
targetSdkVersion = {{ android_api }}
|
||||
supportLibVersion = '27.1.1'
|
||||
supportLibVersion = '28.0.0'
|
||||
googlePlayServicesVersion = '16.1.0'
|
||||
googlePlayServicesVisionVersion = '17.0.2'
|
||||
}
|
||||
@@ -106,11 +106,11 @@ subprojects {
|
||||
dependencies {
|
||||
compile project(':@react-native-community_async-storage')
|
||||
compile project(':react-native-camera')
|
||||
compile project(':react-native-document-picker')
|
||||
compile project(':react-native-exception-handler')
|
||||
compile project(':react-native-fast-image')
|
||||
compile project(':react-native-fs')
|
||||
compile project(':react-native-gesture-handler')
|
||||
compile project(':react-native-reanimated')
|
||||
compile project(':react-native-video')
|
||||
compile project(':rn-fetch-blob')
|
||||
{%- for aar in aars %}
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
google()
|
||||
maven { url "https://jitpack.io" }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.3.0'
|
||||
classpath 'com.google.gms:google-services:4.2.0'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
maven {
|
||||
url 'https://maven.google.com'
|
||||
}
|
||||
maven {
|
||||
// All of React Native (JS, Android binaries) is installed from npm
|
||||
url "$rootDir/react/node_modules/react-native/android"
|
||||
}
|
||||
flatDir {
|
||||
dirs 'libs'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion {{ android_api }}
|
||||
buildToolsVersion '{{ build_tools_version }}'
|
||||
defaultConfig {
|
||||
minSdkVersion {{ args.min_sdk_version }}
|
||||
targetSdkVersion {{ android_api }}
|
||||
versionCode {{ args.numeric_version }} * 10 + 1
|
||||
versionName '{{ args.version }}'
|
||||
missingDimensionStrategy 'react-native-camera', 'general'
|
||||
multiDexEnabled true
|
||||
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a"
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility 1.8
|
||||
targetCompatibility 1.8
|
||||
}
|
||||
|
||||
dexOptions {
|
||||
jumboMode true
|
||||
}
|
||||
|
||||
{% if args.sign -%}
|
||||
signingConfigs {
|
||||
release {
|
||||
storeFile file(System.getenv("P4A_RELEASE_KEYSTORE"))
|
||||
keyAlias System.getenv("P4A_RELEASE_KEYALIAS")
|
||||
storePassword System.getenv("P4A_RELEASE_KEYSTORE_PASSWD")
|
||||
keyPassword System.getenv("P4A_RELEASE_KEYALIAS_PASSWD")
|
||||
}
|
||||
}
|
||||
{%- endif %}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
}
|
||||
release {
|
||||
{% if args.sign -%}
|
||||
signingConfig signingConfigs.release
|
||||
{%- endif %}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
jniLibs.srcDir 'libs'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
compileSdkVersion = {{ android_api }}
|
||||
buildToolsVersion = '{{ build_tools_version }}'
|
||||
minSdkVersion = {{ args.min_sdk_version }}
|
||||
targetSdkVersion = {{ android_api }}
|
||||
supportLibVersion = '28.0.0'
|
||||
googlePlayServicesVersion = '16.1.0'
|
||||
googlePlayServicesVisionVersion = '17.0.2'
|
||||
}
|
||||
|
||||
subprojects {
|
||||
afterEvaluate {project ->
|
||||
if (project.hasProperty("android")) {
|
||||
android {
|
||||
compileSdkVersion {{ android_api }}
|
||||
buildToolsVersion '{{ build_tools_version }}'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(':@react-native-community_async-storage')
|
||||
compile project(':react-native-camera')
|
||||
compile project(':react-native-exception-handler')
|
||||
compile project(':react-native-fast-image')
|
||||
compile project(':react-native-fs')
|
||||
compile project(':react-native-gesture-handler')
|
||||
compile project(':react-native-reanimated')
|
||||
compile project(':react-native-video')
|
||||
compile project(':rn-fetch-blob')
|
||||
{%- for aar in aars %}
|
||||
compile(name: '{{ aar }}', ext: 'aar')
|
||||
{%- endfor -%}
|
||||
{%- if args.depends -%}
|
||||
{%- for depend in args.depends %}
|
||||
compile '{{ depend }}'
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
}
|
||||
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
|
||||
@@ -3,8 +3,6 @@ include ':@react-native-community_async-storage'
|
||||
project(':@react-native-community_async-storage').projectDir = new File(rootProject.projectDir, './react/node_modules/@react-native-community/async-storage/android')
|
||||
include ':react-native-camera'
|
||||
project(':react-native-camera').projectDir = new File(rootProject.projectDir, './react/node_modules/react-native-camera/android')
|
||||
include ':react-native-document-picker'
|
||||
project(':react-native-document-picker').projectDir = new File(rootProject.projectDir, './react/node_modules/react-native-document-picker/android')
|
||||
include ':react-native-exception-handler'
|
||||
project(':react-native-exception-handler').projectDir = new File(rootProject.projectDir, './react/node_modules/react-native-exception-handler/android')
|
||||
include ':react-native-fast-image'
|
||||
@@ -13,6 +11,8 @@ include ':react-native-fs'
|
||||
project(':react-native-fs').projectDir = new File(settingsDir, './react/node_modules/react-native-fs/android')
|
||||
include ':react-native-gesture-handler'
|
||||
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, './react/node_modules/react-native-gesture-handler/android')
|
||||
include ':react-native-reanimated'
|
||||
project(':react-native-reanimated').projectDir = new File(rootProject.projectDir, './react/node_modules/react-native-reanimated/android')
|
||||
include ':react-native-video'
|
||||
project(':react-native-video').projectDir = new File(rootProject.projectDir, './react/node_modules/react-native-video/android-exoplayer')
|
||||
include ':rn-fetch-blob'
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
<string name="private_version">{{ private_version }}</string>
|
||||
<string name="presplash_color">{{ args.presplash_color }}</string>
|
||||
<string name="urlScheme">{{ url_scheme }}</string>
|
||||
|
||||
<string name="default_notification_channel_id">io.lbry.browser.LBRY_ENGAGEMENT_CHANNEL</string>
|
||||
|
||||
<string name="running">Running</string>
|
||||
<string name="service_status">Service Status</string>
|
||||
<string name="stopped">Stopped</string>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
cd app
|
||||
react-native bundle --platform android --dev false --entry-file src/index.js --bundle-output ../src/main/assets/index.android.bundle --assets-dest ../src/main/res/
|
||||
cd ..
|
||||
cp src/main/assets/index.android.bundle /dev/null
|
||||
version=$(cat src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+')
|
||||
buildozer android release <<< y
|
||||
jarsigner -verbose -sigalg SHA1withRSA \
|
||||
@@ -10,6 +11,6 @@ jarsigner -verbose -sigalg SHA1withRSA \
|
||||
-storepass $KEYSTORE_PASSWORD \
|
||||
bin/browser-$version-release-unsigned.apk lbry-android > /dev/null \
|
||||
&& mv bin/browser-$version-release-unsigned.apk bin/browser-$version-release-signed.apk
|
||||
~/.buildozer/android/platform/android-sdk-23/build-tools/26.0.2/zipalign -v 4 \
|
||||
~/.buildozer/android/platform/android-sdk-23/build-tools/28.0.3/zipalign -v 4 \
|
||||
bin/browser-$version-release-signed.apk bin/browser-$version-release.apk > /dev/null \
|
||||
&& rm bin/browser-$version-release-signed.apk
|
||||
@@ -0,0 +1,157 @@
|
||||
package io.lbry.browser;
|
||||
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.media.RingtoneManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
import com.google.firebase.messaging.FirebaseMessagingService;
|
||||
import com.google.firebase.messaging.RemoteMessage;
|
||||
|
||||
import io.lbry.browser.reactmodules.UtilityModule;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class LbrynetMessagingService extends FirebaseMessagingService {
|
||||
|
||||
private static final String TAG = "LbrynetMessagingService";
|
||||
|
||||
private static final String NOTIFICATION_CHANNEL_ID = "io.lbry.browser.LBRY_ENGAGEMENT_CHANNEL";
|
||||
|
||||
private static final String TYPE_SUBSCRIPTION = "subscription";
|
||||
|
||||
private static final String TYPE_REWARD = "reward";
|
||||
|
||||
private static final String TYPE_INTERESTS = "interests";
|
||||
|
||||
private static final String TYPE_CREATOR = "creator";
|
||||
|
||||
private FirebaseAnalytics firebaseAnalytics;
|
||||
|
||||
@Override
|
||||
public void onMessageReceived(RemoteMessage remoteMessage) {
|
||||
Log.d(TAG, "From: " + remoteMessage.getFrom());
|
||||
if (firebaseAnalytics == null) {
|
||||
firebaseAnalytics = FirebaseAnalytics.getInstance(this);
|
||||
}
|
||||
|
||||
Map<String, String> payload = remoteMessage.getData();
|
||||
if (payload != null) {
|
||||
String type = payload.get("type");
|
||||
String url = payload.get("target");
|
||||
String title = payload.get("title");
|
||||
String body = payload.get("body");
|
||||
String name = payload.get("name"); // notification name
|
||||
if (type != null && getEnabledTypes().indexOf(type) > -1 && body != null && body.trim().length() > 0) {
|
||||
// only log the receive event for valid notifications received
|
||||
if (firebaseAnalytics != null) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("name", name);
|
||||
firebaseAnalytics.logEvent("lbry_notification_receive", bundle);
|
||||
}
|
||||
|
||||
sendNotification(title, body, type, url, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNewToken(String token) {
|
||||
Log.d(TAG, "Refreshed token: " + token);
|
||||
|
||||
// If you want to send messages to this application instance or
|
||||
// manage this apps subscriptions on the server side, send the
|
||||
// Instance ID token to your app server.
|
||||
sendRegistrationToServer(token);
|
||||
}
|
||||
|
||||
/**
|
||||
* Persist token to third-party servers.
|
||||
*
|
||||
* Modify this method to associate the user's FCM InstanceID token with any server-side account
|
||||
* maintained by your application.
|
||||
*
|
||||
* @param token The new token.
|
||||
*/
|
||||
private void sendRegistrationToServer(String token) {
|
||||
// TODO: Implement this method to send token to your app server.
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and show a simple notification containing the received FCM message.
|
||||
*
|
||||
* @param messageBody FCM message body received.
|
||||
*/
|
||||
private void sendNotification(String title, String messageBody, String type, String url, String name) {
|
||||
//Intent intent = new Intent(this, MainActivity.class);
|
||||
//intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
if (url == null) {
|
||||
if (TYPE_REWARD.equals(type)) {
|
||||
url = "lbry://?rewards";
|
||||
} else {
|
||||
// default to home page
|
||||
url = "lbry://?discover";
|
||||
}
|
||||
}
|
||||
|
||||
Intent launchIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
launchIntent.putExtra("notification_name", name);
|
||||
launchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, launchIntent, PendingIntent.FLAG_ONE_SHOT);
|
||||
|
||||
Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
|
||||
NotificationCompat.Builder notificationBuilder =
|
||||
new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID)
|
||||
.setColor(ContextCompat.getColor(this, R.color.lbryGreen))
|
||||
.setSmallIcon(R.drawable.ic_lbry)
|
||||
.setContentTitle(title)
|
||||
.setContentText(messageBody)
|
||||
.setAutoCancel(true)
|
||||
.setSound(defaultSoundUri)
|
||||
.setContentIntent(pendingIntent);
|
||||
|
||||
NotificationManager notificationManager =
|
||||
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
// Since android Oreo notification channel is needed.
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
NotificationChannel channel = new NotificationChannel(
|
||||
NOTIFICATION_CHANNEL_ID, "LBRY Engagement", NotificationManager.IMPORTANCE_DEFAULT);
|
||||
notificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
|
||||
notificationManager.notify(9898, notificationBuilder.build());
|
||||
}
|
||||
|
||||
public List<String> getEnabledTypes() {
|
||||
SharedPreferences sp = getSharedPreferences(MainActivity.SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
List<String> enabledTypes = new ArrayList<String>();
|
||||
|
||||
if (sp.getBoolean(UtilityModule.RECEIVE_SUBSCRIPTION_NOTIFICATIONS, true)) {
|
||||
enabledTypes.add(TYPE_SUBSCRIPTION);
|
||||
}
|
||||
if (sp.getBoolean(UtilityModule.RECEIVE_REWARD_NOTIFICATIONS, true)) {
|
||||
enabledTypes.add(TYPE_REWARD);
|
||||
}
|
||||
if (sp.getBoolean(UtilityModule.RECEIVE_INTERESTS_NOTIFICATIONS, true)) {
|
||||
enabledTypes.add(TYPE_INTERESTS);
|
||||
}
|
||||
if (sp.getBoolean(UtilityModule.RECEIVE_CREATOR_NOTIFICATIONS, true)) {
|
||||
enabledTypes.add(TYPE_CREATOR);
|
||||
}
|
||||
|
||||
return enabledTypes;
|
||||
}
|
||||
}
|
||||
@@ -74,8 +74,6 @@ public class LbrynetService extends PythonService {
|
||||
|
||||
public static LbrynetService serviceInstance;
|
||||
|
||||
private static final String SDK_URL = "http://127.0.0.1:5279";
|
||||
|
||||
private static final int SDK_POLL_INTERVAL = 500; // 500 milliseconds
|
||||
|
||||
private BroadcastReceiver stopServiceReceiver;
|
||||
@@ -192,86 +190,10 @@ public class LbrynetService extends PythonService {
|
||||
}
|
||||
}
|
||||
|
||||
private String sdkCall(String method) throws ConnectException {
|
||||
return sdkCall(method, null);
|
||||
}
|
||||
|
||||
private String sdkCall(String method, Map<String, String> params) throws ConnectException {
|
||||
BufferedReader reader = null;
|
||||
DataOutputStream dos = null;
|
||||
HttpURLConnection conn = null;
|
||||
|
||||
try {
|
||||
JSONObject request = new JSONObject();
|
||||
request.put("method", method);
|
||||
if (params != null) {
|
||||
JSONObject requestParams = new JSONObject();
|
||||
for (Map.Entry<String, String> entry : params.entrySet()) {
|
||||
requestParams.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
request.put("params", requestParams);
|
||||
}
|
||||
|
||||
URL url = new URL(SDK_URL);
|
||||
conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setDoInput(true);
|
||||
conn.setDoOutput(true);
|
||||
conn.setUseCaches(false);
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setRequestProperty("Content-type", "application/json");
|
||||
|
||||
dos = new DataOutputStream(conn.getOutputStream());
|
||||
dos.writeBytes(request.toString());
|
||||
dos.flush();
|
||||
dos.close();
|
||||
|
||||
if (conn.getResponseCode() == 200) {
|
||||
reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String input;
|
||||
while ((input = reader.readLine()) != null) {
|
||||
sb.append(input);
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
} else {
|
||||
reader = new BufferedReader(new InputStreamReader(conn.getErrorStream(), "utf-8"));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String error;
|
||||
while ((error = reader.readLine()) != null) {
|
||||
sb.append(error);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
} catch (ConnectException ex) {
|
||||
// sdk not started yet. rethrow
|
||||
throw ex;
|
||||
} catch (IOException ex) {
|
||||
Log.e(TAG, ex.getMessage(), ex);
|
||||
// ignore and continue
|
||||
} catch (Exception ex) {
|
||||
Log.e(TAG, ex.getMessage(), ex);
|
||||
// ignore
|
||||
} finally {
|
||||
try {
|
||||
if (reader != null) {
|
||||
reader.close();
|
||||
}
|
||||
if (conn != null) {
|
||||
conn.disconnect();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
// pass
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void pollFileList() {
|
||||
try {
|
||||
if (!streamManagerReady) {
|
||||
String statusResponse = sdkCall("status");
|
||||
String statusResponse = Utils.sdkCall("status");
|
||||
if (statusResponse != null) {
|
||||
JSONObject status = new JSONObject(statusResponse);
|
||||
if (status.has("error")) {
|
||||
@@ -288,7 +210,7 @@ public class LbrynetService extends PythonService {
|
||||
}
|
||||
|
||||
if (streamManagerReady) {
|
||||
String fileList = sdkCall("file_list");
|
||||
String fileList = Utils.sdkCall("file_list");
|
||||
if (fileList != null) {
|
||||
JSONObject response = new JSONObject(fileList);
|
||||
if (!response.has("error")) {
|
||||
@@ -309,7 +231,7 @@ public class LbrynetService extends PythonService {
|
||||
try {
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("outpoint", outpoint);
|
||||
return sdkCall("file_list", params);
|
||||
return Utils.sdkCall("file_list", params);
|
||||
} catch (ConnectException ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,18 +1,24 @@
|
||||
package io.lbry.browser;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ContentUris;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.Cursor;
|
||||
import android.Manifest;
|
||||
import android.net.Uri;
|
||||
import android.provider.DocumentsContract;
|
||||
import android.provider.MediaStore;
|
||||
import android.provider.Settings;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.app.NotificationManagerCompat;
|
||||
@@ -36,18 +42,21 @@ import com.facebook.react.modules.core.PermissionAwareActivity;
|
||||
import com.facebook.react.modules.core.PermissionListener;
|
||||
import com.facebook.react.shell.MainReactPackage;
|
||||
import com.facebook.react.ReactRootView;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
import com.reactnativecommunity.asyncstorage.AsyncStoragePackage;
|
||||
import com.reactnativedocumentpicker.ReactNativeDocumentPicker;
|
||||
import com.rnfs.RNFSPackage;
|
||||
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
|
||||
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
|
||||
import com.swmansion.reanimated.ReanimatedPackage;
|
||||
import com.RNFetchBlob.RNFetchBlobPackage;
|
||||
|
||||
import io.lbry.browser.reactpackages.LbryReactPackage;
|
||||
import io.lbry.browser.reactmodules.BackgroundMediaModule;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigInteger;
|
||||
import java.net.URISyntaxException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.ArrayList;
|
||||
@@ -73,6 +82,8 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
|
||||
private static final int RECEIVE_SMS_PERMISSION_REQ_CODE = 203;
|
||||
|
||||
public static final int DOCUMENT_PICKER_RESULT_CODE = 301;
|
||||
|
||||
private BroadcastReceiver notificationsReceiver;
|
||||
|
||||
private BroadcastReceiver smsReceiver;
|
||||
@@ -81,6 +92,8 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
|
||||
private BroadcastReceiver downloadEventReceiver;
|
||||
|
||||
private FirebaseAnalytics firebaseAnalytics;
|
||||
|
||||
private ReactRootView mReactRootView;
|
||||
|
||||
private ReactInstanceManager mReactInstanceManager;
|
||||
@@ -139,6 +152,8 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
ServiceHelper.start(this, "", LbrynetService.class, "lbrynetservice");
|
||||
}
|
||||
|
||||
checkNotificationOpenIntent(getIntent());
|
||||
|
||||
mReactRootView = new RNGestureHandlerEnabledRootView(this);
|
||||
mReactInstanceManager = ReactInstanceManager.builder()
|
||||
.setApplication(getApplication())
|
||||
@@ -147,8 +162,8 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
.addPackage(new MainReactPackage())
|
||||
.addPackage(new AsyncStoragePackage())
|
||||
.addPackage(new FastImageViewPackage())
|
||||
.addPackage(new ReactNativeDocumentPicker())
|
||||
.addPackage(new ReactVideoPackage())
|
||||
.addPackage(new ReanimatedPackage())
|
||||
.addPackage(new RNCameraPackage())
|
||||
.addPackage(new RNFetchBlobPackage())
|
||||
.addPackage(new RNFSPackage())
|
||||
@@ -164,6 +179,25 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
setContentView(mReactRootView);
|
||||
}
|
||||
|
||||
private void checkNotificationOpenIntent(Intent intent) {
|
||||
if (intent != null) {
|
||||
String notificationName = intent.getStringExtra("notification_name");
|
||||
if (notificationName != null) {
|
||||
logNotificationOpen(notificationName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void logNotificationOpen(String name) {
|
||||
if (firebaseAnalytics == null) {
|
||||
firebaseAnalytics = FirebaseAnalytics.getInstance(this);
|
||||
}
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("name", name);
|
||||
firebaseAnalytics.logEvent("lbry_notification_open", bundle);
|
||||
}
|
||||
|
||||
private void registerDownloadEventReceiver() {
|
||||
IntentFilter intentFilter = new IntentFilter();
|
||||
intentFilter.addAction(DownloadManager.ACTION_DOWNLOAD_EVENT);
|
||||
@@ -297,6 +331,24 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (requestCode == DOCUMENT_PICKER_RESULT_CODE) {
|
||||
ReactContext reactContext = mReactInstanceManager.getCurrentReactContext();
|
||||
if (reactContext != null) {
|
||||
if (resultCode == RESULT_OK) {
|
||||
Uri fileUri = data.getData();
|
||||
String filePath = getRealPathFromURI_API19(this, fileUri);
|
||||
WritableMap params = Arguments.createMap();
|
||||
params.putString("path", filePath);
|
||||
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
||||
.emit("onDocumentPickerFilePicked", params);
|
||||
} else if (resultCode == RESULT_CANCELED) {
|
||||
// user canceled or request failed
|
||||
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
||||
.emit("onDocumentPickerCanceled", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Activity getActivity() {
|
||||
@@ -506,6 +558,8 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
|
||||
notificationManager.cancel(sourceNotificationId);
|
||||
}
|
||||
|
||||
checkNotificationOpenIntent(intent);
|
||||
}
|
||||
|
||||
super.onNewIntent(intent);
|
||||
@@ -609,4 +663,161 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://gist.github.com/HBiSoft/15899990b8cd0723c3a894c1636550a8
|
||||
*/
|
||||
@SuppressLint("NewApi")
|
||||
public static String getRealPathFromURI_API19(final Context context, final Uri uri) {
|
||||
|
||||
final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
|
||||
|
||||
// DocumentProvider
|
||||
if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
|
||||
// ExternalStorageProvider
|
||||
if (isExternalStorageDocument(uri)) {
|
||||
final String docId = DocumentsContract.getDocumentId(uri);
|
||||
final String[] split = docId.split(":");
|
||||
final String type = split[0];
|
||||
|
||||
// This is for checking Main Memory
|
||||
if ("primary".equalsIgnoreCase(type)) {
|
||||
if (split.length > 1) {
|
||||
return Environment.getExternalStorageDirectory() + "/" + split[1];
|
||||
} else {
|
||||
return Environment.getExternalStorageDirectory() + "/";
|
||||
}
|
||||
// This is for checking SD Card
|
||||
} else {
|
||||
return "storage" + "/" + docId.replace(":", "/");
|
||||
}
|
||||
|
||||
}
|
||||
// DownloadsProvider
|
||||
else if (isDownloadsDocument(uri)) {
|
||||
String fileName = getFilePath(context, uri);
|
||||
if (fileName != null) {
|
||||
return Environment.getExternalStorageDirectory().toString() + "/Download/" + fileName;
|
||||
}
|
||||
|
||||
String id = DocumentsContract.getDocumentId(uri);
|
||||
if (id.startsWith("raw:")) {
|
||||
id = id.replaceFirst("raw:", "");
|
||||
File file = new File(id);
|
||||
if (file.exists())
|
||||
return id;
|
||||
}
|
||||
|
||||
final Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
|
||||
return getDataColumn(context, contentUri, null, null);
|
||||
}
|
||||
// MediaProvider
|
||||
else if (isMediaDocument(uri)) {
|
||||
final String docId = DocumentsContract.getDocumentId(uri);
|
||||
final String[] split = docId.split(":");
|
||||
final String type = split[0];
|
||||
|
||||
Uri contentUri = null;
|
||||
if ("image".equals(type)) {
|
||||
contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
|
||||
} else if ("video".equals(type)) {
|
||||
contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
|
||||
} else if ("audio".equals(type)) {
|
||||
contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
|
||||
}
|
||||
|
||||
final String selection = "_id=?";
|
||||
final String[] selectionArgs = new String[]{
|
||||
split[1]
|
||||
};
|
||||
|
||||
return getDataColumn(context, contentUri, selection, selectionArgs);
|
||||
}
|
||||
}
|
||||
// MediaStore (and general)
|
||||
else if ("content".equalsIgnoreCase(uri.getScheme())) {
|
||||
|
||||
// Return the remote address
|
||||
if (isGooglePhotosUri(uri))
|
||||
return uri.getLastPathSegment();
|
||||
|
||||
return getDataColumn(context, uri, null, null);
|
||||
}
|
||||
// File
|
||||
else if ("file".equalsIgnoreCase(uri.getScheme())) {
|
||||
return uri.getPath();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) {
|
||||
Cursor cursor = null;
|
||||
final String column = "_data";
|
||||
final String[] projection = {
|
||||
column
|
||||
};
|
||||
|
||||
try {
|
||||
cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null);
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
final int index = cursor.getColumnIndexOrThrow(column);
|
||||
return cursor.getString(index);
|
||||
}
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static String getFilePath(Context context, Uri uri) {
|
||||
Cursor cursor = null;
|
||||
final String[] projection = { MediaStore.MediaColumns.DISPLAY_NAME };
|
||||
|
||||
try {
|
||||
cursor = context.getContentResolver().query(uri, projection, null, null, null);
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
final int index = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DISPLAY_NAME);
|
||||
return cursor.getString(index);
|
||||
}
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param uri The Uri to check.
|
||||
* @return Whether the Uri authority is ExternalStorageProvider.
|
||||
*/
|
||||
public static boolean isExternalStorageDocument(Uri uri) {
|
||||
return "com.android.externalstorage.documents".equals(uri.getAuthority());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param uri The Uri to check.
|
||||
* @return Whether the Uri authority is DownloadsProvider.
|
||||
*/
|
||||
public static boolean isDownloadsDocument(Uri uri) {
|
||||
return "com.android.providers.downloads.documents".equals(uri.getAuthority());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param uri The Uri to check.
|
||||
* @return Whether the Uri authority is MediaProvider.
|
||||
*/
|
||||
public static boolean isMediaDocument(Uri uri) {
|
||||
return "com.android.providers.media.documents".equals(uri.getAuthority());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param uri The Uri to check.
|
||||
* @return Whether the Uri authority is Google Photos.
|
||||
*/
|
||||
public static boolean isGooglePhotosUri(Uri uri) {
|
||||
return "com.google.android.apps.photos.content".equals(uri.getAuthority());
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package io.lbry.browser;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.security.KeyPairGeneratorSpec;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
@@ -10,7 +11,14 @@ import io.lbry.browser.BuildConfig;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.IOException;
|
||||
import java.io.DataOutputStream;
|
||||
import java.net.ConnectException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.math.BigInteger;
|
||||
import java.nio.charset.Charset;
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
@@ -18,9 +26,12 @@ import java.security.Key;
|
||||
import java.security.KeyPairGenerator;
|
||||
import java.security.KeyStore;
|
||||
import java.security.NoSuchProviderException;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.PublicKey;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.CipherInputStream;
|
||||
@@ -28,6 +39,9 @@ import javax.crypto.CipherOutputStream;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import javax.security.auth.x500.X500Principal;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONException;
|
||||
|
||||
public final class Utils {
|
||||
|
||||
private static final String TAG = Utils.class.getName();
|
||||
@@ -46,6 +60,8 @@ public final class Utils {
|
||||
|
||||
private static final String SP_API_SECRET_KEY = "api_secret";
|
||||
|
||||
public static final String SDK_URL = "http://127.0.0.1:5279";
|
||||
|
||||
public static String getAndroidRelease() {
|
||||
return android.os.Build.VERSION.RELEASE;
|
||||
}
|
||||
@@ -140,6 +156,7 @@ public final class Utils {
|
||||
try {
|
||||
SharedPreferences pref = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
|
||||
String encryptedValue = pref.getString(key, null);
|
||||
|
||||
if (encryptedValue == null || encryptedValue.trim().length() == 0) {
|
||||
return null;
|
||||
}
|
||||
@@ -243,12 +260,124 @@ public final class Utils {
|
||||
return ks;
|
||||
}
|
||||
|
||||
public static String performRequest(String url) throws ConnectException {
|
||||
return performRequest(url, "GET", null);
|
||||
}
|
||||
|
||||
public static String performRequest(String requestUrl, String requestMethod, String json) throws ConnectException {
|
||||
BufferedReader reader = null;
|
||||
DataOutputStream dos = null;
|
||||
HttpURLConnection conn = null;
|
||||
|
||||
try {
|
||||
URL url = new URL(requestUrl);
|
||||
conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setDoInput(true);
|
||||
conn.setUseCaches(false);
|
||||
conn.setRequestMethod(requestMethod);
|
||||
if ("POST".equals(requestMethod)) {
|
||||
conn.setDoOutput(true);
|
||||
conn.setRequestProperty("Content-type", "application/json");
|
||||
}
|
||||
|
||||
if (json != null) {
|
||||
dos = new DataOutputStream(conn.getOutputStream());
|
||||
dos.writeBytes(json);
|
||||
dos.flush();
|
||||
dos.close();
|
||||
}
|
||||
|
||||
if (conn.getResponseCode() == 200) {
|
||||
reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String input;
|
||||
while ((input = reader.readLine()) != null) {
|
||||
sb.append(input);
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
} else {
|
||||
reader = new BufferedReader(new InputStreamReader(conn.getErrorStream(), "utf-8"));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String error;
|
||||
while ((error = reader.readLine()) != null) {
|
||||
sb.append(error);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
} catch (ConnectException ex) {
|
||||
// unable to connect. rethrow
|
||||
throw ex;
|
||||
} catch (IOException ex) {
|
||||
Log.e(TAG, ex.getMessage(), ex);
|
||||
// pass
|
||||
} catch (Exception ex) {
|
||||
Log.e(TAG, ex.getMessage(), ex);
|
||||
// pass
|
||||
} finally {
|
||||
try {
|
||||
if (reader != null) {
|
||||
reader.close();
|
||||
}
|
||||
if (conn != null) {
|
||||
conn.disconnect();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
// pass
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String sdkCall(String method) throws ConnectException {
|
||||
return sdkCall(method, null);
|
||||
}
|
||||
|
||||
public static String sdkCall(String method, Map<String, String> params) throws ConnectException {
|
||||
try {
|
||||
JSONObject request = new JSONObject();
|
||||
request.put("method", method);
|
||||
if (params != null) {
|
||||
JSONObject requestParams = new JSONObject();
|
||||
for (Map.Entry<String, String> entry : params.entrySet()) {
|
||||
requestParams.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
request.put("params", requestParams);
|
||||
}
|
||||
|
||||
return performRequest(SDK_URL, "POST", request.toString());
|
||||
} catch (ConnectException ex) {
|
||||
// sdk not started yet. rethrow
|
||||
throw ex;
|
||||
} catch (JSONException ex) {
|
||||
// normally shouldn't happen
|
||||
Log.e(TAG, ex.getMessage(), ex);
|
||||
// pass
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static byte[] rsaEncrypt(byte[] secret, KeyStore keyStore) throws Exception {
|
||||
KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) keyStore.getEntry(KEY_ALIAS, null);
|
||||
PrivateKey privateKey = null;
|
||||
PublicKey publicKey = null;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
privateKey = (PrivateKey) keyStore.getKey(KEY_ALIAS, null);
|
||||
publicKey = keyStore.getCertificate(KEY_ALIAS).getPublicKey();
|
||||
} else {
|
||||
KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) keyStore.getEntry(KEY_ALIAS, null);
|
||||
privateKey = privateKeyEntry.getPrivateKey();
|
||||
publicKey = privateKeyEntry.getCertificate().getPublicKey();
|
||||
}
|
||||
|
||||
if (publicKey == null) {
|
||||
throw new Exception("Could not obtain public key for encryption.");
|
||||
}
|
||||
|
||||
// Encrypt the text
|
||||
Cipher inputCipher = Cipher.getInstance(RSA_MODE);
|
||||
inputCipher.init(Cipher.ENCRYPT_MODE, privateKeyEntry.getCertificate().getPublicKey());
|
||||
inputCipher.init(Cipher.ENCRYPT_MODE, publicKey);
|
||||
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
CipherOutputStream cipherOutputStream = new CipherOutputStream(outputStream, inputCipher);
|
||||
@@ -259,9 +388,20 @@ public final class Utils {
|
||||
}
|
||||
|
||||
private static byte[] rsaDecrypt(byte[] encrypted, KeyStore keyStore) throws Exception {
|
||||
KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) keyStore.getEntry(KEY_ALIAS, null);
|
||||
PrivateKey privateKey = null;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
privateKey = (PrivateKey) keyStore.getKey(KEY_ALIAS, null);
|
||||
} else {
|
||||
KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) keyStore.getEntry(KEY_ALIAS, null);
|
||||
privateKey = privateKeyEntry.getPrivateKey();
|
||||
}
|
||||
|
||||
if (privateKey == null) {
|
||||
throw new Exception("Could not obtain private key for decryption");
|
||||
}
|
||||
|
||||
Cipher output = Cipher.getInstance(RSA_MODE);
|
||||
output.init(Cipher.DECRYPT_MODE, privateKeyEntry.getPrivateKey());
|
||||
output.init(Cipher.DECRYPT_MODE, privateKey);
|
||||
CipherInputStream cipherInputStream = new CipherInputStream(new ByteArrayInputStream(encrypted), output);
|
||||
ArrayList<Byte> values = new ArrayList<Byte>();
|
||||
int nextByte;
|
||||
@@ -300,4 +440,14 @@ public final class Utils {
|
||||
}
|
||||
return new SecretKeySpec(rsaDecrypt(Base64.decode(base64Key, Base64.DEFAULT), keyStore), "AES");
|
||||
}
|
||||
|
||||
public static String capitalizeAndStrip(String text) {
|
||||
String[] parts = text.split(" ");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < parts.length; i++) {
|
||||
sb.append(parts[i].substring(0, 1).toUpperCase()).append(parts[i].substring(1));
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,24 @@
|
||||
package io.lbry.browser.reactmodules;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.facebook.react.bridge.Promise;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.firebase.iid.FirebaseInstanceId;
|
||||
import com.google.firebase.iid.InstanceIdResult;
|
||||
|
||||
import io.lbry.browser.BuildConfig;
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.Utils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -34,6 +42,19 @@ public class FirebaseModule extends ReactContextBaseJavaModule {
|
||||
return "Firebase";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void setCurrentScreen(String name, final Promise promise) {
|
||||
final Activity activity = getCurrentActivity();
|
||||
if (activity != null && firebaseAnalytics != null) {
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
firebaseAnalytics.setCurrentScreen(activity, name, Utils.capitalizeAndStrip(name));
|
||||
}
|
||||
});
|
||||
}
|
||||
promise.resolve(true);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void track(String name, ReadableMap payload) {
|
||||
Bundle bundle = new Bundle();
|
||||
@@ -65,8 +86,26 @@ public class FirebaseModule extends ReactContextBaseJavaModule {
|
||||
Toast.makeText(context,
|
||||
"An application error occurred which has been automatically logged. " +
|
||||
"If you keep seeing this message, please provide feedback to the LBRY " +
|
||||
"team by emailing hello@lbry.io.",
|
||||
"team by emailing hello@lbry.com.",
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void getMessagingToken(final Promise promise) {
|
||||
FirebaseInstanceId.getInstance().getInstanceId()
|
||||
.addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
|
||||
@Override
|
||||
public void onComplete(Task<InstanceIdResult> task) {
|
||||
if (!task.isSuccessful()) {
|
||||
promise.reject("Firebase getInstanceId call failed");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get new Instance ID token
|
||||
String token = task.getResult().getToken();
|
||||
promise.resolve(token);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -221,16 +221,23 @@ public class GalleryModule extends ReactContextBaseJavaModule {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (file.exists() && file.length() > 0 && GalleryModule.this.context != null) {
|
||||
WritableMap params = Arguments.createMap();
|
||||
params.putString("id", id);
|
||||
((ReactApplicationContext) GalleryModule.this.context).getJSModule(
|
||||
DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit("onGalleryThumbnailChecked", params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void onPostExecute(Void result) {
|
||||
public void onPostExecute(Void result) {
|
||||
if (GalleryModule.this.context != null) {
|
||||
((ReactApplicationContext) GalleryModule.this.context).getJSModule(
|
||||
DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit("onGalleryThumbnailsChecked", null);
|
||||
DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit("onAllGalleryThumbnailsChecked", null);
|
||||
}
|
||||
}
|
||||
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package io.lbry.browser.reactmodules;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.Promise;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.ReadableMapKeySetIterator;
|
||||
import com.facebook.react.bridge.ReadableType;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.Utils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
|
||||
public class RequestsModule extends ReactContextBaseJavaModule {
|
||||
private Context context;
|
||||
|
||||
public RequestsModule(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
this.context = reactContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Requests";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void get(final String url, final Promise promise) {
|
||||
(new AsyncTask<Void, Void, String>() {
|
||||
@Override
|
||||
protected String doInBackground(Void... params) {
|
||||
try {
|
||||
return Utils.performRequest(url);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void onPostExecute(String response) {
|
||||
if (response == null) {
|
||||
promise.reject(String.format("Request to %s returned null.", url));
|
||||
return;
|
||||
}
|
||||
|
||||
promise.resolve(response);
|
||||
}
|
||||
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void lbryioCall(String authToken, final Promise promise) {
|
||||
// get the auth token here, or let the app pass it in?
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void lbryCall(final Promise promise) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
package io.lbry.browser.reactmodules;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.Promise;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.ReadableMapKeySetIterator;
|
||||
import com.facebook.react.bridge.ReadableType;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
|
||||
import io.lbry.browser.MainActivity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
|
||||
public class StatePersistorModule extends ReactContextBaseJavaModule {
|
||||
private Context context;
|
||||
|
||||
private List<ReadableMap> queue;
|
||||
|
||||
private ReadableMap filter;
|
||||
|
||||
private ReadableMap lastState;
|
||||
|
||||
private AsyncTask persistTask;
|
||||
|
||||
public StatePersistorModule(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
this.context = reactContext;
|
||||
queue = new ArrayList<ReadableMap>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "StatePersistor";
|
||||
}
|
||||
|
||||
/*private WritableMap filterState(ReadableMap state) {
|
||||
WritableMap filteredState = Arguments.createMap();
|
||||
|
||||
return state;
|
||||
}*/
|
||||
|
||||
public boolean hasStateChanged(ReadableMap newState) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void update(ReadableMap state, ReadableMap filter) {
|
||||
if (this.filter == null) {
|
||||
this.filter = filter;
|
||||
}
|
||||
// process state updates from the queue using a background task
|
||||
synchronized (this) {
|
||||
queue.add(state);
|
||||
}
|
||||
persistState();
|
||||
}
|
||||
|
||||
private void persistState() {
|
||||
persistState(false);
|
||||
}
|
||||
|
||||
private void persistState(final boolean flush) {
|
||||
if (flush && persistTask != null) {
|
||||
persistTask.cancel(true);
|
||||
persistTask = null;
|
||||
}
|
||||
|
||||
if (persistTask == null) {
|
||||
persistTask = (new AsyncTask<Object, Void, Boolean>() {
|
||||
protected Boolean doInBackground(Object... param) {
|
||||
// get the first item in the queue
|
||||
ReadableMap queuedState = null;
|
||||
if (queue.size() > 0) {
|
||||
synchronized (StatePersistorModule.this) {
|
||||
queuedState = queue.remove(flush ? queue.size() - 1 : 0);
|
||||
if (flush) {
|
||||
// we only want the final state in this scenario
|
||||
queue.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (queuedState != null) {
|
||||
ReadableMap state = queuedState; //(ReadableMap) filterState(queuedState);
|
||||
// convert to JSON object
|
||||
|
||||
try {
|
||||
JSONObject json = readableMapToJSON(state);
|
||||
|
||||
// save the state file
|
||||
// TODO: explore this option at a later date
|
||||
throw new UnsupportedOperationException();
|
||||
} catch (JSONException ex) {
|
||||
// normally shouldn't happen, but if it does, reinsert into the queue
|
||||
if (queuedState != null) {
|
||||
synchronized (StatePersistorModule.this) {
|
||||
queue.add(0, queuedState);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onPostExecute(Boolean result) {
|
||||
if (queue.size() > 0) {
|
||||
persistState();
|
||||
}
|
||||
|
||||
persistTask = null;
|
||||
}
|
||||
});
|
||||
persistTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void flush() {
|
||||
persistState(true);
|
||||
}
|
||||
|
||||
private static JSONObject readableMapToJSON(ReadableMap readableMap) throws JSONException {
|
||||
JSONObject json = new JSONObject();
|
||||
ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
|
||||
while (iterator.hasNextKey()) {
|
||||
String key = iterator.nextKey();
|
||||
switch (readableMap.getType(key)) {
|
||||
case Map:
|
||||
json.put(key, readableMapToJSON(readableMap.getMap(key)));
|
||||
break;
|
||||
case Array:
|
||||
json.put(key, readableArrayToJSON(readableMap.getArray(key)));
|
||||
break;
|
||||
case Boolean:
|
||||
json.put(key, readableMap.getBoolean(key));
|
||||
break;
|
||||
case Null:
|
||||
json.put(key, JSONObject.NULL);
|
||||
break;
|
||||
case Number:
|
||||
json.put(key, readableMap.getDouble(key));
|
||||
break;
|
||||
case String:
|
||||
json.put(key, readableMap.getString(key));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
private static JSONArray readableArrayToJSON(ReadableArray readableArray) throws JSONException {
|
||||
JSONArray array = new JSONArray();
|
||||
for (int i = 0; i < readableArray.size(); i++) {
|
||||
switch (readableArray.getType(i)) {
|
||||
case Null:
|
||||
break;
|
||||
case Boolean:
|
||||
array.put(readableArray.getBoolean(i));
|
||||
break;
|
||||
case Number:
|
||||
array.put(readableArray.getDouble(i));
|
||||
break;
|
||||
case String:
|
||||
array.put(readableArray.getString(i));
|
||||
break;
|
||||
case Map:
|
||||
array.put(readableMapToJSON(readableArray.getMap(i)));
|
||||
break;
|
||||
case Array:
|
||||
array.put(readableArrayToJSON(readableArray.getArray(i)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,15 @@ public class UtilityModule extends ReactContextBaseJavaModule {
|
||||
|
||||
public static final String ACTION_NOTIFICATION_LATER = "io.lbry.browser.ACTION_NOTIFICATION_LATER";
|
||||
|
||||
public static final String RECEIVE_SUBSCRIPTION_NOTIFICATIONS = "receiveSubscriptionNotifications";
|
||||
|
||||
public static final String RECEIVE_REWARD_NOTIFICATIONS = "receiveRewardNotifications";
|
||||
|
||||
public static final String RECEIVE_INTERESTS_NOTIFICATIONS = "receiveInterestsNotifications";
|
||||
|
||||
public static final String RECEIVE_CREATOR_NOTIFICATIONS = "receiveCreatorNotifications";
|
||||
|
||||
|
||||
private Context context;
|
||||
|
||||
private KeyStore keyStore;
|
||||
@@ -208,6 +217,18 @@ public class UtilityModule extends ReactContextBaseJavaModule {
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void shareUrl(String url) {
|
||||
Intent shareIntent = new Intent();
|
||||
shareIntent.setAction(Intent.ACTION_SEND);
|
||||
shareIntent.setType("text/plain");
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, url);
|
||||
|
||||
Intent shareUrlIntent = Intent.createChooser(shareIntent, "Share LBRY content");
|
||||
shareUrlIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(shareUrlIntent);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void showNotificationForContent(final String uri, String title, String publisher, final String thumbnail, boolean isPlayable) {
|
||||
final NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
@@ -354,4 +375,42 @@ public class UtilityModule extends ReactContextBaseJavaModule {
|
||||
context.sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void openDocumentPicker(String type) {
|
||||
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
||||
intent.setType(type);
|
||||
Activity activity = MainActivity.getActivity();
|
||||
if (activity != null) {
|
||||
activity.startActivityForResult(
|
||||
Intent.createChooser(intent, "Select a file"), MainActivity.DOCUMENT_PICKER_RESULT_CODE);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void setNativeBooleanSetting(String key, boolean value) {
|
||||
if (context != null) {
|
||||
SharedPreferences sp = context.getSharedPreferences(MainActivity.SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sp.edit();
|
||||
editor.putBoolean(key, value);
|
||||
editor.commit();
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void getNotificationLaunchTarget(Promise promise) {
|
||||
Activity activity = MainActivity.getActivity();
|
||||
if (activity != null) {
|
||||
Intent intent = activity.getIntent();
|
||||
if (intent != null) {
|
||||
String target = intent.getStringExtra("target");
|
||||
if (target != null && target.trim().length() > 0) {
|
||||
promise.resolve(target);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
promise.resolve(null);
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,11 @@ import io.lbry.browser.reactmodules.DaemonServiceControlModule;
|
||||
import io.lbry.browser.reactmodules.FirstRunModule;
|
||||
import io.lbry.browser.reactmodules.FirebaseModule;
|
||||
import io.lbry.browser.reactmodules.GalleryModule;
|
||||
import io.lbry.browser.reactmodules.RequestsModule;
|
||||
import io.lbry.browser.reactmodules.ScreenOrientationModule;
|
||||
import io.lbry.browser.reactmodules.StatePersistorModule;
|
||||
import io.lbry.browser.reactmodules.VersionInfoModule;
|
||||
import io.lbry.browser.reactmodules.UtilityModule;;
|
||||
import io.lbry.browser.reactmodules.UtilityModule;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -33,7 +35,9 @@ public class LbryReactPackage implements ReactPackage {
|
||||
modules.add(new FirstRunModule(reactContext));
|
||||
modules.add(new FirebaseModule(reactContext));
|
||||
modules.add(new GalleryModule(reactContext));
|
||||
modules.add(new RequestsModule(reactContext));
|
||||
modules.add(new ScreenOrientationModule(reactContext));
|
||||
modules.add(new StatePersistorModule(reactContext));
|
||||
modules.add(new UtilityModule(reactContext));
|
||||
modules.add(new VersionInfoModule(reactContext));
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
__version__ = "0.8.0"
|
||||
__version__ = "0.11.1"
|
||||
|
||||
class ServiceApp(App):
|
||||
def build(self):
|
||||
|
||||
|
After Width: | Height: | Size: 134 B |
|
After Width: | Height: | Size: 100 B |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 265 KiB |
|
After Width: | Height: | Size: 134 B |
|
After Width: | Height: | Size: 167 B |
|
After Width: | Height: | Size: 207 B |