update lite file page

This commit is contained in:
Akinwale Ariwodola 2020-01-31 20:22:02 +01:00
parent 156c3e1a72
commit e541dcc381
3 changed files with 63 additions and 16 deletions

View file

@ -1,14 +1,10 @@
import { connect } from 'react-redux';
import {
makeSelectContentPositionForUri,
selectBalance,
from 'lbry-redux';
import {
doClaimEligiblePurchaseRewards,
makeSelectViewCountForUri,
} from 'lbryinc';
import { makeSelectContentPositionForUri, selectBalance } from 'lbry-redux';
import { doClaimEligiblePurchaseRewards, makeSelectViewCountForUri } from 'lbryinc';
import { doSetPlayerVisible } from 'redux/actions/drawer';
import { makeSelectPlayerVisible } from 'redux/selectors/drawer';
import { doToggleFullscreenMode } from 'redux/actions/settings';
import FilePage from './view';
import LiteFilePage from './view';
const select = (state, props) => {
const { uri, fullUri } = props.navigation.state.params;

View file

@ -19,6 +19,7 @@ import {
TouchableWithoutFeedback,
View,
} from 'react-native';
import UriBar from 'component/uriBar';
import MediaPlayer from 'component/mediaPlayer';
import filePageStyle from 'styles/filePage';
import uriBarStyle from 'styles/uriBar';
@ -34,12 +35,63 @@ class LiteFilePage extends React.PureComponent {
state = {
fullscreenMode: false,
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() {
const { contentUri } = this.props;
const { navigation } = this.props;
const { uri } = navigation.state.params;
const playerStyle = [
filePageStyle.player,

View file

@ -46,7 +46,6 @@ class SplashScreen extends React.PureComponent {
this.setState({ shouldAuthenticate: true });
NativeModules.Firebase.getMessagingToken()
.then(firebaseToken => {
console.log(firebaseToken);
authenticate(appVersion, Platform.OS, firebaseToken);
})
.catch(() => authenticate(appVersion, Platform.OS));
@ -111,9 +110,10 @@ class SplashScreen extends React.PureComponent {
}
navigateToLiteMode = () => {
const { navigation } = this.props;
const resetAction = StackActions.reset({
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);
};
@ -168,7 +168,6 @@ class SplashScreen extends React.PureComponent {
this.setState({ shouldAuthenticate: true });
NativeModules.Firebase.getMessagingToken()
.then(firebaseToken => {
console.log(firebaseToken);
authenticate(appVersion, Platform.OS, firebaseToken);
})
.catch(() => authenticate(appVersion, Platform.OS));
@ -287,13 +286,13 @@ class SplashScreen extends React.PureComponent {
this.props.fetchRewardedContent();
Linking.getInitialURL().then(url => {
if (url) {
this.setState({ launchUrl: url });
const liteMode = url.indexOf('liteMode=1') > -1;
this.setState({ launchUrl: url, liteMode });
}
NativeModules.UtilityModule.getNotificationLaunchTarget().then(target => {
if (target) {
const liteMode = target.indexOf('liteMode=1') > -1;
android.util.Log.d('setting liteMode=' + liteModoe);
this.setState({ launchUrl: target, liteMode });
}