Repost settings #3712
11 changed files with 64 additions and 23 deletions
|
@ -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))
|
||||
|
||||
|
|
|
@ -988,5 +988,7 @@
|
|||
"Allow the app to access third party analytics platforms": "Allow the app to access third party analytics platforms",
|
||||
"Share usage data with LBRY inc.": "Share usage data with LBRY inc.",
|
||||
"Required": "Required",
|
||||
"Email %help_link% or join our %chat_link% if you encounter any trouble verifying.": "Email %help_link% or join our %chat_link% if you encounter any trouble verifying."
|
||||
}
|
||||
"Email %help_link% or join our %chat_link% if you encounter any trouble verifying.": "Email %help_link% or join our %chat_link% if you encounter any trouble verifying.",
|
||||
"Show reposts": "Show reposts",
|
||||
"Show reposts from the creators you follow.": "Show reposts from the creators you follow."
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
import * as SETTINGS from 'constants/settings';
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doClaimSearch,
|
||||
|
@ -6,6 +5,7 @@ import {
|
|||
selectFetchingClaimSearch,
|
||||
doToggleTagFollow,
|
||||
selectBlockedChannels,
|
||||
SETTINGS,
|
||||
} from 'lbry-redux';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import ClaimListDiscover from './view';
|
||||
|
@ -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),
|
||||
});
|
||||
|
||||
|
|
|
@ -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: {
|
||||
|
@ -51,7 +52,7 @@ type Props = {
|
|||
headerLabel?: string | Node,
|
||||
name?: string,
|
||||
pageSize?: number,
|
||||
claimType?: string | Array<string>,
|
||||
claimType?: Array<string>,
|
||||
renderProperties?: Claim => Node,
|
||||
includeSupportAction?: boolean,
|
||||
hideBlock: boolean,
|
||||
|
@ -67,6 +68,7 @@ function ClaimListDiscover(props: Props) {
|
|||
meta,
|
||||
channelIds,
|
||||
showNsfw,
|
||||
showReposts,
|
||||
history,
|
||||
location,
|
||||
hiddenUris,
|
||||
|
@ -101,12 +103,14 @@ function ClaimListDiscover(props: Props) {
|
|||
not_tags: Array<string>,
|
||||
order_by: Array<string>,
|
||||
release_time?: string,
|
||||
claim_type?: Array<string>,
|
||||
name?: string,
|
||||
claim_type?: string | Array<string>,
|
||||
claim_type?: Array<string>,
|
||||
} = {
|
||||
page_size: pageSize || PAGE_SIZE,
|
||||
page,
|
||||
name,
|
||||
claim_type: claimType || undefined,
|
||||
// no_totals makes it so the sdk doesn't have to calculate total number pages for pagination
|
||||
// it's faster, but we will need to remove it if we start using total_pages
|
||||
no_totals: true,
|
||||
|
@ -162,8 +166,11 @@ function ClaimListDiscover(props: Props) {
|
|||
}
|
||||
}
|
||||
|
||||
if (claimType) {
|
||||
options.claim_type = claimType;
|
||||
if (!showReposts) {
|
||||
options.claim_type =
|
||||
options.claim_type === undefined
|
||||
? ['stream', 'channel']
|
||||
: options.claim_type.filter(claimType => claimType !== 'repost');
|
||||
}
|
||||
|
||||
const hasMatureTags = tags && tags.some(t => MATURE_TAGS.includes(t));
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import * as SETTINGS from 'constants/settings';
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doClaimSearch,
|
||||
|
@ -6,6 +5,7 @@ import {
|
|||
selectFetchingClaimSearch,
|
||||
doToggleTagFollow,
|
||||
selectBlockedChannels,
|
||||
SETTINGS,
|
||||
} from 'lbry-redux';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import ClaimListDiscover from './view';
|
||||
|
@ -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),
|
||||
});
|
||||
|
||||
|
|
|
@ -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>,
|
||||
|
@ -20,7 +21,7 @@ type Props = {
|
|||
pageSize: number,
|
||||
orderBy?: Array<string>,
|
||||
releaseTime?: string,
|
||||
claimType?: string,
|
||||
claimType?: Array<string>,
|
||||
timestamp?: 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,
|
||||
|
@ -52,10 +54,11 @@ function ClaimTilesDiscover(props: Props) {
|
|||
not_tags: Array<string>,
|
||||
order_by: Array<string>,
|
||||
release_time?: string,
|
||||
claim_type?: string,
|
||||
claim_type?: Array<string>,
|
||||
timestamp?: string,
|
||||
} = {
|
||||
page_size: pageSize,
|
||||
claim_type: claimType || undefined,
|
||||
// no_totals makes it so the sdk doesn't have to calculate total number pages for pagination
|
||||
// it's faster, but we will need to remove it if we start using total_pages
|
||||
no_totals: true,
|
||||
|
@ -73,16 +76,24 @@ function ClaimTilesDiscover(props: Props) {
|
|||
options.release_time = releaseTime;
|
||||
}
|
||||
|
||||
if (!showReposts) {
|
||||
options.claim_type =
|
||||
options.claim_type === undefined
|
||||
? ['stream', 'channel']
|
||||
: options.claim_type.filter(claimType => claimType !== 'repost');
|
||||
}
|
||||
|
||||
if (claimType) {
|
||||
options.claim_type = claimType;
|
||||
}
|
||||
|
||||
if (timestamp) {
|
||||
options.timestamp = timestamp;
|
||||
}
|
||||
|
||||
const claimSearchCacheQuery = createNormalizedClaimSearchKey(options);
|
||||
const uris = claimSearchByQuery[claimSearchCacheQuery] || [];
|
||||
const shouldPerformSearch = !hasSearched || (uris.length === 0 || (!loading && uris.length < pageSize));
|
||||
const shouldPerformSearch = !hasSearched || uris.length === 0 || (!loading && uris.length < pageSize);
|
||||
// Don't use the query from createNormalizedClaimSearchKey for the effect since that doesn't include page & release_time
|
||||
const optionsStringForEffect = JSON.stringify(options);
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ function HomePage(props: Props) {
|
|||
title: 'Top Channels On LBRY',
|
||||
options: {
|
||||
orderBy: ['effective_amount'],
|
||||
claimType: 'channel',
|
||||
claimType: ['channel'],
|
||||
},
|
||||
});
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ function HomePage(props: Props) {
|
|||
options: {
|
||||
orderBy: ['effective_amount'],
|
||||
pageSize: 4,
|
||||
claimType: 'stream',
|
||||
claimType: ['stream'],
|
||||
releaseTime: `>${Math.floor(
|
||||
moment()
|
||||
.subtract(1, 'week')
|
||||
|
|
|
@ -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),
|
||||
});
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as SETTINGS from 'constants/settings';
|
||||
import { SHARED_PREFERENCES } from 'lbry-redux';
|
||||
import { SHARED_PREFERENCES, SETTINGS as LBRY_REDUX_SETTINGS } from 'lbry-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
const selectState = state => state.settings || {};
|
||||
|
@ -31,7 +31,10 @@ export const makeSelectClientSetting = setting =>
|
|||
);
|
||||
|
||||
// refactor me
|
||||
export const selectShowMatureContent = makeSelectClientSetting(SETTINGS.SHOW_MATURE);
|
||||
export const selectShowMatureContent = makeSelectClientSetting(LBRY_REDUX_SETTINGS.SHOW_MATURE);
|
||||
|
||||
// and me
|
||||
export const selectShowRepostedContent = makeSelectClientSetting(LBRY_REDUX_SETTINGS.SHOW_REPOSTS);
|
||||
|
||||
export const selectTheme = makeSelectClientSetting(SETTINGS.THEME);
|
||||
export const selectAutomaticDarkModeEnabled = makeSelectClientSetting(SETTINGS.AUTOMATIC_DARK_MODE_ENABLED);
|
||||
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue