diff --git a/BUILD.md b/BUILD.md
index b0201ea1..26954f8a 100644
--- a/BUILD.md
+++ b/BUILD.md
@@ -1,6 +1,8 @@
## 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.
+This app has currently only been built on Ubuntu 14.04, 16.04, 17.10, and 18.04, but these instructions, or an analog of them, should work on most Linux or macOS environments. An abridged version of these instructions is available at [QUICKSTART.md](QUICKSTART.md).
+
+For instructions on how to build using a Docker image, please see [DOCKER.md](DOCKER.md).
### Install Prerequisites
@@ -14,25 +16,31 @@ This app has currently only been built on Ubuntu 14.04, 16.04, 17.10, and 18.04,
* yarn
#### apt Packages
-Based on the quick-start instructions at http://buildozer.readthedocs.io/en/latest/installation.html
+Install all apt packages required by running the following commands:
```
sudo dpkg --add-architecture i386
-sudo apt-get update
-sudo apt-get install autoconf autogen build-essential curl libtool libffi-dev python python-pip python-openssl python3.7 python3.7-dev python3-pip ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 m4 libc6-dev-i386
+sudo apt-get -y update
+sudo apt-get install -y curl ca-certificates software-properties-common gpg-agent wget
+sudo add-apt-repository ppa:deadsnakes/ppa -y && \
+ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
+echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
+sudo apt-get -y update && apt-get -y install autoconf autogen automake libtool libffi-dev \
+ build-essential python3.7 python3.7-dev python3.7-venv python3-pip ccache git libncurses5:i386 libstdc++6:i386 \
+ libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev \
+ python-pip openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 m4 libc6-dev-i386 yarn gawk nodejs npm
```
Alternatively, the JDK available from http://www.oracle.com/technetwork/java/javase/downloads/index.html can be installed instead of the `openjdk-8-jdk` package.
#### Install Cython and Setuptools
```
-sudo pip install --upgrade cython==0.28.1 setuptools
+sudo -H pip install --upgrade cython==0.28.1 setuptools
```
#### Install buildozer
A forked version of `buildozer` needs to be installed in order to copy the React Native UI source files into the corresponding directories.
```
git clone https://github.com/lbryio/buildozer.git
-cd buildozer
-sudo python2.7 setup.py install
+cd buildozer && python2.7 setup.py install && cd ..
```
#### Create buildozer.spec
@@ -59,11 +67,18 @@ Assuming `lbry-android` as the current working folder:
| p4a.source_dir | Path to the python-for-android repository folder. Currently set to the included `p4a` folder |
| p4a.local_recipes | Path to a folder containing python_for_android recipes to be used in the build. The included `recipes` folder includes recipes for a successful build |
+#### Create google-services.json
+The `google-services.json` file is required for the build to be successful due to the Firebase implementation. Simply copy the provided sample file into the same destination folder.
+```
+cd lbry-android
+cp p4a/pythonforandroid/bootstraps/lbry/templates/google-services.sample.json p4a/pythonforandroid/bootstraps/lbry/templates/google-services.json
+```
+
#### Setup Android SDK for buildozer
Download the Android SDK, platform and build tools archives.
* Android API 23 SDK - https://dl.google.com/android/android-sdk_r23-linux.tgz
-* Android API 27 platform - https://dl.google.com/android/repository/platform-27_r01.zip
-* Android build tools 26.0.1 - https://dl.google.com/android/repository/build-tools_r26.0.1-linux.
+* Android API 28 platform - https://dl.google.com/android/repository/platform-28_r06.zip
+* Android build tools 26.0.2 - https://dl.google.com/android/repository/build-tools_r26.0.2-linux.zip
Create the `.buildozer` path (and the `android` sub-path) in your home folder if it doesn't already exist.
`mkdir ~/.buildozer`
@@ -75,17 +90,17 @@ tar -xf android-sdk_r23-linux.tgz ~/.buildozer/android/platform/
mv ~/.buildozer/android/platform/android-sdk-linux ~/.buildozer/android/platform/android-sdk-23
```
-Extract the API 27 platform archive into the `android-sdk-23` folder and rename the extracted folder.
+Extract the API 28 platform archive into the `android-sdk-23` folder and rename the extracted folder.
```
-unzip platform-27_r01.zip -d ~/.buildozer/android/platform/android-sdk-23/platforms
-mv ~/.buildozer/android/platform/android-sdk-23/platforms/android-8.1.0 ~/.buildozer/android/platform/android-sdk-23/platforms/android-27
+unzip ~/.buildozer/android/platform/platform-28_r06.zip -d ~/.buildozer/android/platform/android-sdk-23/platforms
+mv ~/.buildozer/android/platform/android-sdk-23/platforms/android-9 ~/.buildozer/android/platform/android-sdk-23/platforms/android-2
```
-Extract the build tools 26.0.1 build tools into the `android-sdk-23` folder and rename the extracted folder.
+Extract the build tools 26.0.2 build tools into the `android-sdk-23` folder and rename the extracted folder.
```
mkdir -p ~/.buildozer/android/platform/android-sdk-23/build-tools
-unzip ~/.buildozer/android/platform/build-tools_r26.0.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
+unzip ~/.buildozer/android/platform/build-tools_r26.0.2-linux.zip -d ~/.buildozer/android/platform/android-sdk-23/build-tools
+mv ~/.buildozer/android/platform/android-sdk-23/build-tools/android-8.1.0 ~/.buildozer/android/platform/android-sdk-23/build-tools/26.0.2
```
Finally, create the Android SDK license file. This prevents being prompted to accept the SDK license during the build process.
@@ -97,14 +112,17 @@ echo $'\nd56f5187479451eabf01fb78af6dfcb131a6481e' > ~/.buildozer/android/platfo
#### Setup Crystax Android NDK for buildozer
* Download the Crystax Android NDK from https://us.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz and extract. Remember to update `android.ndk_path` in your `buildozer.spec` to the path of the extracted Crystax NDK archive.
* Copy `build-target-python.sh` from the `scripts` folder in the cloned `lbry-android` repository to the `crystax-ndk-10.3.2/build/tools/` folder.
+* Copy `mangled-glibc-syscalls.h` from the `scripts` folder in the cloned `lbry-android` repository to the `crystax-ndk-10.3.2/platforms/android-21/arch-arm/usr/include/crystax/bionic/libc/include/sys/` folder.
* Delete the `android-9` folder in `crystax-ndk-10.3.2/platforms`, and create a symbolic link named `android-9` to the `android-21` folder.
#### Build and Deploy
-Run `npm i` in the `lbry-android/app` folder to install the necessary modules required by the React Native user interface.
+Run `npm install -g react-native-cli` to install React Native CLI tools.
+
+Run `npm i` in the `lbry-android/app` folder to install the necessary modules required by the React Native user interface, and then run `./bundle.sh`.
Run `./build.sh` in `lbry-android` to build the APK. The output can be found in the `bin` subdirectory.
-To build and deploy, you can run `./deploy.sh`. This requires a connected device or running Android emulator.
+To build and deploy, you can run `./deploy.sh`. This requires a connected device or a running Android emulator.
#### Development
If you already installed `Android SDK` and `adb`
diff --git a/DOCKER.md b/DOCKER.md
new file mode 100644
index 00000000..296f6041
--- /dev/null
+++ b/DOCKER.md
@@ -0,0 +1,69 @@
+# Introduction
+The purpose of this guide is to help whomever is interested in running the LBRY Android application from scratch on their device, but they're main computing platform is not Linux but macOS.
+
+## Estimated build time
+25 - 40 minutes (depending on Internet connection speeds)
+
+## What do you need?
+* A computer running the latest OS
+* Internet access to download modules and packages
+* At least 15GB of free disk space
+* Docker
+* Patience
+
+## Step 1/6
+Create an application on [Firebase](https://console.firebase.google.com). In the **Android package name** field, input `io.lbry.browser`. Download the resulting `google-services.json` file and keep it safe, you'll be needing it later.
+
+## Step 2/6
+Start the docker application and paste all of these lines into Terminal:
+
+```bash
+docker run -it lbry/android-base:latest /bin/bash
+wget "https://www.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz" -P ~/.buildozer/android/
+tar -xvf ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz -C ~/.buildozer/android/
+rm -rf ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
+ln -s ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21 ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-9
+git clone https://github.com/lbryio/lbry-android
+cd lbry-android;cp buildozer.spec.sample buildozer.spec
+cd app;npm i;cd ..
+cp scripts/build-target-python.sh ~/.buildozer/android/crystax-ndk-10.3.2/build/tools/build-target-python.sh
+cp scripts/mangled-glibc-syscalls.h ~/.buildozer/android/crystax-ndk-10.3.2/platforms/android-21/arch-arm/usr/include/crystax/bionic/libc/include/sys/mangled-glibc-syscalls.h
+cd p4a/pythonforandroid/bootstraps/lbry/build/templates
+apt install nano -y
+```
+
+## Step 3/6
+Copy the contents of the `google-services.json` you downloaded earlier and paste them into Terminal after running the next command:
+
+```bash
+nano google-services.json
+```
+
+Type `^X` to save and exit.
+
+## Step 4/6
+Paste more lines and I guess check your email, this will take some time:
+
+```bash
+cd /lbry-android/app
+./bundle.sh
+cd ..
+buildozer android debug
+```
+
+When the build is complete, you should see a message like: `[INFO]: # APK renamed to browser-0.7.3-debug.apk`. You will need this filename for the next step.
+
+## Step 5/6
+In a separate Terminal window:
+
+```bash
+docker ps # get container name
+docker cp CONTAINER_NAME:/lbry-android/bin/STEP_4_FILENAME ~/Desktop/ # copies STEP_4_FILENAME to your Desktop
+```
+
+## Step 6/6
+- Download [Android File Transfer](https://www.android.com/filetransfer) and install it.
+- On your Android device, install [File Explorer](https://play.google.com/store/apps/details?id=com.mauriciotogneri.fileexplorer).
+- Plug in your Android device and swipe down from the top into the "USB for file transfer" settings (or similar name on your device) and make sure "Transfer files" is selected.
+- Open **Android File Transfer** on your computer and drag and drop `STEP_4_FILENAME` from your Desktop to the `Downloads` folder on the Android device.
+- Back on the Android device, navigate to `STEP_4_FILENAME` in the `Downloads` folder and tap it to begin installation.
diff --git a/QUICKSTART.md b/QUICKSTART.md
index f5753a1c..99e8b8c2 100644
--- a/QUICKSTART.md
+++ b/QUICKSTART.md
@@ -72,18 +72,20 @@ wget 'https://www.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz' -
```
### Step 7 of 10
-Clone the lbryio/lbry-android git repository and create your buildozer.spec file. The provide buildozer.spec.sample contains defaults provided you followed steps 1 through 5 exactly as described. You can also customise the spec file if you want to.
+Clone the lbryio/lbry-android git repository and create your `buildozer.spec` and `google-services.json` files. The provided `buildozer.spec.sample` contains defaults provided you followed steps 1 through 5 exactly as described. You can also customise the spec file if you want to. The `google-services.sample.json` can be used to ensure the build completes successfully.
```
git clone https://github.com/lbryio/lbry-android
cd lbry-android
cp buildozer.spec.sample buildozer.spec
+cp p4a/pythonforandroid/bootstraps/lbry/templates/google-services.sample.json p4a/pythonforandroid/bootstraps/lbry/templates/google-services.json
```
### Step 8 of 10
-Install the npm packages required for the app's React Native code.
+Install the npm packages required for the app's React Native code, and create the React Native app bundle.
```
cd app
npm install
+./bundle.sh
cd ..
```
diff --git a/app/package-lock.json b/app/package-lock.json
index d0b2e16e..8f318d59 100644
--- a/app/package-lock.json
+++ b/app/package-lock.json
@@ -5553,7 +5553,7 @@
}
},
"lbry-redux": {
- "version": "github:lbryio/lbry-redux#71586660b61c5e98c9f183e06d9c881e33a38e5e",
+ "version": "github:lbryio/lbry-redux#b998577698d703714b0aa0c0e80c991902725a5c",
"from": "github:lbryio/lbry-redux#publishing",
"requires": {
"proxy-polyfill": "0.1.6",
diff --git a/app/src/component/channelSelector/index.js b/app/src/component/channelSelector/index.js
index 0f866697..daee8c76 100644
--- a/app/src/component/channelSelector/index.js
+++ b/app/src/component/channelSelector/index.js
@@ -21,4 +21,7 @@ const perform = dispatch => ({
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
});
-export default connect(select, perform)(ChannelSelector);
+export default connect(
+ select,
+ perform
+)(ChannelSelector);
diff --git a/app/src/component/channelSelector/view.js b/app/src/component/channelSelector/view.js
index 5ad334c3..33c4f085 100644
--- a/app/src/component/channelSelector/view.js
+++ b/app/src/component/channelSelector/view.js
@@ -34,19 +34,19 @@ export default class ChannelSelector extends React.PureComponent {
handleCreateCancel = () => {
this.setState({ showCreateChannel: false, newChannelName: '', newChannelBid: 0.1 });
- }
+ };
handlePickerValueChange = (itemValue, itemIndex) => {
if (Constants.ITEM_CREATE_A_CHANNEL === itemValue) {
this.setState({ showCreateChannel: true });
} else {
this.handleCreateCancel();
- this.handleChannelChange((Constants.ITEM_ANONYMOUS === itemValue) ? CLAIM_VALUES.CHANNEL_ANONYMOUS : itemValue);
+ this.handleChannelChange(Constants.ITEM_ANONYMOUS === itemValue ? CLAIM_VALUES.CHANNEL_ANONYMOUS : itemValue);
}
this.setState({ currentSelectedValue: itemValue });
- }
+ };
- handleChannelChange = (value) => {
+ handleChannelChange = value => {
const { onChannelChange } = this.props;
const { newChannelBid } = this.state;
const channel = value;
@@ -63,9 +63,9 @@ export default class ChannelSelector extends React.PureComponent {
onChannelChange(channel);
}
}
- }
+ };
- handleNewChannelNameChange = (value) => {
+ handleNewChannelNameChange = value => {
const { notify } = this.props;
let newChannelName = value;
@@ -83,9 +83,9 @@ export default class ChannelSelector extends React.PureComponent {
newChannelNameError,
newChannelName,
});
- }
+ };
- handleNewChannelBidChange = (newChannelBid) => {
+ handleNewChannelBidChange = newChannelBid => {
const { balance, notify } = this.props;
let newChannelBidError;
if (newChannelBid === 0) {
@@ -102,7 +102,7 @@ export default class ChannelSelector extends React.PureComponent {
newChannelBid,
newChannelBidError,
});
- }
+ };
handleCreateChannelClick = () => {
const { balance, createChannel, onChannelChange, notify } = this.props;
@@ -114,11 +114,10 @@ export default class ChannelSelector extends React.PureComponent {
}
if (this.channelExists(newChannelName)) {
- notify({ message: 'You have already created a channel with the same name.'});
+ notify({ message: 'You have already created a channel with the same name.' });
return;
}
-
if (newChannelBid > balance) {
notify({ message: 'Deposit cannot be higher than your balance' });
return;
@@ -136,7 +135,7 @@ export default class ChannelSelector extends React.PureComponent {
creatingChannel: false,
addingChannel: false,
currentSelectedValue: channelName,
- showCreateChannel: false
+ showCreateChannel: false,
});
if (onChannelChange) {
@@ -147,31 +146,34 @@ export default class ChannelSelector extends React.PureComponent {
const failure = () => {
notify({ message: 'Unable to create channel due to an internal error.' });
this.setState({
- creatingChannel: false
+ creatingChannel: false,
});
};
createChannel(channelName, newChannelBid).then(success, failure);
- }
+ };
- channelExists = (name) => {
+ channelExists = name => {
const { channels = [] } = this.props;
for (let channel of channels) {
- if (name.toLowerCase() === channel.name.toLowerCase() || `@${name}`.toLowerCase() === channel.name.toLowerCase()) {
+ if (
+ name.toLowerCase() === channel.name.toLowerCase() ||
+ `@${name}`.toLowerCase() === channel.name.toLowerCase()
+ ) {
return true;
}
}
return false;
- }
+ };
render() {
const channel = this.state.addingChannel ? 'new' : this.props.channel;
const { fetchingChannels, channels = [] } = this.props;
console.log(channels);
- const pickerItems = [
- { name: Constants.ITEM_ANONYMOUS },
- { name: Constants.ITEM_CREATE_A_CHANNEL }].concat(channels);
+ const pickerItems = [{ name: Constants.ITEM_ANONYMOUS }, { name: Constants.ITEM_CREATE_A_CHANNEL }].concat(
+ channels
+ );
const {
newChannelName,
newChannelNameError,
@@ -188,47 +190,55 @@ export default class ChannelSelector extends React.PureComponent {
selectedValue={this.state.currentSelectedValue}
style={channelSelectorStyle.channelPicker}
itemStyle={channelSelectorStyle.channelPickerItem}
- onValueChange={this.handlePickerValueChange}>
- {pickerItems.map(item => )}
+ onValueChange={this.handlePickerValueChange}
+ >
+ {pickerItems.map(item => (
+
+ ))}
{this.state.showCreateChannel && (
-
-
-
- Deposit
+
+
+ Deposit
+
- LBC
-
- This LBC remains yours. It is a deposit to reserve the name and can be undone at any time.
+ LBC
+
+
+ This LBC remains yours. It is a deposit to reserve the name and can be undone at any time.
+
-
- {creatingChannel && }
- {!creatingChannel &&
-
-
- }
+
+ {creatingChannel && }
+ {!creatingChannel && (
+
+
+
+ )}
+
-
)}
);
}
-}
\ No newline at end of file
+}
diff --git a/app/src/component/fileItemMedia/view.js b/app/src/component/fileItemMedia/view.js
index d42bc007..ac016678 100644
--- a/app/src/component/fileItemMedia/view.js
+++ b/app/src/component/fileItemMedia/view.js
@@ -96,7 +96,8 @@ class FileItemMedia extends React.PureComponent {
)}
{!isResolvingUri && (
- {title && title.trim().length > 0 &&
+ {title &&
+ title.trim().length > 0 &&
title
.replace(/\s+/g, '')
.substring(0, Math.min(title.replace(' ', '').length, 5))
diff --git a/app/src/component/walletSend/view.js b/app/src/component/walletSend/view.js
index 428f9b13..f1d33ae0 100644
--- a/app/src/component/walletSend/view.js
+++ b/app/src/component/walletSend/view.js
@@ -1,9 +1,10 @@
// @flow
import React from 'react';
import { regexAddress } from 'lbry-redux';
-import { Alert, TextInput, Text, View } from 'react-native';
-import Button from '../button';
-import walletStyle from '../../styles/wallet';
+import { Alert, Clipboard, TextInput, Text, View } from 'react-native';
+import Button from 'component/button';
+import Colors from 'styles/colors';
+import walletStyle from 'styles/wallet';
type DraftTransaction = {
address: string,
@@ -99,10 +100,16 @@ class WalletSend extends React.PureComponent {
onBlur={this.handleAddressInputBlur}
onSubmitEditing={this.handleAddressInputSubmit}
placeholder={'bbFxRyXXXXXXXXXXXZD8nE7XTLUxYnddTs'}
+ underlineColorAndroid={Colors.NextLbryGreen}
value={this.state.address}
returnKeyType={'next'}
style={[walletStyle.input, walletStyle.addressInput, walletStyle.bottomMarginMedium]}
/>
+