Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
858c2dadaf | ||
|
|
eb18871015 | ||
|
|
e901e81074 | ||
|
|
2e3e1a1250 | ||
|
|
190af405bb | ||
|
|
4467853d44 | ||
|
|
a45f68d096 | ||
|
|
79686ff6b9 | ||
|
|
76305a67be | ||
|
|
82345070fb | ||
|
|
56aa0a96a7 | ||
|
|
232cdb3d29 | ||
|
|
61189b817a | ||
|
|
a127e14a0f |
No files matched your search
@@ -33,6 +33,7 @@ import {
|
||||
DeviceEventEmitter,
|
||||
Linking,
|
||||
NativeModules,
|
||||
StatusBar,
|
||||
TextInput,
|
||||
ToastAndroid,
|
||||
} from 'react-native';
|
||||
@@ -50,7 +51,7 @@ import {
|
||||
selectHashChanged,
|
||||
selectUser,
|
||||
} from 'lbryinc';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { makeSelectClientSetting, selectFullscreenMode } from 'redux/selectors/settings';
|
||||
import { decode as atob } from 'base-64';
|
||||
import { dispatchNavigateBack, dispatchNavigateToUri, transformUrl } from 'utils/helper';
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
@@ -435,6 +436,26 @@ class AppWithNavigationState extends React.Component {
|
||||
if (backgroundPlayEnabled || NativeModules.BackgroundMedia) {
|
||||
NativeModules.BackgroundMedia.hidePlaybackNotification();
|
||||
}
|
||||
|
||||
// check fullscreen mode and show / hide navigation bar accordingly
|
||||
this.checkFullscreenMode();
|
||||
}
|
||||
};
|
||||
|
||||
checkFullscreenMode = () => {
|
||||
const { fullscreenMode } = this.props;
|
||||
StatusBar.setHidden(fullscreenMode);
|
||||
|
||||
if (fullscreenMode) {
|
||||
// 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();
|
||||
// hide the navigation bar (on devices that have the soft navigation bar)
|
||||
NativeModules.UtilityModule.showNavigationBar();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -489,6 +510,7 @@ const mapStateToProps = state => ({
|
||||
emailVerifyErrorMessage: selectEmailVerifyErrorMessage(state),
|
||||
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_NSFW)(state),
|
||||
user: selectUser(state),
|
||||
fullscreenMode: selectFullscreenMode(state),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps)(AppWithNavigationState);
|
||||
@@ -54,7 +54,11 @@ class DrawerContent extends React.PureComponent {
|
||||
launchSignInFlow = () => {
|
||||
// for now, sync flow (email, then password input) will be the default sign in flow
|
||||
const { navigation } = this.props;
|
||||
navigation.navigate({ routeName: 'Verification', key: 'verification', params: { syncFlow: true } });
|
||||
navigation.navigate({
|
||||
routeName: 'Verification',
|
||||
key: 'verification',
|
||||
params: { syncFlow: true, signInFlow: true },
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
|
||||
@@ -30,12 +30,12 @@ class FileItem extends React.PureComponent {
|
||||
}
|
||||
|
||||
navigateToFileUri = () => {
|
||||
const { navigation, uri, shortUrl } = this.props;
|
||||
const { claim, navigation, uri, shortUrl } = this.props;
|
||||
const normalizedUri = normalizeURI(uri);
|
||||
if (NativeModules.Firebase) {
|
||||
NativeModules.Firebase.track('explore_click', { uri: normalizedUri, short_url: shortUrl });
|
||||
}
|
||||
navigateToUri(navigation, shortUrl || uri);
|
||||
navigateToUri(navigation, shortUrl || uri, null, false, claim ? claim.permanent_url : null);
|
||||
};
|
||||
|
||||
render() {
|
||||
@@ -124,7 +124,13 @@ class FileItem extends React.PureComponent {
|
||||
style={discoverStyle.channelName}
|
||||
text={channelName}
|
||||
onPress={() => {
|
||||
navigateToUri(navigation, normalizeURI(shortChannelUri || fullChannelUri));
|
||||
navigateToUri(
|
||||
navigation,
|
||||
normalizeURI(shortChannelUri || fullChannelUri),
|
||||
null,
|
||||
false,
|
||||
fullChannelUri
|
||||
);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -59,7 +59,7 @@ class FileListItem extends React.PureComponent {
|
||||
if (featuredResult && !claim) {
|
||||
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISH, params: { vanityUrl: uri.trim() } });
|
||||
} else {
|
||||
navigateToUri(navigation, shortUrl || uri, { autoplay });
|
||||
navigateToUri(navigation, shortUrl || uri, { autoplay }, false, claim ? claim.permanent_url : null);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -198,7 +198,13 @@ class FileListItem extends React.PureComponent {
|
||||
style={fileListStyle.publisher}
|
||||
text={channel}
|
||||
onPress={() => {
|
||||
navigateToUri(navigation, normalizeURI(shortChannelUri || fullChannelUri));
|
||||
navigateToUri(
|
||||
navigation,
|
||||
normalizeURI(shortChannelUri || fullChannelUri),
|
||||
null,
|
||||
false,
|
||||
fullChannelUri
|
||||
);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -57,7 +57,7 @@ class SuggestedSubscriptionItem extends React.PureComponent {
|
||||
style={subscriptionsStyle.suggestedItemName}
|
||||
numberOfLines={1}
|
||||
text={claim.name}
|
||||
onPress={() => navigateToUri(navigation, normalizeURI(shortUrl || uri))}
|
||||
onPress={() => navigateToUri(navigation, normalizeURI(shortUrl || uri), null, false, claim.permanent_url)}
|
||||
/>
|
||||
)}
|
||||
{tags && (
|
||||
|
||||
@@ -82,7 +82,8 @@ class WalletSend extends React.PureComponent<Props> {
|
||||
|
||||
render() {
|
||||
const { balance } = this.props;
|
||||
const canSend = this.state.address && this.state.amount > 0 && this.state.address.trim().length > 0;
|
||||
const canSend =
|
||||
this.state.address && this.state.amount > 0 && this.state.address.trim().length > 0 && this.state.addressValid;
|
||||
|
||||
return (
|
||||
<View style={walletStyle.card}>
|
||||
@@ -94,7 +95,7 @@ class WalletSend extends React.PureComponent<Props> {
|
||||
this.setState({
|
||||
address: value,
|
||||
addressChanged: true,
|
||||
addressValid: value.trim().length == 0 || regexAddress.test(value),
|
||||
addressValid: value.trim().length === 0 || regexAddress.test(value),
|
||||
})
|
||||
}
|
||||
onBlur={this.handleAddressInputBlur}
|
||||
|
||||
@@ -16,7 +16,11 @@ class WalletSignIn extends React.Component {
|
||||
|
||||
onSignInPressed = () => {
|
||||
const { navigation } = this.props;
|
||||
navigation.navigate({ routeName: 'Verification', key: 'verification', params: { syncFlow: true } });
|
||||
navigation.navigate({
|
||||
routeName: 'Verification',
|
||||
key: 'verification',
|
||||
params: { syncFlow: true, signInFlow: true },
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
|
||||
@@ -64,6 +64,8 @@ const Constants = {
|
||||
ACTION_CLEAR_PUBLISH_FORM_STATE: 'CLEAR_PUBLISH_FORM_STATE',
|
||||
ACTION_CLEAR_CHANNEL_FORM_STATE: 'CLEAR_CHANNEL_FORM_STATE',
|
||||
|
||||
ACTION_FULLSCREEN_MODE_TOGGLED: 'FULLSCREEN_MODE_TOGGLED',
|
||||
|
||||
ORIENTATION_HORIZONTAL: 'horizontal',
|
||||
ORIENTATION_VERTICAL: 'vertical',
|
||||
|
||||
|
||||
+16
-14
@@ -42,34 +42,35 @@ import {
|
||||
doStopDownloadingFile,
|
||||
} from 'redux/actions/file';
|
||||
import { doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
import { doToggleFullscreenMode } from 'redux/actions/settings';
|
||||
import { selectDrawerStack } from 'redux/selectors/drawer';
|
||||
import FilePage from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const selectProps = { uri: props.navigation.state.params.uri };
|
||||
const { uri, fullUri } = props.navigation.state.params;
|
||||
const contentUri = fullUri || uri;
|
||||
const selectProps = { uri: contentUri };
|
||||
return {
|
||||
balance: selectBalance(state),
|
||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||
channels: selectMyChannelClaims(state),
|
||||
claim: makeSelectClaimForUri(selectProps.uri)(state),
|
||||
claim: makeSelectClaimForUri(contentUri)(state),
|
||||
drawerStack: selectDrawerStack(state),
|
||||
isResolvingUri: makeSelectIsUriResolving(selectProps.uri)(state),
|
||||
contentType: makeSelectContentTypeForUri(selectProps.uri)(state),
|
||||
costInfo: makeSelectCostInfoForUri(selectProps.uri)(state),
|
||||
metadata: makeSelectMetadataForUri(selectProps.uri)(state),
|
||||
// obscureNsfw: !selectShowNsfw(state),
|
||||
// tab: makeSelectCurrentParam('tab')(state),
|
||||
fileInfo: makeSelectFileInfoForUri(selectProps.uri)(state),
|
||||
isResolvingUri: makeSelectIsUriResolving(contentUri)(state),
|
||||
contentType: makeSelectContentTypeForUri(contentUri)(state),
|
||||
costInfo: makeSelectCostInfoForUri(contentUri)(state),
|
||||
metadata: makeSelectMetadataForUri(contentUri)(state),
|
||||
fileInfo: makeSelectFileInfoForUri(contentUri)(state),
|
||||
rewardedContentClaimIds: selectRewardContentClaimIds(state, selectProps),
|
||||
channelUri: makeSelectChannelForClaimUri(selectProps.uri, true)(state),
|
||||
position: makeSelectContentPositionForUri(selectProps.uri)(state),
|
||||
channelUri: makeSelectChannelForClaimUri(contentUri, true)(state),
|
||||
position: makeSelectContentPositionForUri(contentUri)(state),
|
||||
purchasedUris: selectPurchasedUris(state),
|
||||
failedPurchaseUris: selectFailedPurchaseUris(state),
|
||||
myClaimUris: selectMyClaimUrisWithoutChannels(state),
|
||||
purchaseUriErrorMessage: selectPurchaseUriErrorMessage(state),
|
||||
streamingUrl: makeSelectStreamingUrlForUri(selectProps.uri)(state),
|
||||
thumbnail: makeSelectThumbnailForUri(selectProps.uri)(state),
|
||||
title: makeSelectTitleForUri(selectProps.uri)(state),
|
||||
streamingUrl: makeSelectStreamingUrlForUri(contentUri)(state),
|
||||
thumbnail: makeSelectThumbnailForUri(contentUri)(state),
|
||||
title: makeSelectTitleForUri(contentUri)(state),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -96,6 +97,7 @@ const perform = dispatch => ({
|
||||
startDownload: (uri, outpoint, fileInfo) => dispatch(doStartDownload(uri, outpoint, fileInfo)),
|
||||
updateDownload: (uri, outpoint, fileInfo, progress) => dispatch(doUpdateDownload(uri, outpoint, fileInfo, progress)),
|
||||
completeDownload: (uri, outpoint, fileInfo) => dispatch(doCompleteDownload(uri, outpoint, fileInfo)),
|
||||
toggleFullscreenMode: mode => dispatch(doToggleFullscreenMode(mode)),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
|
||||
+51
-22
@@ -6,6 +6,7 @@ import {
|
||||
Alert,
|
||||
DeviceEventEmitter,
|
||||
Dimensions,
|
||||
Image,
|
||||
Linking,
|
||||
NativeModules,
|
||||
ScrollView,
|
||||
@@ -213,25 +214,25 @@ class FilePage extends React.PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
handleFullscreenToggle = mode => {
|
||||
this.setState({ fullscreenMode: mode });
|
||||
StatusBar.setHidden(mode);
|
||||
if (NativeModules.ScreenOrientation) {
|
||||
if (mode) {
|
||||
// fullscreen, so change orientation to landscape mode
|
||||
NativeModules.ScreenOrientation.lockOrientationLandscape();
|
||||
if (NativeModules.UtilityModule) {
|
||||
// hide the navigation bar (on devices that use have soft navigation bar)
|
||||
NativeModules.UtilityModule.hideNavigationBar();
|
||||
}
|
||||
} else {
|
||||
// Switch back to portrait mode when the media is not fullscreen
|
||||
NativeModules.ScreenOrientation.lockOrientationPortrait();
|
||||
if (NativeModules.UtilityModule) {
|
||||
// hide the navigation bar (on devices that use have soft navigation bar)
|
||||
NativeModules.UtilityModule.showNavigationBar();
|
||||
}
|
||||
}
|
||||
handleFullscreenToggle = isFullscreen => {
|
||||
const { toggleFullscreenMode } = this.props;
|
||||
this.setState({ fullscreenMode: isFullscreen });
|
||||
toggleFullscreenMode(isFullscreen);
|
||||
|
||||
StatusBar.setHidden(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();
|
||||
|
||||
// hide the navigation bar (on devices that have the soft navigation bar)
|
||||
NativeModules.UtilityModule.showNavigationBar();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -739,6 +740,7 @@ class FilePage extends React.PureComponent {
|
||||
const isWebViewable = mediaType === 'text';
|
||||
const canOpen = isViewable && completed;
|
||||
const localFileUri = this.localUriForFileInfo(fileInfo);
|
||||
const unsupported = !isPlayable && !canOpen;
|
||||
|
||||
const openFile = () => {
|
||||
if (mediaType === 'image') {
|
||||
@@ -809,15 +811,36 @@ class FilePage extends React.PureComponent {
|
||||
thumbnail={thumbnail}
|
||||
/>
|
||||
)}
|
||||
{(!this.state.downloadButtonShown || this.state.downloadPressed) && !this.state.mediaLoaded && (
|
||||
{!unsupported &&
|
||||
(!this.state.downloadButtonShown || this.state.downloadPressed) &&
|
||||
!this.state.mediaLoaded && (
|
||||
<ActivityIndicator size="large" color={Colors.NextLbryGreen} style={filePageStyle.loading} />
|
||||
)}
|
||||
|
||||
{unsupported && fileInfo && completed && (
|
||||
<View style={filePageStyle.unsupportedContent}>
|
||||
<Image
|
||||
style={filePageStyle.unsupportedContentImage}
|
||||
resizeMode={'stretch'}
|
||||
source={require('../../assets/gerbil-happy.png')}
|
||||
/>
|
||||
<View style={filePageStyle.unspportedContentTextContainer}>
|
||||
<Text style={filePageStyle.unsupportedContentTitle}>Unsupported Content</Text>
|
||||
<Text style={filePageStyle.unsupportedContentText}>
|
||||
Sorry, we are unable to display this content in the app. You can find the file named{' '}
|
||||
<Text style={filePageStyle.unsupportedContentFilename}>{fileInfo.file_name}</Text> in your
|
||||
downloads folder.
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
|
||||
{((isPlayable && !completed && !canLoadMedia) ||
|
||||
canOpen ||
|
||||
(!completed && !this.state.streamingMode)) &&
|
||||
!this.state.downloadPressed && (
|
||||
<FileDownloadButton
|
||||
uri={uri}
|
||||
uri={claim && claim.permanent_url ? claim.permanent_url : uri}
|
||||
style={filePageStyle.downloadButton}
|
||||
openFile={openFile}
|
||||
isPlayable={isPlayable}
|
||||
@@ -976,7 +999,13 @@ class FilePage extends React.PureComponent {
|
||||
numberOfLines={1}
|
||||
ellipsizeMode={'tail'}
|
||||
onPress={() => {
|
||||
navigateToUri(navigation, normalizeURI(shortChannelUri || fullChannelUri));
|
||||
navigateToUri(
|
||||
navigation,
|
||||
normalizeURI(shortChannelUri || fullChannelUri),
|
||||
null,
|
||||
false,
|
||||
fullChannelUri
|
||||
);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -159,7 +159,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));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doToast } from 'lbry-redux';
|
||||
import { doToast, doPopulateSharedUserState } from 'lbry-redux';
|
||||
import {
|
||||
doCheckSync,
|
||||
doGetSync,
|
||||
@@ -58,6 +58,7 @@ const perform = dispatch => ({
|
||||
checkSync: () => dispatch(doCheckSync()),
|
||||
verifyPhone: verificationCode => dispatch(doUserPhoneVerify(verificationCode)),
|
||||
notify: data => dispatch(doToast(data)),
|
||||
populateSharedUserState: settings => dispatch(doPopulateSharedUserState(settings)),
|
||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||
setEmailToVerify: email => dispatch(doUserEmailToVerify(email)),
|
||||
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
|
||||
|
||||
@@ -112,7 +112,7 @@ class SyncVerifyPage extends React.PureComponent {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { hasSyncedWallet, syncApplyIsPending } = this.props;
|
||||
const { hasSyncedWallet, syncApplyIsPending, signInFlow } = this.props;
|
||||
|
||||
let paragraph;
|
||||
if (!hasSyncedWallet) {
|
||||
@@ -194,7 +194,7 @@ class SyncVerifyPage extends React.PureComponent {
|
||||
<Button
|
||||
style={rewardStyle.verificationButton}
|
||||
theme={'light'}
|
||||
text={'Enable sync'}
|
||||
text={signInFlow ? 'Use LBRY' : 'Enable sync'}
|
||||
onPress={this.onEnableSyncPressed}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import React from 'react';
|
||||
import { Lbry } from 'lbry-redux';
|
||||
import { Lbry, doPreferenceGet } from 'lbry-redux';
|
||||
import { ActivityIndicator, Linking, NativeModules, Text, TouchableOpacity, View } from 'react-native';
|
||||
import { NavigationActions, StackActions } from 'react-navigation';
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import EmailVerifyPage from './internal/email-verify-page';
|
||||
import ManualVerifyPage from './internal/manual-verify-page';
|
||||
import PhoneVerifyPage from './internal/phone-verify-page';
|
||||
@@ -19,6 +20,7 @@ class VerificationScreen extends React.PureComponent {
|
||||
showSkip: false,
|
||||
skipAccountConfirmed: false,
|
||||
showBottomContainer: true,
|
||||
signInFlow: false,
|
||||
walletPassword: null,
|
||||
isEmailVerificationPhase: false,
|
||||
isEmailVerified: false,
|
||||
@@ -27,7 +29,9 @@ class VerificationScreen extends React.PureComponent {
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
const { user } = this.props;
|
||||
const { user, navigation } = this.props;
|
||||
const { signInFlow } = navigation.state.params;
|
||||
this.setState({ signInFlow });
|
||||
this.checkVerificationStatus(user);
|
||||
NativeModules.Firebase.setCurrentScreen('Verification');
|
||||
}
|
||||
@@ -36,8 +40,22 @@ class VerificationScreen extends React.PureComponent {
|
||||
this.setState({ isEmailVerificationPhase: value });
|
||||
};
|
||||
|
||||
getUserSettings = () => {
|
||||
const { populateSharedUserState } = this.props;
|
||||
|
||||
doPreferenceGet(
|
||||
'shared',
|
||||
preference => {
|
||||
populateSharedUserState(preference);
|
||||
},
|
||||
error => {
|
||||
/* failed */
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
checkVerificationStatus = user => {
|
||||
const { deviceWalletSynced, navigation } = this.props;
|
||||
const { deviceWalletSynced, getSync, navigation } = this.props;
|
||||
const { syncFlow } = navigation.state.params;
|
||||
|
||||
this.setState(
|
||||
@@ -57,7 +75,13 @@ class VerificationScreen extends React.PureComponent {
|
||||
}
|
||||
|
||||
if (this.state.isEmailVerified && syncFlow && deviceWalletSynced) {
|
||||
navigation.goBack();
|
||||
// retrieve user settings
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
|
||||
getSync(walletPassword, () => {
|
||||
this.getUserSettings();
|
||||
navigation.goBack();
|
||||
});
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (this.state.isEmailVerified && !this.state.isIdentityVerified && !this.state.isRewardApproved) {
|
||||
@@ -167,6 +191,7 @@ class VerificationScreen extends React.PureComponent {
|
||||
syncApply={syncApply}
|
||||
syncData={syncData}
|
||||
syncHash={syncHash}
|
||||
signInFlow={this.state.signInFlow}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
@@ -182,7 +207,7 @@ class VerificationScreen extends React.PureComponent {
|
||||
|
||||
{!this.state.isEmailVerificationPhase && (
|
||||
<TouchableOpacity style={firstRunStyle.closeButton} onPress={this.onCloseButtonPressed}>
|
||||
<Text style={firstRunStyle.closeButtonText}>x</Text>
|
||||
<Icon name={'times'} size={16} style={firstRunStyle.closeButtonIcon} />
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
</View>
|
||||
|
||||
@@ -38,3 +38,14 @@ export function doSetTimeItem(item) {
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function doToggleFullscreenMode(mode) {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: Constants.ACTION_FULLSCREEN_MODE_TOGGLED,
|
||||
data: {
|
||||
mode,
|
||||
},
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -6,6 +6,7 @@ const defaultState = {
|
||||
clientSettings: {},
|
||||
sortByItemName: Constants.SORT_BY_HOT,
|
||||
timeItemName: Constants.TIME_WEEK,
|
||||
fullscreenMode: false,
|
||||
};
|
||||
|
||||
reducers[ACTIONS.CLIENT_SETTING_CHANGED] = (state, action) => {
|
||||
@@ -29,6 +30,11 @@ reducers[Constants.ACTION_TIME_ITEM_CHANGED] = (state, action) =>
|
||||
timeItemName: action.data.name,
|
||||
});
|
||||
|
||||
reducers[Constants.ACTION_FULLSCREEN_MODE_TOGGLED] = (state, action) =>
|
||||
Object.assign({}, state, {
|
||||
fullscreenMode: action.data.mode,
|
||||
});
|
||||
|
||||
export default function reducer(state = defaultState, action) {
|
||||
const handler = reducers[action.type];
|
||||
if (handler) return handler(state, action);
|
||||
|
||||
@@ -34,3 +34,8 @@ export const makeSelectClientSetting = setting =>
|
||||
export const selectShowNsfw = makeSelectClientSetting(SETTINGS.SHOW_NSFW);
|
||||
|
||||
export const selectKeepDaemonRunning = makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING);
|
||||
|
||||
export const selectFullscreenMode = createSelector(
|
||||
selectState,
|
||||
state => state.fullscreenMode
|
||||
);
|
||||
@@ -402,6 +402,39 @@ const filePageStyle = StyleSheet.create({
|
||||
marginTop: 12,
|
||||
marginBottom: 12,
|
||||
},
|
||||
unsupportedContent: {
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
right: 0,
|
||||
top: 0,
|
||||
bottom: 16,
|
||||
padding: 24,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
backgroundColor: Colors.White,
|
||||
},
|
||||
unspportedContentTextContainer: {
|
||||
flex: 1,
|
||||
},
|
||||
unsupportedContentFilename: {
|
||||
color: Colors.LbryGreen,
|
||||
fontFamily: 'Inter-UI-SemiBold',
|
||||
fontSize: 16,
|
||||
},
|
||||
unsupportedContentImage: {
|
||||
width: 64,
|
||||
height: 80,
|
||||
marginRight: 24,
|
||||
},
|
||||
unsupportedContentTitle: {
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
fontSize: 20,
|
||||
},
|
||||
unsupportedContentText: {
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
fontSize: 16,
|
||||
marginTop: 4,
|
||||
},
|
||||
});
|
||||
|
||||
export default filePageStyle;
|
||||
@@ -153,6 +153,10 @@ const firstRunStyle = StyleSheet.create({
|
||||
color: Colors.White,
|
||||
fontSize: 16,
|
||||
},
|
||||
closeButtonIcon: {
|
||||
alignSelf: 'center',
|
||||
color: Colors.White,
|
||||
},
|
||||
buttonContainer: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
|
||||
+25
-20
@@ -6,32 +6,37 @@ import Constants, { DrawerRoutes, InnerDrawerRoutes } from 'constants'; // eslin
|
||||
|
||||
const tagNameLength = 10;
|
||||
|
||||
const specialRouteMap = {
|
||||
about: Constants.DRAWER_ROUTE_ABOUT,
|
||||
allContent: Constants.DRAWER_ROUTE_TRENDING,
|
||||
channels: Constants.DRAWER_ROUTE_CHANNEL_CREATOR,
|
||||
library: Constants.DRAWER_ROUTE_MY_LBRY,
|
||||
publish: Constants.DRAWER_ROUTE_PUBLISH,
|
||||
publishes: Constants.DRAWER_ROUTE_PUBLISHES,
|
||||
rewards: Constants.DRAWER_ROUTE_REWARDS,
|
||||
settings: Constants.DRAWER_ROUTE_SETTINGS,
|
||||
subscriptions: Constants.DRAWER_ROUTE_SUBSCRIPTIONS,
|
||||
wallet: Constants.FULL_ROUTE_NAME_WALLET,
|
||||
discover: Constants.FULL_ROUTE_NAME_DISCOVER,
|
||||
};
|
||||
|
||||
function getRouteForSpecialUri(uri) {
|
||||
let targetRoute;
|
||||
const page = uri.substring(8).trim(); // 'lbry://?'.length == 8
|
||||
|
||||
switch (page) {
|
||||
case Constants.PAGE_REWARDS:
|
||||
targetRoute = Constants.DRAWER_ROUTE_REWARDS;
|
||||
break;
|
||||
case Constants.PAGE_SETTINGS:
|
||||
targetRoute = Constants.DRAWER_ROUTE_SETTINGS;
|
||||
break;
|
||||
case Constants.PAGE_TRENDING:
|
||||
targetRoute = Constants.DRAWER_ROUTE_TRENDING;
|
||||
break;
|
||||
case Constants.PAGE_WALLET:
|
||||
targetRoute = Constants.FULL_ROUTE_NAME_WALLET;
|
||||
break;
|
||||
default:
|
||||
targetRoute = Constants.FULL_ROUTE_NAME_DISCOVER;
|
||||
break;
|
||||
if (specialRouteMap[page]) {
|
||||
targetRoute = specialRouteMap[page];
|
||||
}
|
||||
|
||||
if (!targetRoute) {
|
||||
// default to the home page if there is no match for the page
|
||||
targetRoute = Constants.FULL_ROUTE_NAME_DISCOVER;
|
||||
}
|
||||
|
||||
return targetRoute;
|
||||
}
|
||||
|
||||
export function dispatchNavigateToUri(dispatch, nav, uri, isNavigatingBack) {
|
||||
export function dispatchNavigateToUri(dispatch, nav, uri, isNavigatingBack, fullUri) {
|
||||
if (uri.startsWith('lbry://?')) {
|
||||
dispatch(NavigationActions.navigate({ routeName: getRouteForSpecialUri(uri) }));
|
||||
return;
|
||||
@@ -45,7 +50,7 @@ export function dispatchNavigateToUri(dispatch, nav, uri, isNavigatingBack) {
|
||||
uriVars = parseUriVars(uriVarsStr);
|
||||
}
|
||||
|
||||
const params = { uri, uriVars };
|
||||
const params = { uri, uriVars, fullUri: fullUri };
|
||||
|
||||
if (!isNavigatingBack) {
|
||||
dispatch(doPushDrawerStack(uri));
|
||||
@@ -108,7 +113,7 @@ function parseUriVars(vars) {
|
||||
return uriVars;
|
||||
}
|
||||
|
||||
export function navigateToUri(navigation, uri, additionalParams, isNavigatingBack) {
|
||||
export function navigateToUri(navigation, uri, additionalParams, isNavigatingBack, fullUri) {
|
||||
if (!navigation) {
|
||||
return;
|
||||
}
|
||||
@@ -131,7 +136,7 @@ export function navigateToUri(navigation, uri, additionalParams, isNavigatingBac
|
||||
}
|
||||
|
||||
const { store } = window;
|
||||
const params = Object.assign({ uri, uriVars }, additionalParams);
|
||||
const params = Object.assign({ uri, uriVars, fullUri: fullUri }, additionalParams);
|
||||
if (navigation.state.routeName === 'File') {
|
||||
const stackAction = StackActions.replace({ routeName: 'File', newKey: uri, params });
|
||||
navigation.dispatch(stackAction);
|
||||
|
||||
Reference in new issue
Block a user