lbry.tv hybrid mode #132

Merged
akinwale merged 8 commits from lbry-tv-experiment into master 2020-03-20 08:25:39 +01:00
17 changed files with 153 additions and 74 deletions
Showing only changes of commit 954abf6fdf - Show all commits

@ -1 +1 @@
Subproject commit 558b609ce2b7301437a2b8db237621b32bedade9
Subproject commit 6d4d9965137441d4d0d460814b1d89d67f23bc81

View file

@ -68,7 +68,7 @@ class DrawerContent extends React.PureComponent {
handleItemPress = routeName => {
const { navigation, notify, sdkReady } = this.props;
if (true && routesRequiringSdkReady.includes(routeName)) {
if (!sdkReady && routesRequiringSdkReady.includes(routeName)) {
if (navigation.closeDrawer) {
navigation.closeDrawer();
}

View file

@ -125,7 +125,9 @@ class FileListItem extends React.PureComponent {
const outpointsToHide = !blackListedOutpoints
? filteredOutpoints
: blackListedOutpoints.concat(filteredOutpoints);
shouldHide = outpointsToHide.some(outpoint => outpoint.txid === claim.txid && outpoint.nout === claim.nout);
shouldHide = outpointsToHide.some(
outpoint => outpoint && outpoint.txid === claim.txid && outpoint.nout === claim.nout,
);
}
// TODO: hide channels on tag pages?
@ -143,10 +145,14 @@ class FileListItem extends React.PureComponent {
<View>
{isRepost && (
<View style={fileListStyle.repostInfo}>
<Icon name={"retweet"} size={14} style={fileListStyle.repostIcon} />
<Icon name={'retweet'} size={14} style={fileListStyle.repostIcon} />
<Text style={fileListStyle.repostChannelName}>
<Link text={repostChannel}
onPress={() => navigateToUri(navigation, normalizeURI(repostChannelUrl), null, false, null, false)} /> reposted</Text>
<Link
text={repostChannel}
onPress={() => navigateToUri(navigation, normalizeURI(repostChannelUrl), null, false, null, false)}
/>{' '}
reposted
</Text>
</View>
)}

View file

@ -22,6 +22,7 @@ import {
import { doUpdateChannelFormState, doClearChannelFormState } from 'redux/actions/form';
import { selectDrawerStack } from 'redux/selectors/drawer';
import { selectChannelFormState, selectHasChannelFormState } from 'redux/selectors/form';
import { selectSdkReady } from 'redux/selectors/settings';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import ChannelCreator from './view';
@ -33,6 +34,7 @@ const select = state => ({
fetchingChannels: selectFetchingMyChannels(state),
balance: selectBalance(state),
hasFormState: selectHasChannelFormState(state),
sdkReady: selectSdkReady(state),
updatingChannel: selectUpdatingChannel(state),
updateChannelError: selectUpdateChannelError(state),
});
@ -52,7 +54,4 @@ const perform = dispatch => ({
setExplicitNavigateBack: flag => dispatch(doSetExplicitNavigateBack(flag)),
});
export default connect(
select,
perform,
)(ChannelCreator);
export default connect(select, perform)(ChannelCreator);

View file

@ -176,9 +176,7 @@ export default class ChannelCreator extends React.PureComponent {
NativeModules.Firebase.setCurrentScreen('Channels').then(result => {
pushDrawerStack(Constants.DRAWER_ROUTE_CHANNEL_CREATOR, navigation.state.params ? navigation.state.params : null);
setPlayerVisible();
if (!fetchingChannels) {
fetchChannelListMine();
}
fetchChannelListMine();
DeviceEventEmitter.addListener('onDocumentPickerFilePicked', this.onFilePicked);
DeviceEventEmitter.addListener('onDocumentPickerCanceled', this.onPickerCanceled);
@ -802,7 +800,15 @@ export default class ChannelCreator extends React.PureComponent {
};
render() {
const { abandoningClaimIds, balance, fetchingChannels, updatingChannel, channels = [], navigation } = this.props;
const {
abandoningClaimIds,
balance,
fetchingChannels,
sdkReady,
updatingChannel,
channels = [],
navigation,
} = this.props;
const {
autoStyle,
autoStyles,
@ -826,6 +832,19 @@ export default class ChannelCreator extends React.PureComponent {
const hasChannels = channels && channels.length > 0;
if (!sdkReady) {
return (
<View style={channelCreatorStyle.container}>
<UriBar navigation={navigation} />
<EmptyStateView
message={__(
'The background service is still initializing. You can still explore and watch content during the initialization process.',
)}
/>
</View>
);
}
return (
<View style={channelCreatorStyle.container}>
<UriBar

View file

@ -11,15 +11,17 @@ import {
import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
import { doDeleteFile } from 'redux/actions/file';
import { selectCurrentRoute } from 'redux/selectors/drawer';
import { selectSdkReady } from 'redux/selectors/settings';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import DownloadsPage from './view';
const select = state => ({
claims: selectMyClaimsWithoutChannels(state),
currentRoute: selectCurrentRoute(state),
fileInfos: selectFileInfosDownloaded(state),
downloadedUris: selectDownloadedUris(state),
fileInfos: selectFileInfosDownloaded(state),
fetching: selectIsFetchingFileList(state) || selectIsFetchingClaimListMine(state),
sdkReady: selectSdkReady(state),
});
const perform = dispatch => ({
@ -32,7 +34,4 @@ const perform = dispatch => ({
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
});
export default connect(
select,
perform
)(DownloadsPage);
export default connect(select, perform)(DownloadsPage);

View file

@ -144,11 +144,24 @@ class DownloadsPage extends React.PureComponent {
};
render() {
const { fetching, claims, downloadedUris, fileInfos, navigation } = this.props;
const { downloadedUris, fetching, navigation, sdkReady } = this.props;
const { selectionMode, selectedUris } = this.state;
const filteredUris = this.getFilteredUris();
const hasDownloads = filteredUris && filteredUris.length > 0;
if (!sdkReady) {
return (
<View style={downloadsStyle.container}>
<UriBar navigation={navigation} />
<EmptyStateView
message={__(
'The background service is still initializing. You can still explore and watch content during the initialization process.',
)}
/>
</View>
);
}
return (
<View style={downloadsStyle.container}>
<UriBar

View file

@ -12,23 +12,22 @@ import {
doFetchInviteStatus,
doUserInviteNew,
} from 'lbryinc';
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
import { doUpdateChannelFormState, doClearChannelFormState } from 'redux/actions/form';
import { selectDrawerStack } from 'redux/selectors/drawer';
import { selectChannelFormState, selectHasChannelFormState } from 'redux/selectors/form';
import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
import { selectSdkReady } from 'redux/selectors/settings';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import InvitesPage from './view';
const select = state => ({
channels: selectMyChannelClaims(state),
errorMessage: selectUserInviteNewErrorMessage(state),
fetchingChannels: selectFetchingMyChannels(state),
fetchingInvitees: selectUserInviteStatusIsPending(state),
errorMessage: selectUserInviteNewErrorMessage(state),
invitesRemaining: selectUserInvitesRemaining(state),
referralCode: selectUserInviteReferralCode(state),
isPending: selectUserInviteNewIsPending(state),
invitees: selectUserInvitees(state),
invitesRemaining: selectUserInvitesRemaining(state),
isPending: selectUserInviteNewIsPending(state),
referralCode: selectUserInviteReferralCode(state),
referralReward: selectReferralReward(state),
sdkReady: selectSdkReady(state),
});
const perform = dispatch => ({
@ -40,7 +39,4 @@ const perform = dispatch => ({
notify: data => dispatch(doToast(data)),
});
export default connect(
select,
perform,
)(InvitesPage);
export default connect(select, perform)(InvitesPage);

View file

@ -11,14 +11,10 @@ import {
View,
} from 'react-native';
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 Link from 'component/link';
import Button from 'component/button';
import ChannelSelector from 'component/channelSelector';
import PageHeader from 'component/pageHeader';
import RewardCard from 'component/rewardCard';
import RewardEnrolment from 'component/rewardEnrolment';
import EmptyStateView from 'component/emptyStateView';
import UriBar from 'component/uriBar';
import invitesStyle from 'styles/invites';
import { fetchReferralCode, logPublish } from 'utils/helper';
@ -134,10 +130,23 @@ class InvitesPage extends React.PureComponent {
};
render() {
const { fetchingInvitees, user, navigation, notify, isPending, invitees } = this.props;
const { email, inviteLink } = this.state;
const { fetchingInvitees, invitees, isPending, navigation, sdkReady } = this.props;
const { email } = this.state;
const hasInvitees = invitees && invitees.length > 0;
if (!sdkReady) {
return (
<View style={invitesStyle.container}>
<UriBar navigation={navigation} />
<EmptyStateView
message={__(
'The background service is still initializing. You can still explore and watch content during the initialization process.',
)}
/>
</View>
);
}
return (
<View style={invitesStyle.container}>
<UriBar navigation={navigation} />

View file

@ -13,6 +13,7 @@ import { selectDrawerStack } from 'redux/selectors/drawer';
import { doUpdatePublishFormState, doClearPublishFormState, doPendingPublishSuccess } from 'redux/actions/form';
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
import { selectPublishFormState, selectHasPublishFormState } from 'redux/selectors/form';
import { selectSdkReady } from 'redux/selectors/settings';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import PublishPage from './view';
@ -23,6 +24,7 @@ const select = state => ({
myClaims: selectMyClaims(state),
publishFormState: selectPublishFormState(state),
publishFormValues: selectPublishFormValues(state),
sdkReady: selectSdkReady(state),
});
const perform = dispatch => ({
@ -39,7 +41,4 @@ const perform = dispatch => ({
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
});
export default connect(
select,
perform,
)(PublishPage);
export default connect(select, perform)(PublishPage);

View file

@ -37,6 +37,7 @@ import Button from 'component/button';
import ChannelSelector from 'component/channelSelector';
import Colors from 'styles/colors';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import EmptyStateView from 'component/emptyStateView';
import FastImage from 'react-native-fast-image';
import FloatingWalletBalance from 'component/floatingWalletBalance';
import Icon from 'react-native-vector-icons/FontAwesome5';
@ -974,7 +975,7 @@ class PublishPage extends React.PureComponent {
};
render() {
const { balance, navigation, notify, publishFormValues } = this.props;
const { balance, navigation, notify, sdkReady } = this.props;
const {
allThumbnailsChecked,
canUseCamera,
@ -987,6 +988,19 @@ class PublishPage extends React.PureComponent {
videos,
} = this.state;
if (!sdkReady) {
return (
<View style={publishStyle.container}>
<UriBar navigation={navigation} />
<EmptyStateView
message={__(
'The background service is still initializing. You can still explore and watch content during the initialization process.',
)}
/>
</View>
);
}
let content;
if (Constants.PHASE_SELECTOR === currentPhase) {
content = (

View file

@ -9,6 +9,7 @@ import {
selectIsFetchingClaimListMine,
} from 'lbry-redux';
import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
import { selectSdkReady } from 'redux/selectors/settings';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import PublishesPage from './view';
@ -16,6 +17,7 @@ const select = state => ({
uris: selectMyClaimUrisWithoutChannels(state),
fetching: selectIsFetchingClaimListMine(state),
pendingClaims: selectPendingClaims(state),
sdkReady: selectSdkReady(state),
});
const perform = dispatch => ({
@ -27,7 +29,4 @@ const perform = dispatch => ({
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
});
export default connect(
select,
perform
)(PublishesPage);
export default connect(select, perform)(PublishesPage);

View file

@ -114,14 +114,27 @@ class PublishesPage extends React.PureComponent {
},
},
],
{ cancelable: true }
{ cancelable: true },
);
};
render() {
const { fetching, navigation, uris } = this.props;
const { fetching, navigation, sdkReady, uris } = this.props;
const { selectionMode, selectedUris } = this.state;
if (!sdkReady) {
return (
<View style={publishStyle.container}>
<UriBar navigation={navigation} />
<EmptyStateView
message={__(
'The background service is still initializing. You can still explore and watch content during the initialization process.',
)}
/>
</View>
);
}
return (
<View style={publishStyle.container}>
<UriBar

View file

@ -12,7 +12,8 @@ import {
import { doToast } from 'lbry-redux';
import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
import { selectCurrentRoute } from 'redux/selectors/drawer';
import Constants from 'constants';
import { selectSdkReady } from 'redux/selectors/settings';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import RewardsPage from './view';
const select = state => ({
@ -22,6 +23,7 @@ const select = state => ({
emailVerifyPending: selectEmailVerifyIsPending(state),
fetching: selectFetchingRewards(state),
rewards: selectUnclaimedRewards(state),
sdkReady: selectSdkReady(state),
user: selectUser(state),
});
@ -33,7 +35,4 @@ const perform = dispatch => ({
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
});
export default connect(
select,
perform
)(RewardsPage);
export default connect(select, perform)(RewardsPage);

View file

@ -5,7 +5,7 @@ import Colors from 'styles/colors';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import Link from 'component/link';
import CustomRewardCard from 'component/customRewardCard';
import PageHeader from 'component/pageHeader';
import EmptyStateView from 'component/emptyStateView';
import RewardCard from 'component/rewardCard';
import RewardEnrolment from 'component/rewardEnrolment';
import UriBar from 'component/uriBar';
@ -192,9 +192,22 @@ class RewardsPage extends React.PureComponent {
};
render() {
const { user, navigation } = this.props;
const { navigation, sdkReady } = this.props;
const { currentFilter } = this.state;
if (!sdkReady) {
return (
<View style={rewardStyle.container}>
<UriBar navigation={navigation} />
<EmptyStateView
message={__(
'The background service is still initializing. You can still explore and watch content during the initialization process.',
)}
/>
</View>
);
}
return (
<View style={rewardStyle.container}>
<UriBar navigation={navigation} />

View file

@ -1,6 +1,6 @@
import { connect } from 'react-redux';
import { doSetClientSetting } from 'redux/actions/settings';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import { makeSelectClientSetting, selectSdkReady } from 'redux/selectors/settings';
import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
import { selectCurrentRoute } from 'redux/selectors/drawer';
import { selectBalance } from 'lbry-redux';
@ -15,6 +15,7 @@ const select = state => ({
deviceWalletSynced: makeSelectClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED)(state),
hasSyncedWallet: selectHasSyncedWallet(state),
rewardsNotInterested: makeSelectClientSetting(Constants.SETTING_REWARDS_NOT_INTERESTED)(state),
sdkReady: selectSdkReady(state),
understandsRisks: makeSelectClientSetting(Constants.SETTING_ALPHA_UNDERSTANDS_RISKS)(state),
user: selectUser(state),
});
@ -27,7 +28,4 @@ const perform = dispatch => ({
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
});
export default connect(
select,
perform
)(WalletPage);
export default connect(select, perform)(WalletPage);

View file

@ -1,5 +1,6 @@
import React from 'react';
import { NativeModules, ScrollView, Text, View } from 'react-native';
import EmptyStateView from 'component/emptyStateView';
import TransactionListRecent from 'component/transactionListRecent';
import WalletAddress from 'component/walletAddress';
import WalletBalance from 'component/walletBalance';
@ -8,8 +9,6 @@ import WalletSend from 'component/walletSend';
import WalletRewardsDriver from 'component/walletRewardsDriver';
import WalletSignIn from 'component/walletSignIn';
import WalletSyncDriver from 'component/walletSyncDriver';
import Button from 'component/button';
import Link from 'component/link';
import UriBar from 'component/uriBar';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import walletStyle from 'styles/wallet';
@ -60,16 +59,20 @@ class WalletPage extends React.PureComponent {
};
render() {
const {
balance,
backupDismissed,
hasSyncedWallet,
rewardsNotInterested,
understandsRisks,
setClientSetting,
navigation,
user,
} = this.props;
const { balance, rewardsNotInterested, understandsRisks, navigation, sdkReady, user } = this.props;
if (!sdkReady) {
return (
<View style={walletStyle.container}>
<UriBar navigation={navigation} />
<EmptyStateView
message={__(
'The background service is still initializing. You can still explore and watch content during the initialization process.',
)}
/>
</View>
);
}
const signedIn = user && user.has_verified_email;
if (!signedIn && !understandsRisks) {