enable pressing the entire media container area to play or download content #96
3 changed files with 19 additions and 5 deletions
|
@ -73,9 +73,7 @@ class FileDownloadButton extends React.PureComponent {
|
||||||
onLayout={onButtonLayout}
|
onLayout={onButtonLayout}
|
||||||
style={[style, fileDownloadButtonStyle.container]}
|
style={[style, fileDownloadButtonStyle.container]}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (NativeModules.Firebase) {
|
|
||||||
NativeModules.Firebase.track('purchase_uri', { uri: uri });
|
NativeModules.Firebase.track('purchase_uri', { uri: uri });
|
||||||
}
|
|
||||||
purchaseUri(uri, costInfo, !isPlayable);
|
purchaseUri(uri, costInfo, !isPlayable);
|
||||||
if (NativeModules.UtilityModule) {
|
if (NativeModules.UtilityModule) {
|
||||||
NativeModules.UtilityModule.checkDownloads();
|
NativeModules.UtilityModule.checkDownloads();
|
||||||
|
|
|
@ -56,6 +56,7 @@ window.__ = __;
|
||||||
|
|
||||||
const globalExceptionHandler = (error, isFatal) => {
|
const globalExceptionHandler = (error, isFatal) => {
|
||||||
if (error && NativeModules.Firebase) {
|
if (error && NativeModules.Firebase) {
|
||||||
|
console.log(error);
|
||||||
NativeModules.Firebase.logException(isFatal, error.message ? error.message : 'No message', JSON.stringify(error));
|
NativeModules.Firebase.logException(isFatal, error.message ? error.message : 'No message', JSON.stringify(error));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -692,6 +692,17 @@ class FilePage extends React.PureComponent {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onMediaContainerPressed = () => {
|
||||||
|
const { costInfo, contentType, purchaseUri } = this.props;
|
||||||
|
const { uri } = this.state;
|
||||||
|
const mediaType = Lbry.getMediaType(contentType);
|
||||||
|
const isPlayable = mediaType === 'video' || mediaType === 'audio';
|
||||||
|
purchaseUri(uri, costInfo, isPlayable);
|
||||||
|
if (isPlayable) {
|
||||||
|
this.onFileDownloadButtonPlayed();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
balance,
|
balance,
|
||||||
|
@ -885,7 +896,11 @@ class FilePage extends React.PureComponent {
|
||||||
}
|
}
|
||||||
onLayout={this.checkOrientation}
|
onLayout={this.checkOrientation}
|
||||||
>
|
>
|
||||||
<View style={filePageStyle.mediaContainer}>
|
<TouchableOpacity
|
||||||
|
activeOpacity={0.5}
|
||||||
|
style={filePageStyle.mediaContainer}
|
||||||
|
onPress={this.onMediaContainerPressed}
|
||||||
|
>
|
||||||
{(canOpen || (!fileInfo || (isPlayable && !canLoadMedia)) || (!canOpen && fileInfo)) && (
|
{(canOpen || (!fileInfo || (isPlayable && !canLoadMedia)) || (!canOpen && fileInfo)) && (
|
||||||
<FileItemMedia
|
<FileItemMedia
|
||||||
duration={duration}
|
duration={duration}
|
||||||
|
@ -944,7 +959,7 @@ class FilePage extends React.PureComponent {
|
||||||
<TouchableOpacity style={filePageStyle.backButton} onPress={this.onBackButtonPressed}>
|
<TouchableOpacity style={filePageStyle.backButton} onPress={this.onBackButtonPressed}>
|
||||||
<Icon name={'arrow-left'} size={18} style={filePageStyle.backButtonIcon} />
|
<Icon name={'arrow-left'} size={18} style={filePageStyle.backButtonIcon} />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</TouchableOpacity>
|
||||||
{(this.state.streamingMode || (canLoadMedia && fileInfo && isPlayable)) && (
|
{(this.state.streamingMode || (canLoadMedia && fileInfo && isPlayable)) && (
|
||||||
<View
|
<View
|
||||||
style={playerBgStyle}
|
style={playerBgStyle}
|
||||||
|
|
Loading…
Reference in a new issue