diff --git a/ui/component/scheduledStreams/index.js b/ui/component/scheduledStreams/index.js index d839e6608..ccfd38334 100644 --- a/ui/component/scheduledStreams/index.js +++ b/ui/component/scheduledStreams/index.js @@ -1,4 +1,11 @@ import { connect } from 'react-redux'; import ScheduledStreams from './view'; +import { doSetClientSetting } from 'redux/actions/settings'; +import { doToast } from 'redux/actions/notifications'; -export default connect()(ScheduledStreams); +const perform = (dispatch) => ({ + setClientSetting: (key, value, pushPrefs) => dispatch(doSetClientSetting(key, value, pushPrefs)), + doShowSnackBar: (message) => dispatch(doToast({ isError: false, message })), +}); + +export default connect(null, perform)(ScheduledStreams); diff --git a/ui/component/scheduledStreams/view.jsx b/ui/component/scheduledStreams/view.jsx index 9af4c2b3d..cb3c8897a 100644 --- a/ui/component/scheduledStreams/view.jsx +++ b/ui/component/scheduledStreams/view.jsx @@ -9,16 +9,20 @@ import ClaimListDiscover from 'component/claimListDiscover'; import Button from 'component/button'; import { LIVESTREAM_UPCOMING_BUFFER } from 'constants/livestream'; // import { SCHEDULED_LIVESTREAM_TAG } from 'constants/tags'; +import * as SETTINGS from 'constants/settings'; type Props = { channelIds: Array, tileLayout: boolean, liveUris: Array, limitClaimsPerChannel?: number, + // --- perform --- + setClientSetting: (string, boolean | string | number, boolean) => void, + doShowSnackBar: (string) => void, }; const ScheduledStreams = (props: Props) => { - const { channelIds, tileLayout, liveUris = [], limitClaimsPerChannel } = props; + const { channelIds, tileLayout, liveUris = [], limitClaimsPerChannel, setClientSetting, doShowSnackBar } = props; const isMediumScreen = useIsMediumScreen(); const isLargeScreen = useIsLargeScreen(); @@ -38,6 +42,20 @@ const ScheduledStreams = (props: Props) => { setTotalUpcomingLivestreams(total); }; + const hideScheduledStreams = () => { + setClientSetting(SETTINGS.HIDE_SCHEDULED_LIVESTREAMS, true, true); + doShowSnackBar(__('Scheduled streams hidden, you can re-enable them in settings.')); + }; + + const Header = () => { + return ( +
+ {__('Upcoming Livestreams')} +
+ ); + }; + return (
{ infiniteScroll={false} showNoSourceClaims hideLayoutButton - header={__('Upcoming Livestreams')} + header={
} maxClaimRender={upcomingMax} excludeUris={liveUris} loadedCallback={loadedCallback} diff --git a/ui/component/settingContent/index.js b/ui/component/settingContent/index.js index 8cd5e1108..8cd6f70c7 100644 --- a/ui/component/settingContent/index.js +++ b/ui/component/settingContent/index.js @@ -15,6 +15,7 @@ const select = (state) => ({ autoplayMedia: selectClientSetting(state, SETTINGS.AUTOPLAY_MEDIA), autoplayNext: selectClientSetting(state, SETTINGS.AUTOPLAY_NEXT), hideReposts: selectClientSetting(state, SETTINGS.HIDE_REPOSTS), + hideScheduledLivestreams: selectClientSetting(state, SETTINGS.HIDE_SCHEDULED_LIVESTREAMS), showNsfw: selectShowMatureContent(state), myChannelUrls: selectMyChannelUrls(state), instantPurchaseEnabled: selectClientSetting(state, SETTINGS.INSTANT_PURCHASE_ENABLED), diff --git a/ui/component/settingContent/view.jsx b/ui/component/settingContent/view.jsx index 502e5b5b1..bf7f77c8b 100644 --- a/ui/component/settingContent/view.jsx +++ b/ui/component/settingContent/view.jsx @@ -26,6 +26,7 @@ type Props = { autoplayNext: boolean, hideReposts: ?boolean, showNsfw: boolean, + hideScheduledLivestreams: boolean, myChannelUrls: ?Array, instantPurchaseEnabled: boolean, instantPurchaseMax: Price, @@ -44,6 +45,7 @@ export default function SettingContent(props: Props) { autoplayNext, hideReposts, showNsfw, + hideScheduledLivestreams, myChannelUrls, instantPurchaseEnabled, instantPurchaseMax, @@ -108,6 +110,15 @@ export default function SettingContent(props: Props) { /> + + setClientSetting(SETTINGS.HIDE_SCHEDULED_LIVESTREAMS, !hideScheduledLivestreams)} + checked={hideScheduledLivestreams} + /> + + {!SIMPLE_SITE && ( <> {/* @@ -223,6 +234,7 @@ const HELP = { AUTOPLAY_MEDIA: 'Autoplay video and audio files when navigating to a file.', AUTOPLAY_NEXT: 'Autoplay the next related item when a file (video or audio) finishes playing.', HIDE_REPOSTS: 'You will not see reposts by people you follow or receive email notifying about them.', + HIDE_SCHEDULED_LIVESTREAMS: 'You will not see scheduled livestreams by people you follow on the home or following page.', SHOW_MATURE: 'Mature content may include nudity, intense sexuality, profanity, or other adult content. By displaying mature content, you are affirming you are of legal age to view mature content in your country or jurisdiction. ', MAX_PURCHASE_PRICE: 'This will prevent you from purchasing any content over a certain cost, as a safety measure.', ONLY_CONFIRM_OVER_AMOUNT: '', // [feel redundant. Disable for now] "When this option is chosen, LBRY won't ask you to confirm purchases or tips below your chosen amount.", diff --git a/ui/constants/settings.js b/ui/constants/settings.js index 2e55ef158..fcf0db500 100644 --- a/ui/constants/settings.js +++ b/ui/constants/settings.js @@ -35,6 +35,7 @@ export const REWARDS_ACKNOWLEDGED = 'rewards_acknowledged'; export const SEARCH_IN_LANGUAGE = 'search_in_language'; export const HOMEPAGE = 'homepage'; export const HIDE_REPOSTS = 'hide_reposts'; +export const HIDE_SCHEDULED_LIVESTREAMS = 'hide_scheduled_livestreams'; export const SUPPORT_OPTION = 'support_option'; export const TILE_LAYOUT = 'tile_layout'; export const VIDEO_THEATER_MODE = 'video_theater_mode'; diff --git a/ui/constants/shared_preferences.js b/ui/constants/shared_preferences.js index 977835281..03f09023e 100644 --- a/ui/constants/shared_preferences.js +++ b/ui/constants/shared_preferences.js @@ -17,6 +17,7 @@ export const SDK_SYNC_KEYS = [DAEMON_SETTINGS.LBRYUM_SERVERS, DAEMON_SETTINGS.SH export const CLIENT_SYNC_KEYS = [ SETTINGS.SHOW_MATURE, SETTINGS.HIDE_REPOSTS, + SETTINGS.HIDE_SCHEDULED_LIVESTREAMS, SETTINGS.SHOW_ANONYMOUS, SETTINGS.INSTANT_PURCHASE_ENABLED, SETTINGS.INSTANT_PURCHASE_MAX, diff --git a/ui/page/channelsFollowing/index.js b/ui/page/channelsFollowing/index.js index fa581ee2c..0656e9168 100644 --- a/ui/page/channelsFollowing/index.js +++ b/ui/page/channelsFollowing/index.js @@ -12,6 +12,7 @@ const select = (state) => ({ tileLayout: selectClientSetting(state, SETTINGS.TILE_LAYOUT), activeLivestreams: selectActiveLivestreams(state), fetchingActiveLivestreams: selectFetchingActiveLivestreams(state), + hideScheduledLivestreams: selectClientSetting(state, SETTINGS.HIDE_SCHEDULED_LIVESTREAMS), }); export default connect(select, { diff --git a/ui/page/channelsFollowing/view.jsx b/ui/page/channelsFollowing/view.jsx index 10365b798..75fd19cf3 100644 --- a/ui/page/channelsFollowing/view.jsx +++ b/ui/page/channelsFollowing/view.jsx @@ -19,6 +19,7 @@ type Props = { activeLivestreams: ?LivestreamInfo, doFetchActiveLivestreams: () => void, fetchingActiveLivestreams: boolean, + hideScheduledLivestreams: boolean, }; function ChannelsFollowingPage(props: Props) { @@ -28,6 +29,7 @@ function ChannelsFollowingPage(props: Props) { activeLivestreams, doFetchActiveLivestreams, fetchingActiveLivestreams, + hideScheduledLivestreams, } = props; const hasSubscribedChannels = subscribedChannels.length > 0; @@ -43,12 +45,14 @@ function ChannelsFollowingPage(props: Props) { {!fetchingActiveLivestreams && ( <> - + {!hideScheduledLivestreams && ( + + )} ({ homepageData: selectHomepageData(state), activeLivestreams: selectActiveLivestreams(state), fetchingActiveLivestreams: selectFetchingActiveLivestreams(state), + hideScheduledLivestreams: selectClientSetting(state, SETTINGS.HIDE_SCHEDULED_LIVESTREAMS), }); const perform = (dispatch) => ({ diff --git a/ui/page/home/view.jsx b/ui/page/home/view.jsx index 591aa1b9f..dc3a35399 100644 --- a/ui/page/home/view.jsx +++ b/ui/page/home/view.jsx @@ -30,6 +30,7 @@ type Props = { activeLivestreams: any, doFetchActiveLivestreams: () => void, fetchingActiveLivestreams: boolean, + hideScheduledLivestreams: boolean, }; function HomePage(props: Props) { @@ -42,6 +43,7 @@ function HomePage(props: Props) { activeLivestreams, doFetchActiveLivestreams, fetchingActiveLivestreams, + hideScheduledLivestreams, } = props; const showPersonalizedChannels = (authenticated || !IS_WEB) && subscribedChannels && subscribedChannels.length > 0; const showPersonalizedTags = (authenticated || !IS_WEB) && followedTags && followedTags.length > 0; @@ -150,7 +152,7 @@ function HomePage(props: Props) { {!fetchingActiveLivestreams && ( <> - {authenticated && channelIds.length > 0 && ( + {authenticated && channelIds.length > 0 && !hideScheduledLivestreams && (