Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
93e8882433 | ||
|
|
56a49e323a | ||
|
|
de97703128 | ||
|
|
f820d19f55 | ||
|
|
a2094e9953 | ||
|
|
e5000f6502 | ||
|
|
9d63c50a2d | ||
|
|
ee90951945 | ||
|
|
8ed87d0739 | ||
|
|
1ebac0df21 | ||
|
|
a4e6025607 | ||
|
|
6ef03b8921 | ||
|
|
fdd6c87a31 | ||
|
|
89bfc845f6 | ||
|
|
9af5c0e0f4 | ||
|
|
8e92b21d60 | ||
|
|
9882d9d1c9 | ||
|
|
55275e48de | ||
|
|
3da896d369 | ||
|
|
745aa61466 | ||
|
|
2672144dbe | ||
|
|
ccbad4be1b | ||
|
|
dad3b86ba7 | ||
|
|
cfb81fc530 | ||
|
|
56afde24db | ||
|
|
88fdc1b503 | ||
|
|
338cd20132 | ||
|
|
ad38a09052 | ||
|
|
078e010c54 | ||
|
|
4ae4a7366a | ||
|
|
bfefc53040 | ||
|
|
f8af04ba4b | ||
|
|
e8a572032a | ||
|
|
5ef300b4a4 | ||
|
|
5e3275e547 | ||
|
|
5a55beee7b | ||
|
|
b8e52e2117 | ||
|
|
541f824909 | ||
|
|
4e763be6ec | ||
|
|
afaa00d635 | ||
|
|
1aa03edf6e | ||
|
|
cafada6ede | ||
|
|
36e0127e2b | ||
|
|
0af369bf23 | ||
|
|
a133f7d82d | ||
|
|
f66b8affb1 | ||
|
|
45ab233d01 | ||
|
|
676617ef19 | ||
|
|
af3baa99b8 | ||
|
|
33abefdd14 | ||
|
|
1cbebd0c9e | ||
|
|
245942ff14 | ||
|
|
608a08d2e8 | ||
|
|
fbb0d7090b | ||
|
|
40c890e644 | ||
|
|
35cf4255a6 | ||
|
|
0da47c409f | ||
|
|
541f582ac1 |
No files matched your search
@@ -6,4 +6,6 @@ build.log
|
||||
recipes/**/*.pyc
|
||||
src/main/assets/index.android.bundle
|
||||
src/main/assets/index.android.bundle.meta
|
||||
*.log
|
||||
.vagrant
|
||||
|
||||
+15
-3
@@ -28,13 +28,13 @@ install:
|
||||
- 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/platform-27_r01.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
|
||||
- unzip -qq ~/.buildozer/android/platform/platform-27_r01.zip -d ~/.buildozer/android/platform/android-sdk-23/platforms
|
||||
- mv ~/.buildozer/android/platform/android-sdk-23/platforms/android-8.1.0 ~/.buildozer/android/platform/android-sdk-23/platforms/android-27
|
||||
- mkdir -p ~/.buildozer/android/platform/android-sdk-23/build-tools
|
||||
- unzip -qq ~/.buildozer/android/platform/build-tools_r26.0.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
|
||||
@@ -69,6 +69,18 @@ deploy:
|
||||
skip_cleanup: true
|
||||
on:
|
||||
tags: true
|
||||
- provider: s3
|
||||
access_key_id:
|
||||
secure: qEZZ73DWBn9+M2pS4VwsyX8YZjZOENIMP/eoU1A9Vbn155oZpbUaJ7k+4cAXqmBm0WBMKZDqpzCRSGehLAxHFH5rjkj9gLSgd8fY9cveABHkl50HeuxxNsQM+ytk9sCtP8bWOqf7rT/iCgM1soyF2pYmfHM3tU9l0fWK8oZ7pFRIg91hXxUvhvYY2u6B9D1NqSN9T3xtrwEkVjvmkmyKMLCtoIdyB7QdeQciFdGFhZC9DYJVRLxa3BlzZ1T8Qv4MCyIxPjxIugNvVR64VgGjdBdq0BEIyoRqbeIvtqQjlnne4DfJFeCmbDrSva1wDP1UyFoxsRhiWQ/jXXgIyN2CisI6QRD0J+a2LgmbmtkUzhRMuVQJmBrIauulOzcowwRV2J4TtUaAJK9iSHT9D3RLzpazCOnjvJZV9CK5w252Vs5eHnisCSCQk8Ozox96Sg6XW580NEXfkYoGzXLSGiy9zrZs813blUjssEY+jIQmJEby80C3guK7/G4lzthv57psqBWcYd0tFR+vTestS+EFlC02ToUngJhW7I7lPA2G2yrJ5319jFxUSniijb1n72TQthnbqTBahepvKvuG1iWZnCKxS5sWkutFoqEcpQyhXdf7QdR/VrOr8N5xrhK1B8dCYZM6h8eMZbBvOLH49+N6L9jiJz5x+Lk32wcssv1oOgI=
|
||||
secret_access_key:
|
||||
secure: lPygaaJdjFgWY4GcXUXC4Oc5op/TE85Md8lX2bzW19058lbcqYSdM0WySQCxoU/4rlM4Q0N8du0qQ3kZXDpP9XSqvFTVnTGTuB4yghUR1yXcpt6u3JOeOX+YAc3wyQ/pmod6VGO0n8pm8hBVsSFXufdBTjD2W+tNrDoa8RYnlWrt7BbICGltB7PcqYh1Qw6S1wDyZt8I4B5JHDhyJmX6FT5KfOb5cJyynpxlKUstUfy1rh81KuGkEcuEVOLg1s7HE1/IUkVIgezAuCrMHjc86qbNcHULJMFCVYntvvs07+tctrPxA/cfS24WkW7smyij+gdZAZWNNgkIDCuwqpex1v1nKn56mC8xXyUl4CnSCuubQtqUBzTmd4T5sF7trTtpVr9NInwy+4mUoCpz2UKZekTjZkqpzCAuC/cBVWE1/k3wsNat6dGyc9QnKXBqLVhuwYsCOteqLW50ToMMMW0ccDV6FXodwZmrunGd5wIX+UgZkf4l32vzKUxHtIupfYbsjylcPc3VO0OzMMKP/3sYLAN6QntVDFc30k1uqqpgJN4t0nV7vvjMI+b0Qr+o7GzUV2d+QulQXOySJgB2pH0kV1EoPAJ8KbqDOy8KgCJl0YIbOaz14+SiRQhotJ2hrLdtsvyVYXMX+d/CKHJSWa2MQq+jD7lMCwVaGg82PFN1gI4=
|
||||
bucket: "build.lbry.io"
|
||||
upload-dir: "android/build-${TRAVIS_BUILD_NUMBER}_commit-${TRAVIS_COMMIT:0:7}"
|
||||
region: us-east-1
|
||||
overwrite: true
|
||||
skip_cleanup: true
|
||||
on:
|
||||
all_branches: true
|
||||
env:
|
||||
global:
|
||||
- secure: GS3Cp1QXiX8UPye3kdk2A2f3iFRr02sHKpY+RE+Zvx3Q7GDmhDuepHKzx6Hq5Os5fZN9Y/Bdds+XH+vLIRtT6XsWR7AONPhSifVY3XB5/2F+lDcZ538W8P8GZvXejpY4VecMUWHoWbuyt0s3PpaGXZJcHp8ir+CUJ0NUmU3I9w449pqj9/de2LHtG3qKH1lG0Xz58iOC0mmEeH451cQv3dDw851ihA4ak9vCTV1KKuMJUcv+2u6PxXGVX0mrJLEssjL6ze6G5iZUB4PM1vUpe3HqcVw8CSOa8O79BQxoB00qyA3WD+LpZDPpI0wh6gmBsR/2nCFyMJndJr3CjyB6lHdK7PgBoK0CJjszKawiZqg74O9DOjzTJTO2v9bnkfPrNxu4/3D/tbDg+whY8k5oV1sgDue9KAo/2aEEO0LGlKP4W3Qqt/lzRKsfpMVrMTdCNKJ8rG/wUFWw8ehOCmAsJaQ1saDOZDMNPLLuYpxFgmXFqWV5ThbUHgEJVj+G7qt6CMEussKvuZJoJZx24Pdk5Prr7ENzTyPmE5gk4b8WNfVNleOEC09xu5tFk2yOdzF1dawKsa1Mog6gImirTQ/INC/3BANdKoG9/cLJEIt9boJaFDXE1dpqoLVzoez9znHKOGSAU/1PaH3thjVnbUyO5z24PpPZ12zM3+3P8DbI454=
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
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.
|
||||
|
||||
<img src="https://spee.ch/8/lbry-android.png" alt="LBRY Android Screenshot" width="384px" />
|
||||
|
||||
## Installation
|
||||
The minimum supported Android version is 5.0 Lollipop. There are two ways to install:
|
||||
|
||||
|
||||
Vendored
+97
@@ -0,0 +1,97 @@
|
||||
echoed=false
|
||||
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.box = "ubuntu/bionic64"
|
||||
#config.disksize.size = "20GB"
|
||||
|
||||
config.vm.provider "virtualbox" do |v|
|
||||
host = RbConfig::CONFIG['host_os']
|
||||
|
||||
# Give VM 1/4 system memory & access to all cpu cores on the host
|
||||
if host =~ /darwin/
|
||||
cpus = `sysctl -n hw.ncpu`.to_i
|
||||
# sysctl returns Bytes and we need to convert to MB
|
||||
mem = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 4
|
||||
elsif host =~ /linux/
|
||||
cpus = `nproc`.to_i
|
||||
# meminfo shows KB and we need to convert to MB
|
||||
mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 4
|
||||
else
|
||||
cpus = `wmic cpu get NumberOfCores`.split("\n")[2].to_i
|
||||
mem = `wmic OS get TotalVisibleMemorySize`.split("\n")[2].to_i / 1024 /4
|
||||
end
|
||||
|
||||
mem = mem / 1024 / 4
|
||||
mem = [mem, 2048].max # Minimum 2048
|
||||
|
||||
if echoed === false
|
||||
echoed=true
|
||||
puts("Memory", mem)
|
||||
puts("CPUs", cpus)
|
||||
end
|
||||
|
||||
#v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/home_vagrant_lbry-android", "1"]
|
||||
#v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant", "1"]
|
||||
v.customize ["modifyvm", :id, "--memory", mem]
|
||||
v.customize ["modifyvm", :id, "--cpus", cpus]
|
||||
end
|
||||
|
||||
config.vm.synced_folder "./", "/home/vagrant/lbry-android"
|
||||
|
||||
|
||||
config.vm.provision "shell", inline: <<-SHELL
|
||||
dpkg --add-architecture i386
|
||||
apt-get update
|
||||
apt-get install -y libssl-dev
|
||||
apt-get install -y autoconf libffi-dev pkg-config libtool build-essential ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 m4 libc6-dev-i386 python-pip
|
||||
pip install -f --upgrade setuptools pyopenssl
|
||||
git clone https://github.com/lbryio/buildozer.git
|
||||
cd buildozer
|
||||
python2.7 setup.py install
|
||||
cd ../
|
||||
rm -rf ./buildozer
|
||||
|
||||
# Install additonal buildozer dependencies
|
||||
sudo apt-get install cython
|
||||
|
||||
# Install node
|
||||
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
|
||||
sudo apt-get install -y nodejs
|
||||
|
||||
export HOME=/home/vagrant
|
||||
|
||||
cp $HOME/lbry-android/buildozer.spec.vagrant $HOME/lbry-android/buildozer.spec
|
||||
|
||||
mkdir -p cd $HOME/.buildozer/android/platform/
|
||||
wget -q 'https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip' -P $HOME/.buildozer/android/platform/
|
||||
wget -q 'https://dl.google.com/android/android-sdk_r23-linux.tgz' -P $HOME/.buildozer/android/platform/
|
||||
wget -q 'https://dl.google.com/android/repository/platform-27_r01.zip' -P $HOME/.buildozer/android/platform/
|
||||
wget -q 'https://dl.google.com/android/repository/build-tools_r26.0.1-linux.zip' -P $HOME/.buildozer/android/platform/
|
||||
unzip -qq $HOME/.buildozer/android/platform/android-ndk-r13b-linux-x86_64.zip -d $HOME/.buildozer/android/platform/
|
||||
rm $HOME/.buildozer/android/platform/android-ndk-r13b-linux-x86_64.zip
|
||||
tar -xf $HOME/.buildozer/android/platform/android-sdk_r23-linux.tgz -C $HOME/.buildozer/android/platform/
|
||||
rm $HOME/.buildozer/android/platform/android-sdk_r23-linux.tgz
|
||||
mv $HOME/.buildozer/android/platform/android-sdk-linux $HOME/.buildozer/android/platform/android-sdk-23
|
||||
unzip -qq $HOME/.buildozer/android/platform/android-23_r02.zip -d $HOME/.buildozer/android/platform/android-sdk-23/platforms
|
||||
rm $HOME/.buildozer/android/platform/platform-27_r01.zip
|
||||
mv $HOME/.buildozer/android/platform/android-sdk-23/platforms/android-8.1.0 $HOME/.buildozer/android/platform/android-sdk-23/platforms/android-27
|
||||
mkdir -p $HOME/.buildozer/android/platform/android-sdk-23/build-tools
|
||||
unzip -qq $HOME/.buildozer/android/platform/build-tools_r26.0.1-linux.zip -d $HOME/.buildozer/android/platform/android-sdk-23/build-tools
|
||||
rm $HOME/.buildozer/android/platform/build-tools_r26.0.1-linux.zip
|
||||
mv $HOME/.buildozer/android/platform/android-sdk-23/build-tools/android-8.0.0 $HOME/.buildozer/android/platform/android-sdk-23/build-tools/26.0.1
|
||||
mkdir -p $HOME/.buildozer/android/platform/android-sdk-23/licenses
|
||||
|
||||
rm -rf $HOME/.buildozer/android/platform/android-sdk-23/tools
|
||||
# https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
|
||||
wget -q https://dl.google.com/android/repository/tools_r25.2.5-linux.zip
|
||||
unzip -o -q ./tools_r25.2.5-linux.zip -d $HOME/.buildozer/android/platform/android-sdk-23/
|
||||
rm sdk-tools-linux-3859397.zip
|
||||
|
||||
echo $'\nd56f5187479451eabf01fb78af6dfcb131a6481e' > $HOME/.buildozer/android/platform/android-sdk-23/licenses/android-sdk-license
|
||||
|
||||
sudo chown -r vagrant $HOME
|
||||
|
||||
echo "Installing React Native via NPM..."
|
||||
sudo npm install -g react-native-cli
|
||||
SHELL
|
||||
end
|
||||
Generated
+1353
-1315
File diff suppressed because it is too large.
Load diff
+4
-2
@@ -10,15 +10,17 @@
|
||||
"moment": "^2.22.1",
|
||||
"react": "16.2.0",
|
||||
"react-native": "0.55.3",
|
||||
"react-native-fetch-blob": "^0.10.8",
|
||||
"react-native-image-zoom-viewer": "^2.2.5",
|
||||
"react-native-vector-icons": "^4.5.0",
|
||||
"react-native-video": "2.0.0",
|
||||
"react-native-vector-icons": "^5.0.0",
|
||||
"react-native-video": "lbryio/react-native-video#exoplayer-lbry-android",
|
||||
"react-navigation": "^1.5.12",
|
||||
"react-navigation-redux-helpers": "^1.0.1",
|
||||
"react-redux": "^5.0.3",
|
||||
"redux": "^3.6.0",
|
||||
"redux-logger": "3.0.6",
|
||||
"redux-persist": "^4.8.0",
|
||||
"redux-persist-filesystem-storage": "^1.2.0",
|
||||
"redux-persist-transform-compress": "^4.2.0",
|
||||
"redux-persist-transform-filter": "0.0.10",
|
||||
"redux-thunk": "^2.2.0"
|
||||
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
} 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 Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import discoverStyle from '../styles/discover';
|
||||
import searchStyle from '../styles/search';
|
||||
import SearchRightHeaderIcon from "../component/searchRightHeaderIcon";
|
||||
@@ -39,7 +39,7 @@ const discoverStack = StackNavigator({
|
||||
screen: DiscoverPage,
|
||||
navigationOptions: ({ navigation }) => ({
|
||||
title: 'Discover',
|
||||
headerLeft: <Feather name="menu" size={24} style={discoverStyle.drawerHamburger} onPress={() => navigation.navigate('DrawerOpen')} />,
|
||||
headerLeft: <Icon name="bars" size={24} style={discoverStyle.drawerHamburger} onPress={() => navigation.navigate('DrawerOpen')} />,
|
||||
})
|
||||
},
|
||||
File: {
|
||||
@@ -64,7 +64,7 @@ const trendingStack = StackNavigator({
|
||||
screen: TrendingPage,
|
||||
navigationOptions: ({ navigation }) => ({
|
||||
title: 'Trending',
|
||||
headerLeft: <Feather name="menu" size={24} style={discoverStyle.drawerHamburger} onPress={() => navigation.navigate('DrawerOpen')} />,
|
||||
headerLeft: <Icon name="bars" size={24} style={discoverStyle.drawerHamburger} onPress={() => navigation.navigate('DrawerOpen')} />,
|
||||
})
|
||||
}
|
||||
});
|
||||
@@ -74,7 +74,7 @@ const walletStack = StackNavigator({
|
||||
screen: WalletPage,
|
||||
navigationOptions: ({ navigation }) => ({
|
||||
title: 'Wallet',
|
||||
headerLeft: <Feather name="menu" size={24} style={discoverStyle.drawerHamburger} onPress={() => navigation.navigate('DrawerOpen')} />,
|
||||
headerLeft: <Icon name="bars" size={24} style={discoverStyle.drawerHamburger} onPress={() => navigation.navigate('DrawerOpen')} />,
|
||||
})
|
||||
},
|
||||
TransactionHistory: {
|
||||
@@ -128,12 +128,14 @@ class AppWithNavigationState extends React.Component {
|
||||
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].routes && nav.routes[0].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) {
|
||||
@@ -142,7 +144,7 @@ class AppWithNavigationState extends React.Component {
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return false;fo
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import React from 'react';
|
||||
import { Text, TouchableOpacity } from 'react-native';
|
||||
import buttonStyle from '../../styles/button';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome';
|
||||
import Colors from '../../styles/colors';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
|
||||
export default class Button extends React.PureComponent {
|
||||
render() {
|
||||
@@ -10,9 +11,10 @@ export default class Button extends React.PureComponent {
|
||||
style,
|
||||
text,
|
||||
icon,
|
||||
theme,
|
||||
onPress
|
||||
} = this.props;
|
||||
|
||||
|
||||
let styles = [buttonStyle.button, buttonStyle.row];
|
||||
if (style) {
|
||||
if (style.length) {
|
||||
@@ -21,19 +23,26 @@ export default class Button extends React.PureComponent {
|
||||
styles.push(style);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (disabled) {
|
||||
styles.push(buttonStyle.disabled);
|
||||
}
|
||||
|
||||
|
||||
const textStyles = [buttonStyle.text];
|
||||
if (icon && icon.trim().length > 0) {
|
||||
textStyles.push(buttonStyle.textWithIcon);
|
||||
}
|
||||
|
||||
|
||||
if (theme === 'light') {
|
||||
textStyles.push(buttonStyle.textDark);
|
||||
} else {
|
||||
// Dark background, default
|
||||
textStyles.push(buttonStyle.textLight);
|
||||
}
|
||||
|
||||
return (
|
||||
<TouchableOpacity disabled={disabled} style={styles} onPress={onPress}>
|
||||
{icon && <Icon name={icon} size={18} color='#ffffff' class={buttonStyle.icon} /> }
|
||||
{icon && <Icon name={icon} size={18} color={'light' === theme ? Colors.DarkGrey : Colors.White} />}
|
||||
{text && (text.trim().length > 0) && <Text style={textStyles}>{text}</Text>}
|
||||
</TouchableOpacity>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React from 'react';
|
||||
import { NativeModules, Text, View, TouchableOpacity } from 'react-native';
|
||||
import Button from '../button';
|
||||
import fileDownloadButtonStyle from '../../styles/fileDownloadButton';
|
||||
|
||||
class FileDownloadButton extends React.PureComponent {
|
||||
@@ -7,14 +8,14 @@ class FileDownloadButton extends React.PureComponent {
|
||||
const { costInfo, fetchCostInfo, uri } = this.props;
|
||||
if (costInfo === undefined) {
|
||||
fetchCostInfo(uri);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
//this.checkAvailability(nextProps.uri);
|
||||
this.restartDownload(nextProps);
|
||||
}
|
||||
|
||||
|
||||
restartDownload(props) {
|
||||
const { downloading, fileInfo, uri, restartDownload } = props;
|
||||
|
||||
@@ -28,7 +29,7 @@ class FileDownloadButton extends React.PureComponent {
|
||||
restartDownload(uri, fileInfo.outpoint);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
const {
|
||||
fileInfo,
|
||||
@@ -36,6 +37,8 @@ class FileDownloadButton extends React.PureComponent {
|
||||
uri,
|
||||
purchaseUri,
|
||||
costInfo,
|
||||
isPlayable,
|
||||
onPlay,
|
||||
loading,
|
||||
doPause,
|
||||
style,
|
||||
@@ -46,7 +49,7 @@ class FileDownloadButton extends React.PureComponent {
|
||||
const progress =
|
||||
fileInfo && fileInfo.written_bytes ? fileInfo.written_bytes / fileInfo.total_bytes * 100 : 0,
|
||||
label = fileInfo ? progress.toFixed(0) + '% complete' : 'Connecting...';
|
||||
|
||||
|
||||
return (
|
||||
<View style={[style, fileDownloadButtonStyle.container]}>
|
||||
<View style={{ width: `${progress}%`, backgroundColor: '#ff0000', position: 'absolute', left: 0, top: 0 }}></View>
|
||||
@@ -62,14 +65,17 @@ class FileDownloadButton extends React.PureComponent {
|
||||
);
|
||||
}
|
||||
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>
|
||||
</TouchableOpacity>
|
||||
<Button icon={isPlayable ? 'play' : null}
|
||||
text={isPlayable ? 'Play' : 'Download'}
|
||||
style={[style, fileDownloadButtonStyle.container]} onPress={() => {
|
||||
if (NativeModules.Mixpanel) {
|
||||
NativeModules.Mixpanel.track('Purchase Uri', { Uri: uri });
|
||||
}
|
||||
purchaseUri(uri);
|
||||
if (isPlayable && onPlay) {
|
||||
this.props.onPlay();
|
||||
}
|
||||
}} />
|
||||
);
|
||||
} else if (fileInfo && fileInfo.download_path) {
|
||||
return (
|
||||
|
||||
@@ -23,7 +23,7 @@ class FileItem extends React.PureComponent {
|
||||
|
||||
resolve(props) {
|
||||
const { isResolvingUri, resolveUri, claim, uri } = props;
|
||||
|
||||
|
||||
if (!isResolvingUri && claim === undefined && uri) {
|
||||
resolveUri(uri);
|
||||
}
|
||||
@@ -47,15 +47,6 @@ class FileItem extends React.PureComponent {
|
||||
const isRewardContent = claim && rewardedContentClaimIds.includes(claim.claim_id);
|
||||
const channelName = claim ? claim.channel_name : null;
|
||||
|
||||
let description = '';
|
||||
if (isResolvingUri && !claim) {
|
||||
description = 'Loading...';
|
||||
} else if (metadata && metadata.description) {
|
||||
description = metadata.description;
|
||||
} else if (claim === null) {
|
||||
description = 'This address contains no content.';
|
||||
}
|
||||
|
||||
return (
|
||||
<View style={style}>
|
||||
<TouchableOpacity style={discoverStyle.container} onPress={() => {
|
||||
@@ -65,12 +56,16 @@ class FileItem extends React.PureComponent {
|
||||
navigation.navigate({ routeName: 'File', key: uri, params: { uri } });
|
||||
}
|
||||
}>
|
||||
<FileItemMedia title={title} thumbnail={thumbnail} blurRadius={obscureNsfw ? 15 : 0} resizeMode="cover" />
|
||||
<FileItemMedia title={title}
|
||||
thumbnail={thumbnail}
|
||||
blurRadius={obscureNsfw ? 15 : 0}
|
||||
resizeMode="cover"
|
||||
isResolvingUri={isResolvingUri} />
|
||||
<FilePrice uri={uri} style={discoverStyle.filePriceContainer} textStyle={discoverStyle.filePriceText} />
|
||||
<Text style={discoverStyle.fileItemName}>{title}</Text>
|
||||
{channelName &&
|
||||
<Link style={discoverStyle.channelName} text={channelName} onPress={() => {
|
||||
const channelUri = normalizeURI(channelName);
|
||||
const channelUri = normalizeURI(channelName);
|
||||
navigation.navigate({ routeName: 'File', key: channelUri, params: { uri: channelUri }});
|
||||
}} />}
|
||||
</TouchableOpacity>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import { Text, Image, View } from 'react-native';
|
||||
import fileItemMediaStyle from '../../styles/fileItemMedia';
|
||||
import { ActivityIndicator, Image, Text, View } from 'react-native';
|
||||
import Colors from '../../styles/colors';
|
||||
import fileItemMediaStyle from '../../styles/fileItemMedia';
|
||||
|
||||
class FileItemMedia extends React.PureComponent {
|
||||
static AUTO_THUMB_STYLES = [
|
||||
@@ -28,14 +29,14 @@ class FileItemMedia extends React.PureComponent {
|
||||
|
||||
render() {
|
||||
let style = this.props.style;
|
||||
const { title, thumbnail, blurRadius, resizeMode } = this.props;
|
||||
const { blurRadius, isResolvingUri, thumbnail, title, resizeMode } = this.props;
|
||||
const atStyle = this.state.autoThumbStyle;
|
||||
|
||||
if (thumbnail && ((typeof thumbnail) === 'string')) {
|
||||
if (style == null) {
|
||||
style = fileItemMediaStyle.thumbnail;
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<Image source={{uri: thumbnail}}
|
||||
blurRadius={blurRadius}
|
||||
@@ -43,14 +44,20 @@ class FileItemMedia extends React.PureComponent {
|
||||
style={style} />
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<View style={[style ? style : fileItemMediaStyle.autothumb, atStyle]}>
|
||||
<Text style={fileItemMediaStyle.autothumbText}>{title &&
|
||||
{isResolvingUri && (
|
||||
<View style={fileItemMediaStyle.resolving}>
|
||||
<ActivityIndicator color={Colors.White} size={"large"} />
|
||||
<Text style={fileItemMediaStyle.text}>Resolving...</Text>
|
||||
</View>
|
||||
)}
|
||||
{!isResolvingUri && <Text style={fileItemMediaStyle.autothumbText}>{title &&
|
||||
title
|
||||
.replace(/\s+/g, '')
|
||||
.substring(0, Math.min(title.replace(' ', '').length, 5))
|
||||
.toUpperCase()}</Text>
|
||||
.toUpperCase()}</Text>}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,18 +2,36 @@ import React from 'react';
|
||||
import { Linking, Text, TouchableOpacity } from 'react-native';
|
||||
|
||||
export default class Link extends React.PureComponent {
|
||||
|
||||
constructor(props) {
|
||||
super(props)
|
||||
this.state = {
|
||||
tappedStyle: false,
|
||||
}
|
||||
this.addTappedStyle = this.addTappedStyle.bind(this)
|
||||
}
|
||||
|
||||
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']
|
||||
}));
|
||||
if (this.props.effectOnTap) this.addTappedStyle();
|
||||
Linking.openURL(href)
|
||||
.then(() => setTimeout(() => { this.setState({ tappedStyle: false }); }, 2000))
|
||||
.catch(err => {
|
||||
notify({ message: error, displayType: ['toast']})
|
||||
this.setState({tappedStyle: false})
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
addTappedStyle() {
|
||||
this.setState({ tappedStyle: true });
|
||||
setTimeout(() => { this.setState({ tappedStyle: false }); }, 2000);
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
@@ -30,6 +48,10 @@ export default class Link extends React.PureComponent {
|
||||
styles.push(style);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.props.effectOnTap && this.state.tappedStyle) {
|
||||
styles.push(this.props.effectOnTap);
|
||||
}
|
||||
|
||||
return (
|
||||
<Text style={styles} onPress={onPress ? onPress : this.handlePress}>
|
||||
|
||||
@@ -9,23 +9,23 @@ import {
|
||||
TouchableOpacity
|
||||
} from 'react-native';
|
||||
import Video from 'react-native-video';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import FileItemMedia from '../fileItemMedia';
|
||||
import mediaPlayerStyle from '../../styles/mediaPlayer';
|
||||
import mediaPlayerStyle from '../../styles/mediaPlayer';
|
||||
|
||||
class MediaPlayer extends React.PureComponent {
|
||||
static ControlsTimeout = 3000;
|
||||
|
||||
|
||||
seekResponder = null;
|
||||
|
||||
|
||||
seekerWidth = 0;
|
||||
|
||||
|
||||
trackingOffset = 0;
|
||||
|
||||
|
||||
tracking = null;
|
||||
|
||||
|
||||
video = null;
|
||||
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
@@ -35,60 +35,61 @@ class MediaPlayer extends React.PureComponent {
|
||||
resizeMode: 'stretch',
|
||||
duration: 0.0,
|
||||
currentTime: 0.0,
|
||||
paused: true,
|
||||
paused: !props.autoPlay,
|
||||
fullscreenMode: false,
|
||||
areControlsVisible: true,
|
||||
controlsTimeout: -1,
|
||||
seekerOffset: 0,
|
||||
seekerPosition: 0,
|
||||
firstPlay: true
|
||||
firstPlay: true,
|
||||
seekTimeout: -1
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
formatTime(time) {
|
||||
let str = '';
|
||||
let minutes = 0, hours = 0, seconds = parseInt(time, 10);
|
||||
if (seconds > 60) {
|
||||
minutes = parseInt(seconds / 60, 10);
|
||||
seconds = seconds % 60;
|
||||
|
||||
|
||||
if (minutes > 60) {
|
||||
hours = parseInt(minutes / 60, 10);
|
||||
minutes = minutes % 60;
|
||||
}
|
||||
|
||||
|
||||
str = (hours > 0 ? this.pad(hours) + ':' : '') + this.pad(minutes) + ':' + this.pad(seconds);
|
||||
} else {
|
||||
str = '00:' + this.pad(seconds);
|
||||
}
|
||||
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
pad(value) {
|
||||
if (value < 10) {
|
||||
return '0' + String(value);
|
||||
}
|
||||
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
onLoad = (data) => {
|
||||
this.setState({
|
||||
duration: data.duration
|
||||
});
|
||||
if (this.props.onMediaLoaded) {
|
||||
this.props.onMediaLoaded();
|
||||
this.props.onMediaLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onProgress = (data) => {
|
||||
this.setState({ currentTime: data.currentTime });
|
||||
|
||||
|
||||
if (!this.state.seeking) {
|
||||
this.setSeekerPosition(this.calculateSeekerPosition());
|
||||
}
|
||||
|
||||
|
||||
if (this.state.firstPlay) {
|
||||
if (NativeModules.Mixpanel) {
|
||||
const { uri } = this.props;
|
||||
@@ -98,13 +99,13 @@ class MediaPlayer extends React.PureComponent {
|
||||
this.hidePlayerControls();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
clearControlsTimeout = () => {
|
||||
if (this.state.controlsTimeout > -1) {
|
||||
clearTimeout(this.state.controlsTimeout)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
showPlayerControls = () => {
|
||||
this.clearControlsTimeout();
|
||||
if (!this.state.areControlsVisible) {
|
||||
@@ -112,7 +113,7 @@ class MediaPlayer extends React.PureComponent {
|
||||
}
|
||||
this.hidePlayerControls();
|
||||
}
|
||||
|
||||
|
||||
hidePlayerControls() {
|
||||
const player = this;
|
||||
let timeout = setTimeout(() => {
|
||||
@@ -120,12 +121,12 @@ class MediaPlayer extends React.PureComponent {
|
||||
}, MediaPlayer.ControlsTimeout);
|
||||
player.setState({ controlsTimeout: timeout });
|
||||
}
|
||||
|
||||
|
||||
togglePlay = () => {
|
||||
this.showPlayerControls();
|
||||
this.setState({ paused: !this.state.paused });
|
||||
}
|
||||
|
||||
|
||||
toggleFullscreenMode = () => {
|
||||
this.showPlayerControls();
|
||||
const { onFullscreenToggled } = this.props;
|
||||
@@ -136,12 +137,12 @@ class MediaPlayer extends React.PureComponent {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
onEnd = () => {
|
||||
this.setState({ paused: true });
|
||||
this.video.seek(0);
|
||||
}
|
||||
|
||||
|
||||
setSeekerPosition(position = 0) {
|
||||
position = this.checkSeekerPosition(position);
|
||||
this.setState({ seekerPosition: position });
|
||||
@@ -149,18 +150,17 @@ class MediaPlayer extends React.PureComponent {
|
||||
this.setState({ seekerOffset: position });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
checkSeekerPosition(val = 0) {
|
||||
const offset = this.getTrackingOffset();
|
||||
if (val < offset) {
|
||||
val = offset;
|
||||
} else if (val >= (offset + this.seekerWidth)) {
|
||||
return offset + this.seekerWidth;
|
||||
if (val < 0) {
|
||||
val = 0;
|
||||
} else if (val >= this.seekerWidth) {
|
||||
return this.seekerWidth;
|
||||
}
|
||||
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
seekTo(time = 0) {
|
||||
if (time > this.state.duration) {
|
||||
return;
|
||||
@@ -168,22 +168,25 @@ class MediaPlayer extends React.PureComponent {
|
||||
this.video.seek(time);
|
||||
this.setState({ currentTime: time });
|
||||
}
|
||||
|
||||
|
||||
initSeeker() {
|
||||
this.seekResponder = PanResponder.create({
|
||||
onStartShouldSetPanResponder: (evt, gestureState) => true,
|
||||
onMoveShouldSetPanResponder: (evt, gestureState) => true,
|
||||
|
||||
|
||||
onPanResponderGrant: (evt, gestureState) => {
|
||||
this.clearControlsTimeout();
|
||||
if (this.state.seekTimeout > 0) {
|
||||
clearTimeout(this.state.seekTimeout);
|
||||
}
|
||||
this.setState({ seeking: true });
|
||||
},
|
||||
|
||||
|
||||
onPanResponderMove: (evt, gestureState) => {
|
||||
const position = this.state.seekerOffset + gestureState.dx;
|
||||
this.setSeekerPosition(position);
|
||||
},
|
||||
|
||||
|
||||
onPanResponderRelease: (evt, gestureState) => {
|
||||
const time = this.getCurrentTimeForSeekerPosition();
|
||||
if (time >= this.state.duration) {
|
||||
@@ -191,43 +194,40 @@ class MediaPlayer extends React.PureComponent {
|
||||
this.onEnd();
|
||||
} else {
|
||||
this.seekTo(time);
|
||||
this.setState({ seeking: false });
|
||||
this.setState({ seekTimeout: setTimeout(() => { this.setState({ seeking: false }); }, 100) });
|
||||
}
|
||||
this.hidePlayerControls();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
getCurrentTimePercentage() {
|
||||
if (this.state.currentTime > 0) {
|
||||
return parseFloat(this.state.currentTime) / parseFloat(this.state.duration);
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
componentWillMount() {
|
||||
this.initSeeker();
|
||||
}
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
this.setSeekerPosition(this.calculateSeekerPosition());
|
||||
}
|
||||
|
||||
|
||||
componentWillUnmount() {
|
||||
this.clearControlsTimeout();
|
||||
this.setState({ paused: true, fullscreenMode: false });
|
||||
@@ -236,7 +236,7 @@ class MediaPlayer extends React.PureComponent {
|
||||
onFullscreenToggled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
renderPlayerControls() {
|
||||
if (this.state.areControlsVisible) {
|
||||
return (
|
||||
@@ -246,25 +246,31 @@ class MediaPlayer extends React.PureComponent {
|
||||
{this.state.paused && <Icon name="play" size={32} color="#ffffff" />}
|
||||
{!this.state.paused && <Icon name="pause" size={32} color="#ffffff" />}
|
||||
</TouchableOpacity>
|
||||
|
||||
|
||||
<TouchableOpacity style={mediaPlayerStyle.toggleFullscreenButton} onPress={this.toggleFullscreenMode}>
|
||||
{this.state.fullscreenMode && <Icon name="compress" size={16} color="#ffffff" />}
|
||||
{!this.state.fullscreenMode && <Icon name="expand" size={16} color="#ffffff" />}
|
||||
</TouchableOpacity>
|
||||
|
||||
|
||||
<Text style={mediaPlayerStyle.elapsedDuration}>{this.formatTime(this.state.currentTime)}</Text>
|
||||
<Text style={mediaPlayerStyle.totalDuration}>{this.formatTime(this.state.duration)}</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
getEncodedDownloadPath = (fileInfo) => {
|
||||
const { file_name: fileName } = fileInfo;
|
||||
const encodedFileName = encodeURIComponent(fileName).replace(/!/g, '%21');
|
||||
return fileInfo.download_path.replace(new RegExp(fileName, 'g'), encodedFileName);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { backgroundPlayEnabled, fileInfo, thumbnail, style } = this.props;
|
||||
const flexCompleted = this.getCurrentTimePercentage() * 100;
|
||||
const flexRemaining = (1 - this.getCurrentTimePercentage()) * 100;
|
||||
const { backgroundPlayEnabled, fileInfo, thumbnail, onLayout, style } = this.props;
|
||||
const completedWidth = this.getCurrentTimePercentage() * this.seekerWidth;
|
||||
const remainingWidth = this.seekerWidth - completedWidth;
|
||||
let styles = [this.state.fullscreenMode ? mediaPlayerStyle.fullscreenContainer : mediaPlayerStyle.container];
|
||||
if (style) {
|
||||
if (style.length) {
|
||||
@@ -273,13 +279,13 @@ class MediaPlayer extends React.PureComponent {
|
||||
styles.push(style);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const trackingStyle = [mediaPlayerStyle.trackingControls, this.state.fullscreenMode ?
|
||||
mediaPlayerStyle.fullscreenTrackingControls : mediaPlayerStyle.containedTrackingControls];
|
||||
|
||||
|
||||
return (
|
||||
<View style={styles}>
|
||||
<Video source={{ uri: 'file:///' + fileInfo.download_path }}
|
||||
<View style={styles} onLayout={onLayout}>
|
||||
<Video source={{ uri: 'file:///' + this.getEncodedDownloadPath(fileInfo) }}
|
||||
ref={(ref: Video) => { this.video = ref }}
|
||||
resizeMode={this.state.resizeMode}
|
||||
playInBackground={backgroundPlayEnabled}
|
||||
@@ -291,25 +297,29 @@ class MediaPlayer extends React.PureComponent {
|
||||
onProgress={this.onProgress}
|
||||
onEnd={this.onEnd}
|
||||
/>
|
||||
|
||||
|
||||
<TouchableOpacity style={mediaPlayerStyle.playerControls} onPress={this.showPlayerControls}>
|
||||
{this.renderPlayerControls()}
|
||||
</TouchableOpacity>
|
||||
|
||||
|
||||
{(!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 style={[mediaPlayerStyle.innerProgressCompleted, { width: completedWidth }]} />
|
||||
<View style={[mediaPlayerStyle.innerProgressRemaining, { width: remainingWidth }]} />
|
||||
</View>
|
||||
</View>}
|
||||
|
||||
|
||||
{this.state.areControlsVisible &&
|
||||
<View style={[mediaPlayerStyle.seekerHandle, { left: this.state.seekerPosition }]} { ...this.seekResponder.panHandlers }>
|
||||
<View style={this.state.seeking ? mediaPlayerStyle.bigSeekerCircle : mediaPlayerStyle.seekerCircle} />
|
||||
<View style={{ left: this.getTrackingOffset(), width: this.seekerWidth }}>
|
||||
<View style={[mediaPlayerStyle.seekerHandle,
|
||||
(this.state.fullscreenMode ? mediaPlayerStyle.seekerHandleFs : mediaPlayerStyle.seekerHandleContained),
|
||||
{ left: this.state.seekerPosition }]} { ...this.seekResponder.panHandlers }>
|
||||
<View style={this.state.seeking ? mediaPlayerStyle.bigSeekerCircle : mediaPlayerStyle.seekerCircle} />
|
||||
</View>
|
||||
</View>}
|
||||
</View>
|
||||
);
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
TouchableOpacity,
|
||||
View
|
||||
} from 'react-native';
|
||||
import Feather from 'react-native-vector-icons/Feather';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import pageHeaderStyle from '../../styles/pageHeader';
|
||||
|
||||
const APPBAR_HEIGHT = Platform.OS === 'ios' ? 44 : 56;
|
||||
@@ -21,7 +21,7 @@ class PageHeader extends React.PureComponent {
|
||||
pageHeaderStyle.container,
|
||||
{ height: APPBAR_HEIGHT }
|
||||
];
|
||||
|
||||
|
||||
return (
|
||||
<View style={containerStyles}>
|
||||
<View style={pageHeaderStyle.flexOne}>
|
||||
@@ -35,7 +35,7 @@ class PageHeader extends React.PureComponent {
|
||||
</AnimatedText>
|
||||
</View>
|
||||
<TouchableOpacity style={pageHeaderStyle.left}>
|
||||
<Feather name="arrow-left" size={24} onPress={onBackPressed} style={pageHeaderStyle.backIcon} />
|
||||
<Icon name="arrow-left" size={24} onPress={onBackPressed} style={pageHeaderStyle.backIcon} />
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -2,37 +2,37 @@
|
||||
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 Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import uriBarStyle from '../../../styles/uriBar';
|
||||
|
||||
class UriBarItem extends React.PureComponent {
|
||||
render() {
|
||||
const { item, onPress } = this.props;
|
||||
const { shorthand, type, value } = item;
|
||||
|
||||
|
||||
let icon;
|
||||
switch (type) {
|
||||
case SEARCH_TYPES.CHANNEL:
|
||||
icon = <Feather name="at-sign" size={18} />
|
||||
icon = <Icon name="at" size={18} />
|
||||
break;
|
||||
|
||||
|
||||
case SEARCH_TYPES.SEARCH:
|
||||
icon = <Feather name="search" size={18} />
|
||||
icon = <Icon name="search" size={18} />
|
||||
break;
|
||||
|
||||
|
||||
case SEARCH_TYPES.FILE:
|
||||
default:
|
||||
icon = <Feather name="file" size={18} />
|
||||
icon = <Icon name="file" size={18} />
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<TouchableOpacity style={uriBarStyle.item} onPress={onPress}>
|
||||
{icon}
|
||||
<Text style={uriBarStyle.itemText} numberOfLines={1}>{shorthand || value} - {type === 'search' ? 'Search' : value}</Text>
|
||||
</TouchableOpacity>
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default UriBarItem;
|
||||
@@ -24,14 +24,14 @@ class WalletAddress extends React.PureComponent<Props> {
|
||||
|
||||
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'}
|
||||
icon={'sync'}
|
||||
text={'Get New Address'}
|
||||
onPress={getNewAddress}
|
||||
disabled={gettingNewAddress}
|
||||
|
||||
@@ -17,21 +17,21 @@ type Props = {
|
||||
|
||||
class WalletSend extends React.PureComponent<Props> {
|
||||
amountInput = null;
|
||||
|
||||
|
||||
state = {
|
||||
amount: null,
|
||||
address: null,
|
||||
addressChanged: false,
|
||||
addressValid: false
|
||||
};
|
||||
|
||||
|
||||
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;
|
||||
@@ -42,7 +42,7 @@ class WalletSend extends React.PureComponent<Props> {
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (amount > balance) {
|
||||
notify({
|
||||
message: 'Insufficient credits',
|
||||
@@ -50,13 +50,13 @@ class WalletSend extends React.PureComponent<Props> {
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (amount && address) {
|
||||
sendToAddress(address, parseFloat(amount));
|
||||
this.setState({ address: null, amount: null });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
handleAddressInputBlur = () => {
|
||||
if (this.state.addressChanged && !this.state.addressValid) {
|
||||
const { notify } = this.props;
|
||||
@@ -66,7 +66,7 @@ class WalletSend extends React.PureComponent<Props> {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
handleAddressInputSubmit = () => {
|
||||
if (this.amountInput) {
|
||||
this.amountInput.focus();
|
||||
|
||||
+14
-14
@@ -1,6 +1,5 @@
|
||||
import React from 'react';
|
||||
import { Provider, connect } from 'react-redux';
|
||||
import DiscoverPage from './page/discover';
|
||||
import {
|
||||
AppRegistry,
|
||||
AppState,
|
||||
@@ -9,16 +8,6 @@ import {
|
||||
View,
|
||||
NativeModules
|
||||
} from 'react-native';
|
||||
import { createStore, applyMiddleware, compose, combineReducers } from 'redux';
|
||||
import {
|
||||
StackNavigator, addNavigationHelpers
|
||||
} from 'react-navigation';
|
||||
import { AppNavigator } from './component/AppNavigator';
|
||||
import AppWithNavigationState from './component/AppNavigator';
|
||||
import { persistStore, autoRehydrate } from 'redux-persist';
|
||||
import createCompressor from 'redux-persist-transform-compress';
|
||||
import createFilter from 'redux-persist-transform-filter';
|
||||
import thunk from 'redux-thunk';
|
||||
import {
|
||||
Lbry,
|
||||
claimsReducer,
|
||||
@@ -28,9 +17,19 @@ import {
|
||||
searchReducer,
|
||||
walletReducer
|
||||
} from 'lbry-redux';
|
||||
import settingsReducer from './redux/reducers/settings';
|
||||
import moment from 'moment';
|
||||
import { createStore, applyMiddleware, compose, combineReducers } from 'redux';
|
||||
import { createLogger } from 'redux-logger';
|
||||
import { StackNavigator, addNavigationHelpers } from 'react-navigation';
|
||||
import { AppNavigator } from './component/AppNavigator';
|
||||
import { persistStore, autoRehydrate } from 'redux-persist';
|
||||
import { reactNavigationMiddleware } from './utils/redux';
|
||||
import AppWithNavigationState from './component/AppNavigator';
|
||||
import FilesystemStorage from 'redux-persist-filesystem-storage';
|
||||
import createCompressor from 'redux-persist-transform-compress';
|
||||
import createFilter from 'redux-persist-transform-filter';
|
||||
import moment from 'moment';
|
||||
import settingsReducer from './redux/reducers/settings';
|
||||
import thunk from 'redux-thunk';
|
||||
|
||||
function isFunction(object) {
|
||||
return typeof object === 'function';
|
||||
@@ -80,6 +79,7 @@ const reducers = combineReducers({
|
||||
});
|
||||
|
||||
const bulkThunk = createBulkThunkMiddleware();
|
||||
const logger = createLogger({ collapsed: true });
|
||||
const middleware = [thunk, bulkThunk, reactNavigationMiddleware];
|
||||
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
@@ -106,7 +106,7 @@ const persistOptions = {
|
||||
// read the data
|
||||
transforms: [saveClaimsFilter, subscriptionsFilter, settingsFilter, walletFilter, compressor],
|
||||
debounce: 10000,
|
||||
storage: AsyncStorage
|
||||
storage: FilesystemStorage
|
||||
};
|
||||
|
||||
persistStore(store, persistOptions, err => {
|
||||
|
||||
+23
-11
@@ -11,11 +11,11 @@ class AboutPage extends React.PureComponent {
|
||||
lbryId: null,
|
||||
versionInfo: null
|
||||
};
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
if (NativeModules.VersionInfo) {
|
||||
NativeModules.VersionInfo.getAppVersion().then(version => {
|
||||
this.setState({appVersion: version});
|
||||
this.setState({appVersion: version});
|
||||
});
|
||||
}
|
||||
Lbry.version().then(info => {
|
||||
@@ -23,19 +23,20 @@ class AboutPage extends React.PureComponent {
|
||||
versionInfo: info,
|
||||
});
|
||||
});
|
||||
Lbry.status({ session_status: true }).then(info => {
|
||||
Lbry.status().then(info => {
|
||||
console.log(info);
|
||||
this.setState({
|
||||
lbryId: info.lbry_id,
|
||||
lbryId: info.installation_id,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
const loading = 'Loading...';
|
||||
const ver = this.state.versionInfo ? this.state.versionInfo : null;
|
||||
|
||||
|
||||
return (
|
||||
<View>
|
||||
<View style={aboutStyle.container}>
|
||||
<PageHeader title={"About LBRY"}
|
||||
onBackPressed={() => { this.props.navigation.goBack(); }} />
|
||||
<ScrollView style={aboutStyle.scrollContainer}>
|
||||
@@ -50,27 +51,38 @@ class AboutPage extends React.PureComponent {
|
||||
<Link style={aboutStyle.link} href="https://lbry.io/faq/what-is-lbry" text="What is LBRY?" />
|
||||
<Link style={aboutStyle.link} href="https://lbry.io/faq" text="Frequently Asked Questions" />
|
||||
</View>
|
||||
<Text style={aboutStyle.socialTitle}>Get Social</Text>
|
||||
<Text style={aboutStyle.paragraph}>
|
||||
You can interact with the LBRY team and members of the community on Discord, Facebook, Instagram, Twitter or Reddit.
|
||||
</Text>
|
||||
<View style={aboutStyle.links}>
|
||||
<Link style={aboutStyle.link} href="https://discordapp.com/invite/Z3bERWA" text="Discord" />
|
||||
<Link style={aboutStyle.link} href="https://www.facebook.com/LBRYio" text="Facebook" />
|
||||
<Link style={aboutStyle.link} href="https://www.instagram.com/LBRYio/" text="Instagram" />
|
||||
<Link style={aboutStyle.link} href="https://twitter.com/LBRYio" text="Twitter" />
|
||||
<Link style={aboutStyle.link} href="https://reddit.com/r/lbry" text="Reddit" />
|
||||
</View>
|
||||
<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>
|
||||
|
||||
@@ -14,7 +14,6 @@ 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 {
|
||||
componentDidMount() {
|
||||
@@ -23,7 +22,7 @@ class DiscoverPage extends React.PureComponent {
|
||||
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();
|
||||
@@ -39,7 +38,7 @@ class DiscoverPage extends React.PureComponent {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.props.fetchFeaturedUris();
|
||||
}
|
||||
|
||||
|
||||
+118
-43
@@ -3,7 +3,7 @@ import { Lbry, normalizeURI } from 'lbry-redux';
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Alert,
|
||||
Button,
|
||||
Dimensions,
|
||||
NativeModules,
|
||||
ScrollView,
|
||||
StatusBar,
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
WebView
|
||||
} from 'react-native';
|
||||
import ImageViewer from 'react-native-image-zoom-viewer';
|
||||
import Button from '../../component/button';
|
||||
import Colors from '../../styles/colors';
|
||||
import ChannelPage from '../channel';
|
||||
import FileDownloadButton from '../../component/fileDownloadButton';
|
||||
@@ -25,36 +26,48 @@ import MediaPlayer from '../../component/mediaPlayer';
|
||||
import UriBar from '../../component/uriBar';
|
||||
import Video from 'react-native-video';
|
||||
import filePageStyle from '../../styles/filePage';
|
||||
import uriBarStyle from '../../styles/uriBar';
|
||||
|
||||
class FilePage extends React.PureComponent {
|
||||
static navigationOptions = {
|
||||
title: ''
|
||||
};
|
||||
|
||||
|
||||
playerBackground = null;
|
||||
|
||||
player = null;
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
mediaLoaded: false,
|
||||
autoplayMedia: false,
|
||||
fullscreenMode: false,
|
||||
showImageViewer: false,
|
||||
showWebView: false,
|
||||
imageUrls: null
|
||||
imageUrls: null,
|
||||
playerBgHeight: 0,
|
||||
playerHeight: 0,
|
||||
isLandscape: false,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
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 });
|
||||
}
|
||||
if (NativeModules.UtilityModule) {
|
||||
NativeModules.UtilityModule.keepAwakeOn();
|
||||
}
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
@@ -78,7 +91,7 @@ class FilePage extends React.PureComponent {
|
||||
props.fetchCostInfo(props.navigation.state.params.uri);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
handleFullscreenToggle = (mode) => {
|
||||
this.setState({ fullscreenMode: mode });
|
||||
StatusBar.setHidden(mode);
|
||||
@@ -86,15 +99,24 @@ class FilePage extends React.PureComponent {
|
||||
if (mode) {
|
||||
// fullscreen, so change orientation to landscape mode
|
||||
NativeModules.ScreenOrientation.lockOrientationLandscape();
|
||||
if (NativeModules.UtilityModule) {
|
||||
// hide the navigation bar (on devices that use have soft navigation bar)
|
||||
NativeModules.UtilityModule.hideNavigationBar();
|
||||
}
|
||||
} else {
|
||||
NativeModules.ScreenOrientation.unlockOrientation();
|
||||
// Switch back to portrait mode when the media is not fullscreen
|
||||
NativeModules.ScreenOrientation.lockOrientationPortrait();
|
||||
if (NativeModules.UtilityModule) {
|
||||
// hide the navigation bar (on devices that use have soft navigation bar)
|
||||
NativeModules.UtilityModule.showNavigationBar();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onDeletePressed = () => {
|
||||
const { deleteFile, fileInfo } = this.props;
|
||||
|
||||
|
||||
Alert.alert(
|
||||
'Delete file',
|
||||
'Are you sure you want to remove this file from your device?',
|
||||
@@ -105,10 +127,10 @@ class FilePage extends React.PureComponent {
|
||||
{ cancelable: true }
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
onStopDownloadPressed = () => {
|
||||
const { deleteFile, stopDownload, fileInfo, navigation } = this.props;
|
||||
|
||||
|
||||
Alert.alert(
|
||||
'Stop download',
|
||||
'Are you sure you want to stop downloading this file?',
|
||||
@@ -119,21 +141,26 @@ class FilePage extends React.PureComponent {
|
||||
{ cancelable: true }
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
componentWillUnmount() {
|
||||
StatusBar.setHidden(false);
|
||||
if (NativeModules.ScreenOrientation) {
|
||||
NativeModules.ScreenOrientation.unlockOrientation();
|
||||
}
|
||||
if (NativeModules.UtilityModule) {
|
||||
const utility = NativeModules.UtilityModule;
|
||||
utility.keepAwakeOff();
|
||||
utility.showNavigationBar();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
localUriForFileInfo = (fileInfo) => {
|
||||
if (!fileInfo) {
|
||||
return null;
|
||||
}
|
||||
return 'file:///' + fileInfo.download_path;
|
||||
}
|
||||
|
||||
|
||||
linkify = (text) => {
|
||||
let linkifiedContent = [];
|
||||
let lines = text.split(/\n/g);
|
||||
@@ -142,26 +169,45 @@ class FilePage extends React.PureComponent {
|
||||
let lineContent = tokens.length === 0 ? '' : tokens.map((token, j) => {
|
||||
let hasSpace = j !== (tokens.length - 1);
|
||||
let space = hasSpace ? ' ' : '';
|
||||
|
||||
|
||||
if (token.match(/^(lbry|https?):\/\//g)) {
|
||||
return (
|
||||
<Link key={j}
|
||||
style={filePageStyle.link}
|
||||
href={token}
|
||||
text={token} />
|
||||
text={token}
|
||||
effectOnTap={filePageStyle.linkTapped} />
|
||||
);
|
||||
} else {
|
||||
return token + space;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
lineContent.push("\n");
|
||||
return (<Text key={i}>{lineContent}</Text>);
|
||||
});
|
||||
|
||||
|
||||
return linkifiedContent;
|
||||
}
|
||||
|
||||
|
||||
checkOrientation = () => {
|
||||
if (this.state.fullscreenMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
const screenDimension = Dimensions.get('window');
|
||||
const screenWidth = screenDimension.width;
|
||||
const screenHeight = screenDimension.height;
|
||||
const isLandscape = screenWidth > screenHeight;
|
||||
this.setState({ isLandscape });
|
||||
|
||||
if (isLandscape) {
|
||||
this.playerBackground.setNativeProps({ height: screenHeight - StyleSheet.flatten(uriBarStyle.uriContainer).height });
|
||||
} else if (this.state.playerBgHeight > 0) {
|
||||
this.playerBackground.setNativeProps({ height: this.state.playerBgHeight });
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
claim,
|
||||
@@ -175,12 +221,12 @@ class FilePage extends React.PureComponent {
|
||||
navigation
|
||||
} = this.props;
|
||||
const { uri } = navigation.state.params;
|
||||
|
||||
|
||||
let innerContent = null;
|
||||
if ((isResolvingUri && !claim) || !claim) {
|
||||
innerContent = (
|
||||
<View style={filePageStyle.container}>
|
||||
{isResolvingUri &&
|
||||
{isResolvingUri &&
|
||||
<View style={filePageStyle.busyContainer}>
|
||||
<ActivityIndicator size="large" color={Colors.LbryGreen} />
|
||||
<Text style={filePageStyle.infoText}>Loading decentralized data...</Text>
|
||||
@@ -198,7 +244,7 @@ class FilePage extends React.PureComponent {
|
||||
<ChannelPage uri={uri} navigation={navigation} />
|
||||
);
|
||||
} else if (claim) {
|
||||
const completed = fileInfo && fileInfo.completed;
|
||||
const completed = fileInfo && fileInfo.completed;
|
||||
const title = metadata.title;
|
||||
const isRewardContent = rewardedContentClaimIds.includes(claim.claim_id);
|
||||
const description = metadata.description ? metadata.description : null;
|
||||
@@ -209,18 +255,19 @@ class FilePage extends React.PureComponent {
|
||||
(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 playerStyle = [filePageStyle.player,
|
||||
this.state.isLandscape ? filePageStyle.containedPlayerLandscape :
|
||||
(this.state.fullscreenMode ? filePageStyle.fullscreenPlayer : filePageStyle.containedPlayer)];
|
||||
const playerBgStyle = [filePageStyle.playerBackground, this.state.fullscreenMode ?
|
||||
filePageStyle.fullscreenPlayerBackground : filePageStyle.containedPlayerBackground];
|
||||
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
|
||||
@@ -243,33 +290,58 @@ class FilePage extends React.PureComponent {
|
||||
<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}>
|
||||
<View style={this.state.fullscreenMode ? filePageStyle.innerPageContainerFsMode : filePageStyle.innerPageContainer}
|
||||
onLayout={this.checkOrientation}>
|
||||
<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} />}
|
||||
<FileDownloadButton uri={uri}
|
||||
style={filePageStyle.downloadButton}
|
||||
openFile={openFile}
|
||||
isPlayable={isPlayable}
|
||||
onPlay={() => this.setState({ autoPlayMedia: true })} />}
|
||||
{!fileInfo && <FilePrice uri={uri} style={filePageStyle.filePriceContainer} textStyle={filePageStyle.filePriceText} />}
|
||||
</View>
|
||||
{canLoadMedia && <View style={playerBgStyle} />}
|
||||
{canLoadMedia && <View style={playerBgStyle} ref={(ref) => { this.playerBackground = ref; }}
|
||||
onLayout={(evt) => {
|
||||
if (!this.state.playerBgHeight) {
|
||||
this.setState({ playerBgHeight: evt.nativeEvent.layout.height });
|
||||
}
|
||||
}} />}
|
||||
{canLoadMedia && <MediaPlayer fileInfo={fileInfo}
|
||||
uri={uri}
|
||||
style={playerStyle}
|
||||
onFullscreenToggled={this.handleFullscreenToggle}
|
||||
onMediaLoaded={() => { this.setState({ mediaLoaded: true }); }}/>}
|
||||
|
||||
ref={(ref) => { this.player = ref; }}
|
||||
uri={uri}
|
||||
style={playerStyle}
|
||||
autoPlay={this.state.autoPlayMedia}
|
||||
onFullscreenToggled={this.handleFullscreenToggle}
|
||||
onMediaLoaded={() => { this.setState({ mediaLoaded: true }); }}
|
||||
onLayout={(evt) => {
|
||||
if (!this.state.playerHeight) {
|
||||
this.setState({ playerHeight: evt.nativeEvent.layout.height });
|
||||
}
|
||||
}}
|
||||
/>}
|
||||
|
||||
{ showActions &&
|
||||
<View style={filePageStyle.actions}>
|
||||
{completed && <Button color="red" title="Delete" onPress={this.onDeletePressed} />}
|
||||
{completed && <Button style={filePageStyle.actionButton}
|
||||
theme={"light"}
|
||||
icon={"trash"}
|
||||
text={"Delete"}
|
||||
onPress={this.onDeletePressed} />}
|
||||
{!completed && fileInfo && !fileInfo.stopped && fileInfo.written_bytes < fileInfo.total_bytes &&
|
||||
<Button color="red" title="Stop Download" onPress={this.onStopDownloadPressed} />
|
||||
<Button style={filePageStyle.actionButton}
|
||||
theme={"light"}
|
||||
text={"Stop Download"}
|
||||
onPress={this.onStopDownloadPressed} />
|
||||
}
|
||||
</View>}
|
||||
<ScrollView style={showActions ? filePageStyle.scrollContainerActions : filePageStyle.scrollContainer}>
|
||||
@@ -281,16 +353,19 @@ class FilePage extends React.PureComponent {
|
||||
const channelUri = normalizeURI(channelName);
|
||||
navigation.navigate({ routeName: 'File', key: channelUri, params: { uri: channelUri }});
|
||||
}} />}
|
||||
|
||||
{description && description.length > 0 && <View style={filePageStyle.divider} />}
|
||||
|
||||
{description && <Text style={filePageStyle.description} selectable={true}>{this.linkify(description)}</Text>}
|
||||
</ScrollView>
|
||||
</View>
|
||||
)}
|
||||
|
||||
<UriBar value={uri} navigation={navigation} />
|
||||
{!this.state.fullscreenMode && <UriBar value={uri} navigation={navigation} />}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return innerContent;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { SETTINGS } from 'lbry-redux';
|
||||
import { Text, View, ScrollView, Switch } from 'react-native';
|
||||
import { Text, View, ScrollView, Switch, NativeModules } from 'react-native';
|
||||
import PageHeader from '../../component/pageHeader';
|
||||
import settingsStyle from '../../styles/settings';
|
||||
|
||||
@@ -8,7 +8,7 @@ class SettingsPage extends React.PureComponent {
|
||||
static navigationOptions = {
|
||||
title: 'Settings'
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
const {
|
||||
backgroundPlayEnabled,
|
||||
@@ -16,10 +16,10 @@ class SettingsPage extends React.PureComponent {
|
||||
showNsfw,
|
||||
setClientSetting
|
||||
} = this.props;
|
||||
|
||||
// If no true / false value set, default to true
|
||||
const actualKeepDaemonRunning = (keepDaemonRunning === undefined || keepDaemonRunning === null) ? true : keepDaemonRunning;
|
||||
|
||||
|
||||
// default to true if the setting is null or undefined
|
||||
const actualKeepDaemonRunning = (keepDaemonRunning === null || keepDaemonRunning === undefined) ? true : keepDaemonRunning;
|
||||
|
||||
return (
|
||||
<View>
|
||||
<PageHeader title={"Settings"}
|
||||
@@ -34,7 +34,7 @@ class SettingsPage extends React.PureComponent {
|
||||
<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>
|
||||
@@ -43,14 +43,19 @@ class SettingsPage extends React.PureComponent {
|
||||
<Switch value={showNsfw} onValueChange={(value) => setClientSetting(SETTINGS.SHOW_NSFW, value)} />
|
||||
</View>
|
||||
</View>
|
||||
|
||||
|
||||
<View style={settingsStyle.row}>
|
||||
<View style={settingsStyle.switchText}>
|
||||
<Text style={settingsStyle.label}>Keep the daemon background service running when the app is suspended.</Text>
|
||||
<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={actualKeepDaemonRunning} onValueChange={(value) => setClientSetting(SETTINGS.KEEP_DAEMON_RUNNING, value)} />
|
||||
<Switch value={actualKeepDaemonRunning} onValueChange={(value) => {
|
||||
setClientSetting(SETTINGS.KEEP_DAEMON_RUNNING, value);
|
||||
if (NativeModules.DaemonServiceControl) {
|
||||
NativeModules.DaemonServiceControl.setKeepDaemonRunning(value);
|
||||
}
|
||||
}} />
|
||||
</View>
|
||||
</View>
|
||||
</ScrollView>
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
import React from 'react';
|
||||
import { Lbry } from 'lbry-redux';
|
||||
import { ActivityIndicator, View, Text, Linking, NativeModules } from 'react-native';
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Linking,
|
||||
NativeModules,
|
||||
Platform,
|
||||
ProgressBarAndroid,
|
||||
Text,
|
||||
View
|
||||
} from 'react-native';
|
||||
import { NavigationActions } from 'react-navigation';
|
||||
import PropTypes from 'prop-types';
|
||||
import Colors from '../../styles/colors';
|
||||
@@ -17,7 +25,9 @@ class SplashScreen extends React.PureComponent {
|
||||
message: 'Connecting',
|
||||
isRunning: false,
|
||||
isLagging: false,
|
||||
launchUrl: null
|
||||
launchUrl: null,
|
||||
isDownloadingHeaders: false,
|
||||
headersDownloadProgress: 0
|
||||
});
|
||||
|
||||
if (NativeModules.DaemonServiceControl) {
|
||||
@@ -44,7 +54,9 @@ class SplashScreen extends React.PureComponent {
|
||||
|
||||
_updateStatusCallback(status) {
|
||||
const startupStatus = status.startup_status;
|
||||
if (startupStatus.code == 'started') {
|
||||
// At the minimum, wallet should be started and blocks_behind equal to 0 before calling resolve
|
||||
const hasStarted = startupStatus.wallet && status.wallet.blocks_behind <= 0;
|
||||
if (hasStarted) {
|
||||
// Wait until we are able to resolve a name before declaring
|
||||
// that we are done.
|
||||
// TODO: This is a hack, and the logic should live in the daemon
|
||||
@@ -76,19 +88,39 @@ class SplashScreen extends React.PureComponent {
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (status.blockchain_status && status.blockchain_status.blocks_behind > 0) {
|
||||
const behind = status.blockchain_status.blocks_behind;
|
||||
|
||||
const blockchainHeaders = status.blockchain_headers;
|
||||
const walletStatus = status.wallet;
|
||||
|
||||
if (blockchainHeaders) {
|
||||
this.setState({
|
||||
isDownloadingHeaders: blockchainHeaders.downloading_headers,
|
||||
headersDownloadProgress: blockchainHeaders.download_progress
|
||||
});
|
||||
} else {
|
||||
// set downloading flag to false if blockchain_headers isn't in the status response
|
||||
this.setState({
|
||||
isDownloadingHeaders: false,
|
||||
});
|
||||
}
|
||||
|
||||
if (blockchainHeaders && blockchainHeaders.downloading_headers) {
|
||||
const downloadProgress = blockchainHeaders.download_progress ? blockchainHeaders.download_progress : 0;
|
||||
this.setState({
|
||||
message: 'Blockchain Sync',
|
||||
details: `Catching up with the blockchain (${downloadProgress}%)`,
|
||||
});
|
||||
} else if (walletStatus && walletStatus.blocks_behind > 0) {
|
||||
const behind = walletStatus.blocks_behind;
|
||||
const behindText = behind + ' block' + (behind == 1 ? '' : 's') + ' behind';
|
||||
this.setState({
|
||||
message: 'Blockchain Sync',
|
||||
details: behindText,
|
||||
isLagging: startupStatus.is_lagging,
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
message: 'Network Loading',
|
||||
details: startupStatus.message + (startupStatus.is_lagging ? '' : '...'),
|
||||
isLagging: startupStatus.is_lagging,
|
||||
details: 'Initializing LBRY service...'
|
||||
});
|
||||
}
|
||||
setTimeout(() => {
|
||||
@@ -128,7 +160,13 @@ class SplashScreen extends React.PureComponent {
|
||||
return (
|
||||
<View style={splashStyle.container}>
|
||||
<Text style={splashStyle.title}>LBRY</Text>
|
||||
<ActivityIndicator color={Colors.White} style={splashStyle.loading} size={"small"} />
|
||||
{'android' === Platform.OS && this.state.isDownloadingHeaders &&
|
||||
<ProgressBarAndroid color={Colors.White}
|
||||
indeterminate={false}
|
||||
styleAttr={"Horizontal"}
|
||||
style={splashStyle.progress}
|
||||
progress={this.state.headersDownloadProgress/100.0} />}
|
||||
{!this.state.isDownloadingHeaders && <ActivityIndicator color={Colors.White} style={splashStyle.loading} size={"small"} />}
|
||||
<Text style={splashStyle.message}>{message}</Text>
|
||||
<Text style={splashStyle.details}>{details}</Text>
|
||||
</View>
|
||||
|
||||
@@ -14,7 +14,6 @@ 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 TrendingPage extends React.PureComponent {
|
||||
componentDidMount() {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { AsyncStorage } from 'react-native';
|
||||
import { ACTIONS } from 'lbry-redux';
|
||||
|
||||
|
||||
const reducers = {};
|
||||
const defaultState = {
|
||||
clientSettings: {}
|
||||
@@ -16,6 +18,7 @@ reducers[ACTIONS.CLIENT_SETTING_CHANGED] = (state, action) => {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
export default function reducer(state = defaultState, action) {
|
||||
const handler = reducers[action.type];
|
||||
if (handler) return handler(state, action);
|
||||
|
||||
+13
-3
@@ -2,9 +2,11 @@ import { StyleSheet } from 'react-native';
|
||||
import Colors from './colors';
|
||||
|
||||
const aboutStyle = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1
|
||||
},
|
||||
scrollContainer: {
|
||||
paddingTop: 16,
|
||||
paddingBottom: 16
|
||||
flex: 1
|
||||
},
|
||||
row: {
|
||||
marginBottom: 1,
|
||||
@@ -18,6 +20,7 @@ const aboutStyle = StyleSheet.create({
|
||||
color: Colors.LbryGreen,
|
||||
fontSize: 24,
|
||||
fontFamily: 'Metropolis-SemiBold',
|
||||
marginTop: 16,
|
||||
marginLeft: 12,
|
||||
marginRight: 12,
|
||||
marginBottom: 8
|
||||
@@ -33,7 +36,7 @@ const aboutStyle = StyleSheet.create({
|
||||
links: {
|
||||
marginLeft: 12,
|
||||
marginRight: 12,
|
||||
marginBottom: 12
|
||||
marginBottom: 18
|
||||
},
|
||||
link: {
|
||||
color: Colors.LbryGreen,
|
||||
@@ -44,6 +47,13 @@ const aboutStyle = StyleSheet.create({
|
||||
col: {
|
||||
alignSelf: 'stretch'
|
||||
},
|
||||
socialTitle: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
marginLeft: 12,
|
||||
marginRight: 12,
|
||||
marginBottom: 8,
|
||||
fontSize: 20
|
||||
},
|
||||
releaseInfoTitle: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
marginLeft: 12,
|
||||
|
||||
@@ -1,24 +1,34 @@
|
||||
import { StyleSheet } from 'react-native';
|
||||
import Colors from './colors';
|
||||
|
||||
const buttonStyle = StyleSheet.create({
|
||||
button: {
|
||||
borderRadius: 24,
|
||||
padding: 8,
|
||||
paddingLeft: 12,
|
||||
paddingRight: 12
|
||||
paddingRight: 12,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center'
|
||||
},
|
||||
disabled: {
|
||||
backgroundColor: '#999999'
|
||||
},
|
||||
row: {
|
||||
alignSelf: 'flex-start',
|
||||
flexDirection: 'row',
|
||||
flexDirection: 'row'
|
||||
},
|
||||
icon: {
|
||||
color: '#ffffff',
|
||||
iconLight: {
|
||||
color: Colors.White,
|
||||
},
|
||||
iconDark: {
|
||||
color: Colors.DarkGrey,
|
||||
},
|
||||
textLight: {
|
||||
color: Colors.White,
|
||||
},
|
||||
textDark: {
|
||||
color: Colors.DarkGrey
|
||||
},
|
||||
text: {
|
||||
color: '#ffffff',
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 14
|
||||
},
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
const Colors = {
|
||||
Black: '#000000',
|
||||
ChannelGrey: '#9b9b9b',
|
||||
DarkGrey: '#555555',
|
||||
DescriptionGrey: '#999999',
|
||||
LbryGreen: '#40b89a',
|
||||
LightGrey: '#cccccc',
|
||||
LighterGrey: '#e5e5e5',
|
||||
Orange: '#ffbb00',
|
||||
Red: '#ff0000',
|
||||
VeryLightGrey: '#f1f1f1',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { StyleSheet } from 'react-native';
|
||||
import Colors from './colors';
|
||||
|
||||
const discoverStyle = StyleSheet.create({
|
||||
container: {
|
||||
@@ -27,12 +28,12 @@ const discoverStyle = StyleSheet.create({
|
||||
marginLeft: 10
|
||||
},
|
||||
categoryName: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontFamily: 'Metropolis-SemiBold',
|
||||
fontSize: 20,
|
||||
marginLeft: 24,
|
||||
marginTop: 16,
|
||||
marginBottom: 16,
|
||||
color: '#40b89a'
|
||||
color: Colors.Black
|
||||
},
|
||||
fileItem: {
|
||||
marginLeft: 24,
|
||||
@@ -48,7 +49,7 @@ const discoverStyle = StyleSheet.create({
|
||||
fontFamily: 'Metropolis-SemiBold',
|
||||
fontSize: 16,
|
||||
marginTop: 4,
|
||||
color: '#c0c0c0'
|
||||
color: Colors.LbryGreen
|
||||
},
|
||||
filePriceContainer: {
|
||||
backgroundColor: '#61fcd8',
|
||||
@@ -58,7 +59,7 @@ const discoverStyle = StyleSheet.create({
|
||||
top: 16,
|
||||
width: 56,
|
||||
height: 24,
|
||||
borderRadius: 4
|
||||
borderRadius: 4
|
||||
},
|
||||
filePriceText: {
|
||||
fontFamily: 'Metropolis-Bold',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { StyleSheet, Dimensions } from 'react-native';
|
||||
|
||||
const screenDimension = Dimensions.get('window');
|
||||
const screenDimension = Dimensions.get('window');
|
||||
const width = screenDimension.width - 48; // screen width minus combined left and right margins
|
||||
|
||||
const fileItemMediaStyle = StyleSheet.create({
|
||||
@@ -49,6 +49,17 @@ const fileItemMediaStyle = StyleSheet.create({
|
||||
autothumbOrange: {
|
||||
backgroundColor: '#ffa726'
|
||||
},
|
||||
resolving: {
|
||||
alignItems: 'center',
|
||||
flex: 1,
|
||||
justifyContent: 'center'
|
||||
},
|
||||
text: {
|
||||
color: '#ffffff',
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 16,
|
||||
marginTop: 8
|
||||
},
|
||||
thumbnail: {
|
||||
flex: 1,
|
||||
width: '100%',
|
||||
|
||||
+31
-11
@@ -1,7 +1,7 @@
|
||||
import { StyleSheet, Dimensions } from 'react-native';
|
||||
import Colors from './colors';
|
||||
|
||||
const screenDimension = Dimensions.get('window');
|
||||
const screenDimension = Dimensions.get('window');
|
||||
const screenWidth = screenDimension.width;
|
||||
|
||||
const filePageStyle = StyleSheet.create({
|
||||
@@ -12,14 +12,25 @@ const filePageStyle = StyleSheet.create({
|
||||
pageContainer: {
|
||||
flex: 1
|
||||
},
|
||||
divider: {
|
||||
backgroundColor: Colors.LighterGrey,
|
||||
width: '100%',
|
||||
height: 1,
|
||||
marginTop: 4,
|
||||
marginBottom: 20
|
||||
},
|
||||
innerPageContainer: {
|
||||
flex: 1,
|
||||
marginBottom: 60
|
||||
},
|
||||
innerPageContainerFsMode: {
|
||||
flex: 1,
|
||||
marginBottom: 0
|
||||
},
|
||||
mediaContainer: {
|
||||
alignItems: 'center',
|
||||
width: screenWidth,
|
||||
height: 220
|
||||
height: 240
|
||||
},
|
||||
emptyClaimText: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
@@ -51,7 +62,7 @@ const filePageStyle = StyleSheet.create({
|
||||
marginLeft: 20,
|
||||
marginRight: 20,
|
||||
marginBottom: 20,
|
||||
color: Colors.ChannelGrey
|
||||
color: Colors.LbryGreen
|
||||
},
|
||||
description: {
|
||||
color: Colors.DescriptionGrey,
|
||||
@@ -64,7 +75,7 @@ const filePageStyle = StyleSheet.create({
|
||||
},
|
||||
thumbnail: {
|
||||
width: screenWidth,
|
||||
height: 204,
|
||||
height: 224,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center'
|
||||
},
|
||||
@@ -76,11 +87,16 @@ const filePageStyle = StyleSheet.create({
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
top: 0,
|
||||
zIndex: 101
|
||||
zIndex: 301,
|
||||
elevation: 21
|
||||
},
|
||||
containedPlayer: {
|
||||
width: '100%',
|
||||
height: 220,
|
||||
height: 240,
|
||||
},
|
||||
containedPlayerLandscape: {
|
||||
width: '100%',
|
||||
height: '100%'
|
||||
},
|
||||
fullscreenPlayer: {
|
||||
width: '100%',
|
||||
@@ -92,7 +108,8 @@ const filePageStyle = StyleSheet.create({
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
top: 0,
|
||||
zIndex: 100,
|
||||
zIndex: 300,
|
||||
elevation: 20,
|
||||
backgroundColor: Colors.Black
|
||||
},
|
||||
containedPlayerBackground: {
|
||||
@@ -113,7 +130,7 @@ const filePageStyle = StyleSheet.create({
|
||||
top: 16,
|
||||
width: 56,
|
||||
height: 24,
|
||||
borderRadius: 4
|
||||
borderRadius: 4
|
||||
},
|
||||
filePriceText: {
|
||||
fontFamily: 'Metropolis-Bold',
|
||||
@@ -129,9 +146,9 @@ const filePageStyle = StyleSheet.create({
|
||||
marginTop: -14,
|
||||
width: '50%',
|
||||
},
|
||||
deleteButton: {
|
||||
backgroundColor: Colors.Red,
|
||||
width: 80
|
||||
actionButton: {
|
||||
backgroundColor: Colors.White,
|
||||
width: 160
|
||||
},
|
||||
loading: {
|
||||
position: 'absolute',
|
||||
@@ -160,6 +177,9 @@ const filePageStyle = StyleSheet.create({
|
||||
},
|
||||
link: {
|
||||
color: Colors.LbryGreen
|
||||
},
|
||||
linkTapped: {
|
||||
color: "rgba(64, 184, 154, .2)"
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ const mediaPlayerStyle = StyleSheet.create({
|
||||
progress: {
|
||||
flex: 1,
|
||||
flexDirection: 'row',
|
||||
width: '100%',
|
||||
height: 3
|
||||
},
|
||||
innerProgressCompleted: {
|
||||
@@ -101,8 +100,13 @@ const mediaPlayerStyle = StyleSheet.create({
|
||||
position: 'absolute',
|
||||
height: 36,
|
||||
width: 48,
|
||||
bottom: 0,
|
||||
marginLeft: -16
|
||||
marginLeft: -18
|
||||
},
|
||||
seekerHandleContained: {
|
||||
bottom: -17
|
||||
},
|
||||
seekerHandleFs: {
|
||||
bottom: 0
|
||||
},
|
||||
bigSeekerCircle: {
|
||||
borderRadius: 24,
|
||||
|
||||
@@ -10,7 +10,8 @@ const searchStyle = StyleSheet.create({
|
||||
flex: 1,
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
padding: 16,
|
||||
paddingLeft: 16,
|
||||
paddingRight: 16,
|
||||
marginBottom: 60
|
||||
},
|
||||
scrollPadding: {
|
||||
@@ -20,14 +21,14 @@ const searchStyle = StyleSheet.create({
|
||||
flex: 1,
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-between',
|
||||
marginBottom: 16
|
||||
marginTop: 16
|
||||
},
|
||||
thumbnail: {
|
||||
width: '100%',
|
||||
height: 80
|
||||
},
|
||||
thumbnailContainer: {
|
||||
width: '25%'
|
||||
width: '25%'
|
||||
},
|
||||
detailsContainer: {
|
||||
width: '70%'
|
||||
|
||||
@@ -17,6 +17,11 @@ const splashStyle = StyleSheet.create({
|
||||
loading: {
|
||||
marginBottom: 36
|
||||
},
|
||||
progress: {
|
||||
alignSelf: 'center',
|
||||
marginBottom: 36,
|
||||
width: '50%'
|
||||
},
|
||||
details: {
|
||||
fontFamily: 'Metropolis-Regular',
|
||||
fontSize: 14,
|
||||
|
||||
@@ -20,7 +20,8 @@ const walletStyle = StyleSheet.create({
|
||||
width: '85%'
|
||||
},
|
||||
button: {
|
||||
backgroundColor: Colors.LbryGreen
|
||||
backgroundColor: Colors.LbryGreen,
|
||||
alignSelf: 'flex-start'
|
||||
},
|
||||
historyList: {
|
||||
backgroundColor: '#ffffff'
|
||||
|
||||
@@ -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, distro, 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
|
||||
requirements = openssl, sqlite3, hostpython2, android, distro, 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, netifaces, txupnp==0.0.1a10, git+https://github.com/lbryio/lbryschema.git@v0.0.16#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,10 +86,10 @@ fullscreen = 0
|
||||
#android.presplash_color = #FFFFFF
|
||||
|
||||
# (list) Permissions
|
||||
android.permissions = ACCESS_NETWORK_STATE,BLUETOOTH,INTERNET,READ_EXTERNAL_STORAGE,WRITE_EXTERNAL_STORAGE
|
||||
android.permissions = ACCESS_NETWORK_STATE,BLUETOOTH,INTERNET,READ_EXTERNAL_STORAGE,READ_PHONE_STATE,WRITE_EXTERNAL_STORAGE
|
||||
|
||||
# (int) Android API to use
|
||||
android.api = 23
|
||||
android.api = 27
|
||||
|
||||
# (int) Minimum API required
|
||||
android.minapi = 21
|
||||
@@ -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:0.55.3, com.mixpanel.android:mixpanel-android:5+, com.google.android.gms:play-services-gcm:11.0.4+
|
||||
android.gradle_dependencies = com.android.support:appcompat-v7:27.1.1, com.facebook.react:react-native:0.55.3, com.mixpanel.android:mixpanel-android:5+, com.google.android.gms:play-services-gcm:11.0.4+, com.facebook.fresco:fresco:1.9.0, com.facebook.fresco:animated-gif:1.9.0
|
||||
|
||||
# (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, distro, 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
|
||||
requirements = openssl, sqlite3, hostpython2, android, distro, 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, netifaces, txupnp==0.0.1a10, git+https://github.com/lbryio/lbryschema.git@v0.0.16#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,10 +86,10 @@ fullscreen = 0
|
||||
#android.presplash_color = #FFFFFF
|
||||
|
||||
# (list) Permissions
|
||||
android.permissions = ACCESS_NETWORK_STATE,BLUETOOTH,INTERNET,READ_EXTERNAL_STORAGE,WRITE_EXTERNAL_STORAGE
|
||||
android.permissions = ACCESS_NETWORK_STATE,BLUETOOTH,INTERNET,READ_EXTERNAL_STORAGE,READ_PHONE_STATE,WRITE_EXTERNAL_STORAGE
|
||||
|
||||
# (int) Android API to use
|
||||
android.api = 23
|
||||
android.api = 27
|
||||
|
||||
# (int) Minimum API required
|
||||
android.minapi = 21
|
||||
@@ -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:0.55.3, com.mixpanel.android:mixpanel-android:5+, com.google.android.gms:play-services-gcm:11.0.4+
|
||||
android.gradle_dependencies = com.android.support:appcompat-v7:27.1.1, com.facebook.react:react-native:0.55.3, com.mixpanel.android:mixpanel-android:5+, com.google.android.gms:play-services-gcm:11.0.4+, com.facebook.fresco:fresco:1.9.0, com.facebook.fresco:animated-gif:1.9.0
|
||||
|
||||
# (str) python-for-android branch to use, defaults to master
|
||||
#p4a.branch = stable
|
||||
|
||||
@@ -0,0 +1,276 @@
|
||||
[app]
|
||||
|
||||
# (str) Title of your application
|
||||
title = LBRY Browser
|
||||
|
||||
# (str) Package name
|
||||
package.name = browser
|
||||
|
||||
# (str) Package domain (needed for android/ios packaging)
|
||||
package.domain = io.lbry
|
||||
|
||||
# (str) Source code where the main.py live
|
||||
source.dir = ./src/main/python
|
||||
|
||||
# (list) Source files to include (let empty to include all the files)
|
||||
source.include_exts = py,png,jpg,kv,atlas
|
||||
|
||||
# (list) List of inclusions using pattern matching
|
||||
#source.include_patterns = assets/*, res/*
|
||||
|
||||
# (list) Source files to exclude (let empty to not exclude anything)
|
||||
#source.exclude_exts = spec
|
||||
|
||||
# (list) List of directory to exclude (let empty to not exclude anything)
|
||||
#source.exclude_dirs = tests, bin
|
||||
|
||||
# (list) List of exclusions using pattern matching
|
||||
#source.exclude_patterns = license,images/*/*.jpg
|
||||
|
||||
# (str) Application versioning (method 1)
|
||||
#version = 0.1
|
||||
|
||||
# (str) Application versioning (method 2)
|
||||
version.regex = __version__ = ['"](.*)['"]
|
||||
version.filename = %(source.dir)s/main.py
|
||||
|
||||
# (list) Application requirements
|
||||
# comma seperated e.g. requirements = sqlite3,kivy
|
||||
requirements = openssl, sqlite3, hostpython2, android, distro, 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, netifaces, txupnp==0.0.1a10, git+https://github.com/lbryio/lbryschema.git@v0.0.16#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
|
||||
# requirements.source.kivy = ../../kivy
|
||||
|
||||
# (list) Garden requirements
|
||||
#garden_requirements =
|
||||
|
||||
# (str) Presplash of the application
|
||||
#presplash.filename = %(source.dir)s/data/presplash.png
|
||||
|
||||
# (str) Icon of the application
|
||||
#icon.filename = %(source.dir)s/data/icon.png
|
||||
|
||||
# (str) Supported orientation (one of landscape, portrait or all)
|
||||
orientation = portrait
|
||||
|
||||
# (list) List of service to declare
|
||||
#services = NAME:ENTRYPOINT_TO_PY,NAME2:ENTRYPOINT2_TO_PY
|
||||
services = lbrynetservice:./lbrynetservice.py
|
||||
|
||||
#
|
||||
# OSX Specific
|
||||
#
|
||||
|
||||
#
|
||||
# author = © Copyright Info
|
||||
|
||||
# change the major version of python used by the app
|
||||
osx.python_version = 3
|
||||
|
||||
# Kivy version to use
|
||||
osx.kivy_version = 1.9.1
|
||||
|
||||
#
|
||||
# Android specific
|
||||
#
|
||||
|
||||
# (bool) Indicate if the application should be fullscreen or not
|
||||
fullscreen = 0
|
||||
|
||||
# (string) Presplash background color (for new android toolchain)
|
||||
# Supported formats are: #RRGGBB #AARRGGBB or one of the following names:
|
||||
# red, blue, green, black, white, gray, cyan, magenta, yellow, lightgray,
|
||||
# darkgray, grey, lightgrey, darkgrey, aqua, fuchsia, lime, maroon, navy,
|
||||
# olive, purple, silver, teal.
|
||||
#android.presplash_color = #FFFFFF
|
||||
|
||||
# (list) Permissions
|
||||
android.permissions = ACCESS_NETWORK_STATE,BLUETOOTH,INTERNET,READ_EXTERNAL_STORAGE,READ_PHONE_STATE,WRITE_EXTERNAL_STORAGE
|
||||
|
||||
# (int) Android API to use
|
||||
android.api = 27
|
||||
|
||||
# (int) Minimum API required
|
||||
android.minapi = 21
|
||||
|
||||
# (int) Android SDK version to use
|
||||
android.sdk = 23
|
||||
|
||||
# (str) Android NDK version to use
|
||||
android.ndk = 13b
|
||||
|
||||
# (bool) Use --private data storage (True) or --dir public storage (False)
|
||||
#android.private_storage = True
|
||||
|
||||
# (str) Android NDK directory (if empty, it will be automatically downloaded.)
|
||||
#android.ndk_path = ~/Dev/SDKs/android-ndk-r13b
|
||||
|
||||
# (str) Android SDK directory (if empty, it will be automatically downloaded.)
|
||||
#android.sdk_path = ~/Dev/SDKs/android
|
||||
|
||||
# (str) ANT directory (if empty, it will be automatically downloaded.)
|
||||
#android.ant_path =
|
||||
|
||||
# (bool) If True, then skip trying to update the Android sdk
|
||||
# This can be useful to avoid excess Internet downloads or save time
|
||||
# when an update is due and you just want to test/build your package
|
||||
#android.skip_update = False
|
||||
|
||||
# (str) Android entry point, default is ok for Kivy-based app
|
||||
#android.entrypoint = org.renpy.android.PythonActivity
|
||||
|
||||
# (list) Pattern to whitelist for the whole project
|
||||
#android.whitelist =
|
||||
|
||||
# (str) Path to a custom whitelist file
|
||||
#android.whitelist_src =
|
||||
|
||||
# (str) Path to a custom blacklist file
|
||||
#android.blacklist_src =
|
||||
|
||||
# (list) List of Java .jar files to add to the libs so that pyjnius can access
|
||||
# their classes. Don't add jars that you do not need, since extra jars can slow
|
||||
# down the build process. Allows wildcards matching, for example:
|
||||
# OUYA-ODK/libs/*.jar
|
||||
#android.add_jars = foo.jar,bar.jar,path/to/more/*.jar
|
||||
|
||||
# (list) List of Java files to add to the android project (can be java or a
|
||||
# directory containing the files)
|
||||
android.add_src = ./src/main
|
||||
|
||||
# (str) Path to the React files and node_modules for building
|
||||
android.react_src = ./app
|
||||
|
||||
# (list) Android AAR archives to add (currently works only with sdl2_gradle
|
||||
# bootstrap)
|
||||
#android.add_aars =
|
||||
|
||||
# (list) Gradle dependencies to add (currently works only with sdl2_gradle
|
||||
# bootstrap)
|
||||
android.gradle_dependencies = com.android.support:appcompat-v7:27.1.1, com.facebook.react:react-native:0.55.3, com.mixpanel.android:mixpanel-android:5+, com.google.android.gms:play-services-gcm:11.0.4+, com.facebook.fresco:fresco:1.9.0, com.facebook.fresco:animated-gif:1.9.0
|
||||
|
||||
# (str) python-for-android branch to use, defaults to master
|
||||
#p4a.branch = stable
|
||||
|
||||
# (str) OUYA Console category. Should be one of GAME or APP
|
||||
# If you leave this blank, OUYA support will not be enabled
|
||||
#android.ouya.category = GAME
|
||||
|
||||
# (str) Filename of OUYA Console icon. It must be a 732x412 png image.
|
||||
#android.ouya.icon.filename = %(source.dir)s/data/ouya_icon.png
|
||||
|
||||
# (str) XML file to include as an intent filters in <activity> tag
|
||||
#android.manifest.intent_filters =
|
||||
|
||||
# (list) Android additionnal libraries to copy into libs/armeabi
|
||||
#android.add_libs_armeabi = libs/android-v7/*
|
||||
#android.add_libs_armeabi_v7a = libs/android-v7/*
|
||||
#android.add_libs_x86 = libs/android-x86/*.so
|
||||
#android.add_libs_mips = libs/android-mips/*.so
|
||||
|
||||
# (bool) Indicate whether the screen should stay on
|
||||
# Don't forget to add the WAKE_LOCK permission if you set this to True
|
||||
#android.wakelock = False
|
||||
|
||||
# (list) Android application meta-data to set (key=value format)
|
||||
#android.meta_data =
|
||||
|
||||
# (list) Android library project to add (will be added in the
|
||||
# project.properties automatically.)
|
||||
#android.library_references =
|
||||
|
||||
# (str) Android logcat filters to use
|
||||
#android.logcat_filters = *:S python:D
|
||||
|
||||
# (bool) Copy library instead of making a libpymodules.so
|
||||
#android.copy_libs = 1
|
||||
|
||||
# (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86
|
||||
android.arch = armeabi-v7a
|
||||
|
||||
#
|
||||
# Python for android (p4a) specific
|
||||
#
|
||||
|
||||
# (str) python-for-android git clone directory (if empty, it will be automatically cloned from github)
|
||||
p4a.source_dir = ./p4a
|
||||
|
||||
# (str) The directory in which python-for-android should look for your own build recipes (if any)
|
||||
p4a.local_recipes = ./recipes
|
||||
|
||||
# (str) Filename to the hook for p4a
|
||||
#p4a.hook =
|
||||
|
||||
# (str) Bootstrap to use for android builds
|
||||
p4a.bootstrap = lbry
|
||||
|
||||
|
||||
#
|
||||
# iOS specific
|
||||
#
|
||||
|
||||
# (str) Path to a custom kivy-ios folder
|
||||
#ios.kivy_ios_dir = ../kivy-ios
|
||||
|
||||
# (str) Name of the certificate to use for signing the debug version
|
||||
# Get a list of available identities: buildozer ios list_identities
|
||||
#ios.codesign.debug = "iPhone Developer: <lastname> <firstname> (<hexstring>)"
|
||||
|
||||
# (str) Name of the certificate to use for signing the release version
|
||||
#ios.codesign.release = %(ios.codesign.debug)s
|
||||
|
||||
|
||||
[buildozer]
|
||||
|
||||
# (int) Log level (0 = error only, 1 = info, 2 = debug (with command output))
|
||||
log_level = 2
|
||||
|
||||
# (int) Display warning if buildozer is run as root (0 = False, 1 = True)
|
||||
warn_on_root = 1
|
||||
|
||||
# (str) Path to build artifact storage, absolute or relative to spec file
|
||||
# build_dir = ./.buildozer
|
||||
|
||||
# (str) Path to build output (i.e. .apk, .ipa) storage
|
||||
# bin_dir = ./bin
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# List as sections
|
||||
#
|
||||
# You can define all the "list" as [section:key].
|
||||
# Each line will be considered as a option to the list.
|
||||
# Let's take [app] / source.exclude_patterns.
|
||||
# Instead of doing:
|
||||
#
|
||||
#[app]
|
||||
#source.exclude_patterns = license,data/audio/*.wav,data/images/original/*
|
||||
#
|
||||
# This can be translated into:
|
||||
#
|
||||
#[app:source.exclude_patterns]
|
||||
#license
|
||||
#data/audio/*.wav
|
||||
#data/images/original/*
|
||||
#
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Profiles
|
||||
#
|
||||
# You can extend section / key with a profile
|
||||
# For example, you want to deploy a demo version of your application without
|
||||
# HD content. You could first change the title to add "(demo)" in the name
|
||||
# and extend the excluded directories to remove the HD content.
|
||||
#
|
||||
#[app@demo]
|
||||
#title = My Application (demo)
|
||||
#
|
||||
#[app:source.exclude_patterns@demo]
|
||||
#images/hd/*
|
||||
#
|
||||
# Then, invoke the command line with the "demo" profile:
|
||||
#
|
||||
#buildozer --profile demo android debug
|
||||
|
||||
builddir = /home/vagrant
|
||||
@@ -1,7 +1,7 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.3.1'
|
||||
@@ -11,6 +11,9 @@ buildscript {
|
||||
allprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
maven {
|
||||
url 'https://maven.google.com'
|
||||
}
|
||||
maven {
|
||||
// All of React Native (JS, Android binaries) is installed from npm
|
||||
url "$rootDir/react/node_modules/react-native/android"
|
||||
@@ -26,14 +29,14 @@ apply plugin: 'com.android.application'
|
||||
android {
|
||||
compileSdkVersion {{ android_api }}
|
||||
buildToolsVersion '{{ build_tools_version }}'
|
||||
defaultConfig {
|
||||
defaultConfig {
|
||||
minSdkVersion {{ args.min_sdk_version }}
|
||||
targetSdkVersion {{ android_api }}
|
||||
versionCode {{ args.numeric_version }}
|
||||
versionName '{{ args.version }}'
|
||||
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a", "x86"
|
||||
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a", "x86"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,14 +63,25 @@ android {
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
jniLibs.srcDir 'libs'
|
||||
jniLibs.srcDir 'libs'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
afterEvaluate {project ->
|
||||
if (project.hasProperty("android")) {
|
||||
android {
|
||||
compileSdkVersion {{ android_api }}
|
||||
buildToolsVersion '{{ build_tools_version }}'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(':react-native-video')
|
||||
compile project(':react-native-fetch-blob')
|
||||
{%- for aar in aars %}
|
||||
compile(name: '{{ aar }}', ext: 'aar')
|
||||
{%- endfor -%}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
rootProject.name = 'browser'
|
||||
include ':react-native-video'
|
||||
project(':react-native-video').projectDir = new File(rootProject.projectDir, './react/node_modules/react-native-video/android')
|
||||
project(':react-native-video').projectDir = new File(rootProject.projectDir, './react/node_modules/react-native-video/android-exoplayer')
|
||||
include ':react-native-fetch-blob'
|
||||
project(':react-native-fetch-blob').projectDir = new File(rootProject.projectDir, './react/node_modules/react-native-fetch-blob/android')
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
import glob
|
||||
from pythonforandroid.toolchain import CompiledComponentsPythonRecipe, Recipe
|
||||
from os.path import join
|
||||
import sh
|
||||
|
||||
|
||||
class NetifacesRecipe(CompiledComponentsPythonRecipe):
|
||||
version = '0.10.7'
|
||||
url = 'https://files.pythonhosted.org/packages/81/39/4e9a026265ba944ddf1fea176dbb29e0fe50c43717ba4fcf3646d099fe38/netifaces-{version}.tar.gz'
|
||||
depends = ['python2', 'setuptools']
|
||||
call_hostpython_via_targetpython = False
|
||||
|
||||
def get_recipe_env(self, arch):
|
||||
env = super(NetifacesRecipe, self).get_recipe_env(arch)
|
||||
|
||||
target_python = Recipe.get_recipe('python2', self.ctx).get_build_dir(arch.arch)
|
||||
env['PYTHON_ROOT'] = join(target_python, 'python-install')
|
||||
env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
|
||||
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python2.7'
|
||||
env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + ' -lpython2.7'
|
||||
|
||||
return env
|
||||
|
||||
recipe = NetifacesRecipe()
|
||||
@@ -0,0 +1,11 @@
|
||||
LOCAL_PATH := $(call my-dir)/..
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := sqlite3.c
|
||||
|
||||
LOCAL_MODULE := sqlite3
|
||||
|
||||
LOCAL_CFLAGS := -DSQLITE_ENABLE_FTS4
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
@@ -0,0 +1,32 @@
|
||||
from pythonforandroid.toolchain import NDKRecipe, shprint, shutil, current_directory
|
||||
from os.path import join, exists
|
||||
import sh
|
||||
|
||||
class Sqlite3Recipe(NDKRecipe):
|
||||
version = '3.24.0'
|
||||
# Don't forget to change the URL when changing the version
|
||||
url = 'https://www.sqlite.org/2018/sqlite-amalgamation-3240000.zip'
|
||||
generated_libraries = ['sqlite3']
|
||||
|
||||
def should_build(self, arch):
|
||||
return not self.has_libs(arch, 'libsqlite3.so')
|
||||
|
||||
def prebuild_arch(self, arch):
|
||||
super(Sqlite3Recipe, self).prebuild_arch(arch)
|
||||
# Copy the Android make file
|
||||
sh.mkdir('-p', join(self.get_build_dir(arch.arch), 'jni'))
|
||||
shutil.copyfile(join(self.get_recipe_dir(), 'Android.mk'),
|
||||
join(self.get_build_dir(arch.arch), 'jni/Android.mk'))
|
||||
|
||||
def build_arch(self, arch, *extra_args):
|
||||
super(Sqlite3Recipe, self).build_arch(arch)
|
||||
# Copy the shared library
|
||||
shutil.copyfile(join(self.get_build_dir(arch.arch), 'libs', arch.arch, 'libsqlite3.so'),
|
||||
join(self.ctx.get_libs_dir(arch.arch), 'libsqlite3.so'))
|
||||
|
||||
def get_recipe_env(self, arch):
|
||||
env = super(Sqlite3Recipe, self).get_recipe_env(arch)
|
||||
env['NDK_PROJECT_PATH'] = self.get_build_dir(arch.arch)
|
||||
return env
|
||||
|
||||
recipe = Sqlite3Recipe()
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2,12 +2,15 @@ package io.lbry.browser;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Intent;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.Binder;
|
||||
import android.os.IBinder;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.File;
|
||||
@@ -29,16 +32,46 @@ import org.renpy.android.ResourceManager;
|
||||
* @version 0.1
|
||||
*/
|
||||
public class LbrynetService extends PythonService {
|
||||
|
||||
|
||||
private static final String NOTIFICATION_CHANNEL_ID = "io.lbry.browser.DAEMON_NOTIFICATION_CHANNEL";
|
||||
|
||||
public static String TAG = "LbrynetService";
|
||||
|
||||
public static LbrynetService serviceInstance;
|
||||
|
||||
@Override
|
||||
public boolean canDisplayNotification() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void doStartForeground(Bundle extras) {
|
||||
String serviceTitle = extras.getString("serviceTitle");
|
||||
String serviceDescription = "The LBRY service is running in the background.";
|
||||
|
||||
Context context = getApplicationContext();
|
||||
|
||||
NotificationManager notificationManager =
|
||||
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
NotificationChannel channel = new NotificationChannel(
|
||||
NOTIFICATION_CHANNEL_ID, "LBRY Browser", NotificationManager.IMPORTANCE_LOW);
|
||||
channel.setDescription("LBRY service notification channel");
|
||||
channel.setShowBadge(false);
|
||||
notificationManager.createNotificationChannel(channel);
|
||||
|
||||
Intent contextIntent = new Intent(context, MainActivity.class);
|
||||
PendingIntent pIntent = PendingIntent.getActivity(context, 0, contextIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID);
|
||||
Notification notification = builder.setContentTitle(serviceTitle)
|
||||
.setContentText(serviceDescription)
|
||||
.setContentIntent(pIntent)
|
||||
.setWhen(System.currentTimeMillis())
|
||||
.setSmallIcon(R.drawable.ic_lbry)
|
||||
.setOngoing(true)
|
||||
.build();
|
||||
startForeground(1, notification);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int startType() {
|
||||
return START_STICKY;
|
||||
@@ -66,7 +99,7 @@ public class LbrynetService extends PythonService {
|
||||
super.onDestroy();
|
||||
serviceInstance = null;
|
||||
}
|
||||
|
||||
|
||||
public String getAppRoot() {
|
||||
String app_root = getApplicationContext().getFilesDir().getAbsolutePath() + "/app";
|
||||
return app_root;
|
||||
|
||||
@@ -4,8 +4,6 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
@@ -14,6 +12,9 @@ import android.content.SharedPreferences;
|
||||
import android.Manifest;
|
||||
import android.net.Uri;
|
||||
import android.provider.Settings;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.brentvatne.react.ReactVideoPackage;
|
||||
@@ -22,22 +23,37 @@ import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
|
||||
import com.facebook.react.ReactRootView;
|
||||
import com.facebook.react.ReactInstanceManager;
|
||||
import com.facebook.react.shell.MainReactPackage;
|
||||
import com.RNFetchBlob.RNFetchBlobPackage;
|
||||
|
||||
import io.lbry.browser.reactpackages.LbryReactPackage;
|
||||
import io.lbry.browser.reactmodules.DownloadManagerModule;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigInteger;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Random;
|
||||
|
||||
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 static final int PHONE_STATE_PERMISSION_REQ_CODE = 202;
|
||||
|
||||
private ReactRootView mReactRootView;
|
||||
|
||||
private ReactInstanceManager mReactInstanceManager;
|
||||
|
||||
public static final String SHARED_PREFERENCES_NAME = "LBRY";
|
||||
|
||||
public static final String SALT_KEY = "salt";
|
||||
|
||||
public static final String DEVICE_ID_KEY = "deviceId";
|
||||
|
||||
public static final String SETTING_KEEP_DAEMON_RUNNING = "keepDaemonRunning";
|
||||
|
||||
/**
|
||||
* Flag which indicates whether or not the service is running. Will be updated in the
|
||||
* onResume method.
|
||||
@@ -52,16 +68,10 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
// Request external storage permission on Android version >= 6
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||
// 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_LONG).show();
|
||||
} else {
|
||||
ActivityCompat.requestPermissions(this,
|
||||
new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, STORAGE_PERMISSION_REQ_CODE);
|
||||
}
|
||||
}
|
||||
checkPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
STORAGE_PERMISSION_REQ_CODE,
|
||||
"LBRY requires access to your device storage to be able to download files and media.",
|
||||
this);
|
||||
}
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -79,6 +89,7 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
.setJSMainModulePath("index")
|
||||
.addPackage(new MainReactPackage())
|
||||
.addPackage(new ReactVideoPackage())
|
||||
.addPackage(new RNFetchBlobPackage())
|
||||
.addPackage(new LbryReactPackage())
|
||||
.setUseDeveloperSupport(true)
|
||||
.setInitialLifecycleState(LifecycleState.RESUMED)
|
||||
@@ -104,6 +115,9 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
switch (requestCode) {
|
||||
case STORAGE_PERMISSION_REQ_CODE:
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
// Request for the READ_PHONE_STATE permission
|
||||
checkPhoneStatePermission(this);
|
||||
|
||||
if (BuildConfig.DEBUG && !Settings.canDrawOverlays(this)) {
|
||||
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
|
||||
Uri.parse("package:" + getPackageName()));
|
||||
@@ -120,9 +134,61 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
finish();
|
||||
}
|
||||
break;
|
||||
|
||||
case PHONE_STATE_PERMISSION_REQ_CODE:
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
// Permission granted
|
||||
acquireDeviceId(this);
|
||||
} else {
|
||||
// Permission not granted. Simply show a message.
|
||||
Toast.makeText(this,
|
||||
"No permission granted to read your device state. Rewards cannot be claimed.", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static String acquireDeviceId(Context context) {
|
||||
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
String id = null;
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
id = telephonyManager.getImei(); // GSM
|
||||
if (id == null) {
|
||||
id = telephonyManager.getMeid(); // CDMA
|
||||
}
|
||||
} else {
|
||||
id = telephonyManager.getDeviceId();
|
||||
}
|
||||
|
||||
} catch (SecurityException ex) {
|
||||
// Maybe the permission was not granted? Try to acquire permission
|
||||
checkPhoneStatePermission(context);
|
||||
} catch (Exception ex) {
|
||||
// id could not be obtained. Display a warning that rewards cannot be claimed.
|
||||
}
|
||||
|
||||
if (id == null || id.trim().length() == 0) {
|
||||
Toast.makeText(context, "Rewards cannot be claimed because we could not identify your device.", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
try {
|
||||
MessageDigest md = MessageDigest.getInstance("SHA-384");
|
||||
md.update(id.getBytes("UTF-8"));
|
||||
String hash = new BigInteger(1, md.digest()).toString(16);
|
||||
|
||||
SharedPreferences sp = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sp.edit();
|
||||
editor.putString(DEVICE_ID_KEY, hash);
|
||||
editor.commit();
|
||||
} catch (NoSuchAlgorithmException | UnsupportedEncodingException ex) {
|
||||
// SHA-384 not found, UTF-8 encoding not supported
|
||||
Toast.makeText(context, "Rewards cannot be claimed because we could not identify your device.", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invokeDefaultOnBackPressed() {
|
||||
super.onBackPressed();
|
||||
@@ -142,13 +208,9 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
super.onResume();
|
||||
|
||||
SharedPreferences sp = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
if (!sp.getBoolean("firstRun", true)) {
|
||||
// We're not showing the welcome page, so it's okay to start the daemon service
|
||||
// because this is not the first run experience
|
||||
serviceRunning = isServiceRunning(LbrynetService.class);
|
||||
if (!serviceRunning) {
|
||||
ServiceHelper.start(this, "", LbrynetService.class, "lbrynetservice");
|
||||
}
|
||||
serviceRunning = isServiceRunning(LbrynetService.class);
|
||||
if (!serviceRunning) {
|
||||
ServiceHelper.start(this, "", LbrynetService.class, "lbrynetservice");
|
||||
}
|
||||
|
||||
if (mReactInstanceManager != null) {
|
||||
@@ -160,7 +222,7 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
protected void onDestroy() {
|
||||
// check service running setting and end it here
|
||||
SharedPreferences sp = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
boolean shouldKeepDaemonRunning = sp.getBoolean("keepDaemonRunning", true);
|
||||
boolean shouldKeepDaemonRunning = sp.getBoolean(SETTING_KEEP_DAEMON_RUNNING, true);
|
||||
if (!shouldKeepDaemonRunning) {
|
||||
serviceRunning = isServiceRunning(LbrynetService.class);
|
||||
if (serviceRunning) {
|
||||
@@ -192,6 +254,26 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
super.onNewIntent(intent);
|
||||
}
|
||||
|
||||
private static void checkPermission(String permission, int requestCode, String rationale, Context context) {
|
||||
if (ContextCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) {
|
||||
// Should we show an explanation?
|
||||
if (ActivityCompat.shouldShowRequestPermissionRationale((Activity) context, permission)) {
|
||||
Toast.makeText(context, rationale, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
ActivityCompat.requestPermissions((Activity) context, new String[] { permission }, requestCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkPhoneStatePermission(Context context) {
|
||||
// Request read phone state permission
|
||||
checkPermission(Manifest.permission.READ_PHONE_STATE,
|
||||
PHONE_STATE_PERMISSION_REQ_CODE,
|
||||
"LBRY requires optional access to be able to identify your device for rewards. " +
|
||||
"You cannot claim rewards without this permission.",
|
||||
context);
|
||||
}
|
||||
|
||||
private boolean isServiceRunning(Class<?> serviceClass) {
|
||||
ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
|
||||
for (ActivityManager.RunningServiceInfo serviceInfo : manager.getRunningServices(Integer.MAX_VALUE)) {
|
||||
|
||||
@@ -3,12 +3,14 @@ package io.lbry.browser.reactmodules;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
|
||||
import io.lbry.browser.LbrynetService;
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.ServiceHelper;
|
||||
|
||||
public class DaemonServiceControlModule extends ReactContextBaseJavaModule {
|
||||
@@ -33,4 +35,14 @@ public class DaemonServiceControlModule extends ReactContextBaseJavaModule {
|
||||
public void stopService() {
|
||||
ServiceHelper.stop(context, LbrynetService.class);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void setKeepDaemonRunning(boolean value) {
|
||||
if (context != null) {
|
||||
SharedPreferences sp = context.getSharedPreferences(MainActivity.SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sp.edit();
|
||||
editor.putBoolean(MainActivity.SETTING_KEEP_DAEMON_RUNNING, value);
|
||||
editor.commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
package io.lbry.browser.reactmodules;
|
||||
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.app.NotificationManagerCompat;
|
||||
|
||||
@@ -28,18 +31,22 @@ public class DownloadManagerModule extends ReactContextBaseJavaModule {
|
||||
|
||||
private HashMap<String, Integer> downloadIdNotificationIdMap = new HashMap<String, Integer>();
|
||||
|
||||
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#");
|
||||
|
||||
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#");
|
||||
|
||||
private static final int MAX_PROGRESS = 100;
|
||||
|
||||
private static final String GROUP_DOWNLOADS = "io.lbry.browser.GROUP_DOWNLOADS";
|
||||
|
||||
|
||||
private static final String NOTIFICATION_CHANNEL_ID = "io.lbry.browser.DOWNLOADS_NOTIFICATION_CHANNEL";
|
||||
|
||||
private static boolean channelCreated = false;
|
||||
|
||||
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;
|
||||
@@ -53,28 +60,40 @@ public class DownloadManagerModule extends ReactContextBaseJavaModule {
|
||||
public String getName() {
|
||||
return "LbryDownloadManager";
|
||||
}
|
||||
|
||||
|
||||
private void createNotificationChannel() {
|
||||
// Only applies to Android 8.0 Oreo (API Level 26) or higher
|
||||
if (!channelCreated && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
NotificationManager notificationManager =
|
||||
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
NotificationChannel channel = new NotificationChannel(
|
||||
NOTIFICATION_CHANNEL_ID, "LBRY Downloads", NotificationManager.IMPORTANCE_LOW);
|
||||
channel.setDescription("LBRY file downloads");
|
||||
notificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID);
|
||||
builder.setContentTitle("Active downloads")
|
||||
.setContentText("Active downloads")
|
||||
.setSmallIcon(R.drawable.ic_file_download_black_24dp)
|
||||
.setSmallIcon(android.R.drawable.stat_sys_download)
|
||||
.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);
|
||||
@@ -84,17 +103,18 @@ public class DownloadManagerModule extends ReactContextBaseJavaModule {
|
||||
|
||||
@ReactMethod
|
||||
public void startDownload(String id, String fileName) {
|
||||
createNotificationChannel();
|
||||
createNotificationGroup();
|
||||
|
||||
|
||||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID);
|
||||
// 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);
|
||||
.setSmallIcon(android.R.drawable.stat_sys_download);
|
||||
|
||||
int notificationId = generateNotificationId();
|
||||
downloadIdNotificationIdMap.put(id, notificationId);
|
||||
@@ -114,6 +134,7 @@ public class DownloadManagerModule extends ReactContextBaseJavaModule {
|
||||
return;
|
||||
}
|
||||
|
||||
createNotificationChannel();
|
||||
createNotificationGroup();
|
||||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
|
||||
NotificationCompat.Builder builder = builders.get(notificationId);
|
||||
@@ -128,12 +149,12 @@ public class DownloadManagerModule extends ReactContextBaseJavaModule {
|
||||
.setContentText(String.format("%s", formatBytes(totalBytes)))
|
||||
.setProgress(0, 0, false);
|
||||
notificationManager.notify(notificationId, builder.build());
|
||||
|
||||
|
||||
downloadIdNotificationIdMap.remove(id);
|
||||
builders.remove(notificationId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ReactMethod
|
||||
public void stopDownload(String id, String filename) {
|
||||
if (!downloadIdNotificationIdMap.containsKey(id)) {
|
||||
@@ -144,14 +165,14 @@ public class DownloadManagerModule extends ReactContextBaseJavaModule {
|
||||
if (!builders.containsKey(notificationId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
|
||||
NotificationCompat.Builder builder = builders.get(notificationId);
|
||||
notificationManager.cancel(notificationId);
|
||||
|
||||
|
||||
downloadIdNotificationIdMap.remove(id);
|
||||
builders.remove(notificationId);
|
||||
|
||||
|
||||
if (builders.values().size() == 0) {
|
||||
notificationManager.cancel(GROUP_ID);
|
||||
groupCreated = false;
|
||||
|
||||
@@ -36,4 +36,12 @@ public class ScreenOrientationModule extends ReactContextBaseJavaModule {
|
||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void lockOrientationPortrait() {
|
||||
Activity activity = getCurrentActivity();
|
||||
if (activity != null) {
|
||||
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package io.lbry.browser.reactmodules;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
|
||||
public class UtilityModule extends ReactContextBaseJavaModule {
|
||||
private Context context;
|
||||
|
||||
public UtilityModule(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
this.context = reactContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "UtilityModule";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void keepAwakeOn() {
|
||||
final Activity activity = getCurrentActivity();
|
||||
|
||||
if (activity != null) {
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void keepAwakeOff() {
|
||||
final Activity activity = getCurrentActivity();
|
||||
|
||||
if (activity != null) {
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void hideNavigationBar() {
|
||||
if (context != null && context instanceof Activity) {
|
||||
Activity activity = (Activity) context;
|
||||
View decorView = activity.getWindow().getDecorView();
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
||||
View.SYSTEM_UI_FLAG_IMMERSIVE |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void showNavigationBar() {
|
||||
if (context != null && context instanceof Activity) {
|
||||
Activity activity = (Activity) context;
|
||||
View decorView = activity.getWindow().getDecorView();
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
||||
View.SYSTEM_UI_FLAG_VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import io.lbry.browser.reactmodules.FirstRunModule;
|
||||
import io.lbry.browser.reactmodules.MixpanelModule;
|
||||
import io.lbry.browser.reactmodules.ScreenOrientationModule;
|
||||
import io.lbry.browser.reactmodules.VersionInfoModule;
|
||||
import io.lbry.browser.reactmodules.UtilityModule;;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -31,8 +32,9 @@ public class LbryReactPackage implements ReactPackage {
|
||||
modules.add(new FirstRunModule(reactContext));
|
||||
modules.add(new MixpanelModule(reactContext));
|
||||
modules.add(new ScreenOrientationModule(reactContext));
|
||||
modules.add(new UtilityModule(reactContext));
|
||||
modules.add(new VersionInfoModule(reactContext));
|
||||
|
||||
return modules;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,8 +81,8 @@ from jsonrpc.proxy import JSONRPCProxy
|
||||
from lbrynet import analytics
|
||||
from lbrynet import conf
|
||||
from lbrynet.core import utils, system_info
|
||||
from lbrynet.daemon.auth.client import LBRYAPIClient
|
||||
from lbrynet.daemon.DaemonServer import DaemonServer
|
||||
from lbrynet.daemon.Components import PEER_PROTOCOL_SERVER_COMPONENT, REFLECTOR_COMPONENT
|
||||
from lbrynet.daemon.Daemon import Daemon
|
||||
|
||||
# https certificate verification
|
||||
# TODO: this is bad. Need to find a way to properly verify https requests
|
||||
@@ -124,33 +124,22 @@ def start():
|
||||
|
||||
lbrynet_log = conf.settings.get_log_filename()
|
||||
log_support.configure_logging(lbrynet_log, True, [])
|
||||
log.debug('Final Settings: %s', conf.settings.get_current_settings_dict())
|
||||
|
||||
# TODO: specify components, initialise auth
|
||||
conf.settings.update({
|
||||
'components_to_skip': [PEER_PROTOCOL_SERVER_COMPONENT, REFLECTOR_COMPONENT],
|
||||
'concurrent_announcers': 0
|
||||
})
|
||||
|
||||
log.info('Final Settings: %s', conf.settings.get_current_settings_dict())
|
||||
log.info("Starting lbrynet-daemon")
|
||||
|
||||
if test_internet_connection():
|
||||
analytics_manager = analytics.Manager.new_instance()
|
||||
start_server_and_listen(False, analytics_manager)
|
||||
daemon = Daemon()
|
||||
daemon.start_listening()
|
||||
reactor.run()
|
||||
else:
|
||||
log.info("Not connected to internet, unable to start")
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def start_server_and_listen(use_auth, analytics_manager, max_tries=5):
|
||||
"""The primary entry point for launching the daemon.
|
||||
Args:
|
||||
use_auth: set to true to enable http authentication
|
||||
analytics_manager: to send analytics
|
||||
"""
|
||||
analytics_manager.send_server_startup()
|
||||
daemon_server = DaemonServer(analytics_manager)
|
||||
try:
|
||||
yield daemon_server.start(use_auth)
|
||||
analytics_manager.send_server_startup_success()
|
||||
except Exception as e:
|
||||
log.exception('Failed to startup')
|
||||
yield daemon_server.stop()
|
||||
analytics_manager.send_server_startup_error(str(e))
|
||||
reactor.fireSystemEvent("shutdown")
|
||||
log.info("Not connected to the Internet. Unable to start.")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
__version__ = "0.1.8"
|
||||
__version__ = "0.1.9"
|
||||
|
||||
class ServiceApp(App):
|
||||
def build(self):
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 134 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 134 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 134 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 134 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 134 KiB |
Reference in new issue
Block a user