code updates

This commit is contained in:
Akinwale Ariwodola 2019-01-28 19:16:06 +01:00
commit 9386bb0148
19 changed files with 270 additions and 45 deletions

View file

@ -66,6 +66,7 @@ const discoverStack = createStackNavigator({
navigationOptions: ({ navigation }) => ({ navigationOptions: ({ navigation }) => ({
title: 'Discover', title: 'Discover',
headerLeft: menuNavigationButton(navigation), headerLeft: menuNavigationButton(navigation),
headerTitleStyle: discoverStyle.titleText
}) })
}, },
File: { File: {
@ -78,7 +79,8 @@ const discoverStack = createStackNavigator({
Search: { Search: {
screen: SearchPage, screen: SearchPage,
navigationOptions: ({ navigation }) => ({ navigationOptions: ({ navigation }) => ({
drawerLockMode: 'locked-closed' drawerLockMode: 'locked-closed',
headerTitleStyle: discoverStyle.titleText
}) })
} }
}, { }, {
@ -91,6 +93,7 @@ const trendingStack = createStackNavigator({
navigationOptions: ({ navigation }) => ({ navigationOptions: ({ navigation }) => ({
title: 'Trending', title: 'Trending',
headerLeft: menuNavigationButton(navigation), headerLeft: menuNavigationButton(navigation),
headerTitleStyle: discoverStyle.titleText
}) })
} }
}); });
@ -101,6 +104,7 @@ const myLbryStack = createStackNavigator({
navigationOptions: ({ navigation }) => ({ navigationOptions: ({ navigation }) => ({
title: 'My LBRY', title: 'My LBRY',
headerLeft: menuNavigationButton(navigation), headerLeft: menuNavigationButton(navigation),
headerTitleStyle: discoverStyle.titleText
}) })
} }
}); });
@ -111,6 +115,7 @@ const rewardsStack = createStackNavigator({
navigationOptions: ({ navigation }) => ({ navigationOptions: ({ navigation }) => ({
title: 'Rewards', title: 'Rewards',
headerLeft: menuNavigationButton(navigation), headerLeft: menuNavigationButton(navigation),
headerTitleStyle: discoverStyle.titleText
}) })
} }
}); });
@ -121,13 +126,15 @@ const walletStack = createStackNavigator({
navigationOptions: ({ navigation }) => ({ navigationOptions: ({ navigation }) => ({
title: 'Wallet', title: 'Wallet',
headerLeft: menuNavigationButton(navigation), headerLeft: menuNavigationButton(navigation),
headerTitleStyle: discoverStyle.titleText
}) })
}, },
TransactionHistory: { TransactionHistory: {
screen: TransactionHistoryPage, screen: TransactionHistoryPage,
navigationOptions: { navigationOptions: {
title: 'Transaction History', title: 'Transaction History',
drawerLockMode: 'locked-closed' drawerLockMode: 'locked-closed',
headerTitleStyle: discoverStyle.titleText
} }
} }
}, { }, {
@ -162,7 +169,8 @@ const drawer = createDrawerNavigator({
drawerWidth: 300, drawerWidth: 300,
headerMode: 'none', headerMode: 'none',
contentOptions: { contentOptions: {
activeTintColor: Colors.LbryGreen activeTintColor: Colors.LbryGreen,
labelStyle: discoverStyle.menuText
} }
}); });

View file

@ -8,15 +8,15 @@ import {
} from 'lbry-redux'; } from 'lbry-redux';
import WalletSend from './view'; import WalletSend from './view';
const perform = dispatch => ({
sendToAddress: (address, amount) => dispatch(doSendDraftTransaction(address, amount)),
notify: (data) => dispatch(doToast(data))
});
const select = state => ({ const select = state => ({
balance: selectBalance(state), balance: selectBalance(state),
draftTransaction: selectDraftTransaction(state), draftTransaction: selectDraftTransaction(state),
transactionError: selectDraftTransactionError(state), transactionError: selectDraftTransactionError(state),
}); });
const perform = dispatch => ({
sendToAddress: (address, amount) => dispatch(doSendDraftTransaction(address, amount)),
notify: (data) => dispatch(doToast(data))
});
export default connect(select, perform)(WalletSend); export default connect(select, perform)(WalletSend);

View file

@ -6,6 +6,11 @@ const Constants = {
ACTION_DELETE_COMPLETED_BLOBS: "DELETE_COMPLETED_BLOBS", ACTION_DELETE_COMPLETED_BLOBS: "DELETE_COMPLETED_BLOBS",
ACTION_FIRST_RUN_PAGE_CHANGED: "FIRST_RUN_PAGE_CHANGED", ACTION_FIRST_RUN_PAGE_CHANGED: "FIRST_RUN_PAGE_CHANGED",
PAGE_REWARDS: 'rewards',
PAGE_SETTINGS: 'settings',
PAGE_TRENDING: 'trending',
PAGE_WALLET: 'wallet'
}; };
export default Constants; export default Constants;

View file

@ -1,4 +1,5 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { doToast } from 'lbry-redux';
import { doFetchAccessToken, selectAccessToken, selectUserEmail } from 'lbryinc'; import { doFetchAccessToken, selectAccessToken, selectUserEmail } from 'lbryinc';
import AboutPage from './view'; import AboutPage from './view';
@ -9,6 +10,7 @@ const select = state => ({
const perform = dispatch => ({ const perform = dispatch => ({
fetchAccessToken: () => dispatch(doFetchAccessToken()), fetchAccessToken: () => dispatch(doFetchAccessToken()),
notify: data => dispatch(doToast(data)),
}); });
export default connect(select, perform)(AboutPage); export default connect(select, perform)(AboutPage);

View file

@ -33,7 +33,7 @@ class AboutPage extends React.PureComponent {
} }
render() { render() {
const { accessToken, navigation, userEmail } = this.props; const { accessToken, navigation, notify, userEmail } = this.props;
const loading = 'Loading...'; const loading = 'Loading...';
const ver = this.state.versionInfo ? this.state.versionInfo : null; const ver = this.state.versionInfo ? this.state.versionInfo : null;
@ -75,7 +75,7 @@ class AboutPage extends React.PureComponent {
</View> </View>
<View> <View>
<Link <Link
style={aboutStyle.emailPreferencesLink} style={aboutStyle.listLink}
href={`http://lbry.io/list/edit/${accessToken}`} href={`http://lbry.io/list/edit/${accessToken}`}
text="Update mailing preferences" /> text="Update mailing preferences" />
</View> </View>
@ -102,6 +102,21 @@ class AboutPage extends React.PureComponent {
<Text selectable={true} style={aboutStyle.lineValueText}>{this.state.lbryId ? this.state.lbryId : loading}</Text> <Text selectable={true} style={aboutStyle.lineValueText}>{this.state.lbryId ? this.state.lbryId : loading}</Text>
</View> </View>
</View> </View>
<View style={aboutStyle.row}>
<View style={aboutStyle.col}><Text style={aboutStyle.text}>Logs</Text></View>
<View style={aboutStyle.col}>
<Link style={aboutStyle.listLink} text="Send log" onPress={() => {
if (NativeModules.UtilityModule) {
NativeModules.UtilityModule.shareLogFile((error) => {
if (error) {
notify(error);
}
});
}
}} />
</View>
</View>
</ScrollView> </ScrollView>
</View> </View>
); );

View file

@ -3,6 +3,7 @@ import {
doFetchFileInfo, doFetchFileInfo,
doFetchCostInfoForUri, doFetchCostInfoForUri,
doResolveUri, doResolveUri,
doSendTip,
doToast, doToast,
makeSelectIsUriResolving, makeSelectIsUriResolving,
makeSelectCostInfoForUri, makeSelectCostInfoForUri,
@ -10,6 +11,7 @@ import {
makeSelectClaimForUri, makeSelectClaimForUri,
makeSelectContentTypeForUri, makeSelectContentTypeForUri,
makeSelectMetadataForUri, makeSelectMetadataForUri,
selectBalance,
selectBlackListedOutpoints, selectBlackListedOutpoints,
} from 'lbry-redux'; } from 'lbry-redux';
import { selectRewardContentClaimIds } from 'lbryinc'; import { selectRewardContentClaimIds } from 'lbryinc';
@ -19,6 +21,7 @@ import FilePage from './view';
const select = (state, props) => { const select = (state, props) => {
const selectProps = { uri: props.navigation.state.params.uri }; const selectProps = { uri: props.navigation.state.params.uri };
return { return {
balance: selectBalance(state),
blackListedOutpoints: selectBlackListedOutpoints(state), blackListedOutpoints: selectBlackListedOutpoints(state),
claim: makeSelectClaimForUri(selectProps.uri)(state), claim: makeSelectClaimForUri(selectProps.uri)(state),
isResolvingUri: makeSelectIsUriResolving(selectProps.uri)(state), isResolvingUri: makeSelectIsUriResolving(selectProps.uri)(state),
@ -40,6 +43,7 @@ const perform = dispatch => ({
fetchCostInfo: uri => dispatch(doFetchCostInfoForUri(uri)), fetchCostInfo: uri => dispatch(doFetchCostInfoForUri(uri)),
notify: data => dispatch(doToast(data)), notify: data => dispatch(doToast(data)),
resolveUri: uri => dispatch(doResolveUri(uri)), resolveUri: uri => dispatch(doResolveUri(uri)),
sendTip: (amount, claimId, uri, successCallback, errorCallback) => dispatch(doSendTip(amount, claimId, uri, successCallback, errorCallback)),
stopDownload: (uri, fileInfo) => dispatch(doStopDownloadingFile(uri, fileInfo)), stopDownload: (uri, fileInfo) => dispatch(doStopDownloadingFile(uri, fileInfo)),
}); });

View file

@ -37,6 +37,8 @@ class FilePage extends React.PureComponent {
title: '' title: ''
}; };
tipAmountInput = null;
playerBackground = null; playerBackground = null;
startTime = null; startTime = null;
@ -55,8 +57,10 @@ class FilePage extends React.PureComponent {
pageSuspended: false, pageSuspended: false,
showImageViewer: false, showImageViewer: false,
showWebView: false, showWebView: false,
showTipView: false,
playerBgHeight: 0, playerBgHeight: 0,
playerHeight: 0, playerHeight: 0,
tipAmount: null,
uri: null, uri: null,
stopDownloadConfirmed: false stopDownloadConfirmed: false
}; };
@ -310,6 +314,21 @@ class FilePage extends React.PureComponent {
this.setState({ fileViewLogged: true }); this.setState({ fileViewLogged: true });
} }
handleSendTip = () => {
const { claim, balance, navigation, notify, sendTip } = this.props;
const { uri } = navigation.state.params;
const { tipAmount } = this.state;
if (tipAmount > balance) {
notify({
message: 'Insufficient credits',
});
return;
}
sendTip(tipAmount, claim.claim_id, uri, () => { this.setState({ tipAmount: 0, showTipView: false }) });
}
render() { render() {
const { const {
claim, claim,
@ -378,12 +397,12 @@ class FilePage extends React.PureComponent {
const mediaType = Lbry.getMediaType(contentType); const mediaType = Lbry.getMediaType(contentType);
const isPlayable = mediaType === 'video' || mediaType === 'audio'; const isPlayable = mediaType === 'video' || mediaType === 'audio';
const { height, channel_name: channelName, value } = claim; const { height, channel_name: channelName, value } = claim;
const showActions = !this.state.fullscreenMode && const showActions = !this.state.fullscreenMode && !this.state.showImageViewer && !this.state.showWebView;
!this.state.showImageViewer && const showFileActions = (completed || (fileInfo && !fileInfo.stopped && fileInfo.written_bytes < fileInfo.total_bytes));
!this.state.showWebView &&
(completed || (fileInfo && !fileInfo.stopped && fileInfo.written_bytes < fileInfo.total_bytes));
const channelClaimId = const channelClaimId =
value && value.publisherSignature && value.publisherSignature.certificateId; value && value.publisherSignature && value.publisherSignature.certificateId;
const canSendTip = this.state.tipAmount > 0;
const playerStyle = [filePageStyle.player, const playerStyle = [filePageStyle.player,
this.state.isLandscape ? filePageStyle.containedPlayerLandscape : this.state.isLandscape ? filePageStyle.containedPlayerLandscape :
@ -473,21 +492,29 @@ class FilePage extends React.PureComponent {
onPlaybackStarted={this.onPlaybackStarted} onPlaybackStarted={this.onPlaybackStarted}
/>} />}
{fileInfo && showActions && {showActions &&
<View style={filePageStyle.actions}> <View style={filePageStyle.actions}>
{completed && <Button style={filePageStyle.actionButton} {<Button style={filePageStyle.actionButton}
theme={"light"} theme={"light"}
icon={"trash"} icon={"gift"}
text={"Delete"} text={"Send a tip"}
onPress={this.onDeletePressed} />} onPress={() => this.setState({ showTipView: true })} />}
{!completed && fileInfo && !fileInfo.stopped && {showFileActions &&
fileInfo.written_bytes < fileInfo.total_bytes && <View style={filePageStyle.fileActions}>
!this.state.stopDownloadConfirmed && {completed && <Button style={filePageStyle.actionButton}
<Button style={filePageStyle.actionButton} theme={"light"}
theme={"light"} icon={"trash"}
text={"Stop Download"} text={"Delete"}
onPress={this.onStopDownloadPressed} /> onPress={this.onDeletePressed} />}
} {!completed && fileInfo && !fileInfo.stopped &&
fileInfo.written_bytes < fileInfo.total_bytes &&
!this.state.stopDownloadConfirmed &&
<Button style={filePageStyle.actionButton}
theme={"light"}
text={"Stop Download"}
onPress={this.onStopDownloadPressed} />
}
</View>}
</View>} </View>}
<ScrollView <ScrollView
style={showActions ? filePageStyle.scrollContainerActions : filePageStyle.scrollContainer} style={showActions ? filePageStyle.scrollContainerActions : filePageStyle.scrollContainer}
@ -507,6 +534,23 @@ class FilePage extends React.PureComponent {
<RelatedContent navigation={navigation} uri={uri} /> <RelatedContent navigation={navigation} uri={uri} />
</ScrollView> </ScrollView>
{this.state.showTipView && <View style={filePageStyle.tipCard}>
<View style={filePageStyle.row}>
<View style={filePageStyle.amountRow}>
<TextInput ref={ref => this.tipAmountInput = ref}
onChangeText={value => this.setState({tipAmount: value})}
keyboardType={'numeric'}
value={this.state.tipAmount}
style={[filePageStyle.input, filePageStyle.tipAmountInput]} />
<Text style={[filePageStyle.text, filePageStyle.currency]}>LBC</Text>
</View>
<Link style={[filePageStyle.link, filePageStyle.cancelTipLink]} text={'Cancel'} onPress={() => this.setState({ showTipView: false })} />
<Button text={'Send tip'}
style={[filePageStyle.button, filePageStyle.sendButton]}
disabled={!canSendTip}
onPress={this.handleSendTip} />
</View>
</View>}
</View> </View>
)} )}
{!this.state.fullscreenMode && <FloatingWalletBalance navigation={navigation} />} {!this.state.fullscreenMode && <FloatingWalletBalance navigation={navigation} />}

View file

@ -56,7 +56,7 @@ const aboutStyle = StyleSheet.create({
fontSize: 16, fontSize: 16,
marginBottom: 24 marginBottom: 24
}, },
emailPreferencesLink: { listLink: {
color: Colors.LbryGreen, color: Colors.LbryGreen,
fontFamily: 'Metropolis-Regular', fontFamily: 'Metropolis-Regular',
fontSize: 15, fontSize: 15,

View file

@ -127,6 +127,13 @@ const discoverStyle = StyleSheet.create({
}, },
rewardTitle: { rewardTitle: {
flex: 0.9 flex: 0.9
},
menuText: {
fontFamily: 'Metropolis-Regular',
fontSize: 16
},
titleText: {
fontFamily: 'Metropolis-Regular'
} }
}); });

View file

@ -142,6 +142,8 @@ const filePageStyle = StyleSheet.create({
color: '#0c604b' color: '#0c604b'
}, },
actions: { actions: {
flexDirection: 'row',
justifyContent: 'space-between',
paddingLeft: 16, paddingLeft: 16,
paddingRight: 16, paddingRight: 16,
paddingTop: 16, paddingTop: 16,
@ -149,6 +151,9 @@ const filePageStyle = StyleSheet.create({
marginTop: -14, marginTop: -14,
width: '100%', width: '100%',
}, },
fileActions: {
alignSelf: 'flex-end'
},
actionButton: { actionButton: {
alignSelf: 'flex-start', alignSelf: 'flex-start',
backgroundColor: Colors.White, backgroundColor: Colors.White,
@ -200,10 +205,57 @@ const filePageStyle = StyleSheet.create({
zIndex: 100 zIndex: 100
}, },
link: { link: {
color: Colors.LbryGreen color: Colors.Grey
}, },
linkTapped: { linkTapped: {
color: "rgba(64, 184, 154, .2)" color: "rgba(64, 184, 154, .2)"
},
tipCard: {
backgroundColor: Colors.White,
position: 'absolute',
top: containedMediaHeightWithControls - 16,
width: '100%',
paddingTop: 8,
paddingBottom: 8,
paddingLeft: 16,
paddingRight: 16
},
row: {
flexDirection: 'row',
flex: 1,
justifyContent: 'space-between'
},
amountRow: {
flexDirection: 'row',
flex: 0.75
},
button: {
backgroundColor: Colors.LbryGreen,
alignSelf: 'flex-end',
marginBottom: 6
},
cancelTipLink: {
alignSelf: 'flex-end',
marginBottom: 14
},
input: {
fontFamily: 'Metropolis-Regular',
fontSize: 14
},
tipAmountInput: {
alignSelf: 'flex-start',
width: 80,
fontSize: 16,
letterSpacing: 1
},
currency: {
alignSelf: 'flex-start',
marginTop: 17
},
text: {
fontFamily: 'Metropolis-Regular',
fontSize: 16,
lineHeight: 24
} }
}); });

View file

@ -42,6 +42,7 @@ const pageHeaderStyle = StyleSheet.create({
flexDirection: 'row', flexDirection: 'row',
}, },
titleText: { titleText: {
fontFamily: 'Metropolis-Regular',
fontSize: Platform.OS === 'ios' ? 17 : 20, fontSize: Platform.OS === 'ios' ? 17 : 20,
fontWeight: Platform.OS === 'ios' ? '700' : '500', fontWeight: Platform.OS === 'ios' ? '700' : '500',
color: 'rgba(0, 0, 0, .9)', color: 'rgba(0, 0, 0, .9)',

View file

@ -1,6 +1,27 @@
import { NavigationActions, StackActions } from 'react-navigation'; import { NavigationActions, StackActions } from 'react-navigation';
import Constants from '../constants';
function getRouteForSpecialUri(uri) {
let targetRoute;
const page = uri.substring(8).trim(); // 'lbry://?'.length == 8
switch (page) {
case Constants.PAGE_REWARDS: targetRoute = 'Rewards'; break;
case Constants.PAGE_SETTINGS: targetRoute = 'Settings'; break;
case Constants.PAGE_TRENDING: targetRoute = 'TrendingStack'; break;
case Constants.PAGE_WALLET: targetRoute = 'WalletStack'; break;
default: targetRoute = 'DiscoverStack'; break;
}
return targetRoute;
}
export function dispatchNavigateToUri(dispatch, nav, uri) { export function dispatchNavigateToUri(dispatch, nav, uri) {
if (uri.startsWith('lbry://?')) {
dispatch(NavigationActions.navigate({ routeName: getRouteForSpecialUri(uri) }));
return;
}
const params = { uri }; const params = { uri };
if (nav && nav.routes && nav.routes.length > 0 && 'Main' === nav.routes[0].routeName) { if (nav && nav.routes && nav.routes.length > 0 && 'Main' === nav.routes[0].routeName) {
const mainRoute = nav.routes[0]; const mainRoute = nav.routes[0];
@ -48,6 +69,11 @@ export function navigateToUri(navigation, uri, additionalParams) {
return; return;
} }
if (uri.startsWith('lbry://?')) {
navigation.navigate({ routeName: getRouteForSpecialUri(uri) });
return;
}
const params = Object.assign({ uri }, additionalParams); const params = Object.assign({ uri }, additionalParams);
if ('File' === navigation.state.routeName) { if ('File' === navigation.state.routeName) {
const stackAction = StackActions.replace({ routeName: 'File', newKey: uri, params }); const stackAction = StackActions.replace({ routeName: 'File', newKey: uri, params });

View file

@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py
# (list) Application requirements # (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy # comma seperated e.g. requirements = sqlite3,kivy
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, miniupnpc==1.9, gmpy, appdirs==1.4.3, argparse==1.2.1, docopt, base58==1.0.0, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2, pyyaml, qrcode==5.2.2, requests, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, txJSON-RPC, zope.interface==4.3.3, protobuf==3.6.1, keyring==10.4.0, txupnp, git+https://github.com/lbryio/lbryschema.git#egg=lbryschema, git+https://github.com/lbryio/lbry.git@remove-android-helpers#egg=lbrynet, git+https://github.com/lbryio/aioupnp.git#egg=aioupnp, asn1crypto, treq==17.8.0, funcsigs, mock, pbr, pyopenssl, twisted, idna, Automat, hyperlink, PyHamcrest, netifaces, cryptography, aiohttp, multidict==4.5.2, idna_ssl==1.1.0, typing_extensions==3.6.5, yarl, chardet==3.0.4, async_timeout==3.0.1, aiorpcX==0.9.0, asyncio, git+https://github.com/lbryio/torba@997b573aa4223ec6c8c01948cd2df0c6475b5f42#egg=torba, coincurve requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, miniupnpc==1.9, gmpy, appdirs==1.4.3, argparse==1.2.1, docopt, base58==1.0.0, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2, pyyaml, qrcode==5.2.2, requests, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, txJSON-RPC, zope.interface==4.3.3, protobuf==3.6.1, keyring==10.4.0, txupnp, git+https://github.com/lbryio/lbryschema.git#egg=lbryschema, git+https://github.com/lbryio/lbry.git@v0.30.4#egg=lbrynet, git+https://github.com/lbryio/aioupnp.git#egg=aioupnp, asn1crypto, treq==17.8.0, funcsigs, mock, pbr, pyopenssl, twisted, idna, Automat, hyperlink, PyHamcrest, netifaces, cryptography, aiohttp, multidict==4.5.2, idna_ssl==1.1.0, typing_extensions==3.6.5, yarl, chardet==3.0.4, async_timeout==3.0.1, aiorpcX==0.9.0, asyncio, git+https://github.com/lbryio/torba#egg=torba, coincurve
# (str) Custom source folders for requirements # (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes # Sets custom source for any requirements with recipes

View file

@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py
# (list) Application requirements # (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy # comma seperated e.g. requirements = sqlite3,kivy
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, miniupnpc==1.9, gmpy, appdirs==1.4.3, argparse==1.2.1, docopt, base58==1.0.0, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2, pyyaml, qrcode==5.2.2, requests, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, txJSON-RPC, zope.interface==4.3.3, protobuf==3.6.1, keyring==10.4.0, txupnp, git+https://github.com/lbryio/lbryschema.git#egg=lbryschema, git+https://github.com/lbryio/lbry.git@remove-android-helpers#egg=lbrynet, git+https://github.com/lbryio/aioupnp.git#egg=aioupnp, asn1crypto, treq==17.8.0, funcsigs, mock, pbr, pyopenssl, twisted, idna, Automat, hyperlink, PyHamcrest, netifaces, cryptography, aiohttp, multidict==4.5.2, idna_ssl==1.1.0, typing_extensions==3.6.5, yarl, chardet==3.0.4, async_timeout==3.0.1, aiorpcX==0.9.0, asyncio, git+https://github.com/lbryio/torba@997b573aa4223ec6c8c01948cd2df0c6475b5f42#egg=torba, coincurve requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, miniupnpc==1.9, gmpy, appdirs==1.4.3, argparse==1.2.1, docopt, base58==1.0.0, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2, pyyaml, qrcode==5.2.2, requests, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, txJSON-RPC, zope.interface==4.3.3, protobuf==3.6.1, keyring==10.4.0, txupnp, git+https://github.com/lbryio/lbryschema.git#egg=lbryschema, git+https://github.com/lbryio/lbry.git@v0.30.4#egg=lbrynet, git+https://github.com/lbryio/aioupnp.git#egg=aioupnp, asn1crypto, treq==17.8.0, funcsigs, mock, pbr, pyopenssl, twisted, idna, Automat, hyperlink, PyHamcrest, netifaces, cryptography, aiohttp, multidict==4.5.2, idna_ssl==1.1.0, typing_extensions==3.6.5, yarl, chardet==3.0.4, async_timeout==3.0.1, aiorpcX==0.9.0, asyncio, git+https://github.com/lbryio/torba#egg=torba, coincurve
# (str) Custom source folders for requirements # (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes # Sets custom source for any requirements with recipes

View file

@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py
# (list) Application requirements # (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy # comma seperated e.g. requirements = sqlite3,kivy
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, miniupnpc==1.9, gmpy, appdirs==1.4.3, argparse==1.2.1, docopt, base58==1.0.0, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2, pyyaml, qrcode==5.2.2, requests, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, txJSON-RPC, zope.interface==4.3.3, protobuf==3.6.1, keyring==10.4.0, txupnp, git+https://github.com/lbryio/lbryschema.git#egg=lbryschema, git+https://github.com/lbryio/lbry.git#egg=lbrynet, git+https://github.com/lbryio/aioupnp.git#egg=aioupnp, asn1crypto, treq==17.8.0, funcsigs, mock, pbr, pyopenssl, twisted, idna, Automat, hyperlink, PyHamcrest, netifaces, cryptography, aiohttp, aiorpcX==0.9.0, asyncio, git+https://github.com/lbryio/torba#egg=torba, coincurve requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro, pyjnius, certifi==2018.4.16, constantly, incremental, miniupnpc==1.9, gmpy, appdirs==1.4.3, argparse==1.2.1, docopt, base58==1.0.0, colorama==0.3.7, dnspython==1.12.0, ecdsa==0.13, envparse, jsonrpclib==0.1.7, jsonschema==2.5.1, pbkdf2, pyyaml, qrcode==5.2.2, requests, seccure==0.3.1.3, attrs==18.1.0, pyasn1, pyasn1-modules, service_identity==16.0.0, six==1.9.0, txJSON-RPC, zope.interface==4.3.3, protobuf==3.6.1, keyring==10.4.0, txupnp, git+https://github.com/lbryio/lbryschema.git#egg=lbryschema, git+https://github.com/lbryio/lbry.git#egg=lbrynet, git+https://github.com/lbryio/aioupnp.git#egg=aioupnp, asn1crypto, treq==17.8.0, funcsigs, mock, pbr, pyopenssl, twisted, idna, Automat, hyperlink, PyHamcrest, netifaces, cryptography, aiohttp, aiorpcX==0.9.0, asyncio, git+https://github.com/lbryio/torba@997b573aa4223ec6c8c01948cd2df0c6475b5f42#egg=torba, coincurve
# (str) Custom source folders for requirements # (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes # Sets custom source for any requirements with recipes

View file

@ -140,6 +140,16 @@
</intent-filter> </intent-filter>
</receiver> </receiver>
{% endif %} {% endif %}
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="io.lbry.browser.fileprovider"
android:grantUriPermissions="true"
android:exported="false">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths" />
</provider>
</application> </application>
</manifest> </manifest>

View file

@ -2,21 +2,30 @@ package io.lbry.browser.reactmodules;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.Manifest; import android.Manifest;
import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.support.v4.content.FileProvider;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.view.View; import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.Promise; import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod; import com.facebook.react.bridge.ReactMethod;
import java.io.File;
import io.lbry.browser.MainActivity; import io.lbry.browser.MainActivity;
import io.lbry.browser.Utils;
public class UtilityModule extends ReactContextBaseJavaModule { public class UtilityModule extends ReactContextBaseJavaModule {
private static final String FILE_PROVIDER = "io.lbry.browser.fileprovider";
private Context context; private Context context;
public UtilityModule(ReactApplicationContext reactContext) { public UtilityModule(ReactApplicationContext reactContext) {
@ -139,6 +148,30 @@ public class UtilityModule extends ReactContextBaseJavaModule {
} }
} }
@ReactMethod
public void shareLogFile(Callback errorCallback) {
String logFileName = "lbrynet.log";
File logFile = new File(String.format("%s/%s", Utils.getAppInternalStorageDir(context), "lbrynet"), logFileName);
if (!logFile.exists()) {
errorCallback.invoke("The lbrynet.log file could not be found.");
return;
}
try {
Uri fileUri = FileProvider.getUriForFile(context, FILE_PROVIDER, logFile);
if (fileUri != null) {
Intent shareIntent = new Intent();
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_STREAM, fileUri);
context.startActivity(Intent.createChooser(shareIntent, "Send LBRY log"));
}
} catch (IllegalArgumentException e) {
errorCallback.invoke("The lbrynet.log file cannot be shared due to permission restrictions.");
}
}
private static boolean isEmulator() { private static boolean isEmulator() {
String buildModel = Build.MODEL.toLowerCase(); String buildModel = Build.MODEL.toLowerCase();
return (// Check FINGERPRINT return (// Check FINGERPRINT

View file

@ -1,14 +1,17 @@
import keyring import keyring
from keyring.backend import KeyringBackend import platform
from jnius import autoclass from jnius import autoclass
from lbrynet.extras.cli import start_daemon from keyring.backend import KeyringBackend
from lbrynet import build_type
from lbrynet.extras.cli import conf, log_support, check_connection, Daemon, reactor
from lbrynet.extras.daemon.Components import DHT_COMPONENT, HASH_ANNOUNCER_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT from lbrynet.extras.daemon.Components import DHT_COMPONENT, HASH_ANNOUNCER_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT
from lbrynet.extras.daemon.Components import REFLECTOR_COMPONENT from lbrynet.extras.daemon.Components import REFLECTOR_COMPONENT
lbrynet_android_utils = autoclass('io.lbry.browser.Utils') lbrynet_android_utils = autoclass('io.lbry.browser.Utils')
service = autoclass('io.lbry.browser.LbrynetService').serviceInstance service = autoclass('io.lbry.browser.LbrynetService').serviceInstance
platform.platform = lambda: 'Android %s (API %s)' % (lbrynet_utils.getAndroidRelease(), lbrynet_utils.getAndroidSdk())
build_type.BUILD = 'dev' if lbrynet_android_utils.isDebug() else 'release'
# Keyring backend # Keyring backend
class LbryAndroidKeyring(KeyringBackend): class LbryAndroidKeyring(KeyringBackend):
@ -34,18 +37,30 @@ def start():
keyring.set_keyring(LbryAndroidKeyring()) keyring.set_keyring(LbryAndroidKeyring())
private_storage_dir = lbrynet_android_utils.getAppInternalStorageDir(service.getApplicationContext()) private_storage_dir = lbrynet_android_utils.getAppInternalStorageDir(service.getApplicationContext())
data_dir = f'{private_storage_dir}/lbrynet' conf.initialize_settings(
wallet_dir = f'{private_storage_dir}/lbryum' data_dir=f'{private_storage_dir}/lbrynet',
download_dir = f'{lbrynet_android_utils.getInternalStorageDir(service.getApplicationContext())}/Download' wallet_dir=f'{private_storage_dir}/lbryum',
download_dir=f'{lbrynet_android_utils.getAppExternalStorageDir(service.getApplicationContext())}/Download'
return start_daemon(settings={ )
'components_to_skip': [DHT_COMPONENT, HASH_ANNOUNCER_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT, conf.settings.update({
REFLECTOR_COMPONENT], 'components_to_skip': [
DHT_COMPONENT, HASH_ANNOUNCER_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT,
REFLECTOR_COMPONENT
],
'use_upnp': False, 'use_upnp': False,
# 'use_https': False, # 'use_https': True, # TODO: does this work on android?
# 'use_auth_http': True # 'use_auth_http': True
}, data_dir=data_dir, wallet_dir=wallet_dir, download_dir=download_dir) })
log_support.configure_logging(conf.settings.get_log_filename(), True, [])
log_support.configure_loggly_handler()
if check_connection():
daemon = Daemon()
daemon.start_listening()
reactor.run()
else:
print("Not connected to internet, unable to start")
if __name__ == '__main__': if __name__ == '__main__':
start() start()

View file

@ -0,0 +1,3 @@
<paths>
<external-files-path path="lbrynet/" name="lbrynet" />
</paths>