Repost settings

This commit is contained in:
Lukewh 2020-02-20 12:30:27 +00:00 committed by Sean Yesmunt
parent 356611d3a7
commit 26168670dd
10 changed files with 42 additions and 10 deletions

View file

@ -7,6 +7,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [0.4x.x] - [Unreleased] ## [0.4x.x] - [Unreleased]
### Added ### Added
- Show reposts setting ([#3712](https://github.com/lbryio/lbry-desktop/pull/3712))
- Czech and Kannada language support ([#3759](https://github.com/lbryio/lbry-desktop/pull/3759)) - Czech and Kannada language support ([#3759](https://github.com/lbryio/lbry-desktop/pull/3759))

View file

@ -14,6 +14,7 @@ const select = state => ({
claimSearchByQuery: selectClaimSearchByQuery(state), claimSearchByQuery: selectClaimSearchByQuery(state),
loading: selectFetchingClaimSearch(state), loading: selectFetchingClaimSearch(state),
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state), showNsfw: makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state),
showReposts: makeSelectClientSetting(SETTINGS.SHOW_REPOSTS)(state),
hiddenUris: selectBlockedChannels(state), hiddenUris: selectBlockedChannels(state),
}); });

View file

@ -36,6 +36,7 @@ type Props = {
doToggleTagFollow: string => void, doToggleTagFollow: string => void,
meta?: Node, meta?: Node,
showNsfw: boolean, showNsfw: boolean,
showReposts: boolean,
history: { action: string, push: string => void, replace: string => void }, history: { action: string, push: string => void, replace: string => void },
location: { search: string, pathname: string }, location: { search: string, pathname: string },
claimSearchByQuery: { claimSearchByQuery: {
@ -67,6 +68,7 @@ function ClaimListDiscover(props: Props) {
meta, meta,
channelIds, channelIds,
showNsfw, showNsfw,
showReposts,
history, history,
location, location,
hiddenUris, hiddenUris,
@ -101,6 +103,7 @@ function ClaimListDiscover(props: Props) {
not_tags: Array<string>, not_tags: Array<string>,
order_by: Array<string>, order_by: Array<string>,
release_time?: string, release_time?: string,
claim_type?: string,
name?: string, name?: string,
claim_type?: string | Array<string>, claim_type?: string | Array<string>,
} = { } = {
@ -162,8 +165,8 @@ function ClaimListDiscover(props: Props) {
} }
} }
if (claimType) { if (!showReposts) {
options.claim_type = claimType; options.claim_type = 'stream';
} }
const hasMatureTags = tags && tags.some(t => MATURE_TAGS.includes(t)); const hasMatureTags = tags && tags.some(t => MATURE_TAGS.includes(t));

View file

@ -14,6 +14,7 @@ const select = state => ({
claimSearchByQuery: selectClaimSearchByQuery(state), claimSearchByQuery: selectClaimSearchByQuery(state),
loading: selectFetchingClaimSearch(state), loading: selectFetchingClaimSearch(state),
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state), showNsfw: makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state),
showReposts: makeSelectClientSetting(SETTINGS.SHOW_REPOSTS)(state),
hiddenUris: selectBlockedChannels(state), hiddenUris: selectBlockedChannels(state),
}); });

View file

@ -8,6 +8,7 @@ type Props = {
doClaimSearch: ({}) => void, doClaimSearch: ({}) => void,
loading: boolean, loading: boolean,
showNsfw: boolean, showNsfw: boolean,
showReposts: boolean,
history: { action: string, push: string => void, replace: string => void }, history: { action: string, push: string => void, replace: string => void },
claimSearchByQuery: { claimSearchByQuery: {
[string]: Array<string>, [string]: Array<string>,
@ -30,6 +31,7 @@ function ClaimTilesDiscover(props: Props) {
claimSearchByQuery, claimSearchByQuery,
loading, loading,
showNsfw, showNsfw,
showReposts,
hiddenUris, hiddenUris,
// Below are options to pass that are forwarded to claim_search // Below are options to pass that are forwarded to claim_search
tags, tags,
@ -73,9 +75,14 @@ function ClaimTilesDiscover(props: Props) {
options.release_time = releaseTime; options.release_time = releaseTime;
} }
if (!showReposts) {
options.claim_type = 'stream';
}
if (claimType) { if (claimType) {
options.claim_type = claimType; options.claim_type = claimType;
} }
if (timestamp) { if (timestamp) {
options.timestamp = timestamp; options.timestamp = timestamp;
} }

View file

@ -23,3 +23,4 @@ export const HIDE_SPLASH_ANIMATION = 'hide_splash_animation';
export const FLOATING_PLAYER = 'floating_player'; export const FLOATING_PLAYER = 'floating_player';
export const DARK_MODE_TIMES = 'dark_mode_times'; export const DARK_MODE_TIMES = 'dark_mode_times';
export const ENABLE_SYNC = 'enable_sync'; export const ENABLE_SYNC = 'enable_sync';
export const SHOW_REPOSTS = 'show_reposts';

View file

@ -32,6 +32,7 @@ const select = state => ({
userBlockedChannelsCount: selectBlockedChannelsCount(state), userBlockedChannelsCount: selectBlockedChannelsCount(state),
hideBalance: makeSelectClientSetting(SETTINGS.HIDE_BALANCE)(state), hideBalance: makeSelectClientSetting(SETTINGS.HIDE_BALANCE)(state),
floatingPlayer: makeSelectClientSetting(SETTINGS.FLOATING_PLAYER)(state), floatingPlayer: makeSelectClientSetting(SETTINGS.FLOATING_PLAYER)(state),
showReposts: makeSelectClientSetting(SETTINGS.SHOW_REPOSTS)(state),
darkModeTimes: makeSelectClientSetting(SETTINGS.DARK_MODE_TIMES)(state), darkModeTimes: makeSelectClientSetting(SETTINGS.DARK_MODE_TIMES)(state),
}); });

View file

@ -74,6 +74,7 @@ type Props = {
hideBalance: boolean, hideBalance: boolean,
confirmForgetPassword: ({}) => void, confirmForgetPassword: ({}) => void,
floatingPlayer: boolean, floatingPlayer: boolean,
showReposts: boolean,
clearPlayingUri: () => void, clearPlayingUri: () => void,
darkModeTimes: DarkModeTimes, darkModeTimes: DarkModeTimes,
setDarkTime: (string, {}) => void, setDarkTime: (string, {}) => void,
@ -208,6 +209,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
hideBalance, hideBalance,
userBlockedChannelsCount, userBlockedChannelsCount,
floatingPlayer, floatingPlayer,
showReposts,
clearPlayingUri, clearPlayingUri,
darkModeTimes, darkModeTimes,
clearCache, clearCache,
@ -397,6 +399,17 @@ class SettingsPage extends React.PureComponent<Props, State> {
)} )}
/> />
<FormField
type="checkbox"
name="show_reposts"
onChange={() => {
setClientSetting(SETTINGS.SHOW_REPOSTS, !showReposts);
}}
checked={showReposts}
label={__('Show reposts')}
helper={__('Show reposts from the creators you follow.')}
/>
{/* <FormField {/* <FormField
type="checkbox" type="checkbox"
name="show_anonymous" name="show_anonymous"

View file

@ -52,6 +52,7 @@ const defaultState = {
[SETTINGS.AUTOPLAY]: true, [SETTINGS.AUTOPLAY]: true,
[SETTINGS.FLOATING_PLAYER]: true, [SETTINGS.FLOATING_PLAYER]: true,
[SETTINGS.AUTO_DOWNLOAD]: true, [SETTINGS.AUTO_DOWNLOAD]: true,
[SETTINGS.SHOW_REPOSTS]: true,
// OS // OS
[SETTINGS.AUTO_LAUNCH]: true, [SETTINGS.AUTO_LAUNCH]: true,

View file

@ -33,6 +33,9 @@ export const makeSelectClientSetting = setting =>
// refactor me // refactor me
export const selectShowMatureContent = makeSelectClientSetting(SETTINGS.SHOW_MATURE); export const selectShowMatureContent = makeSelectClientSetting(SETTINGS.SHOW_MATURE);
// and me
export const selectShowRepostedContent = makeSelectClientSetting(SETTINGS.SHOW_REPOSTS);
export const selectTheme = makeSelectClientSetting(SETTINGS.THEME); export const selectTheme = makeSelectClientSetting(SETTINGS.THEME);
export const selectAutomaticDarkModeEnabled = makeSelectClientSetting(SETTINGS.AUTOMATIC_DARK_MODE_ENABLED); export const selectAutomaticDarkModeEnabled = makeSelectClientSetting(SETTINGS.AUTOMATIC_DARK_MODE_ENABLED);
export const selectIsNight = createSelector( export const selectIsNight = createSelector(
@ -56,14 +59,13 @@ export const makeSelectSharedPreferencesForKey = key =>
prefs => (prefs ? prefs[key] : undefined) prefs => (prefs ? prefs[key] : undefined)
); );
export const selectHasWalletServerPrefs = export const selectHasWalletServerPrefs = createSelector(
createSelector( makeSelectSharedPreferencesForKey(SHARED_PREFERENCES.WALLET_SERVERS),
makeSelectSharedPreferencesForKey(SHARED_PREFERENCES.WALLET_SERVERS), servers => {
servers => { if (servers && servers.length) return true;
if (servers && servers.length) return true; return false;
return false; }
} );
)
export const selectThemePath = createSelector( export const selectThemePath = createSelector(
selectTheme, selectTheme,