Stop download functionality #45

Merged
akinwale merged 4 commits from stop-downloading into master 2018-03-30 13:11:53 +02:00
11 changed files with 80 additions and 83046 deletions
Showing only changes of commit 12f09a23c3 - Show all commits

3
.gitignore vendored
View file

@ -4,4 +4,5 @@ bin
buildozer.spec buildozer.spec
build.log build.log
recipes/**/*.pyc recipes/**/*.pyc
src/main/assets/index.android.bundle
src/main/assets/index.android.bundle.meta

View file

@ -7,7 +7,7 @@ import {
makeSelectIsUriResolving, makeSelectIsUriResolving,
selectRewardContentClaimIds selectRewardContentClaimIds
} from 'lbry-redux'; } from 'lbry-redux';
/*import { selectShowNsfw } from 'redux/selectors/settings';*/ import { selectShowNsfw } from '../../redux/selectors/settings';
import FileItem from './view'; import FileItem from './view';
const select = (state, props) => ({ const select = (state, props) => ({
@ -16,6 +16,7 @@ const select = (state, props) => ({
metadata: makeSelectMetadataForUri(props.uri)(state), metadata: makeSelectMetadataForUri(props.uri)(state),
rewardedContentClaimIds: selectRewardContentClaimIds(state, props), rewardedContentClaimIds: selectRewardContentClaimIds(state, props),
isResolvingUri: makeSelectIsUriResolving(props.uri)(state), isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
obscureNsfw: !selectShowNsfw(state)
}); });
const perform = dispatch => ({ const perform = dispatch => ({

View file

@ -4,6 +4,7 @@ import { NavigationActions } from 'react-navigation';
import { Text, View, TouchableOpacity } from 'react-native'; import { Text, View, TouchableOpacity } from 'react-native';
import FileItemMedia from '../fileItemMedia'; import FileItemMedia from '../fileItemMedia';
import FilePrice from '../filePrice'; import FilePrice from '../filePrice';
import NsfwOverlay from '../nsfwOverlay';
import discoverStyle from '../../styles/discover'; import discoverStyle from '../../styles/discover';
class FileItem extends React.PureComponent { class FileItem extends React.PureComponent {
@ -34,7 +35,8 @@ class FileItem extends React.PureComponent {
metadata, metadata,
isResolvingUri, isResolvingUri,
rewardedContentClaimIds, rewardedContentClaimIds,
style style,
navigation
} = this.props; } = this.props;
const uri = normalizeURI(this.props.uri); const uri = normalizeURI(this.props.uri);
@ -54,16 +56,19 @@ class FileItem extends React.PureComponent {
} }
return ( return (
<TouchableOpacity style={style} onPress={() => { <View style={style}>
this.props.navigation.navigate('File', { uri: uri }); <TouchableOpacity style={discoverStyle.container} onPress={() => {
navigation.navigate('File', { uri: uri });
} }
}> }>
<FileItemMedia title={title} thumbnail={thumbnail} resizeMode="cover" /> <FileItemMedia title={title} thumbnail={thumbnail} blurRadius={obscureNsfw ? 15 : 0} resizeMode="cover" />
<FilePrice uri={uri} style={discoverStyle.filePriceContainer} textStyle={discoverStyle.filePriceText} /> <FilePrice uri={uri} style={discoverStyle.filePriceContainer} textStyle={discoverStyle.filePriceText} />
<Text style={discoverStyle.fileItemName}>{title}</Text> <Text style={discoverStyle.fileItemName}>{title}</Text>
{channelName && {channelName &&
<Text style={discoverStyle.channelName}>{channelName}</Text>} <Text style={discoverStyle.channelName}>{channelName}</Text>}
</TouchableOpacity> </TouchableOpacity>
{obscureNsfw && <NsfwOverlay onPress={() => navigation.navigate('Settings')} />}
</View>
); );
} }
} }

View file

@ -28,7 +28,7 @@ class FileItemMedia extends React.PureComponent {
render() { render() {
let style = this.props.style; let style = this.props.style;
const { title, thumbnail, resizeMode } = this.props; const { title, thumbnail, blurRadius, resizeMode } = this.props;
const atStyle = this.state.autoThumbStyle; const atStyle = this.state.autoThumbStyle;
if (thumbnail && ((typeof thumbnail) === 'string')) { if (thumbnail && ((typeof thumbnail) === 'string')) {
@ -37,7 +37,10 @@ class FileItemMedia extends React.PureComponent {
} }
return ( return (
<Image source={{uri: thumbnail}} resizeMode={resizeMode ? resizeMode : "cover"} style={style} /> <Image source={{uri: thumbnail}}
blurRadius={blurRadius}
resizeMode={resizeMode ? resizeMode : "cover"}
style={style} />
); );
} }

View file

@ -0,0 +1,6 @@
import { connect } from 'react-redux';
import NsfwOverlay from './view';
const perform = dispatch => ({});
export default connect(null, perform)(NsfwOverlay);

View file

@ -0,0 +1,15 @@
import React from 'react';
import { Text, TouchableOpacity } from 'react-native';
import discoverStyle from '../../styles/discover';
class NsfwOverlay extends React.PureComponent {
render() {
return (
<TouchableOpacity style={discoverStyle.overlay} activeOpacity={0.95} onPress={this.props.onPress}>
<Text style={discoverStyle.overlayText}>This content is Not Safe For Work. To view adult content, please change your Settings.</Text>
</TouchableOpacity>
)
}
}
export default NsfwOverlay;

View file

@ -19,6 +19,15 @@ class SettingsPage extends React.PureComponent {
<View> <View>
<Text style={settingsStyle.title}>Settings</Text> <Text style={settingsStyle.title}>Settings</Text>
<ScrollView style={settingsStyle.scrollContainer}> <ScrollView style={settingsStyle.scrollContainer}>
<View style={settingsStyle.row}>
<View style={settingsStyle.switchText}>
<Text style={settingsStyle.label}>Show NSFW content</Text>
</View>
<View style={settingsStyle.switchContainer}>
<Switch value={showNsfw} onValueChange={(value) => setClientSetting(SETTINGS.SHOW_NSFW, value)} />
</View>
</View>
<View style={settingsStyle.row}> <View style={settingsStyle.row}>
<View style={settingsStyle.switchText}> <View style={settingsStyle.switchText}>
<Text style={settingsStyle.label}>Keep the daemon background service running when the app is suspended.</Text> <Text style={settingsStyle.label}>Keep the daemon background service running when the app is suspended.</Text>

View file

@ -56,6 +56,25 @@ const discoverStyle = StyleSheet.create({
}, },
drawerHamburger: { drawerHamburger: {
marginLeft: 8 marginLeft: 8
},
overlay: {
flex: 1,
opacity: 1,
backgroundColor: '#222222',
alignItems: 'center',
justifyContent: 'center',
padding: 32,
position: 'absolute',
left: 0,
top: 0,
width: '100%',
height: '100%'
},
overlayText: {
color: '#ffffff',
fontSize: 14,
textAlign: 'center',
fontFamily: 'Metropolis-Regular'
} }
}); });

View file

@ -12,16 +12,18 @@ const settingsStyle = StyleSheet.create({
paddingBottom: 16 paddingBottom: 16
}, },
row: { row: {
marginBottom: 12, marginBottom: 24,
flex: 1, flex: 1,
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'space-between' justifyContent: 'space-between'
}, },
switchText: { switchText: {
width: '70%' width: '70%',
justifyContent: 'center'
}, },
switchContainer: { switchContainer: {
width: '25%' width: '25%',
justifyContent: 'center'
}, },
label: { label: {
fontSize: 14, fontSize: 14,

File diff suppressed because it is too large Load diff

View file

@ -1 +0,0 @@
+]ח~wֳהש|דב/<05>ב²€/ֽ