Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd2d20af94 | ||
|
|
51065d1b57 | ||
|
|
6a60ce07e9 | ||
|
|
7c8f9a6662 | ||
|
|
ed61f470f7 | ||
|
|
a89d8ac229 | ||
|
|
3c8e7d13e0 | ||
|
|
7d2e4c1e8c | ||
|
|
4fbf90654e | ||
|
|
077af85181 | ||
|
|
1b77a8dd8b | ||
|
|
28071a10b5 | ||
|
|
1a6e3bf214 | ||
|
|
16db19fac7 | ||
|
|
c533e7832b | ||
|
|
0cd33ddada | ||
|
|
140d405aa9 | ||
|
|
ceeef6324e | ||
|
|
f850be1eca | ||
|
|
28c5b01596 | ||
|
|
59f5b5ede3 | ||
|
|
8db8083e32 | ||
|
|
a2c3f36065 | ||
|
|
0483e67026 | ||
|
|
872fafbb50 | ||
|
|
4d57d72980 | ||
|
|
77f5d5cf05 | ||
|
|
5e6dfb18f7 | ||
|
|
fe8b7ec5b3 | ||
|
|
f6503dc367 | ||
|
|
491782a88e | ||
|
|
13fb52478f | ||
|
|
15125159bb | ||
|
|
614069e342 | ||
|
|
48350ff175 | ||
|
|
3d3f1e0ff0 | ||
|
|
6abf511ef4 | ||
|
|
fffa136b3f | ||
|
|
8c4c554a1c | ||
|
|
5c1e542dab | ||
|
|
766290a2a3 | ||
|
|
3706bc5936 | ||
|
|
351e39826b | ||
|
|
808217d41e | ||
|
|
1c8f75ec88 | ||
|
|
296f8b2363 | ||
|
|
4960b9e2ec | ||
|
|
3bba3c5689 | ||
|
|
297b2e0826 | ||
|
|
9ed8a67c5c | ||
|
|
b8ad99b2a1 | ||
|
|
68cec1659a | ||
|
|
a7264e506a | ||
|
|
90d17604fc | ||
|
|
77a86da984 | ||
|
|
41becae272 | ||
|
|
21640e4264 | ||
|
|
1366dc0996 | ||
|
|
c6129ffc31 | ||
|
|
d018e9b577 | ||
|
|
496ec53f8a | ||
|
|
b9e0065aad | ||
|
|
a4798c3cf9 | ||
|
|
7a335515f6 | ||
|
|
a8457a748a | ||
|
|
bb7fa61c33 | ||
|
|
5d8d832e99 | ||
|
|
0bb215a803 | ||
|
|
173920d9eb | ||
|
|
1fb5ce87ea | ||
|
|
43deedd994 | ||
|
|
2d72afe1f0 |
No files matched your search
+77
-39
@@ -1,39 +1,77 @@
|
||||
sudo: required
|
||||
dist: trusty
|
||||
language: python
|
||||
python:
|
||||
- "2.7"
|
||||
install:
|
||||
- deactivate
|
||||
- export PATH=/usr/bin:$PATH
|
||||
- sudo dpkg --add-architecture i386
|
||||
- sudo apt-get -qq update
|
||||
- sudo apt-get -qq install 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 npm nodejs
|
||||
- sudo pip install --upgrade cython==0.25.2 pip setuptools
|
||||
- git clone https://github.com/akinwale/buildozer.git
|
||||
- cd app
|
||||
- npm config set registry="http://registry.npmjs.org/"
|
||||
- npm install --silent --save react@16.2.0 react-native@0.52.0 react-native-video@2.0.0
|
||||
- cd ..
|
||||
- cd buildozer
|
||||
- sudo python setup.py install
|
||||
- cd ..
|
||||
- mv buildozer.spec.travis buildozer.spec
|
||||
- mkdir -p cd ~/.buildozer/android/platform/
|
||||
- wget 'https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip' -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/android-23_r02.zip' -P ~/.buildozer/android/platform/
|
||||
- wget 'https://dl.google.com/android/repository/build-tools_r26.0.1-linux.zip' -P ~/.buildozer/android/platform/
|
||||
- unzip -qq ~/.buildozer/android/platform/android-ndk-r13b-linux-x86_64.zip -d ~/.buildozer/android/platform/
|
||||
- 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/android-23_r02.zip -d ~/.buildozer/android/platform/android-sdk-23/platforms
|
||||
- mv ~/.buildozer/android/platform/android-sdk-23/platforms/android-6.0 ~/.buildozer/android/platform/android-sdk-23/platforms/android-23
|
||||
- mkdir -p ~/.buildozer/android/platform/android-sdk-23/build-tools
|
||||
- unzip -qq ~/.buildozer/android/platform/build-tools_r26.0.1-linux.zip -d ~/.buildozer/android/platform/android-sdk-23/build-tools
|
||||
- mv ~/.buildozer/android/platform/android-sdk-23/build-tools/android-8.0.0 ~/.buildozer/android/platform/android-sdk-23/build-tools/26.0.1
|
||||
- mkdir -p ~/.buildozer/android/platform/android-sdk-23/licenses
|
||||
- echo $'\nd56f5187479451eabf01fb78af6dfcb131a6481e' > ~/.buildozer/android/platform/android-sdk-23/licenses/android-sdk-license
|
||||
script:
|
||||
- ./build.sh | grep -Fv -e 'working:' -e 'copy' --line-buffered
|
||||
- cp bin/*.apk /dev/null
|
||||
sudo: required
|
||||
dist: trusty
|
||||
language: python
|
||||
python:
|
||||
- '2.7'
|
||||
install:
|
||||
- deactivate
|
||||
- export PATH=/usr/bin:$PATH
|
||||
- sudo dpkg --add-architecture i386
|
||||
- sudo apt-get -qq update
|
||||
- sudo apt-get -qq install 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
|
||||
- sudo pip install --upgrade cython==0.25.2 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://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip' -P ~/.buildozer/android/platform/
|
||||
- wget -q 'https://dl.google.com/android/android-sdk_r23-linux.tgz' -P ~/.buildozer/android/platform/
|
||||
- wget -q 'https://dl.google.com/android/repository/android-23_r02.zip' -P ~/.buildozer/android/platform/
|
||||
- wget -q 'https://dl.google.com/android/repository/build-tools_r26.0.1-linux.zip' -P ~/.buildozer/android/platform/
|
||||
- unzip -qq ~/.buildozer/android/platform/android-ndk-r13b-linux-x86_64.zip -d ~/.buildozer/android/platform/
|
||||
- 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/android-23_r02.zip -d ~/.buildozer/android/platform/android-sdk-23/platforms
|
||||
- mv ~/.buildozer/android/platform/android-sdk-23/platforms/android-6.0 ~/.buildozer/android/platform/android-sdk-23/platforms/android-23
|
||||
- mkdir -p ~/.buildozer/android/platform/android-sdk-23/build-tools
|
||||
- unzip -qq ~/.buildozer/android/platform/build-tools_r26.0.1-linux.zip -d ~/.buildozer/android/platform/android-sdk-23/build-tools
|
||||
- mv ~/.buildozer/android/platform/android-sdk-23/build-tools/android-8.0.0 ~/.buildozer/android/platform/android-sdk-23/build-tools/26.0.1
|
||||
- mkdir -p ~/.buildozer/android/platform/android-sdk-23/licenses
|
||||
- echo $'\nd56f5187479451eabf01fb78af6dfcb131a6481e' > ~/.buildozer/android/platform/android-sdk-23/licenses/android-sdk-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
|
||||
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
|
||||
@@ -0,0 +1,76 @@
|
||||
## 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.
|
||||
|
||||
### Install Prerequisites
|
||||
|
||||
#### Requirements
|
||||
* JDK 1.8
|
||||
* Android SDK
|
||||
* Android NDK
|
||||
* Buildozer
|
||||
* Node.js
|
||||
* npm
|
||||
|
||||
#### Apt Packages
|
||||
Based on the quickstart instructions at http://buildozer.readthedocs.io/en/latest/installation.html
|
||||
```
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt-get update
|
||||
sudo apt-get install 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
|
||||
```
|
||||
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
|
||||
```
|
||||
sudo pip install --upgrade cython==0.25.2 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
|
||||
sudo python2.7 setup.py install
|
||||
```
|
||||
|
||||
#### 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 (eg. browser) |
|
||||
| package.domain | package domain (eg. 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 (13b has been tested to result in a successful build) |
|
||||
| android.ndk_path | Android NDK path. buildozer will automatically download this if not set |
|
||||
| android.sdk_path | Android SDK path. buildozer will automatically download this if not set |
|
||||
| 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 |
|
||||
|
||||
#### Build and Deploy
|
||||
Run `npm i` in the `lbry-android/app` folder to install the necessary modules required by the React Native user interface.
|
||||
|
||||
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 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,75 +1,28 @@
|
||||
# LBRY Android
|
||||
[](https://travis-ci.org/lbryio/lbry-android)
|
||||
## 64-bit Ubuntu 16.04 LTS build instructions
|
||||
|
||||
### Install Prerequisites
|
||||
An Android browser and wallet for the [LBRY](https://lbry.io) 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.
|
||||
|
||||
#### Requirements
|
||||
* JDK 1.8
|
||||
* Android SDK
|
||||
* Android NDK
|
||||
* Buildozer
|
||||
## Installation
|
||||
The minimum supported Android version is 5.0 Lollipop. There are two ways to install:
|
||||
|
||||
#### Apt Packages
|
||||
Based on the quickstart instructions at http://buildozer.readthedocs.io/en/latest/installation.html
|
||||
```
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt-get update
|
||||
sudo apt-get install 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
|
||||
```
|
||||
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.
|
||||
1. Via the Google Play Store. While in alpha, it will not show in the Play Store unless you sign up [here](https://lbry.io/android-alpha).
|
||||
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.
|
||||
|
||||
**Additional package for building libgmp**
|
||||
```
|
||||
sudo apt-get install m4
|
||||
```
|
||||
## Usage
|
||||
The app can be launched by opening **LBRY Browser** from the device's app drawer or via the shortcut on the homescreen if that was created upon install.
|
||||
|
||||
**Additional package for the pycrypto recipe**
|
||||
## 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.
|
||||
|
||||
This had to be installed due to an error regarding the `<gnu/stubs.h>` include not found.
|
||||
```
|
||||
sudo apt-get install libc6-dev-i386
|
||||
```
|
||||
## Contributing
|
||||
Contributions to this project are welcome, encouraged, and compensated. For more details, see https://lbry.io/faq/contributing
|
||||
|
||||
## License
|
||||
This project is MIT licensed. For the full license, see [LICENSE](LICENSE).
|
||||
|
||||
#### Install Cython
|
||||
```
|
||||
sudo pip install --upgrade cython==0.25.2
|
||||
```
|
||||
## Security
|
||||
We take security seriously. Please contact security@lbry.io regarding any security issues. Our PGP key is [here](https://keybase.io/lbry/key.asc) if you need it.
|
||||
|
||||
#### Install buildozer
|
||||
```
|
||||
git clone https://github.com/kivy/buildozer.git
|
||||
cd buildozer
|
||||
sudo python2.7 setup.py install
|
||||
```
|
||||
|
||||
#### Create buildozer.spec
|
||||
Assuming `lbrydroid` 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. Basic recommended settings are outlined below.
|
||||
|
||||
|
||||
| Setting | Description |
|
||||
|:------------------- |:-----------------------------|
|
||||
| title | application title |
|
||||
| package.name | package name (eg. lbrynet) |
|
||||
| package.domain | package domain (eg. io.lbry) |
|
||||
| source.dir | the location of the application main.py |
|
||||
| version | application version |
|
||||
| requirements | the 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 (21 and 24 have been tested to result in a successful build) |
|
||||
| android.sdk | Android SDK version (21 and 24 have been tested to result in a successful build) |
|
||||
| android.ndk | Android NDK version (13b has been tested to result in a successful build) |
|
||||
| android.ndk_path | Android NDK path. buildozer will automatically download this if not set |
|
||||
| android.sdk_path | Android SDK path. buildozer will automatically download this if not set |
|
||||
| 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 |
|
||||
|
||||
#### Build and deploy the APK
|
||||
Run `buildozer android debug` to build a debug APK, or `buildozer android release` to build a release APK.
|
||||
|
||||
To deploy and run the APK on a connected Android device, you can run `buildozer android debug deploy run`.
|
||||
|
||||
Run `buildozer android clean` to clean the package if you intend to rebuild.
|
||||
## Contact
|
||||
The primary contact for this project is [@akinwale](https://github.com/akinwale) (akinwale@lbry.io)
|
||||
Generated
+3186
-6936
File diff suppressed because it is too large.
Load diff
+11
-5
@@ -3,16 +3,17 @@
|
||||
"version": "0.0.1",
|
||||
"private": "true",
|
||||
"scripts": {
|
||||
"start": "node node_modules/react-native/local-cli/cli.js start",
|
||||
"postinstall": "cp ./patch/ReactNativeRenderer-dev.js.patch ./node_modules/react-native/Libraries/Renderer/ReactNativeRenderer-dev.js; rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json"
|
||||
"start": "node node_modules/react-native/local-cli/cli.js start"
|
||||
},
|
||||
"dependencies": {
|
||||
"lbry-redux": "lbryio/lbry-redux#common-components-refactor",
|
||||
"lbry-redux": "lbryio/lbry-redux",
|
||||
"moment": "^2.22.1",
|
||||
"react": "16.2.0",
|
||||
"react-native": "0.52.0",
|
||||
"react-native": "0.55.3",
|
||||
"react-native-image-zoom-viewer": "^2.2.5",
|
||||
"react-native-vector-icons": "^4.5.0",
|
||||
"react-native-video": "2.0.0",
|
||||
"react-navigation": "^1.0.3",
|
||||
"react-navigation": "^1.5.12",
|
||||
"react-navigation-redux-helpers": "^1.0.1",
|
||||
"react-redux": "^5.0.3",
|
||||
"redux": "^3.6.0",
|
||||
@@ -21,5 +22,10 @@
|
||||
"redux-persist-transform-compress": "^4.2.0",
|
||||
"redux-persist-transform-filter": "0.0.10",
|
||||
"redux-thunk": "^2.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"babel-preset-stage-2": "^6.18.0",
|
||||
"flow-babel-webpack-plugin": "^1.1.1"
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -1,9 +1,12 @@
|
||||
import React from 'react';
|
||||
import AboutPage from '../page/about';
|
||||
import DiscoverPage from '../page/discover';
|
||||
import FilePage from '../page/file';
|
||||
import SearchPage from '../page/search';
|
||||
import SettingsPage from '../page/settings';
|
||||
import SplashScreen from '../page/splash';
|
||||
import TransactionHistoryPage from '../page/transactionHistory';
|
||||
import WalletPage from '../page/wallet';
|
||||
import SearchInput from '../component/searchInput';
|
||||
import {
|
||||
addNavigationHelpers,
|
||||
@@ -13,12 +16,21 @@ import {
|
||||
} from 'react-navigation';
|
||||
import { connect } from 'react-redux';
|
||||
import { addListener } from '../utils/redux';
|
||||
import { AppState, BackHandler, NativeModules, TextInput } from 'react-native';
|
||||
import { SETTINGS } from 'lbry-redux';
|
||||
import {
|
||||
AppState,
|
||||
AsyncStorage,
|
||||
BackHandler,
|
||||
Linking,
|
||||
NativeModules,
|
||||
TextInput,
|
||||
ToastAndroid
|
||||
} from 'react-native';
|
||||
import { SETTINGS, doHideNotification, selectNotification } from 'lbry-redux';
|
||||
import { makeSelectClientSetting } from '../redux/selectors/settings';
|
||||
import Feather from 'react-native-vector-icons/Feather';
|
||||
import discoverStyle from '../styles/discover';
|
||||
import searchStyle from '../styles/search';
|
||||
import SearchRightHeaderIcon from "../component/searchRightHeaderIcon";
|
||||
|
||||
const discoverStack = StackNavigator({
|
||||
Discover: {
|
||||
@@ -26,7 +38,6 @@ const discoverStack = StackNavigator({
|
||||
navigationOptions: ({ navigation }) => ({
|
||||
title: 'Discover',
|
||||
headerLeft: <Feather name="menu" size={24} style={discoverStyle.drawerHamburger} onPress={() => navigation.navigate('DrawerOpen')} />,
|
||||
headerRight: <Feather name="search" size={24} style={discoverStyle.rightHeaderIcon} onPress={() => navigation.navigate('Search')} />
|
||||
})
|
||||
},
|
||||
File: {
|
||||
@@ -39,20 +50,37 @@ const discoverStack = StackNavigator({
|
||||
Search: {
|
||||
screen: SearchPage,
|
||||
navigationOptions: ({ navigation }) => ({
|
||||
headerTitle: <SearchInput style={searchStyle.searchInput} />,
|
||||
headerRight: <Feather name="x" size={24} style={discoverStyle.rightHeaderIcon} onPress={() => navigation.dispatch(NavigationActions.back())} />
|
||||
drawerLockMode: 'locked-closed'
|
||||
})
|
||||
}
|
||||
}, {
|
||||
headerMode: 'screen',
|
||||
});
|
||||
|
||||
const drawer = DrawerNavigator({
|
||||
Discover: { screen: discoverStack },
|
||||
Settings: {
|
||||
screen: SettingsPage,
|
||||
headerMode: 'screen'
|
||||
const walletStack = StackNavigator({
|
||||
Wallet: {
|
||||
screen: WalletPage,
|
||||
navigationOptions: ({ navigation }) => ({
|
||||
title: 'Wallet',
|
||||
headerLeft: <Feather name="menu" size={24} style={discoverStyle.drawerHamburger} onPress={() => navigation.navigate('DrawerOpen')} />,
|
||||
})
|
||||
},
|
||||
TransactionHistory: {
|
||||
screen: TransactionHistoryPage,
|
||||
navigationOptions: {
|
||||
title: 'Transaction History',
|
||||
drawerLockMode: 'locked-closed'
|
||||
}
|
||||
}
|
||||
}, {
|
||||
headerMode: 'screen'
|
||||
});
|
||||
|
||||
const drawer = DrawerNavigator({
|
||||
DiscoverStack: { screen: discoverStack },
|
||||
WalletStack: { screen: walletStack },
|
||||
Settings: { screen: SettingsPage, navigationOptions: { drawerLockMode: 'locked-closed' } },
|
||||
About: { screen: AboutPage, navigationOptions: { drawerLockMode: 'locked-closed' } }
|
||||
}, {
|
||||
drawerWidth: 300,
|
||||
headerMode: 'none'
|
||||
@@ -73,34 +101,90 @@ export const AppNavigator = new StackNavigator({
|
||||
});
|
||||
|
||||
class AppWithNavigationState extends React.Component {
|
||||
static supportedDisplayTypes = ['toast'];
|
||||
|
||||
componentWillMount() {
|
||||
AppState.addEventListener('change', this._handleAppStateChange);
|
||||
BackHandler.addEventListener('hardwareBackPress', function() {
|
||||
const { dispatch, navigation, nav } = this.props;
|
||||
if (nav.routes.length === 2 && nav.routes[1].routeName === 'Main') {
|
||||
if (nav.routes[1].routes[0].routes[0].index > 0) {
|
||||
dispatch({ type: 'Navigation/BACK' });
|
||||
const { dispatch, nav } = this.props;
|
||||
// There should be a better way to check this
|
||||
if (nav.routes.length > 0) {
|
||||
const subRoutes = nav.routes[0].routes[0].routes;
|
||||
const lastRoute = subRoutes[subRoutes.length - 1];
|
||||
if (nav.routes[0].routes[0].index > 0 &&
|
||||
['About', 'Settings'].indexOf(lastRoute.key) > -1) {
|
||||
dispatch(NavigationActions.back());
|
||||
return true;
|
||||
}
|
||||
if (nav.routes[0].routeName === 'Main') {
|
||||
if (nav.routes[0].routes[0].routes[0].index > 0) {
|
||||
dispatch(NavigationActions.back());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
Linking.addEventListener('url', this._handleUrl);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
AppState.removeEventListener('change', this._handleAppStateChange);
|
||||
BackHandler.removeEventListener('hardwareBackPress');
|
||||
Linking.removeEventListener('url', this._handleUrl);
|
||||
}
|
||||
|
||||
_handleAppStateChange = (nextAppState) => {
|
||||
const { keepDaemonRunning } = this.props;
|
||||
if (AppState.currentState &&
|
||||
AppState.currentState.match(/inactive|background/) &&
|
||||
NativeModules.DaemonServiceControl) {
|
||||
if (!keepDaemonRunning) {
|
||||
// terminate the daemon background service when is suspended / inactive
|
||||
NativeModules.DaemonServiceControl.stopService();
|
||||
|
||||
componentWillUpdate(nextProps) {
|
||||
const { dispatch } = this.props;
|
||||
const { notification } = nextProps;
|
||||
if (notification) {
|
||||
const { displayType, message } = notification;
|
||||
let currentDisplayType;
|
||||
if (displayType.length) {
|
||||
for (let i = 0; i < displayType.length; i++) {
|
||||
const type = displayType[i];
|
||||
if (AppWithNavigationState.supportedDisplayTypes.indexOf(type) > -1) {
|
||||
currentDisplayType = type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (AppWithNavigationState.supportedDisplayTypes.indexOf(displayType) > -1) {
|
||||
currentDisplayType = displayType;
|
||||
}
|
||||
|
||||
if ('toast' === currentDisplayType) {
|
||||
ToastAndroid.show(message, ToastAndroid.SHORT);
|
||||
}
|
||||
|
||||
dispatch(doHideNotification());
|
||||
}
|
||||
}
|
||||
|
||||
_handleAppStateChange = (nextAppState) => {
|
||||
// Check if the app was suspended
|
||||
if (AppState.currentState && AppState.currentState.match(/inactive|background/)) {
|
||||
AsyncStorage.getItem('firstLaunchTime').then(start => {
|
||||
if (start !== null && !isNaN(parseInt(start, 10))) {
|
||||
// App suspended during first launch?
|
||||
// If so, this needs to be included as a property when tracking
|
||||
AsyncStorage.setItem('firstLaunchSuspended', 'true');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
_handleUrl = (evt) => {
|
||||
const { dispatch } = this.props;
|
||||
if (evt.url) {
|
||||
const navigateAction = NavigationActions.navigate({
|
||||
routeName: 'File',
|
||||
key: 'filePage',
|
||||
params: { uri: evt.url }
|
||||
});
|
||||
dispatch(navigateAction);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,8 +204,9 @@ class AppWithNavigationState extends React.Component {
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
nav: state.nav,
|
||||
notification: selectNotification(state),
|
||||
keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state),
|
||||
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_NSFW)(state)
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps)(AppWithNavigationState);
|
||||
export default connect(mapStateToProps)(AppWithNavigationState);
|
||||
@@ -0,0 +1,7 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doNotify } from 'lbry-redux';
|
||||
import Address from './view';
|
||||
|
||||
export default connect(null, {
|
||||
doNotify,
|
||||
})(Address);
|
||||
@@ -0,0 +1,29 @@
|
||||
// @flow
|
||||
import * as React from 'react';
|
||||
import { Clipboard, Text, View } from 'react-native';
|
||||
import Button from '../button';
|
||||
import walletStyle from '../../styles/wallet';
|
||||
|
||||
type Props = {
|
||||
address: string,
|
||||
doNotify: ({ message: string, displayType: Array<string> }) => void,
|
||||
};
|
||||
|
||||
export default class Address extends React.PureComponent<Props> {
|
||||
render() {
|
||||
const { address, doNotify, style } = this.props;
|
||||
|
||||
return (
|
||||
<View style={[walletStyle.row, style]}>
|
||||
<Text selectable={true} numberOfLines={1} style={walletStyle.address}>{address || ''}</Text>
|
||||
<Button icon={'clipboard'} style={walletStyle.button} onPress={() => {
|
||||
Clipboard.setString(address);
|
||||
doNotify({
|
||||
message: 'Address copied',
|
||||
displayType: ['toast'],
|
||||
});
|
||||
}} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { connect } from 'react-redux';
|
||||
import Button from './view';
|
||||
|
||||
export default connect(null, null)(Button);
|
||||
@@ -0,0 +1,41 @@
|
||||
import React from 'react';
|
||||
import { Text, TouchableOpacity } from 'react-native';
|
||||
import buttonStyle from '../../styles/button';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome';
|
||||
|
||||
export default class Button extends React.PureComponent {
|
||||
render() {
|
||||
const {
|
||||
disabled,
|
||||
style,
|
||||
text,
|
||||
icon,
|
||||
onPress
|
||||
} = this.props;
|
||||
|
||||
let styles = [buttonStyle.button, buttonStyle.row];
|
||||
if (style) {
|
||||
if (style.length) {
|
||||
styles = styles.concat(style);
|
||||
} else {
|
||||
styles.push(style);
|
||||
}
|
||||
}
|
||||
|
||||
if (disabled) {
|
||||
styles.push(buttonStyle.disabled);
|
||||
}
|
||||
|
||||
const textStyles = [buttonStyle.text];
|
||||
if (icon && icon.trim().length > 0) {
|
||||
textStyles.push(buttonStyle.textWithIcon);
|
||||
}
|
||||
|
||||
return (
|
||||
<TouchableOpacity disabled={disabled} style={styles} onPress={onPress}>
|
||||
{icon && <Icon name={icon} size={18} color='#ffffff' class={buttonStyle.icon} /> }
|
||||
{text && (text.trim().length > 0) && <Text style={textStyles}>{text}</Text>}
|
||||
</TouchableOpacity>
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import FeaturedCategory from './view';
|
||||
|
||||
const select = state => ({});
|
||||
const perform = dispatch => ({});
|
||||
|
||||
export default connect(select, perform)(FeaturedCategory);
|
||||
@@ -1,27 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Text, View } from 'react-native';
|
||||
import { normalizeURI } from 'lbry-redux';
|
||||
import FileItem from '../fileItem';
|
||||
import discoverStyle from '../../styles/discover';
|
||||
|
||||
class FeaturedCategory extends React.PureComponent {
|
||||
render() {
|
||||
const { category, names, categoryLink, navigation } = this.props;
|
||||
|
||||
return (
|
||||
<View>
|
||||
<Text style={discoverStyle.categoryName}>{category}</Text>
|
||||
{names &&
|
||||
names.map(name => (
|
||||
<FileItem
|
||||
style={discoverStyle.fileItem}
|
||||
key={name}
|
||||
uri={normalizeURI(name)}
|
||||
navigation={navigation} />
|
||||
))}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default FeaturedCategory;
|
||||
@@ -1,5 +1,6 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doFetchCostInfoForUri,
|
||||
makeSelectFileInfoForUri,
|
||||
makeSelectDownloadingForUri,
|
||||
makeSelectLoadingForUri,
|
||||
@@ -17,7 +18,8 @@ const select = (state, props) => ({
|
||||
|
||||
const perform = dispatch => ({
|
||||
purchaseUri: uri => dispatch(doPurchaseUri(uri)),
|
||||
restartDownload: (uri, outpoint) => dispatch(doStartDownload(uri, outpoint))
|
||||
restartDownload: (uri, outpoint) => dispatch(doStartDownload(uri, outpoint)),
|
||||
fetchCostInfo: uri => dispatch(doFetchCostInfoForUri(uri)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(FileDownloadButton);
|
||||
@@ -1,8 +1,15 @@
|
||||
import React from 'react';
|
||||
import { Text, View, TouchableOpacity } from 'react-native';
|
||||
import { NativeModules, Text, View, TouchableOpacity } from 'react-native';
|
||||
import fileDownloadButtonStyle from '../../styles/fileDownloadButton';
|
||||
|
||||
class FileDownloadButton extends React.PureComponent {
|
||||
componentDidMount() {
|
||||
const { costInfo, fetchCostInfo, uri } = this.props;
|
||||
if (costInfo === undefined) {
|
||||
fetchCostInfo(uri);
|
||||
}
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
//this.checkAvailability(nextProps.uri);
|
||||
this.restartDownload(nextProps);
|
||||
@@ -32,13 +39,9 @@ class FileDownloadButton extends React.PureComponent {
|
||||
loading,
|
||||
doPause,
|
||||
style,
|
||||
openFile
|
||||
} = this.props;
|
||||
|
||||
const openFile = () => {
|
||||
//openInShell(fileInfo.download_path);
|
||||
//doPause();
|
||||
};
|
||||
|
||||
if (loading || downloading) {
|
||||
const progress =
|
||||
fileInfo && fileInfo.written_bytes ? fileInfo.written_bytes / fileInfo.total_bytes * 100 : 0,
|
||||
@@ -54,12 +57,15 @@ class FileDownloadButton extends React.PureComponent {
|
||||
if (!costInfo) {
|
||||
return (
|
||||
<View style={[style, fileDownloadButtonStyle.container]}>
|
||||
<Text>Fetching cost info...</Text>
|
||||
<Text style={fileDownloadButtonStyle.text}>Fetching cost info...</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<TouchableOpacity style={[style, fileDownloadButtonStyle.container]} onPress={() => {
|
||||
if (NativeModules.Mixpanel) {
|
||||
NativeModules.Mixpanel.track('Purchase Uri', { Uri: uri });
|
||||
}
|
||||
purchaseUri(uri);
|
||||
}}>
|
||||
<Text style={fileDownloadButtonStyle.text}>Download</Text>
|
||||
@@ -67,7 +73,7 @@ class FileDownloadButton extends React.PureComponent {
|
||||
);
|
||||
} else if (fileInfo && fileInfo.download_path) {
|
||||
return (
|
||||
<TouchableOpacity style={[style, fileDownloadButtonStyle.container]} onPress={() => openFile()}>
|
||||
<TouchableOpacity style={[style, fileDownloadButtonStyle.container]} onPress={openFile}>
|
||||
<Text style={fileDownloadButtonStyle.text}>Open</Text>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { normalizeURI } from 'lbry-redux';
|
||||
import { NavigationActions } from 'react-navigation';
|
||||
import { Text, View, TouchableOpacity } from 'react-native';
|
||||
import { NativeModules, Text, View, TouchableOpacity } from 'react-native';
|
||||
import FileItemMedia from '../fileItemMedia';
|
||||
import FilePrice from '../filePrice';
|
||||
import NsfwOverlay from '../nsfwOverlay';
|
||||
@@ -58,7 +58,10 @@ class FileItem extends React.PureComponent {
|
||||
return (
|
||||
<View style={style}>
|
||||
<TouchableOpacity style={discoverStyle.container} onPress={() => {
|
||||
navigation.navigate('File', { uri: uri });
|
||||
if (NativeModules.Mixpanel) {
|
||||
NativeModules.Mixpanel.track('Discover Tap', { Uri: uri });
|
||||
}
|
||||
navigation.navigate({ routeName: 'File', key: 'filePage', params: { uri } });
|
||||
}
|
||||
}>
|
||||
<FileItemMedia title={title} thumbnail={thumbnail} blurRadius={obscureNsfw ? 15 : 0} resizeMode="cover" />
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import { connect } from 'react-redux';
|
||||
import FileList from './view';
|
||||
import { selectClaimsById } from 'lbry-redux';
|
||||
|
||||
const select = state => ({
|
||||
claimsById: selectClaimsById(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({});
|
||||
|
||||
export default connect(select, perform)(FileList);
|
||||
@@ -0,0 +1,184 @@
|
||||
// @flow
|
||||
import * as React from 'react';
|
||||
import { buildURI } from 'lbry-redux';
|
||||
import { FlatList } from 'react-native';
|
||||
import FileItem from '../fileItem';
|
||||
import discoverStyle from '../../styles/discover';
|
||||
|
||||
// In the future, all Flow types need to be specified in a common source (lbry-redux, perhaps?)
|
||||
type FileInfo = {
|
||||
name: string,
|
||||
channelName: ?string,
|
||||
pending?: boolean,
|
||||
channel_claim_id: string,
|
||||
value?: {
|
||||
publisherSignature: {
|
||||
certificateId: string,
|
||||
},
|
||||
},
|
||||
metadata: {
|
||||
publisherSignature: {
|
||||
certificateId: string,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
type Props = {
|
||||
hideFilter: boolean,
|
||||
sortByHeight?: boolean,
|
||||
claimsById: Array<{}>,
|
||||
fileInfos: Array<FileInfo>,
|
||||
checkPending?: boolean,
|
||||
};
|
||||
|
||||
type State = {
|
||||
sortBy: string,
|
||||
};
|
||||
|
||||
class FileList extends React.PureComponent<Props, State> {
|
||||
static defaultProps = {
|
||||
hideFilter: false,
|
||||
};
|
||||
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
sortBy: 'dateNew',
|
||||
};
|
||||
|
||||
(this: any).handleSortChanged = this.handleSortChanged.bind(this);
|
||||
|
||||
this.sortFunctions = {
|
||||
dateNew: fileInfos =>
|
||||
this.props.sortByHeight
|
||||
? fileInfos.slice().sort((fileInfo1, fileInfo2) => {
|
||||
if (fileInfo1.pending) {
|
||||
return -1;
|
||||
}
|
||||
const height1 = this.props.claimsById[fileInfo1.claim_id]
|
||||
? this.props.claimsById[fileInfo1.claim_id].height
|
||||
: 0;
|
||||
const height2 = this.props.claimsById[fileInfo2.claim_id]
|
||||
? this.props.claimsById[fileInfo2.claim_id].height
|
||||
: 0;
|
||||
if (height1 > height2) {
|
||||
return -1;
|
||||
} else if (height1 < height2) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
})
|
||||
: [...fileInfos].reverse(),
|
||||
dateOld: fileInfos =>
|
||||
this.props.sortByHeight
|
||||
? fileInfos.slice().sort((fileInfo1, fileInfo2) => {
|
||||
const height1 = this.props.claimsById[fileInfo1.claim_id]
|
||||
? this.props.claimsById[fileInfo1.claim_id].height
|
||||
: 999999;
|
||||
const height2 = this.props.claimsById[fileInfo2.claim_id]
|
||||
? this.props.claimsById[fileInfo2.claim_id].height
|
||||
: 999999;
|
||||
if (height1 < height2) {
|
||||
return -1;
|
||||
} else if (height1 > height2) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
})
|
||||
: fileInfos,
|
||||
title: fileInfos =>
|
||||
fileInfos.slice().sort((fileInfo1, fileInfo2) => {
|
||||
const getFileTitle = fileInfo => {
|
||||
const { value, metadata, name, claim_name: claimName } = fileInfo;
|
||||
if (metadata) {
|
||||
// downloaded claim
|
||||
return metadata.title || claimName;
|
||||
} else if (value) {
|
||||
// published claim
|
||||
const { title } = value.stream.metadata;
|
||||
return title || name;
|
||||
}
|
||||
// Invalid claim
|
||||
return '';
|
||||
};
|
||||
const title1 = getFileTitle(fileInfo1).toLowerCase();
|
||||
const title2 = getFileTitle(fileInfo2).toLowerCase();
|
||||
if (title1 < title2) {
|
||||
return -1;
|
||||
} else if (title1 > title2) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}),
|
||||
filename: fileInfos =>
|
||||
fileInfos.slice().sort(({ file_name: fileName1 }, { file_name: fileName2 }) => {
|
||||
const fileName1Lower = fileName1.toLowerCase();
|
||||
const fileName2Lower = fileName2.toLowerCase();
|
||||
if (fileName1Lower < fileName2Lower) {
|
||||
return -1;
|
||||
} else if (fileName2Lower > fileName1Lower) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
getChannelSignature = (fileInfo: FileInfo) => {
|
||||
if (fileInfo.pending) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (fileInfo.value) {
|
||||
return fileInfo.value.publisherSignature.certificateId;
|
||||
}
|
||||
return fileInfo.channel_claim_id;
|
||||
};
|
||||
|
||||
handleSortChanged(event: SyntheticInputEvent<*>) {
|
||||
this.setState({
|
||||
sortBy: event.target.value,
|
||||
});
|
||||
}
|
||||
|
||||
sortFunctions: {};
|
||||
|
||||
render() {
|
||||
const { fileInfos, hideFilter, checkPending, navigation, style } = this.props;
|
||||
const { sortBy } = this.state;
|
||||
const items = [];
|
||||
|
||||
if (!fileInfos) {
|
||||
return null;
|
||||
}
|
||||
|
||||
this.sortFunctions[sortBy](fileInfos).forEach(fileInfo => {
|
||||
const { name: claimName, claim_name: claimNameDownloaded, claim_id: claimId } = fileInfo;
|
||||
const uriParams = {};
|
||||
|
||||
// This is unfortunate
|
||||
// https://github.com/lbryio/lbry/issues/1159
|
||||
const name = claimName || claimNameDownloaded;
|
||||
uriParams.contentName = name;
|
||||
uriParams.claimId = claimId;
|
||||
const uri = buildURI(uriParams);
|
||||
|
||||
items.push(uri);
|
||||
});
|
||||
|
||||
return (
|
||||
<FlatList
|
||||
style={style}
|
||||
data={items}
|
||||
keyExtractor={(item, index) => item}
|
||||
renderItem={({item}) => (
|
||||
<FileItem style={discoverStyle.fileItem}
|
||||
uri={item}
|
||||
navigation={navigation} />
|
||||
)} />
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default FileList;
|
||||
@@ -0,0 +1,9 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doNotify } from 'lbry-redux';
|
||||
import Link from './view';
|
||||
|
||||
const perform = dispatch => ({
|
||||
notify: (data) => dispatch(doNotify(data))
|
||||
});
|
||||
|
||||
export default connect(null, perform)(Link);
|
||||
@@ -0,0 +1,38 @@
|
||||
import React from 'react';
|
||||
import { Linking, Text, TouchableOpacity } from 'react-native';
|
||||
|
||||
export default class Link extends React.PureComponent {
|
||||
handlePress = () => {
|
||||
const { error, href, navigation, notify } = this.props;
|
||||
|
||||
if (navigation && href.startsWith('#')) {
|
||||
navigation.navigate(href.substring(1));
|
||||
} else {
|
||||
Linking.openURL(href).catch(err => notify({
|
||||
message: error,
|
||||
displayType: ['toast']
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
onPress,
|
||||
style,
|
||||
text
|
||||
} = this.props;
|
||||
|
||||
let styles = [];
|
||||
if (style.length) {
|
||||
styles = styles.concat(style);
|
||||
} else {
|
||||
styles.push(style);
|
||||
}
|
||||
|
||||
return (
|
||||
<TouchableOpacity onPress={onPress ? onPress : this.handlePress}>
|
||||
<Text style={styles}>{text}</Text>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -1,7 +1,11 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { SETTINGS } from 'lbry-redux';
|
||||
import { makeSelectClientSetting } from '../../redux/selectors/settings';
|
||||
import MediaPlayer from './view';
|
||||
|
||||
const select = state => ({});
|
||||
const select = state => ({
|
||||
backgroundPlayEnabled: makeSelectClientSetting(SETTINGS.BACKGROUND_PLAY_ENABLED)(state),
|
||||
});
|
||||
const perform = dispatch => ({});
|
||||
|
||||
export default connect(select, perform)(MediaPlayer);
|
||||
@@ -1,6 +1,13 @@
|
||||
import React from 'react';
|
||||
import { Lbry } from 'lbry-redux';
|
||||
import { PanResponder, Text, View, ScrollView, TouchableOpacity } from 'react-native';
|
||||
import {
|
||||
NativeModules,
|
||||
PanResponder,
|
||||
Text,
|
||||
View,
|
||||
ScrollView,
|
||||
TouchableOpacity
|
||||
} from 'react-native';
|
||||
import Video from 'react-native-video';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome';
|
||||
import FileItemMedia from '../fileItemMedia';
|
||||
@@ -13,23 +20,30 @@ class MediaPlayer extends React.PureComponent {
|
||||
|
||||
seekerWidth = 0;
|
||||
|
||||
trackingOffset = 0;
|
||||
|
||||
tracking = null;
|
||||
|
||||
video = null;
|
||||
|
||||
state = {
|
||||
rate: 1,
|
||||
volume: 1,
|
||||
muted: false,
|
||||
resizeMode: 'stretch',
|
||||
duration: 0.0,
|
||||
currentTime: 0.0,
|
||||
paused: true,
|
||||
fullscreenMode: false,
|
||||
areControlsVisible: true,
|
||||
controlsTimeout: -1,
|
||||
seekerOffset: 0,
|
||||
seekerPosition: 0,
|
||||
firstPlay: true
|
||||
};
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
rate: 1,
|
||||
volume: 1,
|
||||
muted: false,
|
||||
resizeMode: 'stretch',
|
||||
duration: 0.0,
|
||||
currentTime: 0.0,
|
||||
paused: true,
|
||||
fullscreenMode: false,
|
||||
areControlsVisible: true,
|
||||
controlsTimeout: -1,
|
||||
seekerOffset: 0,
|
||||
seekerPosition: 0,
|
||||
firstPlay: true
|
||||
};
|
||||
}
|
||||
|
||||
formatTime(time) {
|
||||
let str = '';
|
||||
@@ -76,6 +90,10 @@ class MediaPlayer extends React.PureComponent {
|
||||
}
|
||||
|
||||
if (this.state.firstPlay) {
|
||||
if (NativeModules.Mixpanel) {
|
||||
const { uri } = this.props;
|
||||
NativeModules.Mixpanel.track('Play', { Uri: uri });
|
||||
}
|
||||
this.setState({ firstPlay: false });
|
||||
this.hidePlayerControls();
|
||||
}
|
||||
@@ -133,10 +151,11 @@ class MediaPlayer extends React.PureComponent {
|
||||
}
|
||||
|
||||
checkSeekerPosition(val = 0) {
|
||||
if (val < 0) {
|
||||
val = 0;
|
||||
} else if (val >= this.seekerWidth) {
|
||||
return this.seekerWidth;
|
||||
const offset = this.getTrackingOffset();
|
||||
if (val < offset) {
|
||||
val = offset;
|
||||
} else if (val >= (offset + this.seekerWidth)) {
|
||||
return offset + this.seekerWidth;
|
||||
}
|
||||
|
||||
return val;
|
||||
@@ -179,11 +198,18 @@ class MediaPlayer extends React.PureComponent {
|
||||
});
|
||||
}
|
||||
|
||||
getTrackingOffset() {
|
||||
return this.state.fullscreenMode ? this.trackingOffset : 0;
|
||||
}
|
||||
|
||||
getCurrentTimeForSeekerPosition() {
|
||||
return this.state.duration * (this.state.seekerPosition / this.seekerWidth);
|
||||
}
|
||||
|
||||
calculateSeekerPosition() {
|
||||
if (this.state.fullscreenMode) {
|
||||
return this.getTrackingOffset() + (this.seekerWidth * this.getCurrentTimePercentage());
|
||||
}
|
||||
return this.seekerWidth * this.getCurrentTimePercentage();
|
||||
}
|
||||
|
||||
@@ -198,6 +224,10 @@ class MediaPlayer extends React.PureComponent {
|
||||
this.initSeeker();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.clearControlsTimeout();
|
||||
this.setState({ paused: true, fullscreenMode: false });
|
||||
@@ -232,16 +262,27 @@ class MediaPlayer extends React.PureComponent {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { fileInfo, title, thumbnail, style, fullScreenStyle } = this.props;
|
||||
const { backgroundPlayEnabled, fileInfo, thumbnail, style } = this.props;
|
||||
const flexCompleted = this.getCurrentTimePercentage() * 100;
|
||||
const flexRemaining = (1 - this.getCurrentTimePercentage()) * 100;
|
||||
let styles = [this.state.fullscreenMode ? mediaPlayerStyle.fullscreenContainer : mediaPlayerStyle.container];
|
||||
if (style) {
|
||||
if (style.length) {
|
||||
styles = styles.concat(style);
|
||||
} else {
|
||||
styles.push(style);
|
||||
}
|
||||
}
|
||||
|
||||
const trackingStyle = [mediaPlayerStyle.trackingControls, this.state.fullscreenMode ?
|
||||
mediaPlayerStyle.fullscreenTrackingControls : mediaPlayerStyle.containedTrackingControls];
|
||||
|
||||
return (
|
||||
<View style={[style, mediaPlayerStyle.container]}>
|
||||
<View style={styles}>
|
||||
<Video source={{ uri: 'file:///' + fileInfo.download_path }}
|
||||
ref={(ref: Video) => { this.video = ref }}
|
||||
resizeMode={this.state.resizeMode}
|
||||
playInBackground={true}
|
||||
playInBackground={backgroundPlayEnabled}
|
||||
style={mediaPlayerStyle.player}
|
||||
rate={this.state.rate}
|
||||
volume={this.state.volume}
|
||||
@@ -255,12 +296,16 @@ class MediaPlayer extends React.PureComponent {
|
||||
{this.renderPlayerControls()}
|
||||
</TouchableOpacity>
|
||||
|
||||
<View style={mediaPlayerStyle.trackingControls}>
|
||||
<View style={mediaPlayerStyle.progress} onLayout={(evt) => this.seekerWidth = evt.nativeEvent.layout.width}>
|
||||
{(!this.state.fullscreenMode || (this.state.fullscreenMode && this.state.areControlsVisible)) &&
|
||||
<View style={trackingStyle} onLayout={(evt) => {
|
||||
this.trackingOffset = evt.nativeEvent.layout.x;
|
||||
this.seekerWidth = evt.nativeEvent.layout.width;
|
||||
}}>
|
||||
<View style={mediaPlayerStyle.progress}>
|
||||
<View style={[mediaPlayerStyle.innerProgressCompleted, { flex: flexCompleted }]} />
|
||||
<View style={[mediaPlayerStyle.innerProgressRemaining, { flex: flexRemaining }]} />
|
||||
</View>
|
||||
</View>
|
||||
</View>}
|
||||
|
||||
{this.state.areControlsVisible &&
|
||||
<View style={[mediaPlayerStyle.seekerHandle, { left: this.state.seekerPosition }]} { ...this.seekResponder.panHandlers }>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import { connect } from 'react-redux';
|
||||
import PageHeader from './view';
|
||||
|
||||
const perform = dispatch => ({});
|
||||
|
||||
export default connect(null, perform)(PageHeader);
|
||||
@@ -0,0 +1,47 @@
|
||||
// Based on https://github.com/react-navigation/react-navigation/blob/master/src/views/Header/Header.js
|
||||
import React from 'react';
|
||||
import {
|
||||
Animated,
|
||||
Platform,
|
||||
StyleSheet,
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
View
|
||||
} from 'react-native';
|
||||
import Feather from 'react-native-vector-icons/Feather';
|
||||
import pageHeaderStyle from '../../styles/pageHeader';
|
||||
|
||||
const APPBAR_HEIGHT = Platform.OS === 'ios' ? 44 : 56;
|
||||
const AnimatedText = Animated.Text;
|
||||
|
||||
class PageHeader extends React.PureComponent {
|
||||
render() {
|
||||
const { title, onBackPressed } = this.props;
|
||||
const containerStyles = [
|
||||
pageHeaderStyle.container,
|
||||
{ height: APPBAR_HEIGHT }
|
||||
];
|
||||
|
||||
return (
|
||||
<View style={containerStyles}>
|
||||
<View style={pageHeaderStyle.flexOne}>
|
||||
<View style={pageHeaderStyle.header}>
|
||||
<View style={pageHeaderStyle.title}>
|
||||
<AnimatedText
|
||||
numberOfLines={1}
|
||||
style={pageHeaderStyle.titleText}
|
||||
accessibilityTraits="header">
|
||||
{title}
|
||||
</AnimatedText>
|
||||
</View>
|
||||
<TouchableOpacity style={pageHeaderStyle.left}>
|
||||
<Feather name="arrow-left" size={24} onPress={onBackPressed} style={pageHeaderStyle.backIcon} />
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default PageHeader;
|
||||
@@ -1,9 +1,15 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { NativeModules } from 'react-native';
|
||||
import { doSearch, doUpdateSearchQuery } from 'lbry-redux';
|
||||
import SearchInput from './view';
|
||||
|
||||
const perform = dispatch => ({
|
||||
search: search => dispatch(doSearch(search)),
|
||||
search: search => {
|
||||
if (NativeModules.Mixpanel) {
|
||||
NativeModules.Mixpanel.track('Search', { Query: search });
|
||||
}
|
||||
return dispatch(doSearch(search));
|
||||
},
|
||||
updateSearchQuery: query => dispatch(doUpdateSearchQuery(query, false))
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import { connect } from 'react-redux';
|
||||
import SearchRightHeaderIcon from './view';
|
||||
import { ACTIONS } from 'lbry-redux';
|
||||
const perform = dispatch => ({
|
||||
clearQuery: () => dispatch({
|
||||
type: ACTIONS.HISTORY_NAVIGATE
|
||||
})
|
||||
});
|
||||
|
||||
export default connect(null, perform)(SearchRightHeaderIcon);
|
||||
@@ -0,0 +1,20 @@
|
||||
import React from 'react';
|
||||
|
||||
import { NavigationActions } from 'react-navigation';
|
||||
import Feather from "react-native-vector-icons/Feather";
|
||||
|
||||
class SearchRightHeaderIcon extends React.PureComponent {
|
||||
|
||||
clearAndGoBack() {
|
||||
const { navigation } = this.props;
|
||||
this.props.clearQuery();
|
||||
navigation.dispatch(NavigationActions.back())
|
||||
}
|
||||
|
||||
render() {
|
||||
const { style } = this.props;
|
||||
return <Feather name="x" size={24} style={style} onPress={() => this.clearAndGoBack()} />;
|
||||
}
|
||||
}
|
||||
|
||||
export default SearchRightHeaderIcon;
|
||||
@@ -0,0 +1,11 @@
|
||||
import { connect } from 'react-redux';
|
||||
//import { selectClaimedRewardsByTransactionId } from 'redux/selectors/rewards';
|
||||
import { selectAllMyClaimsByOutpoint } from 'lbry-redux';
|
||||
import TransactionList from './view';
|
||||
|
||||
const select = state => ({
|
||||
//rewards: selectClaimedRewardsByTransactionId(state),
|
||||
myClaims: selectAllMyClaimsByOutpoint(state),
|
||||
});
|
||||
|
||||
export default connect(select, null)(TransactionList);
|
||||
@@ -0,0 +1,59 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { Text, View, Linking } from 'react-native';
|
||||
import { buildURI, formatCredits } from 'lbry-redux';
|
||||
import Link from '../../link';
|
||||
import moment from 'moment';
|
||||
import transactionListStyle from '../../../styles/transactionList';
|
||||
|
||||
class TransactionListItem extends React.PureComponent {
|
||||
capitalize(string: string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { transaction, navigation } = this.props;
|
||||
const { amount, claim_id: claimId, claim_name: name, date, fee, txid, type } = transaction;
|
||||
|
||||
return (
|
||||
<View style={transactionListStyle.listItem}>
|
||||
<View style={[transactionListStyle.row, transactionListStyle.topRow]}>
|
||||
<View style={transactionListStyle.col}>
|
||||
<Text style={transactionListStyle.text}>{this.capitalize(type)}</Text>
|
||||
{name && claimId && (
|
||||
<Link
|
||||
style={transactionListStyle.link}
|
||||
onPress={() => navigation && navigation.navigate({
|
||||
routeName: 'File',
|
||||
key: 'filePage',
|
||||
params: { uri: buildURI({ claimName: name, claimId }) }})
|
||||
}
|
||||
text={name} />
|
||||
)}
|
||||
</View>
|
||||
<View style={transactionListStyle.col}>
|
||||
<Text style={[transactionListStyle.amount, transactionListStyle.text]}>{formatCredits(amount, 8)}</Text>
|
||||
{ fee !== 0 && (<Text style={[transactionListStyle.amount, transactionListStyle.text]}>fee {formatCredits(fee, 8)}</Text>) }
|
||||
</View>
|
||||
</View>
|
||||
<View style={transactionListStyle.row}>
|
||||
<View style={transactionListStyle.col}>
|
||||
<Link style={transactionListStyle.smallLink}
|
||||
text={txid.substring(0, 8)}
|
||||
href={`https://explorer.lbry.io/tx/${txid}`}
|
||||
error={'The transaction URL could not be opened'} />
|
||||
</View>
|
||||
<View style={transactionListStyle.col}>
|
||||
{date ? (
|
||||
<Text style={transactionListStyle.smallText}>{moment(date).format('MMM D')}</Text>
|
||||
) : (
|
||||
<Text style={transactionListStyle.smallText}>Pending</Text>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default TransactionListItem;
|
||||
@@ -0,0 +1,70 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { Text, View } from 'react-native';
|
||||
import TransactionListItem from './internal/transaction-list-item';
|
||||
import transactionListStyle from '../../styles/transactionList';
|
||||
|
||||
export type Transaction = {
|
||||
amount: number,
|
||||
claim_id: string,
|
||||
claim_name: string,
|
||||
fee: number,
|
||||
nout: number,
|
||||
txid: string,
|
||||
type: string,
|
||||
date: Date,
|
||||
};
|
||||
|
||||
class TransactionList extends React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
filter: 'all',
|
||||
};
|
||||
|
||||
(this: any).handleFilterChanged = this.handleFilterChanged.bind(this);
|
||||
(this: any).filterTransaction = this.filterTransaction.bind(this);
|
||||
}
|
||||
|
||||
handleFilterChanged(event: React.SyntheticInputEvent<*>) {
|
||||
this.setState({
|
||||
filter: event.target.value,
|
||||
});
|
||||
}
|
||||
|
||||
filterTransaction(transaction: Transaction) {
|
||||
const { filter } = this.state;
|
||||
|
||||
return filter === 'all' || filter === transaction.type;
|
||||
}
|
||||
|
||||
render() {
|
||||
const { emptyMessage, rewards, transactions, navigation } = this.props;
|
||||
const { filter } = this.state;
|
||||
const transactionList = transactions.filter(this.filterTransaction);
|
||||
|
||||
return (
|
||||
<View>
|
||||
{!transactionList.length && (
|
||||
<Text style={transactionListStyle.noTransactions}>{emptyMessage || 'No transactions to list.'}</Text>
|
||||
)}
|
||||
|
||||
{!!transactionList.length && (
|
||||
<View>
|
||||
{transactionList.map(t => (
|
||||
<TransactionListItem
|
||||
key={`${t.txid}:${t.nout}`}
|
||||
transaction={t}
|
||||
navigation={navigation}
|
||||
reward={rewards && rewards[t.txid]}
|
||||
/>
|
||||
))}
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default TransactionList;
|
||||
@@ -0,0 +1,20 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doFetchTransactions,
|
||||
selectRecentTransactions,
|
||||
selectHasTransactions,
|
||||
selectIsFetchingTransactions,
|
||||
} from 'lbry-redux';
|
||||
import TransactionListRecent from './view';
|
||||
|
||||
const select = state => ({
|
||||
fetchingTransactions: selectIsFetchingTransactions(state),
|
||||
transactions: selectRecentTransactions(state),
|
||||
hasTransactions: selectHasTransactions(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
fetchTransactions: () => dispatch(doFetchTransactions()),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(TransactionListRecent);
|
||||
@@ -0,0 +1,50 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
//import BusyIndicator from 'component/common/busy-indicator';
|
||||
import { Text, View } from 'react-native';
|
||||
import Button from '../button';
|
||||
import Link from '../link';
|
||||
import TransactionList from '../transactionList';
|
||||
import type { Transaction } from '../transactionList/view';
|
||||
import walletStyle from '../../styles/wallet';
|
||||
|
||||
type Props = {
|
||||
fetchTransactions: () => void,
|
||||
fetchingTransactions: boolean,
|
||||
hasTransactions: boolean,
|
||||
transactions: Array<Transaction>,
|
||||
};
|
||||
|
||||
class TransactionListRecent extends React.PureComponent<Props> {
|
||||
componentDidMount() {
|
||||
this.props.fetchTransactions();
|
||||
}
|
||||
|
||||
render() {
|
||||
const { fetchingTransactions, hasTransactions, transactions, navigation } = this.props;
|
||||
|
||||
return (
|
||||
<View style={walletStyle.transactionsCard}>
|
||||
<View style={[walletStyle.row, walletStyle.transactionsHeader]}>
|
||||
<Text style={walletStyle.transactionsTitle}>Recent Transactions</Text>
|
||||
<Link style={walletStyle.link}
|
||||
navigation={navigation}
|
||||
text={'View All'}
|
||||
href={'#TransactionHistory'} />
|
||||
</View>
|
||||
{fetchingTransactions && (
|
||||
<Text style={walletStyle.infoText}>Fetching transactions...</Text>
|
||||
)}
|
||||
{!fetchingTransactions && (
|
||||
<TransactionList
|
||||
navigation={navigation}
|
||||
transactions={transactions}
|
||||
emptyMessage={"Looks like you don't have any recent transactions."}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default TransactionListRecent;
|
||||
@@ -0,0 +1,17 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doUpdateSearchQuery, selectSearchState as selectSearch } from 'lbry-redux';
|
||||
import UriBar from './view';
|
||||
|
||||
const select = state => {
|
||||
const { ...searchState } = selectSearch(state);
|
||||
|
||||
return {
|
||||
...searchState
|
||||
};
|
||||
};
|
||||
|
||||
const perform = dispatch => ({
|
||||
updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(UriBar);
|
||||
@@ -0,0 +1,38 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { SEARCH_TYPES, normalizeURI } from 'lbry-redux';
|
||||
import { Text, TouchableOpacity, View } from 'react-native';
|
||||
import Feather from 'react-native-vector-icons/Feather';
|
||||
import uriBarStyle from '../../../styles/uriBar';
|
||||
|
||||
class UriBarItem extends React.PureComponent {
|
||||
render() {
|
||||
const { item, onPress } = this.props;
|
||||
const { type, value } = item;
|
||||
|
||||
let icon;
|
||||
switch (type) {
|
||||
case SEARCH_TYPES.CHANNEL:
|
||||
icon = <Feather name="at-sign" size={18} />
|
||||
break;
|
||||
|
||||
case SEARCH_TYPES.SEARCH:
|
||||
icon = <Feather name="search" size={18} />
|
||||
break;
|
||||
|
||||
case SEARCH_TYPES.FILE:
|
||||
default:
|
||||
icon = <Feather name="compass" size={18} />
|
||||
break;
|
||||
}
|
||||
|
||||
return (
|
||||
<TouchableOpacity style={uriBarStyle.item} onPress={onPress}>
|
||||
{icon}
|
||||
<Text style={uriBarStyle.itemText} numberOfLines={1}>{value}</Text>
|
||||
</TouchableOpacity>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default UriBarItem;
|
||||
@@ -0,0 +1,99 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { SEARCH_TYPES, isNameValid, normalizeURI } from 'lbry-redux';
|
||||
import { FlatList, Keyboard, TextInput, View } from 'react-native';
|
||||
import UriBarItem from './internal/uri-bar-item';
|
||||
import uriBarStyle from '../../styles/uriBar';
|
||||
|
||||
class UriBar extends React.PureComponent {
|
||||
static INPUT_TIMEOUT = 500;
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
changeTextTimeout: null,
|
||||
currentValue: null,
|
||||
inputText: null,
|
||||
focused: false
|
||||
};
|
||||
}
|
||||
|
||||
handleChangeText = text => {
|
||||
const newValue = text ? text : '';
|
||||
clearTimeout(this.state.changeTextTimeout);
|
||||
const { updateSearchQuery } = this.props;
|
||||
|
||||
let timeout = setTimeout(() => {
|
||||
updateSearchQuery(text);
|
||||
}, UriBar.INPUT_TIMEOUT);
|
||||
this.setState({ inputText: newValue, currentValue: newValue, changeTextTimeout: timeout });
|
||||
}
|
||||
|
||||
handleItemPress = (item) => {
|
||||
const { navigation, updateSearchQuery } = this.props;
|
||||
const { type, value } = item;
|
||||
|
||||
Keyboard.dismiss();
|
||||
|
||||
if (SEARCH_TYPES.SEARCH === type) {
|
||||
navigation.navigate({ routeName: 'Search', key: 'searchPage', params: { searchQuery: value }});
|
||||
} else {
|
||||
navigation.navigate({ routeName: 'File', key: 'filePage', params: { uri: normalizeURI(value) }});
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { navigation, suggestions, updateSearchQuery, value } = this.props;
|
||||
if (this.state.currentValue === null) {
|
||||
this.setState({ currentValue: value });
|
||||
}
|
||||
|
||||
let style = [uriBarStyle.overlay];
|
||||
if (this.state.focused) {
|
||||
style.push(uriBarStyle.inFocus);
|
||||
}
|
||||
|
||||
return (
|
||||
<View style={style}>
|
||||
{this.state.focused && (
|
||||
<View style={uriBarStyle.suggestions}>
|
||||
<FlatList style={uriBarStyle.suggestionList}
|
||||
data={suggestions}
|
||||
keyboardShouldPersistTaps={'handled'}
|
||||
keyExtractor={(item, value) => item.value}
|
||||
renderItem={({item}) => <UriBarItem item={item}
|
||||
navigation={navigation}
|
||||
onPress={() => this.handleItemPress(item)} />} />
|
||||
</View>)}
|
||||
<View style={uriBarStyle.uriContainer}>
|
||||
<TextInput style={uriBarStyle.uriText}
|
||||
selectTextOnFocus={true}
|
||||
placeholder={'Search for videos, music, games and more'}
|
||||
underlineColorAndroid={'transparent'}
|
||||
numberOfLines={1}
|
||||
clearButtonMode={'while-editing'}
|
||||
value={this.state.currentValue}
|
||||
returnKeyType={'go'}
|
||||
inlineImageLeft={'baseline_search_black_24'}
|
||||
inlineImagePadding={16}
|
||||
onFocus={() => this.setState({ focused: true })}
|
||||
onBlur={() => this.setState({ focused: false })}
|
||||
onChangeText={this.handleChangeText}
|
||||
onSubmitEditing={() => {
|
||||
if (this.state.inputText) {
|
||||
let inputText = this.state.inputText;
|
||||
if (isNameValid(inputText)) {
|
||||
navigation.navigate({ routeName: 'File', key: 'filePage', params: { uri: normalizeURI(inputText) }});
|
||||
} else {
|
||||
// Open the search page with the query populated
|
||||
navigation.navigate({ routeName: 'Search', key: 'searchPage', params: { searchQuery: inputText }});
|
||||
}
|
||||
}
|
||||
}}/>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default UriBar;
|
||||
@@ -0,0 +1,20 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doCheckAddressIsMine,
|
||||
doGetNewAddress,
|
||||
selectReceiveAddress,
|
||||
selectGettingNewAddress,
|
||||
} from 'lbry-redux';
|
||||
import WalletAddress from './view';
|
||||
|
||||
const select = state => ({
|
||||
receiveAddress: selectReceiveAddress(state),
|
||||
gettingNewAddress: selectGettingNewAddress(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
checkAddressIsMine: address => dispatch(doCheckAddressIsMine(address)),
|
||||
getNewAddress: () => dispatch(doGetNewAddress()),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(WalletAddress);
|
||||
@@ -0,0 +1,47 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { Text, View } from 'react-native';
|
||||
import Address from '../address';
|
||||
import Button from '../button';
|
||||
import walletStyle from '../../styles/wallet';
|
||||
|
||||
type Props = {
|
||||
checkAddressIsMine: string => void,
|
||||
receiveAddress: string,
|
||||
getNewAddress: () => void,
|
||||
gettingNewAddress: boolean,
|
||||
};
|
||||
|
||||
class WalletAddress extends React.PureComponent<Props> {
|
||||
componentWillMount() {
|
||||
const { checkAddressIsMine, receiveAddress, getNewAddress } = this.props;
|
||||
if (!receiveAddress) {
|
||||
getNewAddress();
|
||||
} else {
|
||||
checkAddressIsMine(receiveAddress);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { receiveAddress, getNewAddress, gettingNewAddress } = this.props;
|
||||
|
||||
return (
|
||||
<View style={walletStyle.card}>
|
||||
<Text style={walletStyle.title}>Receive Credits</Text>
|
||||
<Text style={[walletStyle.text, walletStyle.bottomMarginMedium]}>Use this wallet address to receive credits sent by another user (or yourself).</Text>
|
||||
<Address address={receiveAddress} style={walletStyle.bottomMarginSmall} />
|
||||
<Button style={[walletStyle.button, walletStyle.bottomMarginLarge]}
|
||||
icon={'refresh'}
|
||||
text={'Get New Address'}
|
||||
onPress={getNewAddress}
|
||||
disabled={gettingNewAddress}
|
||||
/>
|
||||
<Text style={walletStyle.smallText}>
|
||||
You can generate a new address at any time, and any previous addresses will continue to work. Using multiple addresses can be helpful for keeping track of incoming payments from multiple sources.
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default WalletAddress;
|
||||
@@ -0,0 +1,9 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectBalance } from 'lbry-redux';
|
||||
import WalletBalance from './view';
|
||||
|
||||
const select = state => ({
|
||||
balance: selectBalance(state),
|
||||
});
|
||||
|
||||
export default connect(select, null)(WalletBalance);
|
||||
@@ -0,0 +1,29 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { Image, Text, View } from 'react-native';
|
||||
import { formatCredits } from 'lbry-redux'
|
||||
import Address from '../address';
|
||||
import Button from '../button';
|
||||
import walletStyle from '../../styles/wallet';
|
||||
|
||||
type Props = {
|
||||
balance: number,
|
||||
};
|
||||
|
||||
class WalletBalance extends React.PureComponent<Props> {
|
||||
render() {
|
||||
const { balance } = this.props;
|
||||
return (
|
||||
<View style={walletStyle.balanceCard}>
|
||||
<Image style={walletStyle.balanceBackground} resizeMode={'cover'} source={require('../../assets/stripe.png')} />
|
||||
<Text style={walletStyle.balanceTitle}>Balance</Text>
|
||||
<Text style={walletStyle.balanceCaption}>You currently have</Text>
|
||||
<Text style={walletStyle.balance}>
|
||||
{(balance || balance === 0) && (formatCredits(balance, 2) + ' LBC')}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default WalletBalance;
|
||||
@@ -0,0 +1,22 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doNotify,
|
||||
doSendDraftTransaction,
|
||||
selectDraftTransaction,
|
||||
selectDraftTransactionError,
|
||||
selectBalance
|
||||
} from 'lbry-redux';
|
||||
import WalletSend from './view';
|
||||
|
||||
const perform = dispatch => ({
|
||||
sendToAddress: (address, amount) => dispatch(doSendDraftTransaction(address, amount)),
|
||||
notify: (data) => dispatch(doNotify(data))
|
||||
});
|
||||
|
||||
const select = state => ({
|
||||
balance: selectBalance(state),
|
||||
draftTransaction: selectDraftTransaction(state),
|
||||
transactionError: selectDraftTransactionError(state),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(WalletSend);
|
||||
@@ -0,0 +1,89 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { regexAddress } from 'lbry-redux';
|
||||
import { TextInput, Text, View } from 'react-native';
|
||||
import Button from '../button';
|
||||
import walletStyle from '../../styles/wallet';
|
||||
|
||||
type DraftTransaction = {
|
||||
address: string,
|
||||
amount: ?number, // So we can use a placeholder in the input
|
||||
};
|
||||
|
||||
type Props = {
|
||||
sendToAddress: (string, number) => void,
|
||||
balance: number,
|
||||
};
|
||||
|
||||
class WalletSend extends React.PureComponent<Props> {
|
||||
state = {
|
||||
amount: null,
|
||||
address: null
|
||||
};
|
||||
|
||||
componentWillUpdate(nextProps) {
|
||||
const { draftTransaction, transactionError } = nextProps;
|
||||
if (transactionError && transactionError.trim().length > 0) {
|
||||
this.setState({ address: draftTransaction.address, amount: draftTransaction.amount });
|
||||
}
|
||||
}
|
||||
|
||||
handleSend = () => {
|
||||
const { balance, sendToAddress, notify } = this.props;
|
||||
const { address, amount } = this.state;
|
||||
if (address && !regexAddress.test(address)) {
|
||||
notify({
|
||||
message: 'The recipient address is not a valid LBRY address.',
|
||||
displayType: ['toast']
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (amount > balance) {
|
||||
notify({
|
||||
message: 'Insufficient credits',
|
||||
displayType: ['toast']
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (amount && address) {
|
||||
sendToAddress(address, parseFloat(amount));
|
||||
this.setState({ address: null, amount: null });
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { balance } = this.props;
|
||||
const canSend = this.state.address &&
|
||||
this.state.amount > 0 &&
|
||||
this.state.address.trim().length > 0;
|
||||
|
||||
return (
|
||||
<View style={walletStyle.card}>
|
||||
<Text style={walletStyle.title}>Send Credits</Text>
|
||||
<Text style={walletStyle.text}>Amount</Text>
|
||||
<View style={[walletStyle.amountRow, walletStyle.bottomMarginMedium]}>
|
||||
<TextInput onChangeText={value => this.setState({amount: value})}
|
||||
keyboardType={'numeric'}
|
||||
value={this.state.amount}
|
||||
style={[walletStyle.input, walletStyle.amountInput]} />
|
||||
<Text style={[walletStyle.text, walletStyle.currency]}>LBC</Text>
|
||||
</View>
|
||||
<Text style={walletStyle.text}>Recipient address</Text>
|
||||
<View style={walletStyle.row}>
|
||||
<TextInput onChangeText={value => this.setState({address: value})}
|
||||
placeholder={'bbFxRyXXXXXXXXXXXZD8nE7XTLUxYnddTs'}
|
||||
value={this.state.address}
|
||||
style={[walletStyle.input, walletStyle.addressInput, walletStyle.bottomMarginMedium]} />
|
||||
<Button text={'Send'}
|
||||
style={[walletStyle.button, walletStyle.sendButton]}
|
||||
disabled={!canSend}
|
||||
onPress={this.handleSend} />
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default WalletSend;
|
||||
@@ -0,0 +1,5 @@
|
||||
const Constants = {
|
||||
SETTING_ALPHA_UNDERSTANDS_RISKS: "ALPHA_UNDERSTANDS_RISKS"
|
||||
};
|
||||
|
||||
export default Constants;
|
||||
+24
-3
@@ -1,7 +1,14 @@
|
||||
import React from 'react';
|
||||
import { Provider, connect } from 'react-redux';
|
||||
import DiscoverPage from './page/discover';
|
||||
import { AppRegistry, AppState, StyleSheet, Text, View, AsyncStorage, NativeModules } from 'react-native';
|
||||
import {
|
||||
AppRegistry,
|
||||
AppState,
|
||||
AsyncStorage,
|
||||
Text,
|
||||
View,
|
||||
NativeModules
|
||||
} from 'react-native';
|
||||
import { createStore, applyMiddleware, compose, combineReducers } from 'redux';
|
||||
import {
|
||||
StackNavigator, addNavigationHelpers
|
||||
@@ -17,10 +24,12 @@ import {
|
||||
claimsReducer,
|
||||
costInfoReducer,
|
||||
fileInfoReducer,
|
||||
notificationsReducer,
|
||||
searchReducer,
|
||||
walletReducer
|
||||
} from 'lbry-redux';
|
||||
import settingsReducer from './redux/reducers/settings';
|
||||
import moment from 'moment';
|
||||
import { reactNavigationMiddleware } from './utils/redux';
|
||||
|
||||
function isFunction(object) {
|
||||
@@ -63,6 +72,7 @@ const reducers = combineReducers({
|
||||
claims: claimsReducer,
|
||||
costInfo: costInfoReducer,
|
||||
fileInfo: fileInfoReducer,
|
||||
notifications: notificationsReducer,
|
||||
search: searchReducer,
|
||||
wallet: walletReducer,
|
||||
nav: navigatorReducer,
|
||||
@@ -88,12 +98,13 @@ const compressor = createCompressor();
|
||||
const saveClaimsFilter = createFilter('claims', ['byId', 'claimsByUri']);
|
||||
const subscriptionsFilter = createFilter('subscriptions', ['subscriptions']);
|
||||
const settingsFilter = createFilter('settings', ['clientSettings']);
|
||||
const walletFilter = createFilter('wallet', ['receiveAddress']);
|
||||
|
||||
const persistOptions = {
|
||||
whitelist: ['claims', 'subscriptions', 'settings'],
|
||||
whitelist: ['claims', 'subscriptions', 'settings', 'wallet'],
|
||||
// Order is important. Needs to be compressed last or other transforms can't
|
||||
// read the data
|
||||
transforms: [saveClaimsFilter, subscriptionsFilter, settingsFilter, compressor],
|
||||
transforms: [saveClaimsFilter, subscriptionsFilter, settingsFilter, walletFilter, compressor],
|
||||
debounce: 10000,
|
||||
storage: AsyncStorage
|
||||
};
|
||||
@@ -105,6 +116,16 @@ persistStore(store, persistOptions, err => {
|
||||
});
|
||||
|
||||
class LBRYApp extends React.Component {
|
||||
componentDidMount() {
|
||||
AsyncStorage.getItem('hasLaunched').then(value => {
|
||||
if (value == null || value !== 'true') {
|
||||
AsyncStorage.setItem('hasLaunched', 'true');
|
||||
// only set firstLaunchTime since we've determined that this is the first app launch ever
|
||||
AsyncStorage.setItem('firstLaunchTime', String(moment().unix()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Provider store={store}>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import { connect } from 'react-redux';
|
||||
import AboutPage from './view';
|
||||
|
||||
const perform = dispatch => ({});
|
||||
|
||||
export default connect(null, perform)(AboutPage);
|
||||
@@ -0,0 +1,74 @@
|
||||
import React from 'react';
|
||||
import { Lbry } from 'lbry-redux';
|
||||
import { NativeModules, Text, View, ScrollView } from 'react-native';
|
||||
import PageHeader from '../../component/pageHeader';
|
||||
import aboutStyle from '../../styles/about';
|
||||
|
||||
class AboutPage extends React.PureComponent {
|
||||
state = {
|
||||
appVersion: null,
|
||||
lbryId: null,
|
||||
versionInfo: null
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
if (NativeModules.VersionInfo) {
|
||||
NativeModules.VersionInfo.getAppVersion().then(version => {
|
||||
this.setState({appVersion: version});
|
||||
});
|
||||
}
|
||||
Lbry.version().then(info => {
|
||||
this.setState({
|
||||
versionInfo: info,
|
||||
});
|
||||
});
|
||||
Lbry.status({ session_status: true }).then(info => {
|
||||
this.setState({
|
||||
lbryId: info.lbry_id,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const loading = 'Loading...';
|
||||
const ver = this.state.versionInfo ? this.state.versionInfo : null;
|
||||
|
||||
return (
|
||||
<View>
|
||||
<PageHeader title={"About LBRY"}
|
||||
onBackPressed={() => { this.props.navigation.goBack(); }} />
|
||||
<ScrollView style={aboutStyle.scrollContainer}>
|
||||
<Text style={aboutStyle.releaseInfoTitle}>Release information</Text>
|
||||
<View style={aboutStyle.row}>
|
||||
<View style={aboutStyle.col}><Text style={aboutStyle.text}>App version</Text></View>
|
||||
<View style={aboutStyle.col}><Text selectable={true} style={aboutStyle.valueText}>{this.state.appVersion}</Text></View>
|
||||
</View>
|
||||
|
||||
<View style={aboutStyle.row}>
|
||||
<View style={aboutStyle.col}><Text style={aboutStyle.text}>Daemon (lbrynet)</Text></View>
|
||||
<View style={aboutStyle.col}><Text selectable={true} style={aboutStyle.valueText}>{ver ? ver.lbrynet_version : loading }</Text></View>
|
||||
</View>
|
||||
|
||||
<View style={aboutStyle.row}>
|
||||
<View style={aboutStyle.col}><Text style={aboutStyle.text}>Wallet (lbryum)</Text></View>
|
||||
<View style={aboutStyle.col}><Text selectable={true} style={aboutStyle.valueText}>{ver ? ver.lbryum_version : loading }</Text></View>
|
||||
</View>
|
||||
|
||||
<View style={aboutStyle.row}>
|
||||
<View style={aboutStyle.col}><Text style={aboutStyle.text}>Platform</Text></View>
|
||||
<View style={aboutStyle.col}><Text selectable={true} style={aboutStyle.valueText}>{ver ? ver.platform : loading }</Text></View>
|
||||
</View>
|
||||
|
||||
<View style={aboutStyle.row}>
|
||||
<View style={aboutStyle.col}>
|
||||
<Text style={aboutStyle.text}>Installation ID</Text>
|
||||
<Text selectable={true} style={aboutStyle.lineValueText}>{this.state.lbryId ? this.state.lbryId : loading}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</ScrollView>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default AboutPage;
|
||||
@@ -0,0 +1,22 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doFetchClaimsByChannel,
|
||||
doFetchClaimCountByChannel,
|
||||
makeSelectClaimForUri,
|
||||
makeSelectClaimsInChannelForPage,
|
||||
makeSelectFetchingChannelClaims,
|
||||
} from 'lbry-redux';
|
||||
import ChannelPage from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
claimsInChannel: makeSelectClaimsInChannelForPage(props.uri, props.page || 1)(state),
|
||||
fetching: makeSelectFetchingChannelClaims(props.uri)(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
fetchClaims: (uri, page) => dispatch(doFetchClaimsByChannel(uri, page)),
|
||||
fetchClaimCount: uri => dispatch(doFetchClaimCountByChannel(uri)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(ChannelPage);
|
||||
@@ -0,0 +1,58 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { ActivityIndicator, Text, View } from 'react-native';
|
||||
import Colors from '../../styles/colors';
|
||||
import FileList from '../../component/fileList';
|
||||
import PageHeader from '../../component/pageHeader';
|
||||
import UriBar from '../../component/uriBar';
|
||||
import channelPageStyle from '../../styles/channelPage';
|
||||
|
||||
class ChannelPage extends React.PureComponent {
|
||||
componentDidMount() {
|
||||
const { uri, page, claimsInChannel, fetchClaims, fetchClaimCount } = this.props;
|
||||
|
||||
if (!claimsInChannel || !claimsInChannel.length) {
|
||||
fetchClaims(uri, page || 1);
|
||||
fetchClaimCount(uri);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { fetching, claimsInChannel, claim, navigation, uri } = this.props;
|
||||
const { name, permanent_url: permanentUrl } = claim;
|
||||
|
||||
let contentList;
|
||||
if (fetching) {
|
||||
contentList = (
|
||||
<View style={channelPageStyle.busyContainer}>
|
||||
<ActivityIndicator size="large" color={Colors.LbryGreen} />
|
||||
<Text style={channelPageStyle.infoText}>Fetching content...</Text>
|
||||
</View>
|
||||
);
|
||||
} else {
|
||||
contentList =
|
||||
claimsInChannel && claimsInChannel.length ? (
|
||||
<FileList sortByHeight
|
||||
hideFilter
|
||||
fileInfos={claimsInChannel}
|
||||
navigation={navigation}
|
||||
style={channelPageStyle.fileList} />
|
||||
) : (
|
||||
<View style={channelPageStyle.busyContainer}>
|
||||
<Text style={channelPageStyle.infoText}>No content found.</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<View style={channelPageStyle.container}>
|
||||
<PageHeader title={name} onBackPressed={() => { this.props.navigation.goBack(); }} />
|
||||
{contentList}
|
||||
<UriBar value={uri} navigation={navigation} />
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default ChannelPage;
|
||||
@@ -1,41 +1,79 @@
|
||||
import React from 'react';
|
||||
import FeaturedCategory from '../../component/featuredCategory';
|
||||
import NavigationActions from 'react-navigation';
|
||||
import { Text, View, ScrollView } from 'react-native';
|
||||
import {
|
||||
ActivityIndicator,
|
||||
AsyncStorage,
|
||||
NativeModules,
|
||||
SectionList,
|
||||
Text,
|
||||
View
|
||||
} from 'react-native';
|
||||
import { normalizeURI } from 'lbry-redux';
|
||||
import moment from 'moment';
|
||||
import FileItem from '../../component/fileItem';
|
||||
import discoverStyle from '../../styles/discover';
|
||||
import Colors from '../../styles/colors';
|
||||
import UriBar from '../../component/uriBar';
|
||||
import Feather from 'react-native-vector-icons/Feather';
|
||||
|
||||
class DiscoverPage extends React.PureComponent {
|
||||
componentWillMount() {
|
||||
componentDidMount() {
|
||||
// Track the total time taken if this is the first launch
|
||||
AsyncStorage.getItem('firstLaunchTime').then(startTime => {
|
||||
if (startTime !== null && !isNaN(parseInt(startTime, 10))) {
|
||||
// We don't need this value anymore once we've retrieved it
|
||||
AsyncStorage.removeItem('firstLaunchTime');
|
||||
|
||||
// We know this is the first app launch because firstLaunchTime is set and it's a valid number
|
||||
const start = parseInt(startTime, 10);
|
||||
const now = moment().unix();
|
||||
const delta = now - start;
|
||||
AsyncStorage.getItem('firstLaunchSuspended').then(suspended => {
|
||||
AsyncStorage.removeItem('firstLaunchSuspended');
|
||||
const appSuspended = (suspended === 'true');
|
||||
if (NativeModules.Mixpanel) {
|
||||
NativeModules.Mixpanel.track('First Run Time', {
|
||||
'Total Seconds': delta, 'App Suspended': appSuspended
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.props.fetchFeaturedUris();
|
||||
}
|
||||
|
||||
render() {
|
||||
const { featuredUris, fetchingFeaturedUris } = this.props;
|
||||
const { featuredUris, fetchingFeaturedUris, navigation } = this.props;
|
||||
const hasContent = typeof featuredUris === 'object' && Object.keys(featuredUris).length,
|
||||
failedToLoad = !fetchingFeaturedUris && !hasContent;
|
||||
|
||||
return (
|
||||
<View style={discoverStyle.container}>
|
||||
{!hasContent && fetchingFeaturedUris && <Text style={discoverStyle.title}>Fetching content...</Text>}
|
||||
{!hasContent && fetchingFeaturedUris && (
|
||||
<View style={discoverStyle.busyContainer}>
|
||||
<ActivityIndicator size="large" color={Colors.LbryGreen} />
|
||||
<Text style={discoverStyle.title}>Fetching content...</Text>
|
||||
</View>
|
||||
)}
|
||||
{hasContent &&
|
||||
<ScrollView style={discoverStyle.scrollContainer}>
|
||||
{hasContent &&
|
||||
Object.keys(featuredUris).map(
|
||||
category =>
|
||||
featuredUris[category].length ? (
|
||||
<FeaturedCategory
|
||||
key={category}
|
||||
category={category}
|
||||
names={featuredUris[category]}
|
||||
navigation={this.props.navigation}
|
||||
/>
|
||||
) : (
|
||||
''
|
||||
)
|
||||
)}
|
||||
</ScrollView>
|
||||
<SectionList style={discoverStyle.scrollContainer}
|
||||
renderItem={ ({item, index, section}) => (
|
||||
<FileItem
|
||||
style={discoverStyle.fileItem}
|
||||
key={item}
|
||||
uri={normalizeURI(item)}
|
||||
navigation={navigation} />
|
||||
)
|
||||
}
|
||||
renderSectionHeader={
|
||||
({section: {title}}) => (<Text style={discoverStyle.categoryName}>{title}</Text>)
|
||||
}
|
||||
sections={Object.keys(featuredUris).map(category => ({ title: category, data: featuredUris[category] }))}
|
||||
keyExtractor={(item, index) => item}
|
||||
/>
|
||||
}
|
||||
<UriBar navigation={navigation} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doFetchFileInfo,
|
||||
makeSelectFileInfoForUri,
|
||||
doResolveUri,
|
||||
doFetchCostInfoForUri,
|
||||
makeSelectIsUriResolving,
|
||||
makeSelectCostInfoForUri,
|
||||
makeSelectFileInfoForUri,
|
||||
makeSelectClaimForUri,
|
||||
makeSelectContentTypeForUri,
|
||||
makeSelectMetadataForUri,
|
||||
selectRewardContentClaimIds,
|
||||
makeSelectCostInfoForUri
|
||||
selectBlackListedOutpoints,
|
||||
} from 'lbry-redux';
|
||||
import { doDeleteFile, doStopDownloadingFile } from '../../redux/actions/file';
|
||||
import FilePage from './view';
|
||||
@@ -15,7 +18,9 @@ import FilePage from './view';
|
||||
const select = (state, props) => {
|
||||
const selectProps = { uri: props.navigation.state.params.uri };
|
||||
return {
|
||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||
claim: makeSelectClaimForUri(selectProps.uri)(state),
|
||||
isResolvingUri: makeSelectIsUriResolving(selectProps.uri)(state),
|
||||
contentType: makeSelectContentTypeForUri(selectProps.uri)(state),
|
||||
costInfo: makeSelectCostInfoForUri(selectProps.uri)(state),
|
||||
metadata: makeSelectMetadataForUri(selectProps.uri)(state),
|
||||
@@ -29,6 +34,7 @@ const select = (state, props) => {
|
||||
const perform = dispatch => ({
|
||||
fetchFileInfo: uri => dispatch(doFetchFileInfo(uri)),
|
||||
fetchCostInfo: uri => dispatch(doFetchCostInfoForUri(uri)),
|
||||
resolveUri: uri => dispatch(doResolveUri(uri)),
|
||||
stopDownload: (uri, fileInfo) => dispatch(doStopDownloadingFile(uri, fileInfo)),
|
||||
deleteFile: (fileInfo, deleteFromDevice, abandonClaim) => {
|
||||
dispatch(doDeleteFile(fileInfo, deleteFromDevice, abandonClaim));
|
||||
|
||||
+156
-53
@@ -4,38 +4,66 @@ import {
|
||||
ActivityIndicator,
|
||||
Alert,
|
||||
Button,
|
||||
Text,
|
||||
View,
|
||||
NativeModules,
|
||||
ScrollView,
|
||||
StatusBar,
|
||||
StyleSheet,
|
||||
Text,
|
||||
TextInput,
|
||||
TouchableOpacity,
|
||||
NativeModules
|
||||
View,
|
||||
WebView
|
||||
} from 'react-native';
|
||||
import ImageViewer from 'react-native-image-zoom-viewer';
|
||||
import Colors from '../../styles/colors';
|
||||
import FileItemMedia from '../../component/fileItemMedia';
|
||||
import ChannelPage from '../channel';
|
||||
import FileDownloadButton from '../../component/fileDownloadButton';
|
||||
import FileItemMedia from '../../component/fileItemMedia';
|
||||
import FilePrice from '../../component/filePrice';
|
||||
import MediaPlayer from '../../component/mediaPlayer';
|
||||
import UriBar from '../../component/uriBar';
|
||||
import Video from 'react-native-video';
|
||||
import filePageStyle from '../../styles/filePage';
|
||||
|
||||
class FilePage extends React.PureComponent {
|
||||
state = {
|
||||
mediaLoaded: false,
|
||||
fullscreenMode: false
|
||||
};
|
||||
|
||||
static navigationOptions = {
|
||||
title: ''
|
||||
};
|
||||
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
mediaLoaded: false,
|
||||
fullscreenMode: false,
|
||||
showImageViewer: false,
|
||||
showWebView: false,
|
||||
imageUrls: null
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
StatusBar.setHidden(false);
|
||||
|
||||
const { isResolvingUri, resolveUri, navigation } = this.props;
|
||||
const { uri } = navigation.state.params;
|
||||
if (!isResolvingUri) resolveUri(uri);
|
||||
|
||||
this.fetchFileInfo(this.props);
|
||||
this.fetchCostInfo(this.props);
|
||||
|
||||
if (NativeModules.Mixpanel) {
|
||||
NativeModules.Mixpanel.track('Open File Page', { Uri: uri });
|
||||
}
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
this.fetchFileInfo(nextProps);
|
||||
componentDidUpdate() {
|
||||
this.fetchFileInfo(this.props);
|
||||
const { isResolvingUri, resolveUri, claim, navigation } = this.props;
|
||||
const { uri } = navigation.state.params;
|
||||
|
||||
if (!isResolvingUri && claim === undefined && uri) {
|
||||
resolveUri(uri);
|
||||
}
|
||||
}
|
||||
|
||||
fetchFileInfo(props) {
|
||||
@@ -98,6 +126,13 @@ class FilePage extends React.PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
localUriForFileInfo = (fileInfo) => {
|
||||
if (!fileInfo) {
|
||||
return null;
|
||||
}
|
||||
return 'file:///' + fileInfo.download_path;
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
claim,
|
||||
@@ -106,54 +141,122 @@ class FilePage extends React.PureComponent {
|
||||
contentType,
|
||||
tab,
|
||||
rewardedContentClaimIds,
|
||||
isResolvingUri,
|
||||
blackListedOutpoints,
|
||||
navigation
|
||||
} = this.props;
|
||||
} = this.props;
|
||||
const { uri } = navigation.state.params;
|
||||
|
||||
if (!claim || !metadata) {
|
||||
return (
|
||||
let innerContent = null;
|
||||
if ((isResolvingUri && !claim) || !claim) {
|
||||
innerContent = (
|
||||
<View style={filePageStyle.container}>
|
||||
<Text style={filePageStyle.emptyClaimText}>Empty claim or metadata info.</Text>
|
||||
{isResolvingUri &&
|
||||
<View style={filePageStyle.busyContainer}>
|
||||
<ActivityIndicator size="large" color={Colors.LbryGreen} />
|
||||
<Text style={filePageStyle.infoText}>Loading decentralized data...</Text>
|
||||
</View>}
|
||||
{claim === null && !isResolvingUri &&
|
||||
<View style={filePageStyle.container}>
|
||||
<Text style={filePageStyle.emptyClaimText}>There's nothing at this location.</Text>
|
||||
</View>
|
||||
}
|
||||
<UriBar value={uri} navigation={navigation} />
|
||||
</View>
|
||||
);
|
||||
} else if (claim && claim.name.length && claim.name[0] === '@') {
|
||||
innerContent = (
|
||||
<ChannelPage uri={uri} navigation={navigation} />
|
||||
);
|
||||
} else if (claim) {
|
||||
const completed = fileInfo && fileInfo.completed;
|
||||
const title = metadata.title;
|
||||
const isRewardContent = rewardedContentClaimIds.includes(claim.claim_id);
|
||||
const description = metadata.description ? metadata.description : null;
|
||||
const mediaType = Lbry.getMediaType(contentType);
|
||||
const isPlayable = mediaType === 'video' || mediaType === 'audio';
|
||||
const { height, channel_name: channelName, value } = claim;
|
||||
const showActions = !this.state.fullscreenMode && !this.state.showImageViewer && !this.state.showWebView &&
|
||||
(completed || (fileInfo && !fileInfo.stopped && fileInfo.written_bytes < fileInfo.total_bytes));
|
||||
const channelClaimId =
|
||||
value && value.publisherSignature && value.publisherSignature.certificateId;
|
||||
|
||||
const playerStyle = [filePageStyle.player, this.state.fullscreenMode ?
|
||||
filePageStyle.fullscreenPlayer : filePageStyle.containedPlayer];
|
||||
const playerBgStyle = [filePageStyle.playerBackground, this.state.fullscreenMode ?
|
||||
filePageStyle.fullscreenPlayerBackground : filePageStyle.containedPlayerBackground];
|
||||
// at least 2MB (or the full download) before media can be loaded
|
||||
const canLoadMedia = fileInfo &&
|
||||
(fileInfo.written_bytes >= 2097152 || fileInfo.written_bytes == fileInfo.total_bytes); // 2MB = 1024*1024*2
|
||||
const canOpen = (mediaType === 'image' || mediaType === 'text') && completed;
|
||||
const isWebViewable = mediaType === 'text';
|
||||
const localFileUri = this.localUriForFileInfo(fileInfo);
|
||||
|
||||
const openFile = () => {
|
||||
if (mediaType === 'image') {
|
||||
// use image viewer
|
||||
this.setState({
|
||||
imageUrls: [{
|
||||
url: localFileUri
|
||||
}],
|
||||
showImageViewer: true
|
||||
});
|
||||
}
|
||||
if (isWebViewable) {
|
||||
// show webview
|
||||
this.setState({
|
||||
showWebView: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
innerContent = (
|
||||
<View style={filePageStyle.pageContainer}>
|
||||
{this.state.showWebView && isWebViewable && <WebView source={{ uri: localFileUri }}
|
||||
style={filePageStyle.viewer} />}
|
||||
|
||||
{this.state.showImageViewer && <ImageViewer style={StyleSheet.flatten(filePageStyle.viewer)}
|
||||
imageUrls={this.state.imageUrls}
|
||||
renderIndicator={() => null} />}
|
||||
|
||||
{!this.state.showWebView && (
|
||||
<View style={filePageStyle.innerPageContainer}>
|
||||
<View style={filePageStyle.mediaContainer}>
|
||||
{(canOpen || (!fileInfo || (isPlayable && !canLoadMedia))) &&
|
||||
<FileItemMedia style={filePageStyle.thumbnail} title={title} thumbnail={metadata.thumbnail} />}
|
||||
{(canOpen || (isPlayable && !this.state.mediaLoaded)) && <ActivityIndicator size="large" color={Colors.LbryGreen} style={filePageStyle.loading} />}
|
||||
{((isPlayable && !completed && !canLoadMedia) || !completed || canOpen) &&
|
||||
<FileDownloadButton uri={uri} style={filePageStyle.downloadButton} openFile={openFile} />}
|
||||
{!fileInfo && <FilePrice uri={uri} style={filePageStyle.filePriceContainer} textStyle={filePageStyle.filePriceText} />}
|
||||
</View>
|
||||
{canLoadMedia && <View style={playerBgStyle} />}
|
||||
{canLoadMedia && <MediaPlayer fileInfo={fileInfo}
|
||||
uri={uri}
|
||||
style={playerStyle}
|
||||
onFullscreenToggled={this.handleFullscreenToggle}
|
||||
onMediaLoaded={() => { this.setState({ mediaLoaded: true }); }}/>}
|
||||
|
||||
{ showActions &&
|
||||
<View style={filePageStyle.actions}>
|
||||
{completed && <Button color="red" title="Delete" onPress={this.onDeletePressed} />}
|
||||
{!completed && fileInfo && !fileInfo.stopped && fileInfo.written_bytes < fileInfo.total_bytes &&
|
||||
<Button color="red" title="Stop Download" onPress={this.onStopDownloadPressed} />
|
||||
}
|
||||
</View>}
|
||||
<ScrollView style={showActions ? filePageStyle.scrollContainerActions : filePageStyle.scrollContainer}>
|
||||
<Text style={filePageStyle.title} selectable={true}>{title}</Text>
|
||||
{channelName && <Text style={filePageStyle.channelName} selectable={true}>{channelName}</Text>}
|
||||
{description && <Text style={filePageStyle.description} selectable={true}>{description}</Text>}
|
||||
</ScrollView>
|
||||
</View>
|
||||
)}
|
||||
|
||||
<UriBar value={uri} navigation={navigation} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const completed = fileInfo && fileInfo.completed;
|
||||
const title = metadata.title;
|
||||
const isRewardContent = rewardedContentClaimIds.includes(claim.claim_id);
|
||||
const description = metadata.description ? metadata.description : null;
|
||||
const mediaType = Lbry.getMediaType(contentType);
|
||||
const isPlayable = mediaType === 'video' || mediaType === 'audio';
|
||||
const { height, channel_name: channelName, value } = claim;
|
||||
const showActions = (completed || (fileInfo && !fileInfo.stopped && fileInfo.written_bytes < fileInfo.total_bytes));
|
||||
const channelClaimId =
|
||||
value && value.publisherSignature && value.publisherSignature.certificateId;
|
||||
|
||||
return (
|
||||
<View style={filePageStyle.pageContainer}>
|
||||
<View style={this.state.fullscreenMode ? filePageStyle.fullscreenMedia : filePageStyle.mediaContainer}>
|
||||
{(!fileInfo || (isPlayable && !this.state.mediaLoaded)) &&
|
||||
<FileItemMedia style={filePageStyle.thumbnail} title={title} thumbnail={metadata.thumbnail} />}
|
||||
{isPlayable && !this.state.mediaLoaded && <ActivityIndicator size="large" color={Colors.LbryGreen} style={filePageStyle.loading} />}
|
||||
{!completed && <FileDownloadButton uri={navigation.state.params.uri} style={filePageStyle.downloadButton} />}
|
||||
{fileInfo && isPlayable && <MediaPlayer fileInfo={fileInfo}
|
||||
style={filePageStyle.player}
|
||||
onFullscreenToggled={this.handleFullscreenToggle}
|
||||
onMediaLoaded={() => { this.setState({ mediaLoaded: true }); }}/>}
|
||||
</View>
|
||||
{ showActions &&
|
||||
<View style={filePageStyle.actions}>
|
||||
{completed && <Button color="red" title="Delete" onPress={this.onDeletePressed} />}
|
||||
{!completed && fileInfo && !fileInfo.stopped && fileInfo.written_bytes < fileInfo.total_bytes &&
|
||||
<Button color="red" title="Stop Download" onPress={this.onStopDownloadPressed} />
|
||||
}
|
||||
</View>}
|
||||
<ScrollView style={showActions ? filePageStyle.scrollContainerActions : filePageStyle.scrollContainer}>
|
||||
<Text style={filePageStyle.title}>{title}</Text>
|
||||
{channelName && <Text style={filePageStyle.channelName}>{channelName}</Text>}
|
||||
{description && <Text style={filePageStyle.description}>{description}</Text>}
|
||||
</ScrollView>
|
||||
</View>
|
||||
);
|
||||
return innerContent;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ const select = (state) => ({
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
search: (query) => dispatch(doSearch(query)),
|
||||
search: (query) => dispatch(doSearch(query))
|
||||
});
|
||||
|
||||
export default connect(select, perform)(SearchPage);
|
||||
@@ -8,14 +8,29 @@ import {
|
||||
View,
|
||||
ScrollView
|
||||
} from 'react-native';
|
||||
import SearchResultItem from '../../component/searchResultItem';
|
||||
import Colors from '../../styles/colors';
|
||||
import PageHeader from '../../component/pageHeader';
|
||||
import SearchResultItem from '../../component/searchResultItem';
|
||||
import UriBar from '../../component/uriBar';
|
||||
import searchStyle from '../../styles/search';
|
||||
|
||||
class SearchPage extends React.PureComponent {
|
||||
static navigationOptions = {
|
||||
title: 'Search Results'
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
const { navigation, search } = this.props;
|
||||
const { searchQuery } = navigation.state.params;
|
||||
if (searchQuery && searchQuery.trim().length > 0) {
|
||||
search(searchQuery);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { isSearching, navigation, uris } = this.props;
|
||||
|
||||
const { isSearching, navigation, uris, query } = this.props;
|
||||
const { searchQuery } = navigation.state.params;
|
||||
|
||||
return (
|
||||
<View style={searchStyle.container}>
|
||||
{!isSearching && (!uris || uris.length === 0) &&
|
||||
@@ -26,10 +41,15 @@ class SearchPage extends React.PureComponent {
|
||||
uri={uri}
|
||||
style={searchStyle.resultItem}
|
||||
navigation={navigation}
|
||||
onPress={() => {navigation.navigate('File', { uri: uri }); }}/>)
|
||||
onPress={() => navigation.navigate({
|
||||
routeName: 'File',
|
||||
key: 'filePage',
|
||||
params: { uri }})
|
||||
}/>)
|
||||
) : null }
|
||||
</ScrollView>
|
||||
{isSearching && <ActivityIndicator size="large" color={Colors.LbryGreen} style={searchStyle.loading} /> }
|
||||
<UriBar value={searchQuery} navigation={navigation} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import { makeSelectClientSetting } from '../../redux/selectors/settings';
|
||||
import SettingsPage from './view';
|
||||
|
||||
const select = state => ({
|
||||
backgroundPlayEnabled: makeSelectClientSetting(SETTINGS.BACKGROUND_PLAY_ENABLED)(state),
|
||||
keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state),
|
||||
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_NSFW)(state),
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import { SETTINGS } from 'lbry-redux';
|
||||
import { Text, View, ScrollView, Switch } from 'react-native';
|
||||
import PageHeader from '../../component/pageHeader';
|
||||
import settingsStyle from '../../styles/settings';
|
||||
|
||||
class SettingsPage extends React.PureComponent {
|
||||
@@ -10,15 +11,30 @@ class SettingsPage extends React.PureComponent {
|
||||
|
||||
render() {
|
||||
const {
|
||||
backgroundPlayEnabled,
|
||||
keepDaemonRunning,
|
||||
showNsfw,
|
||||
setClientSetting
|
||||
} = this.props;
|
||||
|
||||
|
||||
// If no true / false value set, default to true
|
||||
const actualKeepDaemonRunning = (keepDaemonRunning === undefined || keepDaemonRunning === null) ? true : keepDaemonRunning;
|
||||
|
||||
return (
|
||||
<View>
|
||||
<Text style={settingsStyle.title}>Settings</Text>
|
||||
<PageHeader title={"Settings"}
|
||||
onBackPressed={() => { this.props.navigation.goBack(); }} />
|
||||
<ScrollView style={settingsStyle.scrollContainer}>
|
||||
<View style={settingsStyle.row}>
|
||||
<View style={settingsStyle.switchText}>
|
||||
<Text style={settingsStyle.label}>Enable background media playback</Text>
|
||||
<Text style={settingsStyle.description}>Enable this option to play audio or video in the background when the app is suspended.</Text>
|
||||
</View>
|
||||
<View style={settingsStyle.switchContainer}>
|
||||
<Switch value={backgroundPlayEnabled} onValueChange={(value) => setClientSetting(SETTINGS.BACKGROUND_PLAY_ENABLED, value)} />
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View style={settingsStyle.row}>
|
||||
<View style={settingsStyle.switchText}>
|
||||
<Text style={settingsStyle.label}>Show NSFW content</Text>
|
||||
@@ -34,7 +50,7 @@ class SettingsPage extends React.PureComponent {
|
||||
<Text style={settingsStyle.description}>Enable this option for quicker app launch and to keep the synchronisation with the blockchain up to date.</Text>
|
||||
</View>
|
||||
<View style={settingsStyle.switchContainer}>
|
||||
<Switch value={keepDaemonRunning} onValueChange={(value) => setClientSetting(SETTINGS.KEEP_DAEMON_RUNNING, value)} />
|
||||
<Switch value={actualKeepDaemonRunning} onValueChange={(value) => setClientSetting(SETTINGS.KEEP_DAEMON_RUNNING, value)} />
|
||||
</View>
|
||||
</View>
|
||||
</ScrollView>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doBalanceSubscribe } from 'lbry-redux';
|
||||
import SplashScreen from './view';
|
||||
|
||||
const select = state => ({});
|
||||
const perform = dispatch => ({});
|
||||
const perform = dispatch => ({
|
||||
balanceSubscribe: () => dispatch(doBalanceSubscribe())
|
||||
});
|
||||
|
||||
export default connect(select, perform)(SplashScreen);
|
||||
export default connect(null, perform)(SplashScreen);
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import { Lbry } from 'lbry-redux';
|
||||
import { View, Text } from 'react-native';
|
||||
import { View, Text, Linking, NativeModules } from 'react-native';
|
||||
import { NavigationActions } from 'react-navigation';
|
||||
import PropTypes from 'prop-types';
|
||||
import splashStyle from '../../styles/splash';
|
||||
|
||||
@@ -15,6 +16,7 @@ class SplashScreen extends React.PureComponent {
|
||||
message: 'Connecting',
|
||||
isRunning: false,
|
||||
isLagging: false,
|
||||
launchUrl: null
|
||||
});
|
||||
}
|
||||
|
||||
@@ -40,8 +42,20 @@ class SplashScreen extends React.PureComponent {
|
||||
|
||||
Lbry.resolve({ uri: 'lbry://one' }).then(() => {
|
||||
// Leave the splash screen
|
||||
const { navigation } = this.props;
|
||||
navigation.navigate('Main');
|
||||
const { balanceSubscribe, navigation } = this.props;
|
||||
balanceSubscribe();
|
||||
|
||||
const resetAction = NavigationActions.reset({
|
||||
index: 0,
|
||||
actions: [
|
||||
NavigationActions.navigate({ routeName: 'Main'})
|
||||
]
|
||||
});
|
||||
navigation.dispatch(resetAction);
|
||||
|
||||
if (this.state.launchUrl) {
|
||||
navigation.navigate({ routeName: 'File', key: 'filePage', params: { uri: this.state.launchUrl } });
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -66,6 +80,16 @@ class SplashScreen extends React.PureComponent {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (NativeModules.Mixpanel) {
|
||||
NativeModules.Mixpanel.track('App Launch', null);
|
||||
}
|
||||
|
||||
Linking.getInitialURL().then((url) => {
|
||||
if (url) {
|
||||
this.setState({ launchUrl: url });
|
||||
}
|
||||
});
|
||||
|
||||
Lbry
|
||||
.connect()
|
||||
.then(() => {
|
||||
@@ -86,7 +110,7 @@ class SplashScreen extends React.PureComponent {
|
||||
|
||||
return (
|
||||
<View style={splashStyle.container}>
|
||||
<Text style={splashStyle.title}>Lbry.</Text>
|
||||
<Text style={splashStyle.title}>LBRY</Text>
|
||||
<Text style={splashStyle.message}>{message}</Text>
|
||||
<Text style={splashStyle.details}>{details}</Text>
|
||||
</View>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doFetchTransactions,
|
||||
selectTransactionItems,
|
||||
selectIsFetchingTransactions,
|
||||
} from 'lbry-redux';
|
||||
import TransactionHistoryPage from './view';
|
||||
|
||||
const select = state => ({
|
||||
fetchingTransactions: selectIsFetchingTransactions(state),
|
||||
transactions: selectTransactionItems(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
fetchTransactions: () => dispatch(doFetchTransactions()),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(TransactionHistoryPage);
|
||||
@@ -0,0 +1,32 @@
|
||||
import React from 'react';
|
||||
import { View, ScrollView, Text } from 'react-native';
|
||||
import TransactionList from '../../component/transactionList';
|
||||
import walletStyle from '../../styles/wallet';
|
||||
|
||||
class TransactionHistoryPage extends React.PureComponent {
|
||||
componentDidMount() {
|
||||
this.props.fetchTransactions();
|
||||
}
|
||||
|
||||
render() {
|
||||
const { fetchingTransactions, transactions, navigation } = this.props;
|
||||
|
||||
return (
|
||||
<ScrollView>
|
||||
<View style={walletStyle.historyList}>
|
||||
{fetchingTransactions && !transactions.length && (
|
||||
<Text style={walletStyle.infoText}>Loading transactions...</Text>
|
||||
)}
|
||||
{!fetchingTransactions && transactions.length === 0 && (
|
||||
<Text style={walletStyle.infoText}>No transactions to list.</Text>
|
||||
)}
|
||||
{!fetchingTransactions && transactions && (transactions.length > 0) && (
|
||||
<TransactionList navigation={navigation} transactions={transactions} />
|
||||
)}
|
||||
</View>
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default TransactionHistoryPage;
|
||||
@@ -0,0 +1,15 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doSetClientSetting } from '../../redux/actions/settings';
|
||||
import { makeSelectClientSetting } from '../../redux/selectors/settings';
|
||||
import Constants from '../../constants';
|
||||
import WalletPage from './view';
|
||||
|
||||
const select = state => ({
|
||||
understandsRisks: makeSelectClientSetting(Constants.SETTING_ALPHA_UNDERSTANDS_RISKS)(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(WalletPage);
|
||||
@@ -0,0 +1,40 @@
|
||||
import React from 'react';
|
||||
import { ScrollView, Text, View } from 'react-native';
|
||||
import TransactionListRecent from '../../component/transactionListRecent';
|
||||
import WalletAddress from '../../component/walletAddress';
|
||||
import WalletBalance from '../../component/walletBalance';
|
||||
import WalletSend from '../../component/walletSend';
|
||||
import Button from '../../component/button';
|
||||
import Constants from '../../constants';
|
||||
import walletStyle from '../../styles/wallet';
|
||||
|
||||
class WalletPage extends React.PureComponent {
|
||||
render() {
|
||||
const { understandsRisks, setClientSetting } = this.props;
|
||||
|
||||
if (!understandsRisks) {
|
||||
return (
|
||||
<View>
|
||||
<View style={walletStyle.warning}>
|
||||
<Text style={walletStyle.warningText}>
|
||||
This is alpha software. You may lose any LBC that you send to your wallet due to uninstallation, software bugs, deleted files, or malicious third-party software. You should not use this wallet as your primary wallet. If you understand the risks and you wish to continue, please click the button below.
|
||||
</Text>
|
||||
</View>
|
||||
<Button text={'I understand the risks'} style={[walletStyle.button, walletStyle.understand]}
|
||||
onPress={() => setClientSetting(Constants.SETTING_ALPHA_UNDERSTANDS_RISKS, true)}/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<ScrollView>
|
||||
<WalletBalance />
|
||||
<WalletAddress />
|
||||
<WalletSend />
|
||||
<TransactionListRecent navigation={this.props.navigation} />
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default WalletPage;
|
||||
@@ -1,12 +1,15 @@
|
||||
import {
|
||||
ACTIONS,
|
||||
Lbry,
|
||||
doNotify,
|
||||
formatCredits,
|
||||
selectBalance,
|
||||
makeSelectCostInfoForUri,
|
||||
makeSelectFileInfoForUri,
|
||||
selectTotalDownloadProgress,
|
||||
makeSelectMetadataForUri,
|
||||
selectDownloadingByOutpoint,
|
||||
} from 'lbry-redux';
|
||||
import { NativeModules } from 'react-native';
|
||||
import { Alert, NativeModules } from 'react-native';
|
||||
|
||||
const DOWNLOAD_POLL_INTERVAL = 250;
|
||||
|
||||
@@ -34,7 +37,9 @@ export function doUpdateLoadStatus(uri, outpoint) {
|
||||
},
|
||||
});
|
||||
|
||||
NativeModules.LbryDownloadManager.updateDownload(uri, fileInfo.file_name, 100, writtenBytes, totalBytes);
|
||||
if (NativeModules.LbryDownloadManager) {
|
||||
NativeModules.LbryDownloadManager.updateDownload(uri, fileInfo.file_name, 100, writtenBytes, totalBytes);
|
||||
}
|
||||
|
||||
/*const notif = new window.Notification('LBRY Download Complete', {
|
||||
body: fileInfo.metadata.stream.metadata.title,
|
||||
@@ -58,7 +63,9 @@ export function doUpdateLoadStatus(uri, outpoint) {
|
||||
},
|
||||
});
|
||||
|
||||
NativeModules.LbryDownloadManager.updateDownload(uri, fileInfo.file_name, progress, writtenBytes, totalBytes);
|
||||
if (NativeModules.LbryDownloadManager) {
|
||||
NativeModules.LbryDownloadManager.updateDownload(uri, fileInfo.file_name, progress, writtenBytes, totalBytes);
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
dispatch(doUpdateLoadStatus(uri, outpoint));
|
||||
@@ -90,7 +97,9 @@ export function doStartDownload(uri, outpoint) {
|
||||
},
|
||||
});
|
||||
|
||||
NativeModules.LbryDownloadManager.startDownload(uri, fileInfo.file_name);
|
||||
if (NativeModules.LbryDownloadManager) {
|
||||
NativeModules.LbryDownloadManager.startDownload(uri, fileInfo.file_name);
|
||||
}
|
||||
|
||||
dispatch(doUpdateLoadStatus(uri, outpoint));
|
||||
});
|
||||
@@ -114,7 +123,9 @@ export function doStopDownloadingFile(uri, fileInfo) {
|
||||
});
|
||||
});
|
||||
|
||||
NativeModules.LbryDownloadManager.stopDownload(uri, fileInfo.file_name);
|
||||
if (NativeModules.LbryDownloadManager) {
|
||||
NativeModules.LbryDownloadManager.stopDownload(uri, fileInfo.file_name);
|
||||
}
|
||||
|
||||
// Should also delete the file after the user stops downloading
|
||||
dispatch(doDeleteFile(fileInfo.outpoint, uri));
|
||||
@@ -161,8 +172,10 @@ export function doLoadVideo(uri) {
|
||||
data: { uri },
|
||||
});
|
||||
|
||||
console.log(`File timeout for uri ${uri}`);
|
||||
//dispatch(doOpenModal(MODALS.FILE_TIMEOUT, { uri }));
|
||||
dispatch(doNotify({
|
||||
message: `File timeout for uri ${uri}`,
|
||||
displayType: ['toast']
|
||||
}));
|
||||
} else {
|
||||
dispatch(doDownloadFile(uri, streamInfo));
|
||||
}
|
||||
@@ -174,12 +187,10 @@ export function doLoadVideo(uri) {
|
||||
data: { uri },
|
||||
});
|
||||
|
||||
console.log(`Failed to download ${uri}`);
|
||||
/*dispatch(
|
||||
doAlertError(
|
||||
`Failed to download ${uri}, please try again. If this problem persists, visit https://lbry.io/faq/support for support.`
|
||||
)
|
||||
);*/
|
||||
dispatch(doNotify({
|
||||
message: `Failed to download ${uri}, please try again. If this problem persists, visit https://lbry.io/faq/support for support.`,
|
||||
displayType: ['toast']
|
||||
}));
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -187,15 +198,25 @@ export function doLoadVideo(uri) {
|
||||
export function doPurchaseUri(uri, specificCostInfo) {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const balance = 0;//selectBalance(state);
|
||||
const balance = selectBalance(state);
|
||||
const fileInfo = makeSelectFileInfoForUri(uri)(state);
|
||||
const metadata = makeSelectMetadataForUri(uri)(state);
|
||||
const title = metadata ? metadata.title : uri;
|
||||
const downloadingByOutpoint = selectDownloadingByOutpoint(state);
|
||||
const alreadyDownloading = fileInfo && !!downloadingByOutpoint[fileInfo.outpoint];
|
||||
|
||||
function attemptPlay(cost, instantPurchaseMax = null) {
|
||||
if (cost > 0 && (!instantPurchaseMax || cost > instantPurchaseMax)) {
|
||||
//dispatch(doOpenModal(MODALS.AFFIRM_PURCHASE, { uri }));
|
||||
console.log('Affirm purchase...');
|
||||
// display alert
|
||||
const formattedCost = formatCredits(cost, 2);
|
||||
const unit = cost === 1 ? 'credit' : 'credits';
|
||||
Alert.alert('Confirm purchase',
|
||||
`This will purchase "${title}" for ${formattedCost} ${unit}`,
|
||||
[
|
||||
{ text: 'OK', onPress: () => dispatch(doLoadVideo(uri)) },
|
||||
{ text: 'Cancel', style: 'cancel' }
|
||||
],
|
||||
{ cancelable: true });
|
||||
} else {
|
||||
dispatch(doLoadVideo(uri));
|
||||
}
|
||||
@@ -223,15 +244,18 @@ export function doPurchaseUri(uri, specificCostInfo) {
|
||||
|
||||
if (cost > balance) {
|
||||
dispatch(doSetPlayingUri(null));
|
||||
//dispatch(doOpenModal(MODALS.INSUFFICIENT_CREDITS));
|
||||
dispatch(doNotify({
|
||||
message: 'Insufficient credits',
|
||||
displayType: ['toast']
|
||||
}));
|
||||
Promise.resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
if (cost === 0/* || !makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_ENABLED)(state)*/) {
|
||||
attemptPlay(cost);
|
||||
/*if (cost === 0 || !makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_ENABLED)(state)) {
|
||||
attemptPlay(cost);
|
||||
}
|
||||
/*} else {
|
||||
} else {
|
||||
const instantPurchaseMax = makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_MAX)(state);
|
||||
if (instantPurchaseMax.currency === 'LBC') {
|
||||
attemptPlay(cost, instantPurchaseMax.amount);
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import { StyleSheet } from 'react-native';
|
||||
|
||||
const aboutStyle = StyleSheet.create({
|
||||
scrollContainer: {
|
||||
paddingTop: 16,
|
||||
paddingBottom: 16
|
||||
},
|
||||
row: {
|
||||
marginBottom: 1,
|
||||
backgroundColor: '#f9f9f9',
|
||||
padding: 16,
|
||||
flex: 1,
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-between'
|
||||
},
|
||||
col: {
|
||||
alignSelf: 'stretch'
|
||||
},
|
||||
releaseInfoTitle: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
marginLeft: 12,
|
||||
marginRight: 12,
|
||||
marginBottom: 12,
|
||||
fontSize: 14
|
||||
},
|
||||
text: {
|
||||
fontFamily: 'Metropolis-SemiBold',
|
||||
fontSize: 15
|
||||
},
|
||||
valueText: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
textAlign: 'right',
|
||||
fontSize: 15
|
||||
},
|
||||
lineValueText: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 15
|
||||
}
|
||||
});
|
||||
|
||||
export default aboutStyle;
|
||||
@@ -0,0 +1,30 @@
|
||||
import { StyleSheet } from 'react-native';
|
||||
|
||||
const buttonStyle = StyleSheet.create({
|
||||
button: {
|
||||
borderRadius: 24,
|
||||
padding: 8,
|
||||
paddingLeft: 12,
|
||||
paddingRight: 12
|
||||
},
|
||||
disabled: {
|
||||
backgroundColor: '#999999'
|
||||
},
|
||||
row: {
|
||||
alignSelf: 'flex-start',
|
||||
flexDirection: 'row',
|
||||
},
|
||||
icon: {
|
||||
color: '#ffffff',
|
||||
},
|
||||
text: {
|
||||
color: '#ffffff',
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 14
|
||||
},
|
||||
textWithIcon: {
|
||||
marginLeft: 8
|
||||
}
|
||||
});
|
||||
|
||||
export default buttonStyle;
|
||||
@@ -0,0 +1,37 @@
|
||||
import { StyleSheet } from 'react-native';
|
||||
import Colors from './colors';
|
||||
|
||||
const channelPageStyle = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
},
|
||||
content: {
|
||||
flex: 1
|
||||
},
|
||||
fileList: {
|
||||
paddingTop: 30,
|
||||
flex: 1,
|
||||
marginBottom: 60
|
||||
},
|
||||
title: {
|
||||
color: Colors.LbryGreen,
|
||||
fontFamily: 'Metropolis-SemiBold',
|
||||
fontSize: 30,
|
||||
margin: 16
|
||||
},
|
||||
busyContainer: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
flexDirection: 'row'
|
||||
},
|
||||
infoText: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 20,
|
||||
textAlign: 'center',
|
||||
marginLeft: 10
|
||||
}
|
||||
});
|
||||
|
||||
export default channelPageStyle;
|
||||
@@ -1,6 +1,13 @@
|
||||
const Colors = {
|
||||
LbryGreen: '#40b89a'
|
||||
Black: '#000000',
|
||||
ChannelGrey: '#9b9b9b',
|
||||
DescriptionGrey: '#999999',
|
||||
LbryGreen: '#40b89a',
|
||||
LightGrey: '#cccccc',
|
||||
Orange: '#ffbb00',
|
||||
Red: '#ff0000',
|
||||
VeryLightGrey: '#f1f1f1',
|
||||
White: '#ffffff'
|
||||
};
|
||||
|
||||
export default Colors;
|
||||
|
||||
@@ -2,17 +2,23 @@ import { StyleSheet } from 'react-native';
|
||||
|
||||
const discoverStyle = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
flex: 1
|
||||
},
|
||||
scrollContainer: {
|
||||
flex: 1
|
||||
flex: 1,
|
||||
marginBottom: 60
|
||||
},
|
||||
busyContainer: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
flexDirection: 'row'
|
||||
},
|
||||
title: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 20,
|
||||
textAlign: 'center',
|
||||
margin: 10,
|
||||
marginLeft: 10
|
||||
},
|
||||
categoryName: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
|
||||
@@ -2,7 +2,7 @@ import { StyleSheet } from 'react-native';
|
||||
|
||||
const fileDownloadButtonStyle = StyleSheet.create({
|
||||
container: {
|
||||
width: 120,
|
||||
width: 160,
|
||||
height: 36,
|
||||
borderRadius: 18,
|
||||
justifyContent: 'center',
|
||||
|
||||
+74
-15
@@ -1,4 +1,5 @@
|
||||
import { StyleSheet, Dimensions } from 'react-native';
|
||||
import Colors from './colors';
|
||||
|
||||
const screenDimension = Dimensions.get('window');
|
||||
const screenWidth = screenDimension.width;
|
||||
@@ -11,10 +12,14 @@ const filePageStyle = StyleSheet.create({
|
||||
pageContainer: {
|
||||
flex: 1
|
||||
},
|
||||
innerPageContainer: {
|
||||
flex: 1,
|
||||
marginBottom: 60
|
||||
},
|
||||
mediaContainer: {
|
||||
alignItems: 'center',
|
||||
width: screenWidth,
|
||||
height: 220,
|
||||
height: 220
|
||||
},
|
||||
emptyClaimText: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
@@ -25,7 +30,7 @@ const filePageStyle = StyleSheet.create({
|
||||
},
|
||||
scrollContainer: {
|
||||
flex: 1,
|
||||
marginTop: -20,
|
||||
marginTop: -16,
|
||||
marginBottom: -4,
|
||||
paddingTop: 10
|
||||
},
|
||||
@@ -46,7 +51,7 @@ const filePageStyle = StyleSheet.create({
|
||||
marginLeft: 20,
|
||||
marginRight: 20,
|
||||
marginBottom: 20,
|
||||
color: '#9b9b9b'
|
||||
color: Colors.ChannelGrey
|
||||
},
|
||||
description: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
@@ -54,7 +59,7 @@ const filePageStyle = StyleSheet.create({
|
||||
marginLeft: 20,
|
||||
marginRight: 20,
|
||||
marginBottom: 40,
|
||||
color: '#999999'
|
||||
color: Colors.DescriptionGrey
|
||||
},
|
||||
thumbnail: {
|
||||
width: screenWidth,
|
||||
@@ -67,20 +72,53 @@ const filePageStyle = StyleSheet.create({
|
||||
top: '40%'
|
||||
},
|
||||
player: {
|
||||
flex: 1,
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
marginBottom: 14
|
||||
},
|
||||
fullscreenMedia: {
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
top: 0,
|
||||
zIndex: 101
|
||||
},
|
||||
containedPlayer: {
|
||||
width: '100%',
|
||||
height: 220,
|
||||
},
|
||||
fullscreenPlayer: {
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
flex: 1,
|
||||
backgroundColor: '#000000',
|
||||
zIndex: 100
|
||||
bottom: 0
|
||||
},
|
||||
playerBackground: {
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
top: 0,
|
||||
zIndex: 100,
|
||||
backgroundColor: Colors.Black
|
||||
},
|
||||
containedPlayerBackground: {
|
||||
width: '100%',
|
||||
height: 206,
|
||||
},
|
||||
fullscreenPlayerBackground: {
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
right: 0,
|
||||
bottom: 0
|
||||
},
|
||||
filePriceContainer: {
|
||||
backgroundColor: '#61fcd8',
|
||||
justifyContent: 'center',
|
||||
position: 'absolute',
|
||||
right: 16,
|
||||
top: 16,
|
||||
width: 56,
|
||||
height: 24,
|
||||
borderRadius: 4
|
||||
},
|
||||
filePriceText: {
|
||||
fontFamily: 'Metropolis-Bold',
|
||||
fontSize: 12,
|
||||
textAlign: 'center',
|
||||
color: '#0c604b'
|
||||
},
|
||||
actions: {
|
||||
paddingLeft: 16,
|
||||
@@ -91,12 +129,33 @@ const filePageStyle = StyleSheet.create({
|
||||
width: '50%',
|
||||
},
|
||||
deleteButton: {
|
||||
backgroundColor: '#ff0000',
|
||||
backgroundColor: Colors.Red,
|
||||
width: 80
|
||||
},
|
||||
loading: {
|
||||
position: 'absolute',
|
||||
top: '40%'
|
||||
},
|
||||
busyContainer: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
flexDirection: 'row'
|
||||
},
|
||||
infoText: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 20,
|
||||
textAlign: 'center',
|
||||
marginLeft: 10
|
||||
},
|
||||
viewer: {
|
||||
position: 'absolute',
|
||||
flex: 1,
|
||||
left: 0,
|
||||
right: 0,
|
||||
top: 0,
|
||||
bottom: 60,
|
||||
zIndex: 100
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,22 +1,29 @@
|
||||
import { StyleSheet, Dimensions } from 'react-native';
|
||||
|
||||
const screenDimension = Dimensions.get('window');
|
||||
const screenWidth = screenDimension.width;
|
||||
import { StyleSheet } from 'react-native';
|
||||
import Colors from './colors';
|
||||
|
||||
const mediaPlayerStyle = StyleSheet.create({
|
||||
player: {
|
||||
flex: 1
|
||||
flex: 1,
|
||||
width: '100%',
|
||||
height: '100%'
|
||||
},
|
||||
container: {
|
||||
flex: 1,
|
||||
paddingBottom: 16
|
||||
},
|
||||
fullscreenContainer: {
|
||||
flex: 1,
|
||||
justifyContent: 'center'
|
||||
},
|
||||
progress: {
|
||||
flex: 1,
|
||||
flexDirection: 'row',
|
||||
overflow: 'hidden',
|
||||
width: '100%',
|
||||
height: 3
|
||||
},
|
||||
innerProgressCompleted: {
|
||||
height: 4,
|
||||
backgroundColor: '#40c0a9',
|
||||
backgroundColor: Colors.LbryGreen,
|
||||
},
|
||||
innerProgressRemaining: {
|
||||
height: 4,
|
||||
@@ -24,10 +31,16 @@ const mediaPlayerStyle = StyleSheet.create({
|
||||
},
|
||||
trackingControls: {
|
||||
height: 3,
|
||||
width: '100%',
|
||||
position: 'absolute',
|
||||
bottom: 0,
|
||||
bottom: 14
|
||||
},
|
||||
containedTrackingControls: {
|
||||
left: 0,
|
||||
width: '100%'
|
||||
},
|
||||
fullscreenTrackingControls: {
|
||||
alignSelf: 'center',
|
||||
width: '70%'
|
||||
},
|
||||
playerControls: {
|
||||
position: 'absolute',
|
||||
@@ -77,24 +90,25 @@ const mediaPlayerStyle = StyleSheet.create({
|
||||
seekerCircle: {
|
||||
borderRadius: 12,
|
||||
position: 'relative',
|
||||
top: 16,
|
||||
left: 8,
|
||||
top: 14,
|
||||
left: 15,
|
||||
height: 12,
|
||||
width: 12,
|
||||
backgroundColor: '#40c0a9'
|
||||
},
|
||||
seekerHandle: {
|
||||
backgroundColor: 'transparent',
|
||||
position: 'absolute',
|
||||
height: 36,
|
||||
width: 36,
|
||||
bottom: -12,
|
||||
marginLeft: -8
|
||||
width: 48,
|
||||
bottom: 0,
|
||||
marginLeft: -16
|
||||
},
|
||||
bigSeekerCircle: {
|
||||
borderRadius: 24,
|
||||
position: 'relative',
|
||||
top: 10,
|
||||
left: 8,
|
||||
top: 8,
|
||||
left: 15,
|
||||
height: 24,
|
||||
width: 24,
|
||||
backgroundColor: '#40c0a9'
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
import { Platform, StyleSheet } from 'react-native';
|
||||
|
||||
const STATUSBAR_HEIGHT = Platform.OS === 'ios' ? 20 : 0;
|
||||
const TITLE_OFFSET = Platform.OS === 'ios' ? 70 : 56;
|
||||
|
||||
let platformContainerStyles;
|
||||
if (Platform.OS === 'ios') {
|
||||
platformContainerStyles = {
|
||||
borderBottomWidth: StyleSheet.hairlineWidth,
|
||||
borderBottomColor: '#A7A7AA',
|
||||
};
|
||||
} else {
|
||||
platformContainerStyles = {
|
||||
shadowColor: 'black',
|
||||
shadowOpacity: 0.1,
|
||||
shadowRadius: StyleSheet.hairlineWidth,
|
||||
shadowOffset: {
|
||||
height: StyleSheet.hairlineWidth,
|
||||
},
|
||||
elevation: 4,
|
||||
};
|
||||
}
|
||||
|
||||
const pageHeaderStyle = StyleSheet.create({
|
||||
container: {
|
||||
backgroundColor: Platform.OS === 'ios' ? '#F7F7F7' : '#FFF',
|
||||
...platformContainerStyles,
|
||||
},
|
||||
transparentContainer: {
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
...platformContainerStyles,
|
||||
},
|
||||
backIcon: {
|
||||
marginLeft: 16
|
||||
},
|
||||
header: {
|
||||
...StyleSheet.absoluteFillObject,
|
||||
flexDirection: 'row',
|
||||
},
|
||||
titleText: {
|
||||
fontSize: Platform.OS === 'ios' ? 17 : 20,
|
||||
fontWeight: Platform.OS === 'ios' ? '700' : '500',
|
||||
color: 'rgba(0, 0, 0, .9)',
|
||||
textAlign: Platform.OS === 'ios' ? 'center' : 'left',
|
||||
marginHorizontal: 16,
|
||||
},
|
||||
title: {
|
||||
bottom: 0,
|
||||
top: 0,
|
||||
left: TITLE_OFFSET,
|
||||
right: TITLE_OFFSET,
|
||||
position: 'absolute',
|
||||
alignItems: 'center',
|
||||
flexDirection: 'row',
|
||||
justifyContent: Platform.OS === 'ios' ? 'center' : 'flex-start',
|
||||
},
|
||||
left: {
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
top: 0,
|
||||
position: 'absolute',
|
||||
alignItems: 'center',
|
||||
flexDirection: 'row',
|
||||
},
|
||||
right: {
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
top: 0,
|
||||
position: 'absolute',
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
},
|
||||
flexOne: {
|
||||
flex: 1,
|
||||
}
|
||||
});
|
||||
|
||||
export default pageHeaderStyle;
|
||||
@@ -10,7 +10,8 @@ const searchStyle = StyleSheet.create({
|
||||
flex: 1,
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
padding: 16
|
||||
padding: 16,
|
||||
marginBottom: 60
|
||||
},
|
||||
scrollPadding: {
|
||||
paddingBottom: 16
|
||||
|
||||
@@ -7,9 +7,7 @@ const settingsStyle = StyleSheet.create({
|
||||
margin: 16
|
||||
},
|
||||
scrollContainer: {
|
||||
paddingLeft: 16,
|
||||
paddingRight: 16,
|
||||
paddingBottom: 16
|
||||
padding: 16
|
||||
},
|
||||
row: {
|
||||
marginBottom: 24,
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
import { StyleSheet } from 'react-native';
|
||||
import Colors from './colors';
|
||||
|
||||
const transactionListStyle = StyleSheet.create({
|
||||
listItem: {
|
||||
borderBottomWidth: 1,
|
||||
borderBottomColor: '#eeeeee',
|
||||
paddingLeft: 16,
|
||||
paddingRight: 16,
|
||||
paddingTop: 12,
|
||||
paddingBottom: 12
|
||||
},
|
||||
row: {
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-between'
|
||||
},
|
||||
topRow: {
|
||||
marginBottom: 4
|
||||
},
|
||||
col: {
|
||||
alignSelf: 'stretch'
|
||||
},
|
||||
text: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 14
|
||||
},
|
||||
link: {
|
||||
color: Colors.LbryGreen,
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 14
|
||||
},
|
||||
amount: {
|
||||
textAlign: 'right'
|
||||
},
|
||||
smallText: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 12,
|
||||
color: '#aaaaaa'
|
||||
},
|
||||
smallLink: {
|
||||
color: Colors.LbryGreen,
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 12
|
||||
},
|
||||
noTransactions: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
textAlign: 'center',
|
||||
padding: 16,
|
||||
color: '#aaaaaa'
|
||||
}
|
||||
});
|
||||
|
||||
export default transactionListStyle;
|
||||
@@ -0,0 +1,57 @@
|
||||
import { StyleSheet } from 'react-native';
|
||||
import Colors from './colors';
|
||||
|
||||
const uriBarStyle = StyleSheet.create({
|
||||
uriContainer: {
|
||||
backgroundColor: Colors.White,
|
||||
padding: 8,
|
||||
alignSelf: 'flex-end',
|
||||
height: 60,
|
||||
width: '100%',
|
||||
shadowColor: Colors.Black,
|
||||
shadowOpacity: 0.1,
|
||||
shadowRadius: StyleSheet.hairlineWidth,
|
||||
shadowOffset: {
|
||||
height: StyleSheet.hairlineWidth,
|
||||
},
|
||||
elevation: 4
|
||||
},
|
||||
uriText: {
|
||||
backgroundColor: Colors.White,
|
||||
borderWidth: 1,
|
||||
borderColor: Colors.LightGrey,
|
||||
padding: 8,
|
||||
borderRadius: 4,
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 16,
|
||||
width: '100%'
|
||||
},
|
||||
overlay: {
|
||||
position: 'absolute',
|
||||
backgroundColor: 'transparent',
|
||||
bottom: 0,
|
||||
width: '100%',
|
||||
zIndex: 200,
|
||||
elevation: 16
|
||||
},
|
||||
inFocus: {
|
||||
height: '100%'
|
||||
},
|
||||
suggestions: {
|
||||
backgroundColor: 'white',
|
||||
flex: 1
|
||||
},
|
||||
item: {
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'flex-start',
|
||||
padding: 12
|
||||
},
|
||||
itemText: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 16,
|
||||
marginLeft: 12,
|
||||
marginRight: 12
|
||||
}
|
||||
});
|
||||
|
||||
export default uriBarStyle;
|
||||
@@ -0,0 +1,152 @@
|
||||
import { StyleSheet } from 'react-native';
|
||||
import Colors from './colors';
|
||||
|
||||
const walletStyle = StyleSheet.create({
|
||||
row: {
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center'
|
||||
},
|
||||
amountRow: {
|
||||
flexDirection: 'row'
|
||||
},
|
||||
address: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
borderWidth: 1,
|
||||
borderStyle: 'dashed',
|
||||
borderColor: '#cccccc',
|
||||
backgroundColor: '#f9f9f9',
|
||||
padding: 8,
|
||||
width: '85%'
|
||||
},
|
||||
button: {
|
||||
backgroundColor: Colors.LbryGreen
|
||||
},
|
||||
historyList: {
|
||||
backgroundColor: '#ffffff'
|
||||
},
|
||||
card: {
|
||||
backgroundColor: '#ffffff',
|
||||
marginTop: 16,
|
||||
marginLeft: 16,
|
||||
marginRight: 16,
|
||||
padding: 16
|
||||
},
|
||||
transactionsCard: {
|
||||
backgroundColor: '#ffffff',
|
||||
margin: 16
|
||||
},
|
||||
title: {
|
||||
fontFamily: 'Metropolis-Bold',
|
||||
fontSize: 20,
|
||||
marginBottom: 24
|
||||
},
|
||||
transactionsTitle: {
|
||||
fontFamily: 'Metropolis-Bold',
|
||||
fontSize: 20
|
||||
},
|
||||
transactionsHeader: {
|
||||
paddingTop: 12,
|
||||
paddingBottom: 12,
|
||||
paddingLeft: 16,
|
||||
paddingRight: 16,
|
||||
borderBottomWidth: 1,
|
||||
borderBottomColor: '#eeeeee'
|
||||
},
|
||||
text: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 14
|
||||
},
|
||||
link: {
|
||||
color: Colors.LbryGreen,
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 14
|
||||
},
|
||||
smallText: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 12
|
||||
},
|
||||
balanceCard: {
|
||||
marginTop: 16,
|
||||
marginLeft: 16,
|
||||
marginRight: 16
|
||||
},
|
||||
balanceBackground: {
|
||||
position: 'absolute',
|
||||
alignSelf: 'stretch',
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
},
|
||||
balanceTitle: {
|
||||
color: '#ffffff',
|
||||
fontFamily: 'Metropolis-Bold',
|
||||
fontSize: 18,
|
||||
marginLeft: 16,
|
||||
marginTop: 16
|
||||
},
|
||||
balanceCaption: {
|
||||
color: '#caedB9',
|
||||
fontFamily: 'Metropolis-Medium',
|
||||
fontSize: 14,
|
||||
marginLeft: 16,
|
||||
marginTop: 8,
|
||||
marginBottom: 96
|
||||
},
|
||||
balance: {
|
||||
color: '#ffffff',
|
||||
fontFamily: 'Metropolis-Bold',
|
||||
fontSize: 36,
|
||||
marginLeft: 16,
|
||||
marginBottom: 16
|
||||
},
|
||||
infoText: {
|
||||
color: '#aaaaaa',
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 14,
|
||||
padding: 16,
|
||||
textAlign: 'center'
|
||||
},
|
||||
input: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 14
|
||||
},
|
||||
amountInput: {
|
||||
alignSelf: 'flex-start',
|
||||
width: 150
|
||||
},
|
||||
addressInput: {
|
||||
width: '80%'
|
||||
},
|
||||
warning: {
|
||||
backgroundColor: Colors.Orange,
|
||||
padding: 16,
|
||||
margin: 16
|
||||
},
|
||||
warningText: {
|
||||
color: '#ffffff',
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 16,
|
||||
lineHeight: 30
|
||||
},
|
||||
understand: {
|
||||
marginLeft: 16
|
||||
},
|
||||
currency: {
|
||||
alignSelf: 'flex-start',
|
||||
marginTop: 17
|
||||
},
|
||||
sendButton: {
|
||||
marginTop: 8
|
||||
},
|
||||
bottomMarginSmall: {
|
||||
marginBottom: 8
|
||||
},
|
||||
bottomMarginMedium: {
|
||||
marginBottom: 16
|
||||
},
|
||||
bottomMarginLarge: {
|
||||
marginBottom: 24
|
||||
}
|
||||
});
|
||||
|
||||
export default walletStyle;
|
||||
@@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py
|
||||
|
||||
# (list) Application requirements
|
||||
# comma seperated e.g. requirements = sqlite3,kivy
|
||||
requirements = openssl, sqlite3, hostpython2, android, pyjnius, constantly, incremental, functools32, miniupnpc==1.9, gmpy==1.17, twisted==16.6.0, appdirs==1.4.3, argparse==1.2.1, docopt==0.6.2, base58==0.2.2, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse==0.2.0, jsonrpc==1.2, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2==1.3, pycrypto==2.6.1, pyyaml==3.12, qrcode==5.2.2, requests==2.9.1, txrequests==0.9.5, seccure==0.3.1.3, service_identity==16.0.0, six==1.9.0, slowaes==0.1a1, txJSON-RPC==0.5, wsgiref==0.1.2, zope.interface==4.3.3, protobuf==3.2.0, keyring==10.4.0, git+https://github.com/lbryio/lbryschema.git@v0.0.15rc2#egg=lbryschema, git+https://github.com/lbryio/lbryum.git#egg=lbryum, git+https://github.com/lbryio/lbry.git#egg=lbrynet, asn1crypto, cryptography==2.0.3, funcsigs, mock, pbr, unqlite
|
||||
requirements = openssl, sqlite3, hostpython2, android, pyjnius, certifi==2018.4.16, constantly, incremental, functools32, miniupnpc==1.9, gmpy==1.17, twisted==16.6.0, appdirs==1.4.3, argparse==1.2.1, docopt==0.6.2, base58==0.2.2, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse==0.2.0, jsonrpc==1.2, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2==1.3, pyyaml==3.12, qrcode==5.2.2, requests==2.9.1, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, slowaes==0.1a1, txJSON-RPC==0.5, wsgiref==0.1.2, zope.interface==4.3.3, protobuf==3.2.0, keyring==10.4.0, git+https://github.com/lbryio/lbryschema.git@v0.0.15#egg=lbryschema, git+https://github.com/lbryio/lbryum.git#egg=lbryum, git+https://github.com/lbryio/lbry.git#egg=lbrynet, asn1crypto, cryptography==2.2.2, pyopenssl==17.4.0, treq==17.8.0, funcsigs, mock, pbr, unqlite
|
||||
|
||||
# (str) Custom source folders for requirements
|
||||
# Sets custom source for any requirements with recipes
|
||||
@@ -86,13 +86,13 @@ fullscreen = 0
|
||||
#android.presplash_color = #FFFFFF
|
||||
|
||||
# (list) Permissions
|
||||
android.permissions = INTERNET,READ_EXTERNAL_STORAGE,WRITE_EXTERNAL_STORAGE
|
||||
android.permissions = ACCESS_NETWORK_STATE,BLUETOOTH,INTERNET,READ_EXTERNAL_STORAGE,WRITE_EXTERNAL_STORAGE
|
||||
|
||||
# (int) Android API to use
|
||||
android.api = 23
|
||||
|
||||
# (int) Minimum API required
|
||||
android.minapi = 16
|
||||
android.minapi = 21
|
||||
|
||||
# (int) Android SDK version to use
|
||||
android.sdk = 23
|
||||
@@ -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:appcompat-v7:23.4.0, com.facebook.react:react-native:+
|
||||
android.gradle_dependencies = com.android.support:appcompat-v7:23.4.0, com.facebook.react:react-native:0.55.3, com.mixpanel.android:mixpanel-android:5+, com.google.android.gms:play-services-gcm:11.0.4+
|
||||
|
||||
# (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 = openssl, sqlite3, hostpython2, android, pyjnius, constantly, incremental, functools32, miniupnpc==1.9, gmpy==1.17, twisted==16.6.0, appdirs==1.4.3, argparse==1.2.1, docopt==0.6.2, base58==0.2.2, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse==0.2.0, jsonrpc==1.2, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2==1.3, pycrypto==2.6.1, pyyaml==3.12, qrcode==5.2.2, requests==2.9.1, txrequests==0.9.5, seccure==0.3.1.3, service_identity==16.0.0, six==1.9.0, slowaes==0.1a1, txJSON-RPC==0.5, wsgiref==0.1.2, zope.interface==4.3.3, protobuf==3.2.0, keyring==10.4.0, git+https://github.com/lbryio/lbryschema.git@v0.0.15rc2#egg=lbryschema, git+https://github.com/lbryio/lbryum.git#egg=lbryum, git+https://github.com/lbryio/lbry.git#egg=lbrynet, asn1crypto, cryptography==2.0.3, funcsigs, mock, pbr, unqlite
|
||||
requirements = openssl, sqlite3, hostpython2, android, pyjnius, certifi==2018.4.16, constantly, incremental, functools32, miniupnpc==1.9, gmpy==1.17, twisted==16.6.0, appdirs==1.4.3, argparse==1.2.1, docopt==0.6.2, base58==0.2.2, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse==0.2.0, jsonrpc==1.2, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2==1.3, pyyaml==3.12, qrcode==5.2.2, requests==2.9.1, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, slowaes==0.1a1, txJSON-RPC==0.5, wsgiref==0.1.2, zope.interface==4.3.3, protobuf==3.2.0, keyring==10.4.0, git+https://github.com/lbryio/lbryschema.git@v0.0.15#egg=lbryschema, git+https://github.com/lbryio/lbryum.git#egg=lbryum, git+https://github.com/lbryio/lbry.git#egg=lbrynet, asn1crypto, cryptography==2.2.2, pyopenssl==17.4.0, treq==17.8.0, funcsigs, mock, pbr, unqlite
|
||||
|
||||
# (str) Custom source folders for requirements
|
||||
# Sets custom source for any requirements with recipes
|
||||
@@ -86,13 +86,13 @@ fullscreen = 0
|
||||
#android.presplash_color = #FFFFFF
|
||||
|
||||
# (list) Permissions
|
||||
android.permissions = INTERNET,READ_EXTERNAL_STORAGE,WRITE_EXTERNAL_STORAGE
|
||||
android.permissions = ACCESS_NETWORK_STATE,BLUETOOTH,INTERNET,READ_EXTERNAL_STORAGE,WRITE_EXTERNAL_STORAGE
|
||||
|
||||
# (int) Android API to use
|
||||
android.api = 23
|
||||
|
||||
# (int) Minimum API required
|
||||
android.minapi = 16
|
||||
android.minapi = 21
|
||||
|
||||
# (int) Android SDK version to use
|
||||
android.sdk = 23
|
||||
@@ -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:appcompat-v7:23.4.0, com.facebook.react:react-native:+
|
||||
android.gradle_dependencies = com.android.support:appcompat-v7:23.4.0, com.facebook.react:react-native:0.55.3, com.mixpanel.android:mixpanel-android:5+, com.google.android.gms:play-services-gcm:11.0.4+
|
||||
|
||||
# (str) python-for-android branch to use, defaults to master
|
||||
#p4a.branch = stable
|
||||
|
||||
Binary file not shown.
@@ -1,4 +1,5 @@
|
||||
|
||||
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include "Python.h"
|
||||
#ifndef Py_PYTHON_H
|
||||
@@ -307,6 +308,10 @@ JNIEXPORT void JNICALL Java_org_kivy_android_PythonService_nativeStart(
|
||||
setenv("PYTHONHOME", python_home, 1);
|
||||
setenv("PYTHONPATH", python_path, 1);
|
||||
setenv("PYTHON_SERVICE_ARGUMENT", arg, 1);
|
||||
|
||||
char ca_path[128];
|
||||
snprintf(ca_path, 128, "%s/lib/python2.7/site-packages/certifi/cacert.pem", python_home);
|
||||
setenv("SSL_CERT_FILE", ca_path, 1);
|
||||
|
||||
char *argv[] = {"."};
|
||||
/* ANDROID_ARGUMENT points to service subdir,
|
||||
|
||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 386 B |
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 236 B |
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 420 B |
p4a/pythonforandroid/bootstraps/lbry/build/src/main/res/drawable-xxhdpi/baseline_search_black_24.png
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 636 B |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 827 B |
+10
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
|
||||
</vector>
|
||||
@@ -72,8 +72,15 @@
|
||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
|
||||
android:configChanges="keyboardHidden|orientation{% if args.min_sdk_version >= 13 %}|screenSize{% endif %}"
|
||||
android:screenOrientation="{{ args.orientation }}"
|
||||
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>
|
||||
|
||||
{% if args.launcher %}
|
||||
<intent-filter>
|
||||
@@ -92,7 +99,9 @@
|
||||
{{- args.intent_filters -}}
|
||||
{%- endif -%}
|
||||
</activity>
|
||||
|
||||
|
||||
<receiver android:name="io.lbry.browser.receivers.NotificationDeletedReceiver" />
|
||||
|
||||
{% if args.launcher %}
|
||||
<activity android:name="org.kivy.android.launcher.ProjectChooser"
|
||||
android:icon="@drawable/icon"
|
||||
|
||||
@@ -47,6 +47,8 @@ class Context(object):
|
||||
|
||||
symlink_java_src = False # If True, will symlink instead of copying during build
|
||||
|
||||
java_build_tool = 'auto'
|
||||
|
||||
@property
|
||||
def packages_path(self):
|
||||
'''Where packages are downloaded before being unpacked'''
|
||||
@@ -158,7 +160,8 @@ class Context(object):
|
||||
self._ndk_dir = value
|
||||
|
||||
def prepare_build_environment(self, user_sdk_dir, user_ndk_dir,
|
||||
user_android_api, user_ndk_ver):
|
||||
user_android_api, user_android_min_api,
|
||||
user_ndk_ver):
|
||||
'''Checks that build dependencies exist and sets internal variables
|
||||
for the Android SDK etc.
|
||||
|
||||
@@ -171,8 +174,6 @@ class Context(object):
|
||||
if self._build_env_prepared:
|
||||
return
|
||||
|
||||
# AND: This needs revamping to carefully check each dependency
|
||||
# in turn
|
||||
ok = True
|
||||
|
||||
# Work out where the Android SDK is
|
||||
@@ -184,7 +185,7 @@ class Context(object):
|
||||
if sdk_dir is None: # This seems used more conventionally
|
||||
sdk_dir = environ.get('ANDROID_HOME', None)
|
||||
if sdk_dir is None: # Checks in the buildozer SDK dir, useful
|
||||
# # for debug tests of p4a
|
||||
# for debug tests of p4a
|
||||
possible_dirs = glob.glob(expanduser(join(
|
||||
'~', '.buildozer', 'android', 'platform', 'android-sdk-*')))
|
||||
possible_dirs = [d for d in possible_dirs if not
|
||||
@@ -226,6 +227,30 @@ class Context(object):
|
||||
error('You probably want to build with --arch=armeabi-v7a instead')
|
||||
exit(1)
|
||||
|
||||
# try to determinate min_api
|
||||
android_min_api = None
|
||||
if user_android_min_api:
|
||||
android_min_api = user_android_min_api
|
||||
if android_min_api is not None:
|
||||
info('Getting Minimum Android API version from user argument')
|
||||
if android_min_api is None:
|
||||
android_min_api = environ.get("ANDROIDMINAPI", None)
|
||||
if android_min_api is not None:
|
||||
info('Found Android minimum api in $ANDROIDMINAPI')
|
||||
if android_min_api is None:
|
||||
info('Minimum Android API was not set, using current Android API '
|
||||
'{}'.format(android_api))
|
||||
android_min_api = android_api
|
||||
android_min_api = int(android_min_api)
|
||||
self.android_min_api = android_min_api
|
||||
|
||||
info("Requested API {} (minimum {})".format(
|
||||
self.android_api, self.android_min_api))
|
||||
|
||||
if self.android_min_api > android_api:
|
||||
error('Android minimum api cannot be higher than Android api')
|
||||
exit(1)
|
||||
|
||||
if exists(join(sdk_dir, 'tools', 'bin', 'avdmanager')):
|
||||
avdmanager = sh.Command(join(sdk_dir, 'tools', 'bin', 'avdmanager'))
|
||||
targets = avdmanager('list', 'target').stdout.decode('utf-8').split('\n')
|
||||
@@ -235,6 +260,7 @@ class Context(object):
|
||||
else:
|
||||
error('Could not find `android` or `sdkmanager` binaries in '
|
||||
'Android SDK. Exiting.')
|
||||
exit(1)
|
||||
apis = [s for s in targets if re.match(r'^ *API level: ', s)]
|
||||
apis = [re.findall(r'[0-9]+', s) for s in apis]
|
||||
apis = [int(s[0]) for s in apis if s]
|
||||
@@ -323,8 +349,9 @@ class Context(object):
|
||||
warning('If the NDK dir result is correct, you don\'t '
|
||||
'need to manually set the NDK ver.')
|
||||
if ndk_ver is None:
|
||||
warning('Android NDK version could not be found, exiting.')
|
||||
exit(1)
|
||||
warning('Android NDK version could not be found. This probably'
|
||||
'won\'t cause any problems, but if necessary you can'
|
||||
'set it with `--ndk-version=...`.')
|
||||
self.ndk_ver = ndk_ver
|
||||
|
||||
info('Using {} NDK {}'.format(self.ndk.capitalize(), self.ndk_ver))
|
||||
@@ -359,7 +386,7 @@ class Context(object):
|
||||
ok = False
|
||||
warning("Missing requirement: cython is not installed")
|
||||
|
||||
# AND: need to change if supporting multiple archs at once
|
||||
# This would need to be changed if supporting multiarch APKs
|
||||
arch = self.archs[0]
|
||||
platform_dir = arch.platform_dir
|
||||
toolchain_prefix = arch.toolchain_prefix
|
||||
@@ -367,7 +394,7 @@ class Context(object):
|
||||
self.ndk_platform = join(
|
||||
self.ndk_dir,
|
||||
'platforms',
|
||||
'android-{}'.format(self.android_api),
|
||||
'android-{}'.format(self.android_min_api),
|
||||
platform_dir)
|
||||
if not exists(self.ndk_platform):
|
||||
warning('ndk_platform doesn\'t exist: {}'.format(
|
||||
@@ -496,7 +523,7 @@ class Context(object):
|
||||
dir.
|
||||
'''
|
||||
|
||||
# AND: This *must* be replaced with something more general in
|
||||
# This needs to be replaced with something more general in
|
||||
# order to support multiple python versions and/or multiple
|
||||
# archs.
|
||||
if self.python_recipe.from_crystax:
|
||||
@@ -575,7 +602,6 @@ def build_recipes(build_order, python_modules, ctx):
|
||||
.format(recipe.name))
|
||||
|
||||
# 4) biglink everything
|
||||
# AND: Should make this optional
|
||||
info_main('# Biglinking object files')
|
||||
if not ctx.python_recipe or not ctx.python_recipe.from_crystax:
|
||||
biglink(ctx, arch)
|
||||
@@ -666,12 +692,17 @@ def biglink(ctx, arch):
|
||||
info('target {}'.format(join(ctx.get_libs_dir(arch.arch),
|
||||
'libpymodules.so')))
|
||||
do_biglink = copylibs_function if ctx.copy_libs else biglink_function
|
||||
do_biglink(
|
||||
join(ctx.get_libs_dir(arch.arch), 'libpymodules.so'),
|
||||
obj_dir.split(' '),
|
||||
extra_link_dirs=[join(ctx.bootstrap.build_dir,
|
||||
'obj', 'local', arch.arch)],
|
||||
env=env)
|
||||
|
||||
# Move to the directory containing crtstart_so.o and crtend_so.o
|
||||
# This is necessary with newer NDKs? A gcc bug?
|
||||
with current_directory(join(ctx.ndk_platform, 'usr', 'lib')):
|
||||
do_biglink(
|
||||
join(ctx.get_libs_dir(arch.arch), 'libpymodules.so'),
|
||||
obj_dir.split(' '),
|
||||
extra_link_dirs=[join(ctx.bootstrap.build_dir,
|
||||
'obj', 'local', arch.arch),
|
||||
os.path.abspath('.')],
|
||||
env=env)
|
||||
|
||||
|
||||
def biglink_function(soname, objs_paths, extra_link_dirs=[], env=None):
|
||||
|
||||
@@ -30,31 +30,31 @@ def is_arch(xarch):
|
||||
|
||||
def is_api_gt(apiver):
|
||||
def is_x(recipe, **kwargs):
|
||||
return recipe.ctx.android_api > apiver
|
||||
return recipe.ctx.android_min_api > apiver
|
||||
return is_x
|
||||
|
||||
|
||||
def is_api_gte(apiver):
|
||||
def is_x(recipe, **kwargs):
|
||||
return recipe.ctx.android_api >= apiver
|
||||
return recipe.ctx.android_min_api >= apiver
|
||||
return is_x
|
||||
|
||||
|
||||
def is_api_lt(apiver):
|
||||
def is_x(recipe, **kwargs):
|
||||
return recipe.ctx.android_api < apiver
|
||||
return recipe.ctx.android_min_api < apiver
|
||||
return is_x
|
||||
|
||||
|
||||
def is_api_lte(apiver):
|
||||
def is_x(recipe, **kwargs):
|
||||
return recipe.ctx.android_api <= apiver
|
||||
return recipe.ctx.android_min_api <= apiver
|
||||
return is_x
|
||||
|
||||
|
||||
def is_api(apiver):
|
||||
def is_x(recipe, **kwargs):
|
||||
return recipe.ctx.android_api == apiver
|
||||
return recipe.ctx.android_min_api == apiver
|
||||
return is_x
|
||||
|
||||
|
||||
@@ -68,4 +68,3 @@ def is_ndk(ndk):
|
||||
def is_x(recipe, **kwargs):
|
||||
return recipe.ctx.ndk == ndk
|
||||
return is_x
|
||||
|
||||
@@ -931,7 +931,7 @@ class CppCompiledComponentsPythonRecipe(CompiledComponentsPythonRecipe):
|
||||
)
|
||||
env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
|
||||
env['CFLAGS'] += " -I{pyroot}/include/python2.7 " \
|
||||
" -I{ctx.ndk_dir}/platforms/android-{ctx.android_api}/arch-{arch_noeabi}/usr/include" \
|
||||
" -I{ctx.ndk_dir}/platforms/android-{ctx.android_min_api}/arch-{arch_noeabi}/usr/include" \
|
||||
" -I{ctx.ndk_dir}/sources/cxx-stl/gnu-libstdc++/{ctx.toolchain_version}/include" \
|
||||
" -I{ctx.ndk_dir}/sources/cxx-stl/gnu-libstdc++/{ctx.toolchain_version}/libs/{arch.arch}/include".format(**keys)
|
||||
env['CXXFLAGS'] = env['CFLAGS'] + ' -frtti -fexceptions'
|
||||
|
||||
@@ -141,6 +141,7 @@ def require_prebuilt_dist(func):
|
||||
ctx.prepare_build_environment(user_sdk_dir=self.sdk_dir,
|
||||
user_ndk_dir=self.ndk_dir,
|
||||
user_android_api=self.android_api,
|
||||
user_android_min_api=self.android_min_api,
|
||||
user_ndk_ver=self.ndk_version)
|
||||
dist = self._dist
|
||||
if dist.needs_build:
|
||||
@@ -256,6 +257,9 @@ class ToolchainCL(object):
|
||||
generic_parser.add_argument(
|
||||
'--android-api', '--android_api', dest='android_api', default=0, type=int,
|
||||
help='The Android API level to build against.')
|
||||
generic_parser.add_argument(
|
||||
'--android-minapi', '--android_minapi', dest='android_min_api', default=0, type=int,
|
||||
help='The Minimum Android API level to build against (will be used for all C compilation).')
|
||||
generic_parser.add_argument(
|
||||
'--ndk-version', '--ndk_version', dest='ndk_version', default='',
|
||||
help=('The version of the Android NDK. This is optional, '
|
||||
@@ -499,6 +503,7 @@ class ToolchainCL(object):
|
||||
self.sdk_dir = args.sdk_dir
|
||||
self.ndk_dir = args.ndk_dir
|
||||
self.android_api = args.android_api
|
||||
self.android_min_api = args.android_min_api
|
||||
self.ndk_version = args.ndk_version
|
||||
self.ctx.symlink_java_src = args.symlink_java_src
|
||||
self.ctx.java_build_tool = args.java_build_tool
|
||||
@@ -904,6 +909,7 @@ class ToolchainCL(object):
|
||||
ctx.prepare_build_environment(user_sdk_dir=self.sdk_dir,
|
||||
user_ndk_dir=self.ndk_dir,
|
||||
user_android_api=self.android_api,
|
||||
user_android_min_api=self.android_min_api,
|
||||
user_ndk_ver=self.ndk_version)
|
||||
android = sh.Command(join(ctx.sdk_dir, 'tools', args.tool))
|
||||
output = android(
|
||||
@@ -931,6 +937,7 @@ class ToolchainCL(object):
|
||||
ctx.prepare_build_environment(user_sdk_dir=self.sdk_dir,
|
||||
user_ndk_dir=self.ndk_dir,
|
||||
user_android_api=self.android_api,
|
||||
user_android_min_api=self.android_min_api,
|
||||
user_ndk_ver=self.ndk_version)
|
||||
if platform in ('win32', 'cygwin'):
|
||||
adb = sh.Command(join(ctx.sdk_dir, 'platform-tools', 'adb.exe'))
|
||||
|
||||
@@ -3,7 +3,7 @@ from os.path import dirname, join
|
||||
|
||||
class CryptographyRecipe(CompiledComponentsPythonRecipe):
|
||||
name = 'cryptography'
|
||||
version = '2.0.3'
|
||||
version = '2.2.2'
|
||||
url = 'https://github.com/pyca/cryptography/archive/{version}.tar.gz'
|
||||
depends = [('python2', 'python3crystax'), 'openssl', 'idna', 'pyasn1', 'six', 'setuptools', 'enum34', 'ipaddress', 'cffi']
|
||||
call_hostpython_via_targetpython = False
|
||||
|
||||
@@ -7,7 +7,8 @@ import sh
|
||||
|
||||
class LibGMPRecipe(Recipe):
|
||||
version = '6.1.2'
|
||||
url = 'https://gmplib.org/download/gmp/gmp-{version}.tar.bz2'
|
||||
url = 'https://ftp.gnu.org/pub/gnu/gmp/gmp-{version}.tar.bz2'
|
||||
#url = 'https://gmplib.org/download/gmp/gmp-{version}.tar.bz2'
|
||||
|
||||
def should_build(self, arch):
|
||||
build_dir = self.get_build_dir(arch.arch)
|
||||
|
||||
@@ -3,9 +3,10 @@ from pythonforandroid.toolchain import PythonRecipe
|
||||
|
||||
|
||||
class PyASN1Recipe(PythonRecipe):
|
||||
version = '0.1.8'
|
||||
version = '0.4.2'
|
||||
url = 'https://pypi.python.org/packages/source/p/pyasn1/pyasn1-{version}.tar.gz'
|
||||
depends = ['python2']
|
||||
|
||||
call_hostpython_via_targetpython = False
|
||||
|
||||
recipe = PyASN1Recipe()
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
from pythonforandroid.toolchain import (
|
||||
PythonRecipe,
|
||||
Recipe,
|
||||
current_directory,
|
||||
info,
|
||||
shprint,
|
||||
)
|
||||
from os.path import join
|
||||
import sh
|
||||
|
||||
|
||||
class SetuptoolsRecipe(PythonRecipe):
|
||||
version = '18.5'
|
||||
url = 'https://pypi.python.org/packages/source/s/setuptools/setuptools-{version}.tar.gz'
|
||||
|
||||
depends = ['python2']
|
||||
|
||||
call_hostpython_via_targetpython = False
|
||||
install_in_hostpython = True
|
||||
|
||||
|
||||
recipe = SetuptoolsRecipe()
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
cd app
|
||||
react-native bundle --platform android --dev false --entry-file src/index.js --bundle-output ../src/main/assets/index.android.bundle --assets-dest ../src/main/res/
|
||||
cd ..
|
||||
version=$(cat src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+')
|
||||
buildozer android release
|
||||
jarsigner -verbose -sigalg SHA1withRSA \
|
||||
-digestalg SHA1 \
|
||||
-keystore lbry-android.keystore \
|
||||
-storepass $KEYSTORE_PASSWORD \
|
||||
bin/browser-$version-release-unsigned.apk lbry-android \
|
||||
&& mv bin/browser-$version-release-unsigned.apk bin/browser-$version-release-signed.apk
|
||||
~/.buildozer/android/platform/android-sdk-23/build-tools/26.0.1/zipalign -v 4 \
|
||||
bin/browser-$version-release-signed.apk bin/browser-$version-release.apk \
|
||||
&& rm bin/browser-$version-release-signed.apk
|
||||
|
||||
|
||||
@@ -34,6 +34,11 @@ public class LbrynetService extends PythonService {
|
||||
|
||||
public static LbrynetService serviceInstance;
|
||||
|
||||
@Override
|
||||
public boolean canDisplayNotification() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int startType() {
|
||||
return START_STICKY;
|
||||
|
||||
@@ -6,8 +6,9 @@ import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.content.Intent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.SharedPreferences;
|
||||
import android.Manifest;
|
||||
@@ -23,13 +24,14 @@ import com.facebook.react.ReactInstanceManager;
|
||||
import com.facebook.react.shell.MainReactPackage;
|
||||
|
||||
import io.lbry.browser.reactpackages.LbryReactPackage;
|
||||
import io.lbry.browser.reactmodules.DownloadManagerModule;
|
||||
|
||||
public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
|
||||
|
||||
private static final int OVERLAY_PERMISSION_REQ_CODE = 101;
|
||||
|
||||
private static final int STORAGE_PERMISSION_REQ_CODE = 201;
|
||||
|
||||
|
||||
private ReactRootView mReactRootView;
|
||||
|
||||
private ReactInstanceManager mReactInstanceManager;
|
||||
@@ -41,7 +43,11 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
* onResume method.
|
||||
*/
|
||||
private boolean serviceRunning;
|
||||
|
||||
|
||||
protected String getMainComponentName() {
|
||||
return "LBRYApp";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
@@ -50,7 +56,7 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
// Should we show an explanation?
|
||||
if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
|
||||
Toast.makeText(this,
|
||||
"LBRY requires access to your device storage to be able to download files and media.", Toast.LENGTH_SHORT).show();
|
||||
"LBRY requires access to your device storage to be able to download files and media.", Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
ActivityCompat.requestPermissions(this,
|
||||
new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, STORAGE_PERMISSION_REQ_CODE);
|
||||
@@ -98,7 +104,7 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
switch (requestCode) {
|
||||
case STORAGE_PERMISSION_REQ_CODE:
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
if (!Settings.canDrawOverlays(this)) {
|
||||
if (BuildConfig.DEBUG && !Settings.canDrawOverlays(this)) {
|
||||
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
|
||||
Uri.parse("package:" + getPackageName()));
|
||||
startActivityForResult(intent, OVERLAY_PERMISSION_REQ_CODE);
|
||||
@@ -156,7 +162,7 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
ServiceHelper.stop(this, LbrynetService.class);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
super.onDestroy();
|
||||
|
||||
if (mReactInstanceManager != null) {
|
||||
@@ -172,6 +178,14 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNewIntent(Intent intent) {
|
||||
if (mReactInstanceManager != null) {
|
||||
mReactInstanceManager.onNewIntent(intent);
|
||||
}
|
||||
super.onNewIntent(intent);
|
||||
}
|
||||
|
||||
private boolean isServiceRunning(Class<?> serviceClass) {
|
||||
ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package io.lbry.browser.reactmodules;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.app.NotificationManagerCompat;
|
||||
|
||||
@@ -8,27 +12,34 @@ import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.receivers.NotificationDeletedReceiver;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by akinwale on 3/15/18.
|
||||
*/
|
||||
|
||||
public class DownloadManagerModule extends ReactContextBaseJavaModule {
|
||||
|
||||
private Context context;
|
||||
|
||||
private HashMap<Integer, NotificationCompat.Builder> builders = new HashMap<Integer, NotificationCompat.Builder>();
|
||||
|
||||
private HashMap<String, Integer> downloadIdNotificationIdMap = new HashMap<String, Integer>();
|
||||
|
||||
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#");
|
||||
|
||||
private static final int MAX_PROGRESS = 100;
|
||||
|
||||
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.##");
|
||||
|
||||
private static final String GROUP_DOWNLOADS = "io.lbry.browser.GROUP_DOWNLOADS";
|
||||
|
||||
public static final String NOTIFICATION_ID_KEY = "io.lbry.browser.notificationId";
|
||||
|
||||
public static final int GROUP_ID = 0;
|
||||
|
||||
public static boolean groupCreated = false;
|
||||
|
||||
public DownloadManagerModule(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
this.context = reactContext;
|
||||
@@ -42,16 +53,48 @@ public class DownloadManagerModule extends ReactContextBaseJavaModule {
|
||||
public String getName() {
|
||||
return "LbryDownloadManager";
|
||||
}
|
||||
|
||||
private void createNotificationGroup() {
|
||||
if (!groupCreated) {
|
||||
Intent intent = new Intent(context, NotificationDeletedReceiver.class);
|
||||
intent.putExtra(NOTIFICATION_ID_KEY, GROUP_ID);
|
||||
|
||||
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, GROUP_ID, intent, 0);
|
||||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
|
||||
builder.setContentTitle("Active downloads")
|
||||
.setContentText("Active downloads")
|
||||
.setSmallIcon(R.drawable.ic_file_download_black_24dp)
|
||||
.setPriority(NotificationCompat.PRIORITY_LOW)
|
||||
.setGroup(GROUP_DOWNLOADS)
|
||||
.setGroupSummary(true)
|
||||
.setDeleteIntent(pendingIntent);
|
||||
notificationManager.notify(GROUP_ID, builder.build());
|
||||
|
||||
groupCreated = true;
|
||||
}
|
||||
}
|
||||
|
||||
private PendingIntent getLaunchPendingIntent(String uri) {
|
||||
Intent launchIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
|
||||
launchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
PendingIntent intent = PendingIntent.getActivity(context, 0, launchIntent, 0);
|
||||
return intent;
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void startDownload(String id, String fileName) {
|
||||
createNotificationGroup();
|
||||
|
||||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
|
||||
builder.setContentTitle(String.format("Downloading %s...", fileName))
|
||||
.setSmallIcon(R.drawable.ic_file_download_black_24dp)
|
||||
.setPriority(NotificationCompat.PRIORITY_LOW);
|
||||
|
||||
builder.setProgress(MAX_PROGRESS, 0, false);
|
||||
// The file URI is used as the unique ID
|
||||
builder.setContentIntent(getLaunchPendingIntent(id))
|
||||
.setContentTitle(String.format("Downloading %s...", fileName))
|
||||
.setGroup(GROUP_DOWNLOADS)
|
||||
.setPriority(NotificationCompat.PRIORITY_LOW)
|
||||
.setProgress(MAX_PROGRESS, 0, false)
|
||||
.setSmallIcon(R.drawable.ic_file_download_black_24dp);
|
||||
|
||||
int notificationId = generateNotificationId();
|
||||
downloadIdNotificationIdMap.put(id, notificationId);
|
||||
@@ -71,16 +114,21 @@ public class DownloadManagerModule extends ReactContextBaseJavaModule {
|
||||
return;
|
||||
}
|
||||
|
||||
createNotificationGroup();
|
||||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
|
||||
NotificationCompat.Builder builder = builders.get(notificationId);
|
||||
builder.setProgress(MAX_PROGRESS, new Double(progress).intValue(), false);
|
||||
builder.setContentText(String.format("%.0f%% (%s / %s)", progress, formatBytes(writtenBytes), formatBytes(totalBytes)));
|
||||
builder.setOngoing(true);
|
||||
builder.setContentIntent(getLaunchPendingIntent(id))
|
||||
.setContentText(String.format("%.0f%% (%s / %s)", progress, formatBytes(writtenBytes), formatBytes(totalBytes)))
|
||||
.setGroup(GROUP_DOWNLOADS)
|
||||
.setProgress(MAX_PROGRESS, new Double(progress).intValue(), false);
|
||||
notificationManager.notify(notificationId, builder.build());
|
||||
|
||||
if (progress == MAX_PROGRESS) {
|
||||
builder.setContentTitle(String.format("Downloaded %s.", fileName));
|
||||
builder.setOngoing(false);
|
||||
builder.setContentTitle(String.format("Downloaded %s", fileName))
|
||||
.setContentText(String.format("%s", formatBytes(totalBytes)))
|
||||
.setProgress(0, 0, false);
|
||||
notificationManager.notify(notificationId, builder.build());
|
||||
|
||||
downloadIdNotificationIdMap.remove(id);
|
||||
builders.remove(notificationId);
|
||||
}
|
||||
@@ -99,11 +147,15 @@ public class DownloadManagerModule extends ReactContextBaseJavaModule {
|
||||
|
||||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
|
||||
NotificationCompat.Builder builder = builders.get(notificationId);
|
||||
builder.setOngoing(false);
|
||||
notificationManager.cancel(notificationId);
|
||||
|
||||
|
||||
downloadIdNotificationIdMap.remove(id);
|
||||
builders.remove(notificationId);
|
||||
|
||||
if (builders.values().size() == 0) {
|
||||
notificationManager.cancel(GROUP_ID);
|
||||
groupCreated = false;
|
||||
}
|
||||
}
|
||||
|
||||
private String formatBytes(double bytes)
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package io.lbry.browser.reactmodules;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
|
||||
import com.mixpanel.android.mpmetrics.MixpanelAPI;
|
||||
|
||||
import io.lbry.browser.BuildConfig;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONException;
|
||||
|
||||
public class MixpanelModule extends ReactContextBaseJavaModule {
|
||||
|
||||
private static final String MIXPANEL_TOKEN = BuildConfig.DEBUG ?
|
||||
"bc1630b8be64c5dfaa4700b3a62969f3" /* Dev Testing */ :
|
||||
"93b81fb957cb0ddcd3198c10853a6a95"; /* Production */
|
||||
|
||||
private Context context;
|
||||
|
||||
private MixpanelAPI mixpanel;
|
||||
|
||||
public MixpanelModule(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
this.context = reactContext;
|
||||
this.mixpanel = MixpanelAPI.getInstance(this.context, MIXPANEL_TOKEN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Mixpanel";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void track(String name, ReadableMap payload) {
|
||||
JSONObject props = new JSONObject();
|
||||
try {
|
||||
if (payload != null) {
|
||||
HashMap<String, Object> payloadMap = payload.toHashMap();
|
||||
for (Map.Entry<String, Object> entry : payloadMap.entrySet()) {
|
||||
props.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
// Cannot use props. Stick with empty props.
|
||||
}
|
||||
|
||||
if (mixpanel != null) {
|
||||
mixpanel.track(name, props);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loaded 100 of 105 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user