Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff30e7f6a4 | ||
|
|
3fcc01597d | ||
|
|
cbc4a662e6 | ||
|
|
5aa0513324 | ||
|
|
4d1f142f9c | ||
|
|
e9c8f9432f | ||
|
|
56c375f344 | ||
|
|
5b165a2339 | ||
|
|
bfd3c711ab | ||
|
|
4627e284fa | ||
|
|
ea8ac783a8 | ||
|
|
966dd2bf2c | ||
|
|
364de592fa | ||
|
|
d38241f0d1 | ||
|
|
e217be6b67 | ||
|
|
37f84f0399 | ||
|
|
b618b9fa2b | ||
|
|
37b893103d | ||
|
|
e2d4852df7 | ||
|
|
1e0298d73a | ||
|
|
64c13295d6 | ||
|
|
0261ece709 | ||
|
|
a5799347ad | ||
|
|
6c7c4d1a88 | ||
|
|
f5390316a7 | ||
|
|
da1ea77aa9 | ||
|
|
8ea48977ae | ||
|
|
6721db54e2 | ||
|
|
6a7079c8b2 | ||
|
|
8cc7e9d6c9 | ||
|
|
d0ac41c242 | ||
|
|
bc8f476ef1 | ||
|
|
2d01b63cfe | ||
|
|
88dc31e9af | ||
|
|
8d1e5eb64d | ||
|
|
8113ef3f8a | ||
|
|
a74ed0e93b | ||
|
|
11f42bf71e | ||
|
|
8eb96025ec | ||
|
|
1ece7ff433 | ||
|
|
e312c451f8 | ||
|
|
bb64e91648 | ||
|
|
69398f6a2c | ||
|
|
bef7aa0ae9 | ||
|
|
2776696501 | ||
|
|
fa075df278 | ||
|
|
05311fd3a1 | ||
|
|
79001239d9 | ||
|
|
e344733bf0 | ||
|
|
282fdbb903 | ||
|
|
ee7c571101 | ||
|
|
87e42d6b7e | ||
|
|
8fcf135280 | ||
|
|
ae9364ad7e | ||
|
|
6aa44d8a9e | ||
|
|
3f013d1272 | ||
|
|
94d1f5a4eb | ||
|
|
1d8a7d838b | ||
|
|
c5d441fa1f | ||
|
|
4276a78a81 | ||
|
|
36c24a448f | ||
|
|
4bf1051549 | ||
|
|
fc4ab3128c | ||
|
|
65d32ea13e | ||
|
|
4cd8c80226 | ||
|
|
7adcdc43cf | ||
|
|
77852dc135 | ||
|
|
746ca62ca7 | ||
|
|
5e993f0fcc | ||
|
|
168dbba62c | ||
|
|
4db7bf814c | ||
|
|
21a3ff318b | ||
|
|
116de67d4c | ||
|
|
c6b8dfd539 | ||
|
|
37f33e9943 | ||
|
|
4bae7fdf94 | ||
|
|
c455bde154 | ||
|
|
5aa4321787 | ||
|
|
27a2100c72 | ||
|
|
4fc82c6527 | ||
|
|
56486ad274 | ||
|
|
99a38e655b | ||
|
|
262050147d | ||
|
|
5ff2e608c2 | ||
|
|
4e305faf5b | ||
|
|
0bdbb843fb | ||
|
|
c8736ad26e | ||
|
|
57d6b72f5a | ||
|
|
d0117b14db | ||
|
|
6729842ed8 | ||
|
|
723ade8ba6 | ||
|
|
83066232b6 | ||
|
|
4dc0b19c5d | ||
|
|
a58cc820ef | ||
|
|
2b3397bc85 | ||
|
|
a519b5c0b1 | ||
|
|
fb3a34c871 | ||
|
|
a1bc3fcd7e | ||
|
|
7daf3c6f55 | ||
|
|
7d032179ef | ||
|
|
156507f8f7 | ||
|
|
032a1927db | ||
|
|
f24bf570ef | ||
|
|
75c2ece016 | ||
|
|
0c1c1a6c79 | ||
|
|
5af25a9d43 | ||
|
|
55fec0f578 | ||
|
|
b61fc3a148 | ||
|
|
e3cd0fc2b1 | ||
|
|
fe01f50c65 | ||
|
|
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 |
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,17 +1,68 @@
|
||||
.buildozer
|
||||
.buildozer-downloads
|
||||
# OSX
|
||||
#
|
||||
.DS_Store
|
||||
|
||||
# Xcode
|
||||
#
|
||||
build/
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
!default.mode1v3
|
||||
*.mode2v3
|
||||
!default.mode2v3
|
||||
*.perspectivev3
|
||||
!default.perspectivev3
|
||||
xcuserdata
|
||||
*.xccheckout
|
||||
*.moved-aside
|
||||
DerivedData
|
||||
*.hmap
|
||||
*.ipa
|
||||
*.xcuserstate
|
||||
|
||||
# Android/IntelliJ
|
||||
#
|
||||
build/
|
||||
.idea
|
||||
.gradle
|
||||
app/node_modules/
|
||||
bin
|
||||
buildozer.spec
|
||||
build.log
|
||||
recipes/**/*.pyc
|
||||
src/main/assets/index.android.bundle
|
||||
src/main/assets/index.android.bundle.meta
|
||||
local.properties
|
||||
*.iml
|
||||
|
||||
# node.js
|
||||
#
|
||||
node_modules/
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
|
||||
# BUCK
|
||||
buck-out/
|
||||
\.buckd/
|
||||
*.keystore
|
||||
!debug.keystore
|
||||
|
||||
# fastlane
|
||||
#
|
||||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
|
||||
# screenshots whenever they are needed.
|
||||
# For more information about the recommended setup visit:
|
||||
# https://docs.fastlane.tools/best-practices/source-control/
|
||||
|
||||
*/fastlane/report.xml
|
||||
*/fastlane/Preview.html
|
||||
*/fastlane/screenshots
|
||||
|
||||
# Bundle artifact
|
||||
*.jsbundle
|
||||
|
||||
# CocoaPods
|
||||
/ios/Pods/
|
||||
|
||||
# Other Files
|
||||
app/google-services.json
|
||||
app/src/main/assets/index.android.bundle
|
||||
*.log
|
||||
.vagrant
|
||||
|
||||
lbry-android.keystore
|
||||
p4a/pythonforandroid/bootstraps/lbry/build/templates/google-services.json
|
||||
.gitsecret/keys/random_seed
|
||||
|
||||
*.hprof
|
||||
app/build
|
||||
bin
|
||||
@@ -1,79 +1,63 @@
|
||||
stages:
|
||||
- build
|
||||
- build2
|
||||
- deploy
|
||||
- release
|
||||
|
||||
build arm64 apk:
|
||||
variables:
|
||||
REACT_NATIVE_BRANCH: "master"
|
||||
|
||||
build apk:
|
||||
stage: build
|
||||
image: lbry/android-base:latest
|
||||
image: lbry/android-base:platform-28
|
||||
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
|
||||
- apt-get -y update && apt-get -y install build-essential ca-certificates curl git gpg-agent openjdk-8-jdk software-properties-common wget zipalign
|
||||
- wget -q https://nodejs.org/dist/latest-v10.x/node-v10.19.0-linux-x64.tar.gz && tar xf node-v10.19.0-linux-x64.tar.gz -C /opt
|
||||
- ln -fs /opt/node-v10.19.0-linux-x64/bin/node /usr/bin/node
|
||||
- ln -fs /opt/node-v10.19.0-linux-x64/bin/npm /usr/bin/npm
|
||||
- ln -fs /opt/node-v10.19.0-linux-x64/bin/npx /usr/bin/npx
|
||||
- chmod u+x $CI_PROJECT_DIR/gradlew
|
||||
- export ANDROID_SDK_ROOT=~/.buildozer/android/platform/android-sdk-23
|
||||
- export BUILD_VERSION=$($CI_PROJECT_DIR/gradlew -q printVersionName --console=plain | tail -1)
|
||||
artifacts:
|
||||
paths:
|
||||
- bin/browser-*-release__arm.apk
|
||||
- bin/browser-*-release__arm64.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/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__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
|
||||
- curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
||||
- echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
|
||||
- echo "deb https://dl.bintray.com/sobolevn/deb git-secret main" | tee -a /etc/apt/sources.list
|
||||
- wget -O - https://api.bintray.com/users/sobolevn/keys/gpg/public.key | apt-key add -
|
||||
- apt-get -y update && apt-get -y install yarn git-secret
|
||||
- git secret reveal
|
||||
- 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
|
||||
- npm install -g react-native-cli
|
||||
- cd ~/
|
||||
- git clone --single-branch --branch $REACT_NATIVE_BRANCH https://github.com/lbryio/lbry-react-native
|
||||
- cd lbry-react-native
|
||||
- chmod u+x bundle-android.sh
|
||||
- yarn
|
||||
- rm -rf android # temporary, should be a submodule init?
|
||||
- cp -rf $CI_PROJECT_DIR/ android/
|
||||
- cd android
|
||||
- chmod u+x ./release.sh
|
||||
- ./release.sh
|
||||
- mkdir -p $CI_PROJECT_DIR/bin/ && cp bin/*.apk $CI_PROJECT_DIR/bin/
|
||||
- cd $CI_PROJECT_DIR
|
||||
- cp bin/browser-$BUILD_VERSION-release__arm.apk /dev/null
|
||||
- cp bin/browser-$BUILD_VERSION-release__arm64.apk /dev/null
|
||||
|
||||
deploy build.lbry.io:
|
||||
image: python:latest
|
||||
image: python:stretch
|
||||
stage: deploy
|
||||
dependencies:
|
||||
- build arm apk
|
||||
- build arm64 apk
|
||||
- build apk
|
||||
before_script:
|
||||
- apt-get -y update && apt-get -y install openjdk-8-jdk
|
||||
- pip install awscli
|
||||
- export BUILD_VERSION=$(cat $CI_PROJECT_DIR/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+')
|
||||
- chmod u+x $CI_PROJECT_DIR/gradlew
|
||||
- export BUILD_VERSION=$($CI_PROJECT_DIR/gradlew -q printVersionName --console=plain | tail -1)
|
||||
- export BUILD_APK_FILENAME__32=browser-$BUILD_VERSION-release__arm.apk
|
||||
- export BUILD_APK_FILENAME__64=browser-$BUILD_VERSION-release__arm64.apk
|
||||
script:
|
||||
@@ -82,16 +66,17 @@ deploy build.lbry.io:
|
||||
- aws s3 cp bin/$BUILD_APK_FILENAME__64 s3://build.lbry.io/android/push.apk
|
||||
|
||||
release apk:
|
||||
image: python:latest
|
||||
image: python:stretch
|
||||
stage: release
|
||||
only:
|
||||
- tags
|
||||
dependencies:
|
||||
- build arm apk
|
||||
- build arm64 apk
|
||||
- build apk
|
||||
before_script:
|
||||
- apt-get -y update && apt-get -y install openjdk-8-jdk
|
||||
- pip install awscli githubrelease
|
||||
- export BUILD_VERSION=$(cat $CI_PROJECT_DIR/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+')
|
||||
- chmod u+x $CI_PROJECT_DIR/gradlew
|
||||
- export BUILD_VERSION=$($CI_PROJECT_DIR/gradlew -q printVersionName --console=plain | tail -1)
|
||||
- export BUILD_APK_FILENAME__32=browser-$BUILD_VERSION-release__arm.apk
|
||||
- export BUILD_APK_FILENAME__64=browser-$BUILD_VERSION-release__arm64.apk
|
||||
script:
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
[submodule "app"]
|
||||
path = app
|
||||
url = https://github.com/lbryio/lbry-react-native
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
lbry-android.keystore:
|
||||
p4a/pythonforandroid/bootstraps/lbry/build/templates/google-services.json
|
||||
lbry-android.keystore:0d958c531870694624cc877ea98ca1c583485f8ebbb3a5acca58b1930c190d65
|
||||
app/google-services.json:896a0bee8294a36d061f10fa926129d8a780528b34d0a2f03113400c4246d67c
|
||||
@@ -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
|
||||
@@ -1,137 +0,0 @@
|
||||
## Linux Build Instructions
|
||||
|
||||
This app has currently only been built on Ubuntu 14.04, 16.04, 17.10, and 18.04, but these instructions, or an analog of them, should work on most Linux or macOS environments. An abridged version of these instructions is available at [QUICKSTART.md](QUICKSTART.md).
|
||||
|
||||
For instructions on how to build using a Docker image, please see [DOCKER.md](DOCKER.md).
|
||||
|
||||
### Install Prerequisites
|
||||
|
||||
#### Requirements
|
||||
* JDK 1.8
|
||||
* Android SDK
|
||||
* Crystax Android NDK
|
||||
* Buildozer
|
||||
* Node.js
|
||||
* npm
|
||||
* yarn
|
||||
|
||||
#### apt Packages
|
||||
Install all apt packages required by running the following commands:
|
||||
```
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt-get -y update
|
||||
sudo apt-get install -y curl ca-certificates software-properties-common gpg-agent wget
|
||||
sudo add-apt-repository ppa:deadsnakes/ppa -y && \
|
||||
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
||||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
|
||||
sudo apt-get -y update && apt-get -y install autoconf autogen automake libtool libffi-dev \
|
||||
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 \
|
||||
python-pip openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 m4 libc6-dev-i386 yarn gawk nodejs npm
|
||||
```
|
||||
Alternatively, the JDK available from http://www.oracle.com/technetwork/java/javase/downloads/index.html can be installed instead of the `openjdk-8-jdk` package.
|
||||
|
||||
#### Install Cython and Setuptools
|
||||
```
|
||||
sudo -H pip install --upgrade cython==0.28.1 setuptools
|
||||
```
|
||||
|
||||
#### Install buildozer
|
||||
A forked version of `buildozer` needs to be installed in order to copy the React Native UI source files into the corresponding directories.
|
||||
```
|
||||
git clone https://github.com/lbryio/buildozer.git
|
||||
cd buildozer && python2.7 setup.py install && cd ..
|
||||
```
|
||||
|
||||
#### Create buildozer.spec
|
||||
Assuming `lbry-android` as the current working folder:
|
||||
* Copy `buildozer.spec.sample` to `buildozer.spec` in the `lbry-android` folder. Running `buildozer init` instead will create a new `buildozer.spec` file.
|
||||
* Update `buildozer.spec` settings to match your environment. The basic recommended settings are outlined below.
|
||||
|
||||
|
||||
| Setting | Description |
|
||||
|:------------------- |:-----------------------------|
|
||||
| title | application title |
|
||||
| package.name | package name (e.g. browser) |
|
||||
| package.domain | package domain (e.g. io.lbry) |
|
||||
| source.dir | the location of the application main.py |
|
||||
| version | application version |
|
||||
| requirements | the Python module requirements for building the application |
|
||||
| services | list of Android background services and their corresponding Python entry points |
|
||||
| android.permissions | Android manifest permissions required by the application. This should be set to `INTERNET` at the very least to enable internet connectivity |
|
||||
| android.api | Android API version (Should be at least 23 for Gradle build support) |
|
||||
| android.sdk | Android SDK version (Should be at least 23 for Gradle build support) |
|
||||
| android.ndk | Android NDK version (not required when using crystax Android NDK) |
|
||||
| android.ndk_path | Android NDK path. This should be set to the crystax Android NDK path) |
|
||||
| android.sdk_path | Android SDK path. This should be set to the path where the Android SDK is manually set up (if not set up in the `.buildozer` path). |
|
||||
| p4a.source_dir | Path to the python-for-android repository folder. Currently set to the included `p4a` folder |
|
||||
| p4a.local_recipes | Path to a folder containing python_for_android recipes to be used in the build. The included `recipes` folder includes recipes for a successful build |
|
||||
|
||||
#### Create google-services.json
|
||||
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
|
||||
```
|
||||
|
||||
#### Setup Android SDK for buildozer
|
||||
Download the Android SDK, platform and build tools archives.
|
||||
* Android API 23 SDK - https://dl.google.com/android/android-sdk_r23-linux.tgz
|
||||
* Android API 28 platform - https://dl.google.com/android/repository/platform-28_r06.zip
|
||||
* Android build tools 26.0.2 - https://dl.google.com/android/repository/build-tools_r26.0.2-linux.zip
|
||||
|
||||
Create the `.buildozer` path (and the `android` sub-path) in your home folder if it doesn't already exist.
|
||||
`mkdir ~/.buildozer`
|
||||
`mkdir ~/.buildozer/android`
|
||||
|
||||
Extract the API 23 SDK to the `~/.buildozer/android` path and rename the extracted folder.
|
||||
```
|
||||
tar -xf android-sdk_r23-linux.tgz ~/.buildozer/android/platform/
|
||||
mv ~/.buildozer/android/platform/android-sdk-linux ~/.buildozer/android/platform/android-sdk-23
|
||||
```
|
||||
|
||||
Extract the API 28 platform archive into the `android-sdk-23` folder and rename the extracted folder.
|
||||
```
|
||||
unzip ~/.buildozer/android/platform/platform-28_r06.zip -d ~/.buildozer/android/platform/android-sdk-23/platforms
|
||||
mv ~/.buildozer/android/platform/android-sdk-23/platforms/android-9 ~/.buildozer/android/platform/android-sdk-23/platforms/android-2
|
||||
```
|
||||
|
||||
Extract the build tools 26.0.2 build tools into the `android-sdk-23` folder and rename the extracted folder.
|
||||
```
|
||||
mkdir -p ~/.buildozer/android/platform/android-sdk-23/build-tools
|
||||
unzip ~/.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
|
||||
```
|
||||
|
||||
Finally, create the Android SDK license file. This prevents being prompted to accept the SDK license during the build process.
|
||||
```
|
||||
mkdir -p ~/.buildozer/android/platform/android-sdk-23/licenses
|
||||
echo $'\nd56f5187479451eabf01fb78af6dfcb131a6481e' > ~/.buildozer/android/platform/android-sdk-23/licenses/android-sdk-license
|
||||
```
|
||||
|
||||
#### Setup Crystax Android NDK for buildozer
|
||||
* Download the Crystax Android NDK from https://us.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz and extract. Remember to update `android.ndk_path` in your `buildozer.spec` to the path of the extracted Crystax NDK archive.
|
||||
* Copy `build-target-python.sh` from the `scripts` folder in the cloned `lbry-android` repository to the `crystax-ndk-10.3.2/build/tools/` folder.
|
||||
* Copy `mangled-glibc-syscalls.h` from the `scripts` folder in the cloned `lbry-android` repository to the `crystax-ndk-10.3.2/platforms/android-21/arch-arm/usr/include/crystax/bionic/libc/include/sys/` folder.
|
||||
* Delete the `android-9` folder in `crystax-ndk-10.3.2/platforms`, and create a symbolic link named `android-9` to the `android-21` folder.
|
||||
|
||||
#### Build and Deploy
|
||||
Run `npm install -g react-native-cli` to install React Native CLI tools.
|
||||
|
||||
Initialise git submodules by running `git submodule update --init --recursive` in the `lbry-android` folder.
|
||||
|
||||
Run `npm i` in the `lbry-android/app` folder to install the necessary modules required by the React Native user interface, and then run `./bundle.sh`.
|
||||
|
||||
Run `./build.sh` in `lbry-android` to build the APK. The output can be found in the `bin` subdirectory.
|
||||
|
||||
To build and deploy, you can run `./deploy.sh`. This requires a connected device or a running Android emulator.
|
||||
|
||||
#### Development
|
||||
If you already installed `Android SDK` and `adb`
|
||||
|
||||
* Run `adb reverse tcp:8081 tcp:8081`
|
||||
* Then go to the `lbry-android/app` folder and run `npm start`
|
||||
|
||||
Note: You need to have your device connected with USB debugging.
|
||||
|
||||
Once the bundler is ready, run the LBRY Browser app on your device and then shake the device violently until you see the React Native dev menu. You can enable "Live Reloading" and "Hot Reloading" from this menu, so any changes you make to the React Native code will be visible as you save. This will only reload React Native Javascript files. Native Java code needs to be redeployed by running the command `./deploy.sh`
|
||||
@@ -1,156 +0,0 @@
|
||||
# lbry-android development environment inside docker
|
||||
|
||||
[scripts/lbry-android.sh](scripts/lbry-android.sh) is a bash script to create a
|
||||
docker container for lbry-android development.
|
||||
|
||||
This is a hybrid approach where the apk is built inside docker, but you run
|
||||
Android Studio, `adb`, and the app hot-reload bundler, directly on your host.
|
||||
|
||||
## Features
|
||||
|
||||
* Clones lbry-android source code to a directory on the host, and mounts it
|
||||
inside the container.
|
||||
* Installs all build dependencies inside the container, leaving your host
|
||||
computer clean.
|
||||
* Mounted `.buildozer` directory to save container space. (Docker containers
|
||||
should stay under 10GB, and `.buildozer` is too big, so it has to stay in a
|
||||
mounted host directory instead.)
|
||||
* The biggest downloads are cached in `.buildozer-downloads` directory so you
|
||||
can easily remove `.buildozer` and not have to re-download the large cryostax
|
||||
NDK more than once.
|
||||
* Instructions for installing on a real Android device, and for setting up
|
||||
hot-reload.
|
||||
* Only a handful of commands to go from zero->hero.
|
||||
|
||||
## Requirements
|
||||
|
||||
Install all of the following on your host computer:
|
||||
|
||||
* Tested on Linux x86_64 with BASH.
|
||||
* [Install Android Studio](https://developer.android.com/studio/).
|
||||
* The normal install auto-creates a directory in `$HOME/Android/Sdk` to store
|
||||
SDK downloads in your home directory.
|
||||
* [Install nodejs](https://nodejs.org/en/download/package-manager/).
|
||||
* [Install yarn](https://yarnpkg.com/lang/en/docs/install).
|
||||
* [Install Docker](https://docs.docker.com/install/).
|
||||
* Install `sudo` and give your user account access to run `sudo docker`.
|
||||
|
||||
## Install
|
||||
|
||||
Clone `lbry-android`:
|
||||
|
||||
```
|
||||
LBRY_GIT=$HOME/git/vendor/lbryio/
|
||||
mkdir -p $LBRY_GIT
|
||||
git clone https://github.com/lbryio/lbry-android.git $LBRY_GIT/lbry-android
|
||||
cd $LBRY_GIT/lbry-android
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
Install a bash alias to the [scripts/lbry-android.sh](scripts/lbry-android.sh)
|
||||
script:
|
||||
|
||||
```
|
||||
echo "alias lbry-android=$LBRY_GIT/lbry-android/scripts/lbry-android.sh" >> $HOME/.bashrc
|
||||
|
||||
source ~/.bashrc
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
* First create the base docker image:
|
||||
|
||||
```
|
||||
lbry-android docker-build
|
||||
```
|
||||
|
||||
(If anytime you change the docker build scripts in the [scripts](scripts)
|
||||
subdirectory, you should rebuild the image again.)
|
||||
|
||||
* Setup buildozer and install dependencies:
|
||||
|
||||
```
|
||||
lbry-android setup
|
||||
```
|
||||
|
||||
* Build the apk:
|
||||
|
||||
```
|
||||
lbry-android build
|
||||
```
|
||||
|
||||
The apk will be built and end up in the `lbry-android/bin/` subdirectory.
|
||||
|
||||
## Running on a real Android device
|
||||
|
||||
Once you have the apk built, you can install it on a real Android device to
|
||||
start testing.
|
||||
|
||||
Follow the Android documentation for [enabling USB
|
||||
debugging](https://developer.android.com/studio/command-line/adb#Enabling) on
|
||||
your device.
|
||||
|
||||
Once you have enabled debugging, do the following:
|
||||
|
||||
* Plug your device into a USB port on the host computer.
|
||||
* Run:
|
||||
|
||||
```~/Android/Sdk/platform-tools/adb devices```
|
||||
|
||||
* ADB should list your device like so:
|
||||
|
||||
```
|
||||
[ryan@t440s lbry-android]$ adb devices
|
||||
List of devices attached
|
||||
HT71R0000000 device
|
||||
```
|
||||
|
||||
* The first time you connect, you should see a modal dialog on the device
|
||||
asking to confirm the host id. You must approve it, or adb will fail to
|
||||
connect.
|
||||
|
||||
* If after trying several times, adb is still not connecting to your device,
|
||||
and adb lists your device as `unauthorized`, you may need to [follow this
|
||||
advice](https://stackoverflow.com/a/38380384/56560) and delete your
|
||||
`$HOME/.android` directory.
|
||||
|
||||
* Install the apk (whatever the current version is called) to the device:
|
||||
|
||||
```
|
||||
~/Android/Sdk/platform-tools/adb install ./bin/browser-0.7.5-debug.apk
|
||||
```
|
||||
|
||||
* Open the app on your device, and follow the initial steps to get to the main
|
||||
lbry-android browser page.
|
||||
|
||||
* Create a tcp tunnel over the adb bridge, for the app to handle live-reload:
|
||||
|
||||
```
|
||||
~/Android/Sdk/platform-tools/adb reverse tcp:8081 tcp:8081
|
||||
```
|
||||
|
||||
* Start the live-reload server on the host:
|
||||
|
||||
```
|
||||
cd app/
|
||||
yarn install
|
||||
yarn start
|
||||
```
|
||||
|
||||
* With your device currently running the lbry-android app, shake the device
|
||||
from side to side, and a menu will appear. Choose `Enable Hot Reloading`.
|
||||
|
||||
* The app should reload itself.
|
||||
|
||||
* Now make a change to the source code to test hot reload. From the host, open
|
||||
up the main page view source code: `app/src/component/uriBar/view.js`. Find
|
||||
the line that reads `Search movies, music, and more` (This is the main search
|
||||
bar at the top of the app.) - Change some of the text and save the file.
|
||||
|
||||
* If hot-reload is working, within a few seconds the phone should reload the
|
||||
page automatically and show the change that you made.
|
||||
|
||||
* If the hot-reload does not work, try closing the app (dismiss the window from
|
||||
the tab overview, via android square button) and reload the app.
|
||||
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
# Introduction
|
||||
The purpose of this guide is to help whomever is interested in running the LBRY Android application from scratch on their device, but they're main computing platform is not Linux but macOS.
|
||||
|
||||
## Estimated build time
|
||||
25 - 40 minutes (depending on Internet connection speeds)
|
||||
|
||||
## What do you need?
|
||||
* A computer running the latest OS
|
||||
* Internet access to download modules and packages
|
||||
* At least 15GB of free disk space
|
||||
* Docker
|
||||
* Patience
|
||||
|
||||
## Step 1/6
|
||||
Create an application on [Firebase](https://console.firebase.google.com). In the **Android package name** field, input `io.lbry.browser`. Download the resulting `google-services.json` file and keep it safe, you'll be needing it later.
|
||||
|
||||
## Step 2/6
|
||||
Start the docker application and paste all of these lines into Terminal:
|
||||
|
||||
```bash
|
||||
docker run -it lbry/android-base:latest /bin/bash
|
||||
wget "https://www.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz" -P ~/.buildozer/android/
|
||||
tar -xvf ~/.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
|
||||
git clone https://github.com/lbryio/lbry-android
|
||||
cd lbry-android
|
||||
git submodule update --init --recursive
|
||||
cp buildozer.spec.sample buildozer.spec
|
||||
cd app;npm i;cd ..
|
||||
cp scripts/build-target-python.sh ~/.buildozer/android/crystax-ndk-10.3.2/build/tools/build-target-python.sh
|
||||
cp 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
|
||||
cd p4a/pythonforandroid/bootstraps/lbry/build/templates
|
||||
apt install nano -y
|
||||
```
|
||||
|
||||
## Step 3/6
|
||||
Copy the contents of the `google-services.json` you downloaded earlier and paste them into Terminal after running the next command:
|
||||
|
||||
```bash
|
||||
nano google-services.json
|
||||
```
|
||||
|
||||
Type `^X` to save and exit.
|
||||
|
||||
## Step 4/6
|
||||
Paste more lines and I guess check your email, this will take some time:
|
||||
|
||||
```bash
|
||||
cd /lbry-android/app
|
||||
./bundle.sh
|
||||
cd ..
|
||||
buildozer android debug
|
||||
```
|
||||
|
||||
When the build is complete, you should see a message like: `[INFO]: # APK renamed to browser-0.7.3-debug.apk`. You will need this filename for the next step.
|
||||
|
||||
## Step 5/6
|
||||
In a separate Terminal window:
|
||||
|
||||
```bash
|
||||
docker ps # get container name
|
||||
docker cp CONTAINER_NAME:/lbry-android/bin/STEP_4_FILENAME ~/Desktop/ # copies STEP_4_FILENAME to your Desktop
|
||||
```
|
||||
|
||||
## Step 6/6
|
||||
- Download [Android File Transfer](https://www.android.com/filetransfer) and install it.
|
||||
- On your Android device, install [File Explorer](https://play.google.com/store/apps/details?id=com.mauriciotogneri.fileexplorer).
|
||||
- Plug in your Android device and swipe down from the top into the "USB for file transfer" settings (or similar name on your device) and make sure "Transfer files" is selected.
|
||||
- Open **Android File Transfer** on your computer and drag and drop `STEP_4_FILENAME` from your Desktop to the `Downloads` folder on the Android device.
|
||||
- Back on the Android device, navigate to `STEP_4_FILENAME` in the `Downloads` folder and tap it to begin installation.
|
||||
@@ -10,8 +10,9 @@ RUN dpkg --add-architecture i386 && \
|
||||
python-pip zlib1g-dev m4 zlib1g:i386 libc6-dev-i386 gawk nodejs npm unzip openjdk-8-jdk \
|
||||
autoconf autogen automake libtool libffi-dev build-essential \
|
||||
ccache git libncurses5:i386 libstdc++6:i386 \
|
||||
libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 && \
|
||||
npm install -g yarn react-native-cli && \
|
||||
libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386
|
||||
RUN npm install -g npm@latest
|
||||
RUN npm install -g yarn react-native-cli && \
|
||||
pip2 install --upgrade cython setuptools && \
|
||||
pip2 install git+https://github.com/lbryio/buildozer.git@master && \
|
||||
ln -s /src/scripts/build-docker.sh /usr/local/bin/build && \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2018 LBRY Inc
|
||||
Copyright (c) 2017-2020 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,113 +0,0 @@
|
||||
### 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
|
||||
25 - 40 minutes (depending on Internet connection speeds)
|
||||
|
||||
#### What do you need?
|
||||
* A computer running Ubuntu 18.04
|
||||
* 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.
|
||||
|
||||
### Step 1 of 10
|
||||
Install all the apt packages required by running the following commands. You can copy-paste directly to your terminal.
|
||||
```
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt-get -y update
|
||||
sudo apt-get install -y curl ca-certificates software-properties-common gpg-agent wget
|
||||
sudo add-apt-repository ppa:deadsnakes/ppa -y && \
|
||||
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
||||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
|
||||
sudo apt-get -y update && apt-get -y install autoconf autogen automake libtool libffi-dev \
|
||||
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 \
|
||||
python-pip openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 m4 libc6-dev-i386 yarn gawk nodejs npm
|
||||
```
|
||||
|
||||
### Step 2 of 10
|
||||
Install a couple of packages using the Python package installer
|
||||
```
|
||||
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.
|
||||
```
|
||||
git clone https://github.com/lbryio/buildozer.git
|
||||
cd buildozer && python2.7 setup.py install && cd ..
|
||||
```
|
||||
|
||||
### Step 4 of 10
|
||||
The Android SDK needs to be setup for buildozer. This requires creating a few directories and downloading a number of files. Run the following commands to create the buildozer directory, download the required archives and extract them into their proper destination folders.
|
||||
|
||||
```
|
||||
mkdir -p ~/.buildozer/android/platform
|
||||
wget 'https://dl.google.com/android/android-sdk_r23-linux.tgz' -P ~/.buildozer/android/platform/ && \
|
||||
wget 'https://dl.google.com/android/repository/platform-28_r06.zip' -P ~/.buildozer/android/platform/ && \
|
||||
wget 'https://dl.google.com/android/repository/build-tools_r26.0.2-linux.zip' -P ~/.buildozer/android/platform/
|
||||
tar -xvf ~/.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 ~/.buildozer/android/platform/platform-28_r06.zip -d ~/.buildozer/android/platform/android-sdk-23/platforms && \
|
||||
mv ~/.buildozer/android/platform/android-sdk-23/platforms/android-9 ~/.buildozer/android/platform/android-sdk-23/platforms/android-28 && \
|
||||
mkdir -p ~/.buildozer/android/platform/android-sdk-23/build-tools && \
|
||||
unzip ~/.buildozer/android/platform/build-tools_r26.0.2-linux.zip -d ~/.buildozer/android/platform/android-sdk-23/build-tools && \
|
||||
mkdir -p ~/.buildozer/android/platform/android-sdk-23/licenses && \
|
||||
echo $'\nd56f5187479451eabf01fb78af6dfcb131a6481e' > ~/.buildozer/android/platform/android-sdk-23/licenses/android-sdk-license
|
||||
```
|
||||
|
||||
### Step 5 of 10
|
||||
Install the react-native-cli npm package.
|
||||
```
|
||||
sudo npm install -g react-native-cli
|
||||
```
|
||||
|
||||
### Step 6 of 10
|
||||
Install the Crystax NDK which is required for building Python 3.7 for the mobile app, and a number of native C / C++ modules and packages used by the app. Run the following commands to download and extract the NDK.
|
||||
```
|
||||
wget 'https://www.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz' -P ~/.buildozer/android/ && \
|
||||
tar -xvf ~/.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
|
||||
```
|
||||
|
||||
### 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.
|
||||
```
|
||||
git clone https://github.com/lbryio/lbry-android
|
||||
cd lbry-android
|
||||
git submodule update --init --recursive
|
||||
cp buildozer.spec.sample buildozer.spec
|
||||
cp p4a/pythonforandroid/bootstraps/lbry/templates/google-services.sample.json p4a/pythonforandroid/bootstraps/lbry/templates/google-services.json
|
||||
```
|
||||
|
||||
### Step 8 of 10
|
||||
Install the npm packages required for the app's React Native code, and create the React Native app bundle.
|
||||
```
|
||||
cd app
|
||||
npm install
|
||||
./bundle.sh
|
||||
cd ..
|
||||
```
|
||||
|
||||
### Step 9 of 10
|
||||
Copy a couple of required files from the repository for the build to be successful.
|
||||
```
|
||||
cp scripts/build-target-python.sh ~/.buildozer/android/crystax-ndk-10.3.2/build/tools/build-target-python.sh
|
||||
cp 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
|
||||
```
|
||||
|
||||
### Step 10 of 10
|
||||
If you made it this far, you're finally ready to build the package! You just have to run a single command to generate the APK.
|
||||
```
|
||||
buildozer android debug
|
||||
```
|
||||
|
||||
### 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.
|
||||
@@ -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.
|
||||
An Android browser and wallet for the [LBRY](https://lbry.com) network. This app bundles [LBRY SDK](https://github.com/lbryio/lbry) as a background service with a UI layer built with React Native.
|
||||
|
||||
|
||||
<img src="https://spee.ch/@lbry:3f/android-08-homepage.gif" alt="LBRY Android GIF" width="384px" />
|
||||
|
||||
<img src="https://spee.ch/8/lbry-android.png" alt="LBRY Android Screenshot" width="384px" />
|
||||
|
||||
## Installation
|
||||
The minimum supported Android version is 5.0 Lollipop. There are two ways to install:
|
||||
@@ -12,10 +15,10 @@ The minimum supported Android version is 5.0 Lollipop. There are two ways to ins
|
||||
1. Direct APK install available at [http://build.lbry.io/android/latest.apk](http://build.lbry.io/android/latest.apk). You will need to enable installation from third-party sources on your device in order to install from this source.
|
||||
|
||||
## Usage
|
||||
The app can be launched by opening **LBRY Browser** from the device's app drawer or via the shortcut on the home screen if that was created upon installation.
|
||||
The app can be launched by opening **LBRY** from the device's app drawer or via the shortcut on the home screen if that was created upon installation.
|
||||
|
||||
## Running from Source
|
||||
The app is built from source via [Buildozer](https://github.com/kivy/buildozer). After cloning the repository, copy `buildozer.spec.sample` to `buildozer.spec` and modify this file as necessary for your environment. Please see [BUILD.md](BUILD.md) for detailed build instructions.
|
||||
Please refer to https://github.com/lbryio/lbry-react-native/blob/master/README.md
|
||||
|
||||
## Contributing
|
||||
Contributions to this project are welcome, encouraged, and compensated. For more details, see https://lbry.io/faq/contributing
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
echoed=false
|
||||
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.box = "ubuntu/bionic64"
|
||||
#config.disksize.size = "20GB"
|
||||
|
||||
config.vm.provider "virtualbox" do |v|
|
||||
host = RbConfig::CONFIG['host_os']
|
||||
|
||||
# Give VM 1/4 system memory & access to all cpu cores on the host
|
||||
if host =~ /darwin/
|
||||
cpus = `sysctl -n hw.ncpu`.to_i
|
||||
# sysctl returns Bytes and we need to convert to MB
|
||||
mem = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 4
|
||||
elsif host =~ /linux/
|
||||
cpus = `nproc`.to_i
|
||||
# meminfo shows KB and we need to convert to MB
|
||||
mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 4
|
||||
else
|
||||
cpus = `wmic cpu get NumberOfCores`.split("\n")[2].to_i
|
||||
mem = `wmic OS get TotalVisibleMemorySize`.split("\n")[2].to_i / 1024 /4
|
||||
end
|
||||
|
||||
mem = mem / 1024 / 4
|
||||
mem = [mem, 2048].max # Minimum 2048
|
||||
|
||||
if echoed === false
|
||||
echoed=true
|
||||
puts("Memory", mem)
|
||||
puts("CPUs", cpus)
|
||||
end
|
||||
|
||||
#v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/home_vagrant_lbry-android", "1"]
|
||||
#v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant", "1"]
|
||||
v.customize ["modifyvm", :id, "--memory", mem]
|
||||
v.customize ["modifyvm", :id, "--cpus", cpus]
|
||||
end
|
||||
|
||||
config.vm.synced_folder "./", "/home/vagrant/lbry-android"
|
||||
|
||||
|
||||
config.vm.provision "shell", inline: <<-SHELL
|
||||
dpkg --add-architecture i386
|
||||
apt-get update
|
||||
apt-get install -y libssl-dev
|
||||
apt-get install -y python3.6 python3.6-dev python3-pip autoconf libffi-dev pkg-config libtool build-essential 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 python-pip
|
||||
pip install -f --upgrade setuptools pyopenssl
|
||||
git clone https://github.com/lbryio/buildozer.git
|
||||
cd buildozer
|
||||
python2.7 setup.py install
|
||||
cd ../
|
||||
rm -rf ./buildozer
|
||||
|
||||
# Install additonal buildozer dependencies
|
||||
sudo apt-get install cython
|
||||
|
||||
# Install node
|
||||
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
|
||||
sudo apt-get install -y nodejs
|
||||
|
||||
export HOME=/home/vagrant
|
||||
|
||||
cp $HOME/lbry-android/buildozer.spec.vagrant $HOME/lbry-android/buildozer.spec
|
||||
|
||||
mkdir -p cd $HOME/.buildozer/android/platform/
|
||||
wget -q 'https://us.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz' -P $HOME/.buildozer/android/
|
||||
wget -q 'https://dl.google.com/android/android-sdk_r23-linux.tgz' -P $HOME/.buildozer/android/platform/
|
||||
wget -q 'https://dl.google.com/android/repository/platform-27_r01.zip' -P $HOME/.buildozer/android/platform/
|
||||
wget -q 'https://dl.google.com/android/repository/build-tools_r26.0.1-linux.zip' -P $HOME/.buildozer/android/platform/
|
||||
tar -xf ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz -C $HOME/.buildozer/android/
|
||||
rm $HOME/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz
|
||||
ln -s $HOME/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21 $HOME/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
|
||||
cp -f $HOME/lbry-android/scripts/build-target-python.sh $HOME/.buildozer/android/crystax-ndk-10.3.2/build/tools/build-target-python.sh
|
||||
rm -rf $HOME/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
|
||||
tar -xf $HOME/.buildozer/android/platform/android-sdk_r23-linux.tgz -C $HOME/.buildozer/android/platform/
|
||||
rm $HOME/.buildozer/android/platform/android-sdk_r23-linux.tgz
|
||||
mv $HOME/.buildozer/android/platform/android-sdk-linux $HOME/.buildozer/android/platform/android-sdk-23
|
||||
unzip -qq $HOME/.buildozer/android/platform/android-23_r02.zip -d $HOME/.buildozer/android/platform/android-sdk-23/platforms
|
||||
rm $HOME/.buildozer/android/platform/platform-27_r01.zip
|
||||
mv $HOME/.buildozer/android/platform/android-sdk-23/platforms/android-8.1.0 $HOME/.buildozer/android/platform/android-sdk-23/platforms/android-27
|
||||
mkdir -p $HOME/.buildozer/android/platform/android-sdk-23/build-tools
|
||||
unzip -qq $HOME/.buildozer/android/platform/build-tools_r26.0.1-linux.zip -d $HOME/.buildozer/android/platform/android-sdk-23/build-tools
|
||||
rm $HOME/.buildozer/android/platform/build-tools_r26.0.1-linux.zip
|
||||
mv $HOME/.buildozer/android/platform/android-sdk-23/build-tools/android-8.0.0 $HOME/.buildozer/android/platform/android-sdk-23/build-tools/26.0.1
|
||||
mkdir -p $HOME/.buildozer/android/platform/android-sdk-23/licenses
|
||||
|
||||
rm -rf $HOME/.buildozer/android/platform/android-sdk-23/tools
|
||||
# https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
|
||||
wget -q https://dl.google.com/android/repository/tools_r25.2.5-linux.zip
|
||||
unzip -o -q ./tools_r25.2.5-linux.zip -d $HOME/.buildozer/android/platform/android-sdk-23/
|
||||
rm sdk-tools-linux-3859397.zip
|
||||
|
||||
echo $'\nd56f5187479451eabf01fb78af6dfcb131a6481e' > $HOME/.buildozer/android/platform/android-sdk-23/licenses/android-sdk-license
|
||||
|
||||
sudo chown -r vagrant $HOME
|
||||
|
||||
echo "Installing React Native via NPM..."
|
||||
sudo npm install -g react-native-cli
|
||||
SHELL
|
||||
end
|
||||
@@ -0,0 +1,55 @@
|
||||
# To learn about Buck see [Docs](https://buckbuild.com/).
|
||||
# To run your application with Buck:
|
||||
# - install Buck
|
||||
# - `npm start` - to start the packager
|
||||
# - `cd android`
|
||||
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
|
||||
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
|
||||
# - `buck install -r android/app` - compile, install and run application
|
||||
#
|
||||
|
||||
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
|
||||
|
||||
lib_deps = []
|
||||
|
||||
create_aar_targets(glob(["libs/*.aar"]))
|
||||
|
||||
create_jar_targets(glob(["libs/*.jar"]))
|
||||
|
||||
android_library(
|
||||
name = "all-libs",
|
||||
exported_deps = lib_deps,
|
||||
)
|
||||
|
||||
android_library(
|
||||
name = "app-code",
|
||||
srcs = glob([
|
||||
"src/main/java/**/*.java",
|
||||
]),
|
||||
deps = [
|
||||
":all-libs",
|
||||
":build_config",
|
||||
":res",
|
||||
],
|
||||
)
|
||||
|
||||
android_build_config(
|
||||
name = "build_config",
|
||||
package = "com.lbryandroid",
|
||||
)
|
||||
|
||||
android_resource(
|
||||
name = "res",
|
||||
package = "com.lbryandroid",
|
||||
res = "src/main/res",
|
||||
)
|
||||
|
||||
android_binary(
|
||||
name = "app",
|
||||
keystore = "//android/keystores:debug",
|
||||
manifest = "src/main/AndroidManifest.xml",
|
||||
package_type = "debug",
|
||||
deps = [
|
||||
":app-code",
|
||||
],
|
||||
)
|
||||
@@ -0,0 +1,233 @@
|
||||
apply plugin: "com.android.application"
|
||||
|
||||
import com.android.build.OutputFile
|
||||
|
||||
/**
|
||||
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
|
||||
* and bundleReleaseJsAndAssets).
|
||||
* These basically call `react-native bundle` with the correct arguments during the Android build
|
||||
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
|
||||
* bundle directly from the development server. Below you can see all the possible configurations
|
||||
* and their defaults. If you decide to add a configuration block, make sure to add it before the
|
||||
* `apply from: "../../node_modules/react-native/react.gradle"` line.
|
||||
*
|
||||
* project.ext.react = [
|
||||
* // the name of the generated asset file containing your JS bundle
|
||||
* bundleAssetName: "index.android.bundle",
|
||||
*
|
||||
* // the entry file for bundle generation
|
||||
* entryFile: "index.android.js",
|
||||
*
|
||||
* // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
|
||||
* bundleCommand: "ram-bundle",
|
||||
*
|
||||
* // whether to bundle JS and assets in debug mode
|
||||
* bundleInDebug: false,
|
||||
*
|
||||
* // whether to bundle JS and assets in release mode
|
||||
* bundleInRelease: true,
|
||||
*
|
||||
* // whether to bundle JS and assets in another build variant (if configured).
|
||||
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
|
||||
* // The configuration property can be in the following formats
|
||||
* // 'bundleIn${productFlavor}${buildType}'
|
||||
* // 'bundleIn${buildType}'
|
||||
* // bundleInFreeDebug: true,
|
||||
* // bundleInPaidRelease: true,
|
||||
* // bundleInBeta: true,
|
||||
*
|
||||
* // whether to disable dev mode in custom build variants (by default only disabled in release)
|
||||
* // for example: to disable dev mode in the staging build type (if configured)
|
||||
* devDisabledInStaging: true,
|
||||
* // The configuration property can be in the following formats
|
||||
* // 'devDisabledIn${productFlavor}${buildType}'
|
||||
* // 'devDisabledIn${buildType}'
|
||||
*
|
||||
* // the root of your project, i.e. where "package.json" lives
|
||||
* root: "../../",
|
||||
*
|
||||
* // where to put the JS bundle asset in debug mode
|
||||
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
|
||||
*
|
||||
* // where to put the JS bundle asset in release mode
|
||||
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
|
||||
*
|
||||
* // where to put drawable resources / React Native assets, e.g. the ones you use via
|
||||
* // require('./image.png')), in debug mode
|
||||
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
|
||||
*
|
||||
* // where to put drawable resources / React Native assets, e.g. the ones you use via
|
||||
* // require('./image.png')), in release mode
|
||||
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
|
||||
*
|
||||
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
|
||||
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
|
||||
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
|
||||
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
|
||||
* // for example, you might want to remove it from here.
|
||||
* inputExcludes: ["android/**", "ios/**"],
|
||||
*
|
||||
* // override which node gets called and with what additional arguments
|
||||
* nodeExecutableAndArgs: ["node"],
|
||||
*
|
||||
* // supply additional arguments to the packager
|
||||
* extraPackagerArgs: []
|
||||
* ]
|
||||
*/
|
||||
|
||||
task buildReactNativeBundle(type:Exec) {
|
||||
println("Building React Native bundle")
|
||||
workingDir new File(rootProject.projectDir, '../')
|
||||
commandLine './bundle-android.sh'
|
||||
}
|
||||
preBuild.dependsOn buildReactNativeBundle
|
||||
|
||||
task printVersionName {
|
||||
doLast {
|
||||
println android.defaultConfig.versionName
|
||||
}
|
||||
}
|
||||
|
||||
project.ext.react = [
|
||||
entryFile: "index.js",
|
||||
enableHermes: false, // clean and rebuild if changing
|
||||
]
|
||||
|
||||
/**
|
||||
* Set this to true to create two separate APKs instead of one:
|
||||
* - An APK that only works on ARM devices
|
||||
* - An APK that only works on x86 devices
|
||||
* The advantage is the size of the APK is reduced by about 4MB.
|
||||
* Upload all the APKs to the Play Store and people will download
|
||||
* the correct one based on the CPU architecture of their device.
|
||||
*/
|
||||
def enableSeparateBuildPerCPUArchitecture = false
|
||||
|
||||
/**
|
||||
* Run Proguard to shrink the Java bytecode in release builds.
|
||||
*/
|
||||
def enableProguardInReleaseBuilds = false
|
||||
|
||||
/**
|
||||
* The preferred build flavor of JavaScriptCore.
|
||||
*
|
||||
* For example, to use the international variant, you can use:
|
||||
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
|
||||
*
|
||||
* The international variant includes ICU i18n library and necessary data
|
||||
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
|
||||
* give correct results when using with locales other than en-US. Note that
|
||||
* this variant is about 6MiB larger per architecture than default.
|
||||
*/
|
||||
def jscFlavor = 'org.webkit:android-jsc:+'
|
||||
|
||||
/**
|
||||
* Whether to enable the Hermes VM.
|
||||
*
|
||||
* This should be set on project.ext.react and mirrored here. If it is not set
|
||||
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
|
||||
* and the benefits of using Hermes will therefore be sharply reduced.
|
||||
*/
|
||||
def enableHermes = project.ext.react.get("enableHermes", false);
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
flavorDimensions "default"
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
applicationId "io.lbry.browser"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1401
|
||||
versionName "0.14.1"
|
||||
missingDimensionStrategy 'react-native-camera', 'general'
|
||||
multiDexEnabled true
|
||||
}
|
||||
dexOptions {
|
||||
javaMaxHeapSize "2048M"
|
||||
preDexLibraries false
|
||||
jumboMode true
|
||||
}
|
||||
productFlavors {
|
||||
__32bit {
|
||||
versionCode android.defaultConfig.versionCode * 10 + 1
|
||||
ndk {
|
||||
abiFilter "armeabi-v7a"
|
||||
}
|
||||
}
|
||||
__64bit {
|
||||
versionCode android.defaultConfig.versionCode * 10 + 2
|
||||
ndk {
|
||||
abiFilter "arm64-v8a"
|
||||
}
|
||||
}
|
||||
}
|
||||
signingConfigs {
|
||||
debug {
|
||||
storeFile file('debug.keystore')
|
||||
storePassword 'android'
|
||||
keyAlias 'androiddebugkey'
|
||||
keyPassword 'android'
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
debug {
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
release {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':@react-native-community_async-storage')
|
||||
implementation project(':react-native-camera')
|
||||
implementation project(':react-native-exception-handler')
|
||||
implementation project(':react-native-fast-image')
|
||||
implementation project(':react-native-fs')
|
||||
implementation project(':react-native-gesture-handler')
|
||||
implementation project(':react-native-reanimated')
|
||||
implementation project(':react-native-snackbar')
|
||||
implementation project(':react-native-video')
|
||||
implementation project(':react-native-webview')
|
||||
implementation project(':rn-fetch-blob')
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'androidx.media:media:1.0.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.0.0'
|
||||
implementation 'com.facebook.react:react-native:0.61.5'
|
||||
implementation 'com.facebook.fresco:fresco:1.9.0'
|
||||
implementation 'com.facebook.fresco:animated-gif:1.9.0'
|
||||
implementation 'com.squareup.picasso:picasso:2.71828'
|
||||
implementation 'com.google.firebase:firebase-analytics:17.2.1'
|
||||
implementation 'com.google.android.gms:play-services-base:17.1.0'
|
||||
implementation 'androidx.exifinterface:exifinterface:1.0.0'
|
||||
implementation 'com.facebook.fresco:animated-base-support:1.3.0'
|
||||
implementation 'com.facebook.fresco:animated-gif:1.10.0'
|
||||
implementation 'com.google.firebase:firebase-messaging:20.1.0'
|
||||
|
||||
__32bitImplementation files('libs/lbrysdk-0.65.0-release__arm.aar')
|
||||
__64bitImplementation files('libs/lbrysdk-0.65.0-release__arm64.aar')
|
||||
|
||||
if (enableHermes) {
|
||||
def hermesPath = "../../node_modules/hermes-engine/android/";
|
||||
debugImplementation files(hermesPath + "hermes-debug.aar")
|
||||
releaseImplementation files(hermesPath + "hermes-release.aar")
|
||||
} else {
|
||||
implementation jscFlavor
|
||||
}
|
||||
}
|
||||
|
||||
// Run this once to be able to run the application with BUCK
|
||||
// puts all compile dependencies into folder libs for BUCK to use
|
||||
task copyDownloadableDepsToLibs(type: Copy) {
|
||||
from configurations.compile
|
||||
into 'libs'
|
||||
}
|
||||
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
|
||||
@@ -0,0 +1,19 @@
|
||||
"""Helper definitions to glob .aar and .jar targets"""
|
||||
|
||||
def create_aar_targets(aarfiles):
|
||||
for aarfile in aarfiles:
|
||||
name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
|
||||
lib_deps.append(":" + name)
|
||||
android_prebuilt_aar(
|
||||
name = name,
|
||||
aar = aarfile,
|
||||
)
|
||||
|
||||
def create_jar_targets(jarfiles):
|
||||
for jarfile in jarfiles:
|
||||
name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
|
||||
lib_deps.append(":" + name)
|
||||
prebuilt_jar(
|
||||
name = name,
|
||||
binary_jar = jarfile,
|
||||
)
|
||||
@@ -37,4 +37,5 @@
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
@@ -0,0 +1,85 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="io.lbry.browser"
|
||||
android:installLocation="auto">
|
||||
|
||||
<supports-screens
|
||||
android:smallScreens="true"
|
||||
android:normalScreens="true"
|
||||
android:largeScreens="true"
|
||||
android:anyDensity="true"
|
||||
android:xlargeScreens="true"
|
||||
/>
|
||||
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<application android:label="@string/app_name"
|
||||
android:icon="@drawable/icon"
|
||||
android:allowBackup="true"
|
||||
android:theme="@style/LbryAppTheme"
|
||||
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"/>
|
||||
|
||||
<meta-data android:name="wakelock" android:value="0"/>
|
||||
|
||||
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
|
||||
|
||||
<activity android:name="io.lbry.browser.MainActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/LbryAppTheme"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:screenOrientation="portrait"
|
||||
android:launchMode="singleInstance"
|
||||
>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="lbry" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<receiver android:name="io.lbry.browser.receivers.NotificationDeletedReceiver" />
|
||||
|
||||
<service
|
||||
android:name="io.lbry.browser.LbrynetMessagingService"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<provider
|
||||
android:name="io.lbry.browser.LocalFileProvider"
|
||||
android:authorities="io.lbry.browser.fileprovider"
|
||||
android:grantUriPermissions="true"
|
||||
android:exported="false">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/filepaths" />
|
||||
</provider>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -8,20 +8,19 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.app.NotificationManagerCompat;
|
||||
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import io.lbry.browser.receivers.NotificationDeletedReceiver;
|
||||
import io.lbry.lbrysdk.LbrynetService;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Random;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class DownloadManager {
|
||||
private Context context;
|
||||
@@ -30,6 +29,11 @@ public class DownloadManager {
|
||||
|
||||
private List<String> completedDownloads = new ArrayList<String>();
|
||||
|
||||
private Map<String, String> downloadIdOutpointsMap = new HashMap<String, String>();
|
||||
|
||||
// maintain a map of uris to writtenBytes, so that we check if it's changed and don't flood RN with update events every 500ms
|
||||
private Map<String, Double> writtenDownloadBytes = new HashMap<String, Double>();
|
||||
|
||||
private HashMap<Integer, NotificationCompat.Builder> builders = new HashMap<Integer, NotificationCompat.Builder>();
|
||||
|
||||
private HashMap<String, Integer> downloadIdNotificationIdMap = new HashMap<String, Integer>();
|
||||
@@ -86,6 +90,7 @@ public class DownloadManager {
|
||||
NotificationChannel channel = new NotificationChannel(
|
||||
NOTIFICATION_CHANNEL_ID, "LBRY Downloads", NotificationManager.IMPORTANCE_LOW);
|
||||
channel.setDescription("LBRY file downloads");
|
||||
channel.setSound(null, null);
|
||||
notificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
}
|
||||
@@ -119,7 +124,35 @@ public class DownloadManager {
|
||||
return intent;
|
||||
}
|
||||
|
||||
public void startDownload(String id, String filename) {
|
||||
public void updateWrittenBytesForDownload(String id, double writtenBytes) {
|
||||
if (!writtenDownloadBytes.containsKey(id)) {
|
||||
writtenDownloadBytes.put(id, writtenBytes);
|
||||
}
|
||||
}
|
||||
|
||||
public double getWrittenBytesForDownload(String id) {
|
||||
if (writtenDownloadBytes.containsKey(id)) {
|
||||
return writtenDownloadBytes.get(id);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void clearWrittenBytesForDownload(String id) {
|
||||
if (writtenDownloadBytes.containsKey(id)) {
|
||||
writtenDownloadBytes.remove(id);
|
||||
}
|
||||
}
|
||||
|
||||
private Intent getDeleteDownloadIntent(String uri) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(LbrynetService.ACTION_DELETE_DOWNLOAD);
|
||||
intent.putExtra("uri", uri);
|
||||
intent.putExtra("nativeDelete", true);
|
||||
return intent;
|
||||
}
|
||||
|
||||
public void startDownload(String id, String filename, String outpoint) {
|
||||
if (filename == null || filename.trim().length() == 0) {
|
||||
return;
|
||||
}
|
||||
@@ -127,20 +160,26 @@ public class DownloadManager {
|
||||
synchronized (this) {
|
||||
if (!isDownloadActive(id)) {
|
||||
activeDownloads.add(id);
|
||||
downloadIdOutpointsMap.put(id, outpoint);
|
||||
}
|
||||
|
||||
createNotificationChannel();
|
||||
createNotificationGroup();
|
||||
|
||||
PendingIntent stopDownloadIntent = PendingIntent.getBroadcast(context, 0, getDeleteDownloadIntent(id), PendingIntent.FLAG_CANCEL_CURRENT);
|
||||
|
||||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID);
|
||||
// The file URI is used as the unique ID
|
||||
builder.setContentIntent(getLaunchPendingIntent(id, context))
|
||||
builder.setColor(ContextCompat.getColor(context, R.color.lbryGreen))
|
||||
.setContentIntent(getLaunchPendingIntent(id, context))
|
||||
.setContentTitle(String.format("Downloading %s", truncateFilename(filename)))
|
||||
.setGroup(GROUP_DOWNLOADS)
|
||||
.setPriority(NotificationCompat.PRIORITY_LOW)
|
||||
.setProgress(MAX_PROGRESS, 0, false)
|
||||
.setSmallIcon(android.R.drawable.stat_sys_download);
|
||||
.setSmallIcon(android.R.drawable.stat_sys_download)
|
||||
.setOngoing(true)
|
||||
.addAction(android.R.drawable.ic_menu_close_clear_cancel, "Stop", stopDownloadIntent);
|
||||
|
||||
int notificationId = getNotificationId(id);
|
||||
downloadIdNotificationIdMap.put(id, notificationId);
|
||||
@@ -169,9 +208,13 @@ public class DownloadManager {
|
||||
if (builders.containsKey(notificationId)) {
|
||||
builder = builders.get(notificationId);
|
||||
} else {
|
||||
PendingIntent stopDownloadIntent = PendingIntent.getBroadcast(context, 0, getDeleteDownloadIntent(id), PendingIntent.FLAG_CANCEL_CURRENT);
|
||||
builder = new NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID);
|
||||
builder.setContentTitle(String.format("Downloading %s", truncateFilename(filename)))
|
||||
.setPriority(NotificationCompat.PRIORITY_LOW);
|
||||
builder.setColor(ContextCompat.getColor(context, R.color.lbryGreen))
|
||||
.setContentTitle(String.format("Downloading %s", truncateFilename(filename)))
|
||||
.setPriority(NotificationCompat.PRIORITY_LOW)
|
||||
.setOngoing(true)
|
||||
.addAction(android.R.drawable.ic_menu_close_clear_cancel, "Stop", stopDownloadIntent);
|
||||
builders.put(notificationId, builder);
|
||||
}
|
||||
|
||||
@@ -188,7 +231,9 @@ public class DownloadManager {
|
||||
.setContentText(String.format("%s", formatBytes(totalBytes)))
|
||||
.setGroup(GROUP_DOWNLOADS)
|
||||
.setProgress(0, 0, false)
|
||||
.setSmallIcon(android.R.drawable.stat_sys_download_done);
|
||||
.setSmallIcon(android.R.drawable.stat_sys_download_done)
|
||||
.setOngoing(false);
|
||||
builder.mActions.clear();
|
||||
notificationManager.notify(notificationId, builder.build());
|
||||
|
||||
if (downloadIdNotificationIdMap.containsKey(id)) {
|
||||
@@ -233,11 +278,13 @@ public class DownloadManager {
|
||||
.setContentText(String.format("%s", formatBytes(totalBytes)))
|
||||
.setGroup(GROUP_DOWNLOADS)
|
||||
.setProgress(0, 0, false)
|
||||
.setSmallIcon(android.R.drawable.stat_sys_download_done);
|
||||
notificationManager.notify(notificationId, builder.build());
|
||||
.setSmallIcon(android.R.drawable.stat_sys_download_done)
|
||||
.setOngoing(false);
|
||||
builder.mActions.clear();
|
||||
notificationManager.notify(notificationId, builder.build());
|
||||
|
||||
// If there are no more downloads and the group exists, set the icon to stop animating
|
||||
checkGroupDownloadIcon(notificationManager);
|
||||
// If there are no more downloads and the group exists, set the icon to stop animating
|
||||
checkGroupDownloadIcon(notificationManager);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,11 +317,22 @@ public class DownloadManager {
|
||||
return completedDownloads;
|
||||
}
|
||||
|
||||
public String getOutpointForDownload(String uri) {
|
||||
if (downloadIdOutpointsMap.containsKey(uri)) {
|
||||
return downloadIdOutpointsMap.get(uri);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void deleteDownloadUri(String uri) {
|
||||
synchronized (this) {
|
||||
activeDownloads.remove(uri);
|
||||
completedDownloads.remove(uri);
|
||||
|
||||
if (downloadIdOutpointsMap.containsKey(uri)) {
|
||||
downloadIdOutpointsMap.remove(uri);
|
||||
}
|
||||
if (downloadIdNotificationIdMap.containsKey(uri)) {
|
||||
removeDownloadNotification(uri);
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
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 androidx.core.app.NotificationCompat;
|
||||
import androidx.core.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.lbrysdk.LbrynetService;
|
||||
import io.lbry.browser.reactmodules.UtilityModule;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
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
|
||||
String contentTitle = payload.get("content_title");
|
||||
String channelUrl = payload.get("channel_url");
|
||||
//String publishTime = payload.get("publish_time");
|
||||
String publishTime = null;
|
||||
|
||||
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, contentTitle, channelUrl, publishTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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,
|
||||
String contentTitle, String channelUrl, String publishTime) {
|
||||
//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";
|
||||
}
|
||||
} else {
|
||||
if (!MainActivity.isServiceRunning(this, LbrynetService.class) &&
|
||||
contentTitle != null &&
|
||||
channelUrl != null &&
|
||||
!url.startsWith("lbry://?") /* not a special url */
|
||||
) {
|
||||
// only enter lite mode when contentTitle and channelUrl are set (and the service isn't running yet)
|
||||
// cold start
|
||||
url = url + ((url.indexOf("?") > -1) ? "&liteMode=1" : "?liteMode=1");
|
||||
try {
|
||||
if (contentTitle != null) {
|
||||
url = url + "&contentTitle=" + URLEncoder.encode(contentTitle, "UTF-8");
|
||||
}
|
||||
if (channelUrl != null) {
|
||||
url = url + "&channelUrl=" + URLEncoder.encode(channelUrl, "UTF-8");
|
||||
}
|
||||
if (publishTime != null) {
|
||||
url = url + "&publishTime=" + URLEncoder.encode(publishTime, "UTF-8");
|
||||
}
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
// shouldn't happen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.lbry.browser;
|
||||
|
||||
import android.support.v4.content.FileProvider;
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
public class LocalFileProvider extends FileProvider {
|
||||
|
||||
@@ -1,26 +1,39 @@
|
||||
package io.lbry.browser;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.os.AsyncTask;
|
||||
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.os.Handler;
|
||||
import android.provider.DocumentsContract;
|
||||
import android.provider.MediaStore;
|
||||
import android.provider.Settings;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.app.NotificationManagerCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import android.telephony.SmsMessage;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.azendoo.reactnativesnackbar.SnackbarPackage;
|
||||
import com.brentvatne.react.ReactVideoPackage;
|
||||
import com.dylanvann.fastimage.FastImageViewPackage;
|
||||
import com.facebook.react.common.LifecycleState;
|
||||
@@ -35,98 +48,84 @@ import com.facebook.react.modules.core.DeviceEventManagerModule;
|
||||
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.facebook.soloader.SoLoader;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
import com.reactnativecommunity.asyncstorage.AsyncStoragePackage;
|
||||
import io.github.elyx0.reactnativedocumentpicker.DocumentPickerPackage;
|
||||
import com.reactnativecommunity.webview.RNCWebViewPackage;
|
||||
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.reactmodules.UtilityModule;
|
||||
import io.lbry.browser.reactpackages.LbryReactPackage;
|
||||
import io.lbry.browser.reactmodules.BackgroundMediaModule;
|
||||
import io.lbry.lbrysdk.LbrynetService;
|
||||
import io.lbry.lbrysdk.ServiceHelper;
|
||||
import io.lbry.lbrysdk.Utils;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigInteger;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.io.File;
|
||||
import java.net.ConnectException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.reactnative.camera.RNCameraPackage;
|
||||
|
||||
public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler, PermissionAwareActivity {
|
||||
public class MainActivity extends FragmentActivity implements DefaultHardwareBackBtnHandler, PermissionAwareActivity {
|
||||
|
||||
private static Activity currentActivity = null;
|
||||
|
||||
private static final int OVERLAY_PERMISSION_REQ_CODE = 101;
|
||||
|
||||
private static final int STORAGE_PERMISSION_REQ_CODE = 201;
|
||||
|
||||
private static final int PHONE_STATE_PERMISSION_REQ_CODE = 202;
|
||||
|
||||
private static final int RECEIVE_SMS_PERMISSION_REQ_CODE = 203;
|
||||
public static final int DOCUMENT_PICKER_RESULT_CODE = 301;
|
||||
public static final String SHARED_PREFERENCES_NAME = "LBRY";
|
||||
public static final String SALT_KEY = "salt";
|
||||
public static final String DEVICE_ID_KEY = "deviceId";
|
||||
public static final String SOURCE_NOTIFICATION_ID_KEY = "sourceNotificationId";
|
||||
public static final String SETTING_KEEP_DAEMON_RUNNING = "keepDaemonRunning";
|
||||
public static List<Integer> downloadNotificationIds = new ArrayList<Integer>();
|
||||
|
||||
private BroadcastReceiver notificationsReceiver;
|
||||
|
||||
private BroadcastReceiver smsReceiver;
|
||||
|
||||
private BroadcastReceiver stopServiceReceiver;
|
||||
|
||||
private BroadcastReceiver serviceActionsReceiver;
|
||||
private BroadcastReceiver downloadEventReceiver;
|
||||
|
||||
private FirebaseAnalytics firebaseAnalytics;
|
||||
private ReactRootView mReactRootView;
|
||||
|
||||
private ReactInstanceManager mReactInstanceManager;
|
||||
|
||||
public static final String SHARED_PREFERENCES_NAME = "LBRY";
|
||||
|
||||
public static final String SALT_KEY = "salt";
|
||||
|
||||
public static final String DEVICE_ID_KEY = "deviceId";
|
||||
|
||||
public static final String SOURCE_NOTIFICATION_ID_KEY = "sourceNotificationId";
|
||||
|
||||
public static final String SETTING_KEEP_DAEMON_RUNNING = "keepDaemonRunning";
|
||||
|
||||
public static List<Integer> downloadNotificationIds = new ArrayList<Integer>();
|
||||
|
||||
/**
|
||||
* Flag which indicates whether or not the service is running. Will be updated in the
|
||||
* onResume method.
|
||||
*/
|
||||
private boolean serviceRunning;
|
||||
|
||||
private CheckSdkReadyTask checkSdkReadyTask;
|
||||
private boolean receivedStopService;
|
||||
|
||||
private PermissionListener permissionListener;
|
||||
public static boolean lbrySdkReady;
|
||||
|
||||
protected String getMainComponentName() {
|
||||
return "LBRYApp";
|
||||
}
|
||||
|
||||
|
||||
public static LaunchTiming CurrentLaunchTiming;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
// Request external storage permission on Android version >= 6
|
||||
checkPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
STORAGE_PERMISSION_REQ_CODE,
|
||||
"LBRY requires access to your device storage to be able to download files and media.",
|
||||
this);
|
||||
}
|
||||
|
||||
CurrentLaunchTiming = new LaunchTiming(new Date());
|
||||
super.onCreate(savedInstanceState);
|
||||
currentActivity = this;
|
||||
|
||||
SoLoader.init(this, false);
|
||||
|
||||
// Register the stop service receiver (so that we close the activity if the user requests the service to stop)
|
||||
registerStopReceiver();
|
||||
registerServiceActionsReceiver();
|
||||
|
||||
// Register SMS receiver for handling verification texts
|
||||
registerSmsReceiver();
|
||||
@@ -134,29 +133,38 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
// Register the receiver to emit download events
|
||||
registerDownloadEventReceiver();
|
||||
|
||||
// Start the daemon service if it is not started
|
||||
serviceRunning = isServiceRunning(LbrynetService.class);
|
||||
// Start the sdk service if it is not started
|
||||
// Check the dht setting
|
||||
SharedPreferences sp = getSharedPreferences(MainActivity.SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
LbrynetService.setDHTEnabled(sp.getBoolean(UtilityModule.DHT_ENABLED, false));
|
||||
serviceRunning = isServiceRunning(this, LbrynetService.class);
|
||||
if (!serviceRunning) {
|
||||
CurrentLaunchTiming.setColdStart(true);
|
||||
ServiceHelper.start(this, "", LbrynetService.class, "lbrynetservice");
|
||||
}
|
||||
checkSdkReady();
|
||||
|
||||
checkNotificationOpenIntent(getIntent());
|
||||
|
||||
mReactRootView = new RNGestureHandlerEnabledRootView(this);
|
||||
mReactInstanceManager = ReactInstanceManager.builder()
|
||||
.setApplication(getApplication())
|
||||
.setCurrentActivity(this)
|
||||
.setBundleAssetName("index.android.bundle")
|
||||
.setJSMainModulePath("index")
|
||||
.addPackage(new MainReactPackage())
|
||||
.addPackage(new AsyncStoragePackage())
|
||||
.addPackage(new FastImageViewPackage())
|
||||
.addPackage(new DocumentPickerPackage())
|
||||
.addPackage(new RNCWebViewPackage())
|
||||
.addPackage(new ReactVideoPackage())
|
||||
.addPackage(new ReanimatedPackage())
|
||||
.addPackage(new RNCameraPackage())
|
||||
.addPackage(new RNFetchBlobPackage())
|
||||
.addPackage(new RNFSPackage())
|
||||
.addPackage(new RNGestureHandlerPackage())
|
||||
.addPackage(new SnackbarPackage())
|
||||
.addPackage(new LbryReactPackage())
|
||||
.setUseDeveloperSupport(true)
|
||||
.setUseDeveloperSupport(BuildConfig.DEBUG)
|
||||
.setInitialLifecycleState(LifecycleState.RESUMED)
|
||||
.build();
|
||||
mReactRootView.startReactApplication(mReactInstanceManager, "LBRYApp", null);
|
||||
@@ -166,6 +174,41 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
setContentView(mReactRootView);
|
||||
}
|
||||
|
||||
private void checkSdkReady() {
|
||||
if (!lbrySdkReady) {
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (checkSdkReadyTask != null && checkSdkReadyTask.getStatus() != AsyncTask.Status.FINISHED) {
|
||||
// task already running
|
||||
return;
|
||||
}
|
||||
checkSdkReadyTask = new CheckSdkReadyTask();
|
||||
checkSdkReadyTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -177,17 +220,28 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
String outpoint = intent.getStringExtra("outpoint");
|
||||
String fileInfoJson = intent.getStringExtra("file_info");
|
||||
|
||||
if (uri == null || outpoint == null || fileInfoJson == null) {
|
||||
|
||||
if (uri == null || outpoint == null || (fileInfoJson == null && !"abort".equals(downloadAction))) {
|
||||
return;
|
||||
}
|
||||
|
||||
String eventName = null;
|
||||
WritableMap params = Arguments.createMap();
|
||||
params.putString("uri", uri);
|
||||
params.putString("outpoint", outpoint);
|
||||
|
||||
ReactContext reactContext = mReactInstanceManager.getCurrentReactContext();
|
||||
if ("abort".equals(downloadAction)) {
|
||||
eventName = "onDownloadAborted";
|
||||
if (reactContext != null) {
|
||||
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit(eventName, params);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
String eventName = null;
|
||||
JSONObject json = new JSONObject(fileInfoJson);
|
||||
WritableMap fileInfo = JSONObjectToMap(json);
|
||||
WritableMap params = Arguments.createMap();
|
||||
params.putString("uri", uri);
|
||||
params.putString("outpoint", outpoint);
|
||||
params.putMap("fileInfo", fileInfo);
|
||||
|
||||
if (DownloadManager.ACTION_UPDATE.equals(downloadAction)) {
|
||||
@@ -198,7 +252,6 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
eventName = (DownloadManager.ACTION_START.equals(downloadAction)) ? "onDownloadStarted" : "onDownloadCompleted";
|
||||
}
|
||||
|
||||
ReactContext reactContext = mReactInstanceManager.getCurrentReactContext();
|
||||
if (reactContext != null) {
|
||||
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit(eventName, params);
|
||||
}
|
||||
@@ -210,17 +263,53 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
registerReceiver(downloadEventReceiver, intentFilter);
|
||||
}
|
||||
|
||||
private void registerStopReceiver() {
|
||||
private void registerServiceActionsReceiver() {
|
||||
IntentFilter intentFilter = new IntentFilter();
|
||||
intentFilter.addAction(LbrynetService.LBRY_SDK_SERVICE_STARTED);
|
||||
intentFilter.addAction(LbrynetService.ACTION_STOP_SERVICE);
|
||||
stopServiceReceiver = new BroadcastReceiver() {
|
||||
serviceActionsReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
MainActivity.this.receivedStopService = true;
|
||||
MainActivity.this.finish();
|
||||
String action = intent.getAction();
|
||||
if (LbrynetService.ACTION_STOP_SERVICE.equals(action)) {
|
||||
MainActivity.this.receivedStopService = true;
|
||||
MainActivity.this.finish();
|
||||
} else if (LbrynetService.LBRY_SDK_SERVICE_STARTED.equals(action)) {
|
||||
// Rebuild the service notification
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Notification svcNotification = buildServiceNotification();
|
||||
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
notificationManager.notify(1, svcNotification);
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
};
|
||||
registerReceiver(stopServiceReceiver, intentFilter);
|
||||
registerReceiver(serviceActionsReceiver, intentFilter);
|
||||
}
|
||||
|
||||
private Notification buildServiceNotification() {
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, LbrynetService.NOTIFICATION_CHANNEL_ID);
|
||||
Intent contextIntent = new Intent(this, MainActivity.class);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, contextIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
||||
Intent stopIntent = new Intent(LbrynetService.ACTION_STOP_SERVICE);
|
||||
PendingIntent stopPendingIntent = PendingIntent.getBroadcast(this, 0, stopIntent, 0);
|
||||
|
||||
String serviceDescription = "The LBRY service is running in the background.";
|
||||
Notification notification = builder.setColor(ContextCompat.getColor(this, R.color.lbryGreen))
|
||||
.setContentIntent(pendingIntent)
|
||||
.setContentText(serviceDescription)
|
||||
.setGroup(LbrynetService.GROUP_SERVICE)
|
||||
.setWhen(System.currentTimeMillis())
|
||||
.setSmallIcon(R.drawable.ic_lbry)
|
||||
.setOngoing(true)
|
||||
.addAction(android.R.drawable.ic_menu_close_clear_cancel, "Stop", stopPendingIntent)
|
||||
.build();
|
||||
|
||||
return notification;
|
||||
}
|
||||
|
||||
private void registerNotificationsReceiver() {
|
||||
@@ -299,6 +388,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() {
|
||||
@@ -309,30 +416,34 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
|
||||
ReactContext reactContext = mReactInstanceManager.getCurrentReactContext();
|
||||
switch (requestCode) {
|
||||
case STORAGE_PERMISSION_REQ_CODE:
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
if (BuildConfig.DEBUG && !Settings.canDrawOverlays(this)) {
|
||||
if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= 23 && !Settings.canDrawOverlays(this)) {
|
||||
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
|
||||
Uri.parse("package:" + getPackageName()));
|
||||
Uri.parse("package:" + getPackageName()));
|
||||
startActivityForResult(intent, OVERLAY_PERMISSION_REQ_CODE);
|
||||
}
|
||||
if (reactContext != null) {
|
||||
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
||||
.emit("onStoragePermissionGranted", null);
|
||||
}
|
||||
} else {
|
||||
// Permission not granted. Show a message and terminate the application
|
||||
Toast.makeText(this,
|
||||
// Permission not granted
|
||||
/*Toast.makeText(this,
|
||||
"LBRY requires access to your device storage to be able to download files and media." +
|
||||
" Please enable the storage permission and restart the app.", Toast.LENGTH_LONG).show();
|
||||
if (serviceRunning) {
|
||||
ServiceHelper.stop(this, LbrynetService.class);
|
||||
" Please enable the storage permission and restart the app.", Toast.LENGTH_LONG).show();*/
|
||||
if (reactContext != null) {
|
||||
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
||||
.emit("onStoragePermissionRefused", null);
|
||||
}
|
||||
finish();
|
||||
}
|
||||
break;
|
||||
|
||||
case PHONE_STATE_PERMISSION_REQ_CODE:
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
// Permission granted. Emit an onPhoneStatePermissionGranted event
|
||||
ReactContext reactContext = mReactInstanceManager.getCurrentReactContext();
|
||||
if (reactContext != null) {
|
||||
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
||||
.emit("onPhoneStatePermissionGranted", null);
|
||||
@@ -347,7 +458,6 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
case RECEIVE_SMS_PERMISSION_REQ_CODE:
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
// Permission granted. Emit an onPhoneStatePermissionGranted event
|
||||
ReactContext reactContext = mReactInstanceManager.getCurrentReactContext();
|
||||
if (reactContext != null) {
|
||||
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
||||
.emit("onReceiveSmsPermissionGranted", null);
|
||||
@@ -371,37 +481,6 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
}
|
||||
}
|
||||
|
||||
public static String acquireDeviceId(Context context) {
|
||||
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
String id = null;
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
id = telephonyManager.getImei(); // GSM
|
||||
if (id == null) {
|
||||
id = telephonyManager.getMeid(); // CDMA
|
||||
}
|
||||
} else {
|
||||
id = telephonyManager.getDeviceId();
|
||||
}
|
||||
} catch (SecurityException ex) {
|
||||
// Maybe the permission was not granted? Try to acquire permission
|
||||
checkPhoneStatePermission(context);
|
||||
} catch (Exception ex) {
|
||||
// id could not be obtained. Display a warning that rewards cannot be claimed.
|
||||
}
|
||||
|
||||
if (id == null || id.trim().length() == 0) {
|
||||
Toast.makeText(context, "Rewards cannot be claimed because we could not identify your device.", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
SharedPreferences sp = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sp.edit();
|
||||
editor.putString(DEVICE_ID_KEY, id);
|
||||
editor.commit();
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invokeDefaultOnBackPressed() {
|
||||
super.onBackPressed();
|
||||
@@ -421,10 +500,13 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
super.onResume();
|
||||
|
||||
SharedPreferences sp = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
serviceRunning = isServiceRunning(LbrynetService.class);
|
||||
LbrynetService.setDHTEnabled(sp.getBoolean(UtilityModule.DHT_ENABLED, false));
|
||||
|
||||
serviceRunning = isServiceRunning(this, LbrynetService.class);
|
||||
if (!serviceRunning) {
|
||||
ServiceHelper.start(this, "", LbrynetService.class, "lbrynetservice");
|
||||
}
|
||||
checkSdkReady();
|
||||
|
||||
if (mReactInstanceManager != null) {
|
||||
mReactInstanceManager.onHostResume(this, this);
|
||||
@@ -437,7 +519,7 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
SharedPreferences sp = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
boolean shouldKeepDaemonRunning = sp.getBoolean(SETTING_KEEP_DAEMON_RUNNING, true);
|
||||
if (!shouldKeepDaemonRunning) {
|
||||
serviceRunning = isServiceRunning(LbrynetService.class);
|
||||
serviceRunning = isServiceRunning(this, LbrynetService.class);
|
||||
if (serviceRunning) {
|
||||
ServiceHelper.stop(this, LbrynetService.class);
|
||||
}
|
||||
@@ -458,9 +540,9 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
downloadEventReceiver = null;
|
||||
}
|
||||
|
||||
if (stopServiceReceiver != null) {
|
||||
unregisterReceiver(stopServiceReceiver);
|
||||
stopServiceReceiver = null;
|
||||
if (serviceActionsReceiver != null) {
|
||||
unregisterReceiver(serviceActionsReceiver);
|
||||
serviceActionsReceiver = null;
|
||||
}
|
||||
|
||||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
|
||||
@@ -471,7 +553,7 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
notificationManager.cancel(downloadNotificationIds.get(i));
|
||||
}
|
||||
}
|
||||
if (receivedStopService || !isServiceRunning(LbrynetService.class)) {
|
||||
if (receivedStopService || !isServiceRunning(this, LbrynetService.class)) {
|
||||
notificationManager.cancelAll();
|
||||
}
|
||||
super.onDestroy();
|
||||
@@ -508,6 +590,8 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
|
||||
notificationManager.cancel(sourceNotificationId);
|
||||
}
|
||||
|
||||
checkNotificationOpenIntent(intent);
|
||||
}
|
||||
|
||||
super.onNewIntent(intent);
|
||||
@@ -551,8 +635,17 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
true);
|
||||
}
|
||||
|
||||
private boolean isServiceRunning(Class<?> serviceClass) {
|
||||
ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
|
||||
public static void checkStoragePermission(Context context) {
|
||||
// Request read phone state permission
|
||||
checkPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
STORAGE_PERMISSION_REQ_CODE,
|
||||
"LBRY requires access to your device storage to be able to download files and media.",
|
||||
context,
|
||||
true);
|
||||
}
|
||||
|
||||
public static boolean isServiceRunning(Context context, Class<?> serviceClass) {
|
||||
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
for (ActivityManager.RunningServiceInfo serviceInfo : manager.getRunningServices(Integer.MAX_VALUE)) {
|
||||
if (serviceClass.getName().equals(serviceInfo.service.getClassName())) {
|
||||
return true;
|
||||
@@ -611,4 +704,227 @@ 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());
|
||||
}
|
||||
|
||||
private class CheckSdkReadyTask extends AsyncTask<Void, Void, Boolean> {
|
||||
|
||||
public Boolean doInBackground(Void... params) {
|
||||
boolean sdkReady = false;
|
||||
try {
|
||||
String response = Utils.sdkCall("status");
|
||||
if (response != null) {
|
||||
JSONObject result = new JSONObject(response);
|
||||
JSONObject status = result.getJSONObject("result");
|
||||
|
||||
// send status response for splash page updates
|
||||
WritableMap sdkStatus = JSONObjectToMap(status);
|
||||
ReactContext reactContext = mReactInstanceManager.getCurrentReactContext();
|
||||
if (reactContext != null) {
|
||||
WritableMap evtParams = Arguments.createMap();
|
||||
evtParams.putMap("status", sdkStatus);
|
||||
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit("onSdkStatusResponse", evtParams);
|
||||
}
|
||||
|
||||
JSONObject startupStatus = status.getJSONObject("startup_status");
|
||||
sdkReady = startupStatus.has("stream_manager") && startupStatus.has("wallet") &&
|
||||
startupStatus.getBoolean("stream_manager") && startupStatus.getBoolean("wallet") &&
|
||||
(status.getJSONObject("wallet").getLong("blocks_behind") <= 0);
|
||||
}
|
||||
} catch (ConnectException ex) {
|
||||
// pass
|
||||
} catch (JSONException ex) {
|
||||
// pass
|
||||
}
|
||||
|
||||
return sdkReady;
|
||||
}
|
||||
protected void onPostExecute(Boolean sdkReady) {
|
||||
lbrySdkReady = sdkReady;
|
||||
ReactContext reactContext = mReactInstanceManager.getCurrentReactContext();
|
||||
if (sdkReady && reactContext != null) {
|
||||
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit("onSdkReady", null);
|
||||
}
|
||||
|
||||
if (!sdkReady) {
|
||||
checkSdkReady();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class LaunchTiming {
|
||||
private Date start;
|
||||
private boolean coldStart;
|
||||
|
||||
public LaunchTiming(Date start) {
|
||||
this.start = start;
|
||||
}
|
||||
|
||||
public Date getStart() {
|
||||
return start;
|
||||
}
|
||||
public void setStart(Date start) {
|
||||
this.start = start;
|
||||
}
|
||||
public boolean isColdStart() {
|
||||
return coldStart;
|
||||
}
|
||||
public void setColdStart(boolean coldStart) {
|
||||
this.coldStart = coldStart;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,17 +10,17 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.app.NotificationManagerCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
|
||||
import io.lbry.browser.LbrynetService;
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.lbrysdk.LbrynetService;
|
||||
|
||||
public class BackgroundMediaModule extends ReactContextBaseJavaModule {
|
||||
|
||||
@@ -66,7 +66,7 @@ public class BackgroundMediaModule extends ReactContextBaseJavaModule {
|
||||
.setGroup(LbrynetService.GROUP_SERVICE)
|
||||
.setOngoing(!paused)
|
||||
.setSmallIcon(paused ? android.R.drawable.ic_media_pause : android.R.drawable.ic_media_play)
|
||||
.setStyle(new android.support.v4.media.app.NotificationCompat.MediaStyle()
|
||||
.setStyle(new androidx.media.app.NotificationCompat.MediaStyle()
|
||||
.setShowActionsInCompactView(0))
|
||||
.addAction(paused ? android.R.drawable.ic_media_play : android.R.drawable.ic_media_pause,
|
||||
paused ? "Play" : "Pause",
|
||||
@@ -10,9 +10,9 @@ import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
|
||||
import io.lbry.browser.LbrynetService;
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.ServiceHelper;
|
||||
import io.lbry.lbrysdk.LbrynetService;
|
||||
import io.lbry.lbrysdk.ServiceHelper;
|
||||
|
||||
public class DaemonServiceControlModule extends ReactContextBaseJavaModule {
|
||||
|
||||
@@ -11,11 +11,16 @@ 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 io.lbry.lbrysdk.Utils;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.json.JSONObject;
|
||||
@@ -37,7 +42,7 @@ public class FirebaseModule extends ReactContextBaseJavaModule {
|
||||
public String getName() {
|
||||
return "Firebase";
|
||||
}
|
||||
|
||||
|
||||
@ReactMethod
|
||||
public void setCurrentScreen(String name, final Promise promise) {
|
||||
final Activity activity = getCurrentActivity();
|
||||
@@ -50,7 +55,7 @@ public class FirebaseModule extends ReactContextBaseJavaModule {
|
||||
}
|
||||
promise.resolve(true);
|
||||
}
|
||||
|
||||
|
||||
@ReactMethod
|
||||
public void track(String name, ReadableMap payload) {
|
||||
Bundle bundle = new Bundle();
|
||||
@@ -72,8 +77,8 @@ public class FirebaseModule extends ReactContextBaseJavaModule {
|
||||
@ReactMethod
|
||||
public void logException(boolean fatal, String message, String error) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("message", message);
|
||||
bundle.putString("error", error);
|
||||
bundle.putString("exception_message", message);
|
||||
bundle.putString("exception_error", error);
|
||||
if (firebaseAnalytics != null) {
|
||||
firebaseAnalytics.logEvent(fatal ? "reactjs_exception" : "reactjs_warning", bundle);
|
||||
}
|
||||
@@ -86,4 +91,41 @@ public class FirebaseModule extends ReactContextBaseJavaModule {
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void logLaunchTiming() {
|
||||
Date end = new Date();
|
||||
MainActivity.LaunchTiming currentTiming = MainActivity.CurrentLaunchTiming;
|
||||
if (currentTiming == null) {
|
||||
// no start timing data, so skip this
|
||||
return;
|
||||
}
|
||||
|
||||
long totalTimeMs = end.getTime() - currentTiming.getStart().getTime();
|
||||
String eventName = currentTiming.isColdStart() ? "app_cold_start" : "app_warm_start";
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putLong("total_ms", totalTimeMs);
|
||||
bundle.putLong("total_seconds", new Double(Math.ceil(totalTimeMs / 1000.0)).longValue());
|
||||
if (firebaseAnalytics != null) {
|
||||
firebaseAnalytics.logEvent(eventName, bundle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
||||
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.Utils;
|
||||
import io.lbry.lbrysdk.Utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -16,7 +16,7 @@ import com.facebook.react.bridge.ReadableType;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.Utils;
|
||||
import io.lbry.lbrysdk.Utils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
@@ -12,10 +12,10 @@ import android.Manifest;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.support.v4.content.FileProvider;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.app.NotificationManagerCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import androidx.core.content.FileProvider;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
@@ -23,13 +23,20 @@ import android.view.WindowManager;
|
||||
import com.facebook.react.bridge.Callback;
|
||||
import com.facebook.react.bridge.Promise;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
|
||||
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.Closeable;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
@@ -37,9 +44,9 @@ import java.security.KeyStore;
|
||||
|
||||
import io.lbry.browser.DownloadManager;
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.LbrynetService;
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.Utils;
|
||||
import io.lbry.lbrysdk.LbrynetService;
|
||||
import io.lbry.lbrysdk.Utils;
|
||||
|
||||
public class UtilityModule extends ReactContextBaseJavaModule {
|
||||
private static final Map<String, Integer> activeNotifications = new HashMap<String, Integer>();
|
||||
@@ -52,6 +59,22 @@ public class UtilityModule extends ReactContextBaseJavaModule {
|
||||
|
||||
public static final String ACTION_NOTIFICATION_LATER = "io.lbry.browser.ACTION_NOTIFICATION_LATER";
|
||||
|
||||
// Setting keys from React Native
|
||||
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";
|
||||
|
||||
public static final String DHT_ENABLED = "dhtEnabled";
|
||||
|
||||
// the last language set to be loaded
|
||||
private static final String LANGUAGE_SETTING_KEY = "language";
|
||||
|
||||
private String language;
|
||||
|
||||
private Context context;
|
||||
|
||||
private KeyStore keyStore;
|
||||
@@ -64,6 +87,17 @@ public class UtilityModule extends ReactContextBaseJavaModule {
|
||||
} catch (Exception ex) {
|
||||
// continue without keystore
|
||||
}
|
||||
|
||||
SharedPreferences sp = context.getSharedPreferences(MainActivity.SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
language = sp.getString(LANGUAGE_SETTING_KEY, "en");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getConstants() {
|
||||
final Map<String, Object> constants = MapBuilder.newHashMap();
|
||||
constants.put("language", language);
|
||||
constants.put("dhtEnabled", LbrynetService.isDHTEnabled());
|
||||
return constants;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -113,7 +147,6 @@ public class UtilityModule extends ReactContextBaseJavaModule {
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,6 +214,19 @@ public class UtilityModule extends ReactContextBaseJavaModule {
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void canReadWriteStorage(final Promise promise) {
|
||||
promise.resolve(MainActivity.hasPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, MainActivity.getActivity()));
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void requestStoragePermission() {
|
||||
MainActivity activity = (MainActivity) MainActivity.getActivity();
|
||||
if (activity != null) {
|
||||
MainActivity.checkStoragePermission(activity);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void shareLogFile(Callback errorCallback) {
|
||||
String logFileName = "lbrynet.log";
|
||||
@@ -208,6 +254,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);
|
||||
@@ -340,6 +398,7 @@ public class UtilityModule extends ReactContextBaseJavaModule {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(LbrynetService.ACTION_QUEUE_DOWNLOAD);
|
||||
intent.putExtra("outpoint", outpoint);
|
||||
|
||||
if (context != null) {
|
||||
context.sendBroadcast(intent);
|
||||
}
|
||||
@@ -354,4 +413,125 @@ 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, final 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();
|
||||
}
|
||||
|
||||
if (DHT_ENABLED.equalsIgnoreCase(key)) {
|
||||
(new AsyncTask<Void, Void, Void>() {
|
||||
protected Void doInBackground(Void... params) {
|
||||
String fileContent = value ? "on" : "off";
|
||||
String path = String.format("%s/%s", Utils.getAppInternalStorageDir(context), "dht");
|
||||
PrintStream out = null;
|
||||
try {
|
||||
out = new PrintStream(new FileOutputStream(path));
|
||||
out.print(fileContent);
|
||||
} catch (Exception ex) {
|
||||
// pass
|
||||
} finally {
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void getNativeBooleanSetting(String key, boolean defaultValue, Promise promise) {
|
||||
if (context != null) {
|
||||
SharedPreferences sp = context.getSharedPreferences(MainActivity.SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
promise.resolve(sp.getBoolean(key, defaultValue));
|
||||
} else {
|
||||
promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void setNativeStringSetting(String key, String value) {
|
||||
if (context != null) {
|
||||
SharedPreferences sp = context.getSharedPreferences(MainActivity.SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sp.edit();
|
||||
editor.putString(key, value);
|
||||
editor.commit();
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void getNativeStringSetting(String key, String defaultValue, Promise promise) {
|
||||
if (context != null) {
|
||||
SharedPreferences sp = context.getSharedPreferences(MainActivity.SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
promise.resolve(sp.getString(key, defaultValue));
|
||||
} else {
|
||||
promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void getDownloadDirectory(Promise promise) {
|
||||
// This obtains a public default download directory after the storage permission has been granted
|
||||
promise.resolve(Utils.getConfiguredDownloadDirectory(context));
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void getLbrynetDirectory(Promise promise) {
|
||||
String path = String.format("%s/%s", Utils.getAppInternalStorageDir(context), "lbrynet");
|
||||
promise.resolve(path);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void getPlatform(Promise promise) {
|
||||
String platform = String.format("Android %s (API %s)", Utils.getAndroidRelease(), Utils.getAndroidSdk());
|
||||
promise.resolve(platform);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void checkSdkReady() {
|
||||
// check that the sdk ready when the service is already running so that we can send the ready event
|
||||
ReactContext reactContext = (ReactContext) context;
|
||||
if (MainActivity.lbrySdkReady && reactContext != null) {
|
||||
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit("onSdkReady", null);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void log(String tag, String message) {
|
||||
android.util.Log.d(tag, message);
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 620 B |
|
Before Width: | Height: | Size: 134 B After Width: | Height: | Size: 134 B |
|
Before Width: | Height: | Size: 134 B After Width: | Height: | Size: 134 B |
|
Before Width: | Height: | Size: 134 B After Width: | Height: | Size: 134 B |
|
Before Width: | Height: | Size: 134 B After Width: | Height: | Size: 134 B |
|
After Width: | Height: | Size: 134 B |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 444 B |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 640 B After Width: | Height: | Size: 640 B |
|
Before Width: | Height: | Size: 611 B After Width: | Height: | Size: 611 B |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 494 B After Width: | Height: | Size: 494 B |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 451 B After Width: | Height: | Size: 451 B |
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 225 B |
|
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 683 B After Width: | Height: | Size: 683 B |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 247 B |
|
Before Width: | Height: | Size: 879 B After Width: | Height: | Size: 879 B |
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 332 B After Width: | Height: | Size: 332 B |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 7.9 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 265 B After Width: | Height: | Size: 265 B |
|
Before Width: | Height: | Size: 437 B After Width: | Height: | Size: 437 B |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 523 B After Width: | Height: | Size: 523 B |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 57 KiB |