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]
### 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))

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -74,6 +74,7 @@ type Props = {
hideBalance: boolean,
confirmForgetPassword: ({}) => void,
floatingPlayer: boolean,
showReposts: boolean,
clearPlayingUri: () => void,
darkModeTimes: DarkModeTimes,
setDarkTime: (string, {}) => void,
@ -208,6 +209,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
hideBalance,
userBlockedChannelsCount,
floatingPlayer,
showReposts,
clearPlayingUri,
darkModeTimes,
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
type="checkbox"
name="show_anonymous"

View file

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

View file

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