Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
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. -->
|
||||
-95
@@ -1,95 +0,0 @@
|
||||
sudo: required
|
||||
dist: xenial
|
||||
language: python
|
||||
python:
|
||||
- '3.7'
|
||||
install:
|
||||
- deactivate
|
||||
- export PATH=/usr/bin:$PATH
|
||||
- export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
|
||||
- sudo dpkg --add-architecture i386
|
||||
- sudo add-apt-repository ppa:deadsnakes/ppa -y
|
||||
- sudo apt-get -qq update
|
||||
- sudo apt-get -qq install build-essential python3.7 python3.7-dev python3.7-venv python3-pip ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 m4 libc6-dev-i386
|
||||
- sudo pip install --upgrade cython==0.28.1 pip setuptools
|
||||
- wget -q https://nodejs.org/dist/v8.11.1/node-v8.11.1-linux-x64.tar.xz
|
||||
- tar -xf node-v8.11.1-linux-x64.tar.xz
|
||||
- sudo ln -s $TRAVIS_BUILD_DIR/node-v8.11.1-linux-x64/bin/node /usr/bin/node
|
||||
- sudo ln -s $TRAVIS_BUILD_DIR/node-v8.11.1-linux-x64/bin/npm /usr/bin/npm
|
||||
- git clone https://github.com/lbryio/buildozer.git
|
||||
- cd app
|
||||
- npm config set registry="http://registry.npmjs.org/"
|
||||
- npm install
|
||||
- sudo npm install -g react-native-cli
|
||||
- sudo ln -s $TRAVIS_BUILD_DIR/node-v8.11.1-linux-x64/bin/react-native /usr/bin/react-native
|
||||
- cd ..
|
||||
- cd buildozer
|
||||
- sudo python setup.py install
|
||||
- cd ..
|
||||
- mv buildozer.spec.travis buildozer.spec
|
||||
- mkdir -p cd ~/.buildozer/android/platform/
|
||||
- wget -q 'https://dist.testnet.lbry.tech/crystax-ndk-10.3.2-linux-x86_64.tar.xz' -P ~/.buildozer/android/
|
||||
- wget -q 'https://dl.google.com/android/android-sdk_r23-linux.tgz' -P ~/.buildozer/android/platform/
|
||||
- wget -q 'https://dl.google.com/android/repository/platform-27_r01.zip' -P ~/.buildozer/android/platform/
|
||||
- wget -q 'https://dl.google.com/android/repository/build-tools_r26.0.2-linux.zip' -P ~/.buildozer/android/platform/
|
||||
- tar -xf ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz -C ~/.buildozer/android/
|
||||
- cp -f $TRAVIS_BUILD_DIR/scripts/build-target-python.sh ~/.buildozer/android/crystax-ndk-10.3.2/build/tools/build-target-python.sh
|
||||
- rm -rf ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
|
||||
- ln -s ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21 ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
|
||||
- tar -xf ~/.buildozer/android/platform/android-sdk_r23-linux.tgz -C ~/.buildozer/android/platform/
|
||||
- mv ~/.buildozer/android/platform/android-sdk-linux ~/.buildozer/android/platform/android-sdk-23
|
||||
- unzip -qq ~/.buildozer/android/platform/platform-27_r01.zip -d ~/.buildozer/android/platform/android-sdk-23/platforms
|
||||
- mv ~/.buildozer/android/platform/android-sdk-23/platforms/android-8.1.0 ~/.buildozer/android/platform/android-sdk-23/platforms/android-27
|
||||
- mkdir -p ~/.buildozer/android/platform/android-sdk-23/build-tools
|
||||
- unzip -qq ~/.buildozer/android/platform/build-tools_r26.0.2-linux.zip -d ~/.buildozer/android/platform/android-sdk-23/build-tools
|
||||
- mv ~/.buildozer/android/platform/android-sdk-23/build-tools/android-8.1.0 ~/.buildozer/android/platform/android-sdk-23/build-tools/26.0.2
|
||||
- mkdir -p ~/.buildozer/android/platform/android-sdk-23/licenses
|
||||
- echo $'\nd56f5187479451eabf01fb78af6dfcb131a6481e' > ~/.buildozer/android/platform/android-sdk-23/licenses/android-sdk-license
|
||||
- echo $'\n84831b9409646a918e30573bab4c9c91346d8abd' > ~/.buildozer/android/platform/android-sdk-23/licenses/android-sdk-preview-license
|
||||
script:
|
||||
- "./release.sh | grep -Fv -e 'working:' -e 'copy' -e 'Compiling' --line-buffered"
|
||||
- cp $TRAVIS_BUILD_DIR/bin/*.apk /dev/null
|
||||
before_deploy:
|
||||
- cd $TRAVIS_BUILD_DIR/bin
|
||||
- export BUILD_VERSION=$(cat ../src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+')
|
||||
- cp browser-$BUILD_VERSION-release.apk latest.apk
|
||||
deploy:
|
||||
- provider: releases
|
||||
api_key:
|
||||
secure: m+FYX7vHZoiLSHHiJ2d3y8Fm4qSRoIVjEei+5BV17awiow/U8UKvy/5J1n8qfBdq+dpst5z58pTHCKWPbJz84C3z/posJ5mwEcOAaD/kxSAMHbtlaPW90pRWHUu3aW86UM/ggqtljE9Qz8KS/9a0xNUDfcXLkLgxuxgwodMcacEulAAc9TIOCUeR3IFI+KN0ptTCVahCu2JN8DCHKomaR+yKZHdo/9v9XCAcvmImSDu9nUDLH3+A7xQeRpPJqSspk1dadgdXP76kU8t3OKsYuM7DS5AoKvMIc9lZot4UYYKAx7/zavbzeEmqnyskULgsmV8/UDI1AV9U7uFBdrR6dSjISA1k6EHnCgqzasF+lp0hz5iE/0yPxlE9Z1kLW9gZgxSJtjr6Kv2uqAjHYYmpkjtTwHPwBugRM7PWMTxHNcPwkIHpBSRkXjpyDjkWd/LY4X866Y1g2BdIhbGshjy/9Fb2vnYxNZW6drLHn+wWeHJ41Vfgtg1cn01yZGJqgIkcTkhzNL6Bi++y8EBJXDr4L870s336SpbqRuIrO/C16ZFB+XnOg4Ty50Fk5zkbySMHII58iWqSyDYWNvhqo9zU9jn1XQQeok12129Y4t9TUOcJRbxhQ+511lCmVcFIkWHsXDK2QSZ7TeMK5GQUA8OvcNe+WLCJaQ/YD7OZvwlPTvc=
|
||||
file_glob: true
|
||||
file: browser-*-release.apk
|
||||
overwrite: true
|
||||
skip_cleanup: true
|
||||
on:
|
||||
tags: true
|
||||
- provider: s3
|
||||
access_key_id:
|
||||
secure: qEZZ73DWBn9+M2pS4VwsyX8YZjZOENIMP/eoU1A9Vbn155oZpbUaJ7k+4cAXqmBm0WBMKZDqpzCRSGehLAxHFH5rjkj9gLSgd8fY9cveABHkl50HeuxxNsQM+ytk9sCtP8bWOqf7rT/iCgM1soyF2pYmfHM3tU9l0fWK8oZ7pFRIg91hXxUvhvYY2u6B9D1NqSN9T3xtrwEkVjvmkmyKMLCtoIdyB7QdeQciFdGFhZC9DYJVRLxa3BlzZ1T8Qv4MCyIxPjxIugNvVR64VgGjdBdq0BEIyoRqbeIvtqQjlnne4DfJFeCmbDrSva1wDP1UyFoxsRhiWQ/jXXgIyN2CisI6QRD0J+a2LgmbmtkUzhRMuVQJmBrIauulOzcowwRV2J4TtUaAJK9iSHT9D3RLzpazCOnjvJZV9CK5w252Vs5eHnisCSCQk8Ozox96Sg6XW580NEXfkYoGzXLSGiy9zrZs813blUjssEY+jIQmJEby80C3guK7/G4lzthv57psqBWcYd0tFR+vTestS+EFlC02ToUngJhW7I7lPA2G2yrJ5319jFxUSniijb1n72TQthnbqTBahepvKvuG1iWZnCKxS5sWkutFoqEcpQyhXdf7QdR/VrOr8N5xrhK1B8dCYZM6h8eMZbBvOLH49+N6L9jiJz5x+Lk32wcssv1oOgI=
|
||||
secret_access_key:
|
||||
secure: lPygaaJdjFgWY4GcXUXC4Oc5op/TE85Md8lX2bzW19058lbcqYSdM0WySQCxoU/4rlM4Q0N8du0qQ3kZXDpP9XSqvFTVnTGTuB4yghUR1yXcpt6u3JOeOX+YAc3wyQ/pmod6VGO0n8pm8hBVsSFXufdBTjD2W+tNrDoa8RYnlWrt7BbICGltB7PcqYh1Qw6S1wDyZt8I4B5JHDhyJmX6FT5KfOb5cJyynpxlKUstUfy1rh81KuGkEcuEVOLg1s7HE1/IUkVIgezAuCrMHjc86qbNcHULJMFCVYntvvs07+tctrPxA/cfS24WkW7smyij+gdZAZWNNgkIDCuwqpex1v1nKn56mC8xXyUl4CnSCuubQtqUBzTmd4T5sF7trTtpVr9NInwy+4mUoCpz2UKZekTjZkqpzCAuC/cBVWE1/k3wsNat6dGyc9QnKXBqLVhuwYsCOteqLW50ToMMMW0ccDV6FXodwZmrunGd5wIX+UgZkf4l32vzKUxHtIupfYbsjylcPc3VO0OzMMKP/3sYLAN6QntVDFc30k1uqqpgJN4t0nV7vvjMI+b0Qr+o7GzUV2d+QulQXOySJgB2pH0kV1EoPAJ8KbqDOy8KgCJl0YIbOaz14+SiRQhotJ2hrLdtsvyVYXMX+d/CKHJSWa2MQq+jD7lMCwVaGg82PFN1gI4=
|
||||
bucket: "build.lbry.io"
|
||||
upload-dir: android
|
||||
region: us-east-1
|
||||
overwrite: true
|
||||
skip_cleanup: true
|
||||
on:
|
||||
tags: true
|
||||
- provider: s3
|
||||
access_key_id:
|
||||
secure: qEZZ73DWBn9+M2pS4VwsyX8YZjZOENIMP/eoU1A9Vbn155oZpbUaJ7k+4cAXqmBm0WBMKZDqpzCRSGehLAxHFH5rjkj9gLSgd8fY9cveABHkl50HeuxxNsQM+ytk9sCtP8bWOqf7rT/iCgM1soyF2pYmfHM3tU9l0fWK8oZ7pFRIg91hXxUvhvYY2u6B9D1NqSN9T3xtrwEkVjvmkmyKMLCtoIdyB7QdeQciFdGFhZC9DYJVRLxa3BlzZ1T8Qv4MCyIxPjxIugNvVR64VgGjdBdq0BEIyoRqbeIvtqQjlnne4DfJFeCmbDrSva1wDP1UyFoxsRhiWQ/jXXgIyN2CisI6QRD0J+a2LgmbmtkUzhRMuVQJmBrIauulOzcowwRV2J4TtUaAJK9iSHT9D3RLzpazCOnjvJZV9CK5w252Vs5eHnisCSCQk8Ozox96Sg6XW580NEXfkYoGzXLSGiy9zrZs813blUjssEY+jIQmJEby80C3guK7/G4lzthv57psqBWcYd0tFR+vTestS+EFlC02ToUngJhW7I7lPA2G2yrJ5319jFxUSniijb1n72TQthnbqTBahepvKvuG1iWZnCKxS5sWkutFoqEcpQyhXdf7QdR/VrOr8N5xrhK1B8dCYZM6h8eMZbBvOLH49+N6L9jiJz5x+Lk32wcssv1oOgI=
|
||||
secret_access_key:
|
||||
secure: lPygaaJdjFgWY4GcXUXC4Oc5op/TE85Md8lX2bzW19058lbcqYSdM0WySQCxoU/4rlM4Q0N8du0qQ3kZXDpP9XSqvFTVnTGTuB4yghUR1yXcpt6u3JOeOX+YAc3wyQ/pmod6VGO0n8pm8hBVsSFXufdBTjD2W+tNrDoa8RYnlWrt7BbICGltB7PcqYh1Qw6S1wDyZt8I4B5JHDhyJmX6FT5KfOb5cJyynpxlKUstUfy1rh81KuGkEcuEVOLg1s7HE1/IUkVIgezAuCrMHjc86qbNcHULJMFCVYntvvs07+tctrPxA/cfS24WkW7smyij+gdZAZWNNgkIDCuwqpex1v1nKn56mC8xXyUl4CnSCuubQtqUBzTmd4T5sF7trTtpVr9NInwy+4mUoCpz2UKZekTjZkqpzCAuC/cBVWE1/k3wsNat6dGyc9QnKXBqLVhuwYsCOteqLW50ToMMMW0ccDV6FXodwZmrunGd5wIX+UgZkf4l32vzKUxHtIupfYbsjylcPc3VO0OzMMKP/3sYLAN6QntVDFc30k1uqqpgJN4t0nV7vvjMI+b0Qr+o7GzUV2d+QulQXOySJgB2pH0kV1EoPAJ8KbqDOy8KgCJl0YIbOaz14+SiRQhotJ2hrLdtsvyVYXMX+d/CKHJSWa2MQq+jD7lMCwVaGg82PFN1gI4=
|
||||
bucket: "build.lbry.io"
|
||||
upload-dir: "android/build-${TRAVIS_BUILD_NUMBER}_commit-${TRAVIS_COMMIT:0:7}"
|
||||
region: us-east-1
|
||||
overwrite: true
|
||||
skip_cleanup: true
|
||||
on:
|
||||
all_branches: true
|
||||
env:
|
||||
global:
|
||||
- secure: GS3Cp1QXiX8UPye3kdk2A2f3iFRr02sHKpY+RE+Zvx3Q7GDmhDuepHKzx6Hq5Os5fZN9Y/Bdds+XH+vLIRtT6XsWR7AONPhSifVY3XB5/2F+lDcZ538W8P8GZvXejpY4VecMUWHoWbuyt0s3PpaGXZJcHp8ir+CUJ0NUmU3I9w449pqj9/de2LHtG3qKH1lG0Xz58iOC0mmEeH451cQv3dDw851ihA4ak9vCTV1KKuMJUcv+2u6PxXGVX0mrJLEssjL6ze6G5iZUB4PM1vUpe3HqcVw8CSOa8O79BQxoB00qyA3WD+LpZDPpI0wh6gmBsR/2nCFyMJndJr3CjyB6lHdK7PgBoK0CJjszKawiZqg74O9DOjzTJTO2v9bnkfPrNxu4/3D/tbDg+whY8k5oV1sgDue9KAo/2aEEO0LGlKP4W3Qqt/lzRKsfpMVrMTdCNKJ8rG/wUFWw8ehOCmAsJaQ1saDOZDMNPLLuYpxFgmXFqWV5ThbUHgEJVj+G7qt6CMEussKvuZJoJZx24Pdk5Prr7ENzTyPmE5gk4b8WNfVNleOEC09xu5tFk2yOdzF1dawKsa1Mog6gImirTQ/INC/3BANdKoG9/cLJEIt9boJaFDXE1dpqoLVzoez9znHKOGSAU/1PaH3thjVnbUyO5z24PpPZ12zM3+3P8DbI454=
|
||||
before_install:
|
||||
- openssl aes-256-cbc -K $encrypted_b4c9b905b12e_key -iv $encrypted_b4c9b905b12e_iv
|
||||
-in lbry-android.keystore.enc -out lbry-android.keystore -d
|
||||
@@ -71,7 +71,7 @@ Assuming `lbry-android` as the current working folder:
|
||||
The `google-services.json` file is required for the build to be successful due to the Firebase implementation. Simply copy the provided sample file into the same destination folder.
|
||||
```
|
||||
cd lbry-android
|
||||
cp p4a/pythonforandroid/bootstraps/lbry/templates/google-services.sample.json p4a/pythonforandroid/bootstraps/lbry/templates/google-services.json
|
||||
cp p4a/pythonforandroid/bootstraps/lbry/build/templates/google-services.sample.json p4a/pythonforandroid/bootstraps/lbry/build/templates/google-services.json
|
||||
```
|
||||
|
||||
#### Setup Android SDK for buildozer
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2018 LBRY Inc
|
||||
Copyright (c) 2017-2019 LBRY Inc
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
|
||||
+10
-10
@@ -1,17 +1,17 @@
|
||||
### Introduction
|
||||
# Introduction
|
||||
If you would like to contribute to the Android app, but find the build documentation a little daunting, this guide lets you copy-paste your way to a successful APK build.
|
||||
|
||||
#### Estimated build time
|
||||
### Estimated build time
|
||||
25 - 40 minutes (depending on Internet connection speeds)
|
||||
|
||||
#### What do you need?
|
||||
* A computer running Ubuntu 18.04
|
||||
### What do you need?
|
||||
* A computer running [Ubuntu 18.04](https://ubuntu.com/download/desktop)
|
||||
* Internet access to download modules and packages.
|
||||
* At least 15GB of free disk space.
|
||||
* Alternatively, Docker. You can skip steps 1 through 5 if you make use of the `lbry/android-base` Docker base image. Scroll down to Fast track if you would prefer to use Docker.
|
||||
* Alternatively, Docker. You can skip steps 1 through 5 if you make use of the `lbry/android-base` Docker base image. Scroll down to [Fast Track](#Fast-Track) at the bottom of the page if you would prefer to use Docker.
|
||||
|
||||
### Step 1 of 10
|
||||
Install all the apt packages required by running the following commands. You can copy-paste directly to your terminal.
|
||||
Install all the apt packages required by running the following commands. You can copy-paste this directly to your terminal.
|
||||
```
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt-get -y update
|
||||
@@ -32,7 +32,7 @@ sudo -H pip install --upgrade cython==0.28.1 setuptools
|
||||
```
|
||||
|
||||
### Step 3 of 10
|
||||
Install buildozer, a tool for creating the apk package using the python for android toolcahin.
|
||||
Install [buildozer](https://github.com/lbryio/buildozer.git), a tool for creating the apk package using the python for android toolchain.
|
||||
```
|
||||
git clone https://github.com/lbryio/buildozer.git
|
||||
cd buildozer && python2.7 setup.py install && cd ..
|
||||
@@ -72,7 +72,7 @@ wget 'https://www.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz' -
|
||||
```
|
||||
|
||||
### Step 7 of 10
|
||||
Clone the lbryio/lbry-android git repository, initialise submodules and create your `buildozer.spec` and `google-services.json` files. The provided `buildozer.spec.sample` contains defaults provided you followed steps 1 through 5 exactly as described. You can also customise the spec file if you want to. The `google-services.sample.json` can be used to ensure the build completes successfully.
|
||||
Clone the [lbryio/lbry-android git repository](https://github.com/lbryio/lbry-android), initialise submodules and create your `buildozer.spec` and `google-services.json` files. The provided `buildozer.spec.sample` contains defaults provided you followed steps 1 through 5 exactly as described. You can also customise the spec file if you want to. The `google-services.sample.json` can be used to ensure the build completes successfully.
|
||||
```
|
||||
git clone https://github.com/lbryio/lbry-android
|
||||
cd lbry-android
|
||||
@@ -103,11 +103,11 @@ If you made it this far, you're finally ready to build the package! You just hav
|
||||
buildozer android debug
|
||||
```
|
||||
|
||||
### Fast Track
|
||||
### Fast Track {#Fast-Track}
|
||||
Install Docker and start a container using the `lbry/android-base` image, which is about 1.72GB in size. Run the following commands for Ubuntu and then follow steps 6 through 10 in the container's bash prompt.
|
||||
```
|
||||
sudo apt-get install docker-ce
|
||||
docker run -it lbry/android-base:latest /bin/bash
|
||||
```
|
||||
|
||||
**Protip:** You can also make use of Docker to run your builds on macOS or Windows.
|
||||
**Pro Tip:** You can also make use of Docker to run your builds on macOS or Windows.
|
||||
@@ -1,9 +1,12 @@
|
||||
# LBRY Android
|
||||
[](https://ci.lbry.tech/lbry/lbry-android/commits/master)
|
||||
[](https://github.com/lbryio/lbry-android/blob/master/LICENSE)
|
||||
|
||||
An Android browser and wallet for the [LBRY](https://lbry.com) network. This app bundles [lbrynet-daemon](https://github.com/lbryio/lbry) as a background service with a UI layer built with React Native. The APK is built using buildozer and the Gradle build tool.
|
||||
|
||||
<img src="https://spee.ch/8/lbry-android.png" alt="LBRY Android Screenshot" width="384px" />
|
||||
|
||||
<img src="https://spee.ch/@lbry:3f/android-08-homepage.gif" alt="LBRY Android GIF" width="384px" />
|
||||
|
||||
|
||||
## Installation
|
||||
The minimum supported Android version is 5.0 Lollipop. There are two ways to install:
|
||||
|
||||
+1
-1
Submodule app updated: 5d86b68a3e...a127e14a0f.
@@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py
|
||||
|
||||
# (list) Application requirements
|
||||
# comma seperated e.g. requirements = sqlite3,kivy
|
||||
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.40.1#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.40.1#egg=torba&subdirectory=torba"
|
||||
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=torba&subdirectory=torba"
|
||||
|
||||
# (str) Custom source folders for requirements
|
||||
# Sets custom source for any requirements with recipes
|
||||
@@ -148,7 +148,7 @@ android.react_src = ./app
|
||||
|
||||
# (list) Gradle dependencies to add (currently works only with sdl2_gradle
|
||||
# bootstrap)
|
||||
android.gradle_dependencies = com.android.support:support-v4:28.0.0, com.android.support:support-media-compat:28.0.0, com.android.support:appcompat-v7:28.0.0, com.facebook.react:react-native:0.59.10, com.google.android.gms:play-services-gcm:11.0.4+, com.facebook.fresco:fresco:1.9.0, com.facebook.fresco:animated-gif:1.9.0, com.squareup.picasso:picasso:2.71828, com.google.firebase:firebase-core:16.0.1, com.google.android.gms:play-services-base:16.1.0, com.android.support:exifinterface:28.0.0, com.facebook.fresco:animated-base-support:1.3.0, com.facebook.fresco:animated-gif:1.10.0
|
||||
android.gradle_dependencies = com.android.support:support-v4:28.0.0, com.android.support:support-media-compat:28.0.0, com.android.support:appcompat-v7:28.0.0, com.facebook.react:react-native:0.59.10, com.google.android.gms:play-services-gcm:11.0.4+, com.facebook.fresco:fresco:1.9.0, com.facebook.fresco:animated-gif:1.9.0, com.squareup.picasso:picasso:2.71828, com.google.firebase:firebase-core:16.0.1, com.google.android.gms:play-services-base:16.1.0, com.android.support:exifinterface:28.0.0, com.facebook.fresco:animated-base-support:1.3.0, com.facebook.fresco:animated-gif:1.10.0, com.google.firebase:firebase-messaging:18.0.0
|
||||
|
||||
# (str) python-for-android branch to use, defaults to master
|
||||
#p4a.branch = stable
|
||||
|
||||
@@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py
|
||||
|
||||
# (list) Application requirements
|
||||
# comma seperated e.g. requirements = sqlite3,kivy
|
||||
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.40.1#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.40.1#egg=torba&subdirectory=torba"
|
||||
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=torba&subdirectory=torba"
|
||||
|
||||
# (str) Custom source folders for requirements
|
||||
# Sets custom source for any requirements with recipes
|
||||
@@ -148,7 +148,7 @@ android.react_src = ./app
|
||||
|
||||
# (list) Gradle dependencies to add (currently works only with sdl2_gradle
|
||||
# bootstrap)
|
||||
android.gradle_dependencies = com.android.support:support-v4:28.0.0, com.android.support:support-media-compat:28.0.0, com.android.support:appcompat-v7:28.0.0, com.facebook.react:react-native:0.59.10, com.google.android.gms:play-services-gcm:11.0.4+, com.facebook.fresco:fresco:1.9.0, com.facebook.fresco:animated-gif:1.9.0, com.squareup.picasso:picasso:2.71828, com.google.firebase:firebase-core:16.0.1, com.google.android.gms:play-services-base:16.1.0, com.android.support:exifinterface:28.0.0, com.facebook.fresco:animated-base-support:1.3.0, com.facebook.fresco:animated-gif:1.10.0
|
||||
android.gradle_dependencies = com.android.support:support-v4:28.0.0, com.android.support:support-media-compat:28.0.0, com.android.support:appcompat-v7:28.0.0, com.facebook.react:react-native:0.59.10, com.google.android.gms:play-services-gcm:11.0.4+, com.facebook.fresco:fresco:1.9.0, com.facebook.fresco:animated-gif:1.9.0, com.squareup.picasso:picasso:2.71828, com.google.firebase:firebase-core:16.0.1, com.google.android.gms:play-services-base:16.1.0, com.android.support:exifinterface:28.0.0, com.facebook.fresco:animated-base-support:1.3.0, com.facebook.fresco:animated-gif:1.10.0, com.google.firebase:firebase-messaging:18.0.0
|
||||
|
||||
# (str) python-for-android branch to use, defaults to master
|
||||
#p4a.branch = stable
|
||||
|
||||
@@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py
|
||||
|
||||
# (list) Application requirements
|
||||
# comma seperated e.g. requirements = sqlite3,kivy
|
||||
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.40.1#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.40.1#egg=torba&subdirectory=torba"
|
||||
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=torba&subdirectory=torba"
|
||||
|
||||
# (str) Custom source folders for requirements
|
||||
# Sets custom source for any requirements with recipes
|
||||
@@ -148,7 +148,7 @@ android.react_src = ./app
|
||||
|
||||
# (list) Gradle dependencies to add (currently works only with sdl2_gradle
|
||||
# bootstrap)
|
||||
android.gradle_dependencies = com.android.support:support-v4:28.0.0, com.android.support:support-media-compat:28.0.0, com.android.support:appcompat-v7:28.0.0, com.facebook.react:react-native:0.59.10, com.google.android.gms:play-services-gcm:11.0.4+, com.facebook.fresco:fresco:1.9.0, com.facebook.fresco:animated-gif:1.9.0, com.squareup.picasso:picasso:2.71828, com.google.firebase:firebase-core:16.0.1, com.google.android.gms:play-services-base:16.1.0, com.android.support:exifinterface:28.0.0, com.facebook.fresco:animated-base-support:1.3.0, com.facebook.fresco:animated-gif:1.10.0
|
||||
android.gradle_dependencies = com.android.support:support-v4:28.0.0, com.android.support:support-media-compat:28.0.0, com.android.support:appcompat-v7:28.0.0, com.facebook.react:react-native:0.59.10, com.google.android.gms:play-services-gcm:11.0.4+, com.facebook.fresco:fresco:1.9.0, com.facebook.fresco:animated-gif:1.9.0, com.squareup.picasso:picasso:2.71828, com.google.firebase:firebase-core:16.0.1, com.google.android.gms:play-services-base:16.1.0, com.android.support:exifinterface:28.0.0, com.facebook.fresco:animated-base-support:1.3.0, com.facebook.fresco:animated-gif:1.10.0, com.google.firebase:firebase-messaging:18.0.0
|
||||
|
||||
# (str) python-for-android branch to use, defaults to master
|
||||
#p4a.branch = stable
|
||||
|
||||
@@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py
|
||||
|
||||
# (list) Application requirements
|
||||
# comma seperated e.g. requirements = sqlite3,kivy
|
||||
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, git+https://github.com/lbryio/aioupnp.git@a404269d91cff5358bcffb8067b0fd1d9c6842d3#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.38.3#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.38.3#egg=torba&subdirectory=torba"
|
||||
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=torba&subdirectory=torba"
|
||||
|
||||
# (str) Custom source folders for requirements
|
||||
# Sets custom source for any requirements with recipes
|
||||
@@ -148,7 +148,7 @@ android.react_src = ./app
|
||||
|
||||
# (list) Gradle dependencies to add (currently works only with sdl2_gradle
|
||||
# bootstrap)
|
||||
android.gradle_dependencies = com.android.support:support-v4:28.0.0, com.android.support:support-media-compat:28.0.0, com.android.support:appcompat-v7:28.0.0, com.facebook.react:react-native:0.59.10, com.google.android.gms:play-services-gcm:11.0.4+, com.facebook.fresco:fresco:1.9.0, com.facebook.fresco:animated-gif:1.9.0, com.squareup.picasso:picasso:2.71828, com.google.firebase:firebase-core:16.0.1, com.google.android.gms:play-services-base:16.1.0, com.android.support:exifinterface:28.0.0, com.facebook.fresco:animated-base-support:1.3.0, com.facebook.fresco:animated-gif:1.10.0
|
||||
android.gradle_dependencies = com.android.support:support-v4:28.0.0, com.android.support:support-media-compat:28.0.0, com.android.support:appcompat-v7:28.0.0, com.facebook.react:react-native:0.59.10, com.google.android.gms:play-services-gcm:11.0.4+, com.facebook.fresco:fresco:1.9.0, com.facebook.fresco:animated-gif:1.9.0, com.squareup.picasso:picasso:2.71828, com.google.firebase:firebase-core:16.0.1, com.google.android.gms:play-services-base:16.1.0, com.android.support:exifinterface:28.0.0, com.facebook.fresco:animated-base-support:1.3.0, com.facebook.fresco:animated-gif:1.10.0, com.google.firebase:firebase-messaging:18.0.0
|
||||
|
||||
# (str) python-for-android branch to use, defaults to master
|
||||
#p4a.branch = stable
|
||||
@@ -272,4 +272,4 @@ warn_on_root = 1
|
||||
# Then, invoke the command line with the "demo" profile:
|
||||
#
|
||||
#buildozer --profile demo android debug
|
||||
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.40.1#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.40.1#egg=torba&subdirectory=torba"
|
||||
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.43.3#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.3#egg=torba&subdirectory=torba"
|
||||
@@ -58,6 +58,16 @@
|
||||
android:hardwareAccelerated="true"
|
||||
android:usesCleartextTraffic="true">
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.firebase.messaging.default_notification_icon"
|
||||
android:resource="@drawable/ic_lbry" />
|
||||
<meta-data
|
||||
android:name="com.google.firebase.messaging.default_notification_color"
|
||||
android:resource="@color/lbryGreen" />
|
||||
<meta-data
|
||||
android:name="com.google.firebase.messaging.default_notification_channel_id"
|
||||
android:value="@string/default_notification_channel_id"/>
|
||||
|
||||
{% for m in args.meta_data %}
|
||||
<meta-data android:name="{{ m.split('=', 1)[0] }}" android:value="{{ m.split('=', 1)[-1] }}"/>{% endfor %}
|
||||
<meta-data android:name="wakelock" android:value="{% if args.wakelock %}1{% else %}0{% endif %}"/>
|
||||
@@ -131,6 +141,14 @@
|
||||
<service android:name="{{ args.package }}.LbrynetTestRunnerService"
|
||||
android:process=":service_lbrynet_testrunner" />
|
||||
|
||||
<service
|
||||
android:name="{{ args.package }}.LbrynetMessagingService"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
{% if args.billing_pubkey %}
|
||||
<service android:name="org.kivy.android.billing.BillingReceiver"
|
||||
android:process=":pythonbilling" />
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
<string name="private_version">{{ private_version }}</string>
|
||||
<string name="presplash_color">{{ args.presplash_color }}</string>
|
||||
<string name="urlScheme">{{ url_scheme }}</string>
|
||||
|
||||
<string name="default_notification_channel_id">io.lbry.browser.LBRY_ENGAGEMENT_CHANNEL</string>
|
||||
|
||||
<string name="running">Running</string>
|
||||
<string name="service_status">Service Status</string>
|
||||
<string name="stopped">Stopped</string>
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
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.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.firebase.messaging.FirebaseMessagingService;
|
||||
import com.google.firebase.messaging.RemoteMessage;
|
||||
|
||||
import io.lbry.browser.reactmodules.UtilityModule;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class LbrynetMessagingService extends FirebaseMessagingService {
|
||||
|
||||
private static final String TAG = "LbrynetMessagingService";
|
||||
|
||||
private static final String NOTIFICATION_CHANNEL_ID = "io.lbry.browser.LBRY_ENGAGEMENT_CHANNEL";
|
||||
|
||||
private static final String TYPE_SUBSCRIPTION = "subscription";
|
||||
|
||||
private static final String TYPE_REWARD = "reward";
|
||||
|
||||
private static final String TYPE_INTERESTS = "interests";
|
||||
|
||||
private static final String TYPE_CREATOR = "creator";
|
||||
|
||||
@Override
|
||||
public void onMessageReceived(RemoteMessage remoteMessage) {
|
||||
Log.d(TAG, "From: " + remoteMessage.getFrom());
|
||||
|
||||
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");
|
||||
if (type != null && getEnabledTypes().indexOf(type) > -1 && body != null && body.trim().length() > 0) {
|
||||
Log.d(TAG, "Message Notification Body: " + body);
|
||||
sendNotification(title, body, type, url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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) {
|
||||
//Intent intent = new Intent(this, MainActivity.class);
|
||||
//intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
if (url == null) {
|
||||
if (TYPE_REWARD.equals(type)) {
|
||||
url = "lbry://?rewards";
|
||||
} else {
|
||||
// default to home page
|
||||
url = "lbry://?discover";
|
||||
}
|
||||
}
|
||||
|
||||
Intent launchIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
launchIntent.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;
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,7 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
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;
|
||||
|
||||
private BroadcastReceiver notificationsReceiver;
|
||||
@@ -297,7 +297,7 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
};
|
||||
registerReceiver(smsReceiver, smsFilter);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (requestCode == OVERLAY_PERMISSION_REQ_CODE) {
|
||||
@@ -307,7 +307,7 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (requestCode == DOCUMENT_PICKER_RESULT_CODE) {
|
||||
ReactContext reactContext = mReactInstanceManager.getCurrentReactContext();
|
||||
if (reactContext != null) {
|
||||
@@ -637,7 +637,7 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* https://gist.github.com/HBiSoft/15899990b8cd0723c3a894c1636550a8
|
||||
*/
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.lbry.browser;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.security.KeyPairGeneratorSpec;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
@@ -25,6 +26,8 @@ import java.security.Key;
|
||||
import java.security.KeyPairGenerator;
|
||||
import java.security.KeyStore;
|
||||
import java.security.NoSuchProviderException;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.PublicKey;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
@@ -40,7 +43,7 @@ import org.json.JSONObject;
|
||||
import org.json.JSONException;
|
||||
|
||||
public final class Utils {
|
||||
|
||||
|
||||
private static final String TAG = Utils.class.getName();
|
||||
|
||||
private static final String AES_MODE = "AES/ECB/PKCS7Padding";
|
||||
@@ -56,9 +59,9 @@ public final class Utils {
|
||||
private static final String SP_ENCRYPTION_KEY = "key";
|
||||
|
||||
private static final String SP_API_SECRET_KEY = "api_secret";
|
||||
|
||||
|
||||
public static final String SDK_URL = "http://127.0.0.1:5279";
|
||||
|
||||
|
||||
public static String getAndroidRelease() {
|
||||
return android.os.Build.VERSION.RELEASE;
|
||||
}
|
||||
@@ -153,6 +156,7 @@ public final class Utils {
|
||||
try {
|
||||
SharedPreferences pref = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
|
||||
String encryptedValue = pref.getString(key, null);
|
||||
|
||||
if (encryptedValue == null || encryptedValue.trim().length() == 0) {
|
||||
return null;
|
||||
}
|
||||
@@ -255,11 +259,11 @@ public final class Utils {
|
||||
|
||||
return ks;
|
||||
}
|
||||
|
||||
|
||||
public static String performRequest(String url) throws ConnectException {
|
||||
return performRequest(url, "GET", null);
|
||||
}
|
||||
|
||||
|
||||
public static String performRequest(String requestUrl, String requestMethod, String json) throws ConnectException {
|
||||
BufferedReader reader = null;
|
||||
DataOutputStream dos = null;
|
||||
@@ -275,14 +279,14 @@ public final class Utils {
|
||||
conn.setDoOutput(true);
|
||||
conn.setRequestProperty("Content-type", "application/json");
|
||||
}
|
||||
|
||||
|
||||
if (json != null) {
|
||||
dos = new DataOutputStream(conn.getOutputStream());
|
||||
dos.writeBytes(json);
|
||||
dos.flush();
|
||||
dos.close();
|
||||
}
|
||||
|
||||
|
||||
if (conn.getResponseCode() == 200) {
|
||||
reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@@ -325,7 +329,7 @@ public final class Utils {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static String sdkCall(String method) throws ConnectException {
|
||||
return sdkCall(method, null);
|
||||
}
|
||||
@@ -341,7 +345,7 @@ public final class Utils {
|
||||
}
|
||||
request.put("params", requestParams);
|
||||
}
|
||||
|
||||
|
||||
return performRequest(SDK_URL, "POST", request.toString());
|
||||
} catch (ConnectException ex) {
|
||||
// sdk not started yet. rethrow
|
||||
@@ -356,11 +360,24 @@ public final class Utils {
|
||||
}
|
||||
|
||||
private static byte[] rsaEncrypt(byte[] secret, KeyStore keyStore) throws Exception {
|
||||
KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) keyStore.getEntry(KEY_ALIAS, null);
|
||||
PrivateKey privateKey = null;
|
||||
PublicKey publicKey = null;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
privateKey = (PrivateKey) keyStore.getKey(KEY_ALIAS, null);
|
||||
publicKey = keyStore.getCertificate(KEY_ALIAS).getPublicKey();
|
||||
} else {
|
||||
KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) keyStore.getEntry(KEY_ALIAS, null);
|
||||
privateKey = privateKeyEntry.getPrivateKey();
|
||||
publicKey = privateKeyEntry.getCertificate().getPublicKey();
|
||||
}
|
||||
|
||||
if (publicKey == null) {
|
||||
throw new Exception("Could not obtain public key for encryption.");
|
||||
}
|
||||
|
||||
// Encrypt the text
|
||||
Cipher inputCipher = Cipher.getInstance(RSA_MODE);
|
||||
inputCipher.init(Cipher.ENCRYPT_MODE, privateKeyEntry.getCertificate().getPublicKey());
|
||||
inputCipher.init(Cipher.ENCRYPT_MODE, publicKey);
|
||||
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
CipherOutputStream cipherOutputStream = new CipherOutputStream(outputStream, inputCipher);
|
||||
@@ -371,9 +388,20 @@ public final class Utils {
|
||||
}
|
||||
|
||||
private static byte[] rsaDecrypt(byte[] encrypted, KeyStore keyStore) throws Exception {
|
||||
KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) keyStore.getEntry(KEY_ALIAS, null);
|
||||
PrivateKey privateKey = null;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
privateKey = (PrivateKey) keyStore.getKey(KEY_ALIAS, null);
|
||||
} else {
|
||||
KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) keyStore.getEntry(KEY_ALIAS, null);
|
||||
privateKey = privateKeyEntry.getPrivateKey();
|
||||
}
|
||||
|
||||
if (privateKey == null) {
|
||||
throw new Exception("Could not obtain private key for decryption");
|
||||
}
|
||||
|
||||
Cipher output = Cipher.getInstance(RSA_MODE);
|
||||
output.init(Cipher.DECRYPT_MODE, privateKeyEntry.getPrivateKey());
|
||||
output.init(Cipher.DECRYPT_MODE, privateKey);
|
||||
CipherInputStream cipherInputStream = new CipherInputStream(new ByteArrayInputStream(encrypted), output);
|
||||
ArrayList<Byte> values = new ArrayList<Byte>();
|
||||
int nextByte;
|
||||
@@ -412,14 +440,14 @@ public final class Utils {
|
||||
}
|
||||
return new SecretKeySpec(rsaDecrypt(Base64.decode(base64Key, Base64.DEFAULT), keyStore), "AES");
|
||||
}
|
||||
|
||||
|
||||
public static String capitalizeAndStrip(String text) {
|
||||
String[] parts = text.split(" ");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < parts.length; i++) {
|
||||
sb.append(parts[i].substring(0, 1).toUpperCase()).append(parts[i].substring(1));
|
||||
}
|
||||
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,10 @@ 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;
|
||||
@@ -37,7 +41,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 +54,7 @@ public class FirebaseModule extends ReactContextBaseJavaModule {
|
||||
}
|
||||
promise.resolve(true);
|
||||
}
|
||||
|
||||
|
||||
@ReactMethod
|
||||
public void track(String name, ReadableMap payload) {
|
||||
Bundle bundle = new Bundle();
|
||||
@@ -86,4 +90,22 @@ 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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,15 @@ public class UtilityModule extends ReactContextBaseJavaModule {
|
||||
|
||||
public static final String ACTION_NOTIFICATION_LATER = "io.lbry.browser.ACTION_NOTIFICATION_LATER";
|
||||
|
||||
public static final String RECEIVE_SUBSCRIPTION_NOTIFICATIONS = "receiveSubscriptionNotifications";
|
||||
|
||||
public static final String RECEIVE_REWARD_NOTIFICATIONS = "receiveRewardNotifications";
|
||||
|
||||
public static final String RECEIVE_INTERESTS_NOTIFICATIONS = "receiveInterestsNotifications";
|
||||
|
||||
public static final String RECEIVE_CREATOR_NOTIFICATIONS = "receiveCreatorNotifications";
|
||||
|
||||
|
||||
private Context context;
|
||||
|
||||
private KeyStore keyStore;
|
||||
@@ -208,6 +217,18 @@ public class UtilityModule extends ReactContextBaseJavaModule {
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void shareUrl(String url) {
|
||||
Intent shareIntent = new Intent();
|
||||
shareIntent.setAction(Intent.ACTION_SEND);
|
||||
shareIntent.setType("text/plain");
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, url);
|
||||
|
||||
Intent shareUrlIntent = Intent.createChooser(shareIntent, "Share LBRY content");
|
||||
shareUrlIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(shareUrlIntent);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void showNotificationForContent(final String uri, String title, String publisher, final String thumbnail, boolean isPlayable) {
|
||||
final NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
@@ -354,7 +375,7 @@ public class UtilityModule extends ReactContextBaseJavaModule {
|
||||
context.sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ReactMethod
|
||||
public void openDocumentPicker(String type) {
|
||||
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
||||
@@ -365,4 +386,31 @@ public class UtilityModule extends ReactContextBaseJavaModule {
|
||||
Intent.createChooser(intent, "Select a file"), MainActivity.DOCUMENT_PICKER_RESULT_CODE);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void setNativeBooleanSetting(String key, boolean value) {
|
||||
if (context != null) {
|
||||
SharedPreferences sp = context.getSharedPreferences(MainActivity.SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sp.edit();
|
||||
editor.putBoolean(key, value);
|
||||
editor.commit();
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void getNotificationLaunchTarget(Promise promise) {
|
||||
Activity activity = MainActivity.getActivity();
|
||||
if (activity != null) {
|
||||
Intent intent = activity.getIntent();
|
||||
if (intent != null) {
|
||||
String target = intent.getStringExtra("target");
|
||||
if (target != null && target.trim().length() > 0) {
|
||||
promise.resolve(target);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
promise.resolve(null);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
__version__ = "0.9.1"
|
||||
__version__ = "0.11.0"
|
||||
|
||||
class ServiceApp(App):
|
||||
def build(self):
|
||||
|
||||
Reference in new issue
Block a user