update lite file page
This commit is contained in:
parent
156c3e1a72
commit
e541dcc381
3 changed files with 63 additions and 16 deletions
|
@ -1,14 +1,10 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import {
|
import { makeSelectContentPositionForUri, selectBalance } from 'lbry-redux';
|
||||||
makeSelectContentPositionForUri,
|
import { doClaimEligiblePurchaseRewards, makeSelectViewCountForUri } from 'lbryinc';
|
||||||
selectBalance,
|
import { doSetPlayerVisible } from 'redux/actions/drawer';
|
||||||
from 'lbry-redux';
|
import { makeSelectPlayerVisible } from 'redux/selectors/drawer';
|
||||||
import {
|
|
||||||
doClaimEligiblePurchaseRewards,
|
|
||||||
makeSelectViewCountForUri,
|
|
||||||
} from 'lbryinc';
|
|
||||||
import { doToggleFullscreenMode } from 'redux/actions/settings';
|
import { doToggleFullscreenMode } from 'redux/actions/settings';
|
||||||
import FilePage from './view';
|
import LiteFilePage from './view';
|
||||||
|
|
||||||
const select = (state, props) => {
|
const select = (state, props) => {
|
||||||
const { uri, fullUri } = props.navigation.state.params;
|
const { uri, fullUri } = props.navigation.state.params;
|
||||||
|
|
|
@ -19,6 +19,7 @@ import {
|
||||||
TouchableWithoutFeedback,
|
TouchableWithoutFeedback,
|
||||||
View,
|
View,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
|
import UriBar from 'component/uriBar';
|
||||||
import MediaPlayer from 'component/mediaPlayer';
|
import MediaPlayer from 'component/mediaPlayer';
|
||||||
import filePageStyle from 'styles/filePage';
|
import filePageStyle from 'styles/filePage';
|
||||||
import uriBarStyle from 'styles/uriBar';
|
import uriBarStyle from 'styles/uriBar';
|
||||||
|
@ -34,12 +35,63 @@ class LiteFilePage extends React.PureComponent {
|
||||||
state = {
|
state = {
|
||||||
fullscreenMode: false,
|
fullscreenMode: false,
|
||||||
playerHeight: null,
|
playerHeight: null,
|
||||||
|
isLandscape: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
getStreamUrl = uri => {};
|
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 (!this.playerBackground) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
handleFullscreenToggle = isFullscreen => {
|
||||||
|
const { toggleFullscreenMode } = this.props;
|
||||||
|
toggleFullscreenMode(isFullscreen);
|
||||||
|
|
||||||
|
if (isFullscreen) {
|
||||||
|
// fullscreen, so change orientation to landscape mode
|
||||||
|
NativeModules.ScreenOrientation.lockOrientationLandscape();
|
||||||
|
|
||||||
|
// hide the navigation bar (on devices that have the soft navigation bar)
|
||||||
|
NativeModules.UtilityModule.hideNavigationBar();
|
||||||
|
} else {
|
||||||
|
// Switch back to portrait mode when the media is not fullscreen
|
||||||
|
NativeModules.ScreenOrientation.lockOrientationPortrait();
|
||||||
|
|
||||||
|
// show the navigation bar (on devices that have the soft navigation bar)
|
||||||
|
NativeModules.UtilityModule.showNavigationBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({ fullscreenMode: isFullscreen });
|
||||||
|
StatusBar.setHidden(isFullscreen);
|
||||||
|
};
|
||||||
|
|
||||||
|
getStreamUrl = uri => {
|
||||||
|
const { claimName, claimId } = parseURI(uri);
|
||||||
|
return `https://player.lbry.tv/content/claims/${claimName}/${claimId}/stream`;
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { contentUri } = this.props;
|
const { navigation } = this.props;
|
||||||
|
const { uri } = navigation.state.params;
|
||||||
|
|
||||||
const playerStyle = [
|
const playerStyle = [
|
||||||
filePageStyle.player,
|
filePageStyle.player,
|
||||||
|
|
|
@ -46,7 +46,6 @@ class SplashScreen extends React.PureComponent {
|
||||||
this.setState({ shouldAuthenticate: true });
|
this.setState({ shouldAuthenticate: true });
|
||||||
NativeModules.Firebase.getMessagingToken()
|
NativeModules.Firebase.getMessagingToken()
|
||||||
.then(firebaseToken => {
|
.then(firebaseToken => {
|
||||||
console.log(firebaseToken);
|
|
||||||
authenticate(appVersion, Platform.OS, firebaseToken);
|
authenticate(appVersion, Platform.OS, firebaseToken);
|
||||||
})
|
})
|
||||||
.catch(() => authenticate(appVersion, Platform.OS));
|
.catch(() => authenticate(appVersion, Platform.OS));
|
||||||
|
@ -111,9 +110,10 @@ class SplashScreen extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
navigateToLiteMode = () => {
|
navigateToLiteMode = () => {
|
||||||
|
const { navigation } = this.props;
|
||||||
const resetAction = StackActions.reset({
|
const resetAction = StackActions.reset({
|
||||||
index: 0,
|
index: 0,
|
||||||
actions: [NavigationActions.navigate({ routeName: 'LiteFile', params: { url: this.state.launchUrl } })],
|
actions: [NavigationActions.navigate({ routeName: 'LiteFile', params: { uri: this.state.launchUrl } })],
|
||||||
});
|
});
|
||||||
navigation.dispatch(resetAction);
|
navigation.dispatch(resetAction);
|
||||||
};
|
};
|
||||||
|
@ -168,7 +168,6 @@ class SplashScreen extends React.PureComponent {
|
||||||
this.setState({ shouldAuthenticate: true });
|
this.setState({ shouldAuthenticate: true });
|
||||||
NativeModules.Firebase.getMessagingToken()
|
NativeModules.Firebase.getMessagingToken()
|
||||||
.then(firebaseToken => {
|
.then(firebaseToken => {
|
||||||
console.log(firebaseToken);
|
|
||||||
authenticate(appVersion, Platform.OS, firebaseToken);
|
authenticate(appVersion, Platform.OS, firebaseToken);
|
||||||
})
|
})
|
||||||
.catch(() => authenticate(appVersion, Platform.OS));
|
.catch(() => authenticate(appVersion, Platform.OS));
|
||||||
|
@ -287,13 +286,13 @@ class SplashScreen extends React.PureComponent {
|
||||||
this.props.fetchRewardedContent();
|
this.props.fetchRewardedContent();
|
||||||
Linking.getInitialURL().then(url => {
|
Linking.getInitialURL().then(url => {
|
||||||
if (url) {
|
if (url) {
|
||||||
this.setState({ launchUrl: url });
|
const liteMode = url.indexOf('liteMode=1') > -1;
|
||||||
|
this.setState({ launchUrl: url, liteMode });
|
||||||
}
|
}
|
||||||
|
|
||||||
NativeModules.UtilityModule.getNotificationLaunchTarget().then(target => {
|
NativeModules.UtilityModule.getNotificationLaunchTarget().then(target => {
|
||||||
if (target) {
|
if (target) {
|
||||||
const liteMode = target.indexOf('liteMode=1') > -1;
|
const liteMode = target.indexOf('liteMode=1') > -1;
|
||||||
android.util.Log.d('setting liteMode=' + liteModoe);
|
|
||||||
this.setState({ launchUrl: target, liteMode });
|
this.setState({ launchUrl: target, liteMode });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue