use lbry-redux constants for view settings

This commit is contained in:
Sean Yesmunt 2020-02-28 12:12:19 -05:00
parent 31ef391ff6
commit ef2171e457
7 changed files with 22 additions and 15 deletions

View file

@ -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."
}

View file

@ -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';

View file

@ -103,14 +103,14 @@ function ClaimListDiscover(props: Props) {
not_tags: Array<string>,
order_by: Array<string>,
release_time?: string,
claim_type?: 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 || ['stream', 'channel', 'repost'],
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,
@ -167,7 +167,10 @@ function ClaimListDiscover(props: Props) {
}
if (!showReposts) {
options.claim_type = options.claim_type.filter(claimType => claimType !== 'repost');
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));

View file

@ -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';

View file

@ -54,11 +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 || ['stream', 'channel', 'repost'],
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,
@ -77,7 +77,10 @@ function ClaimTilesDiscover(props: Props) {
}
if (!showReposts) {
options.claim_type = options.claim_type.filter(claimType => claimType !== 'repost');
options.claim_type =
options.claim_type === undefined
? ['stream', 'channel']
: options.claim_type.filter(claimType => claimType !== 'repost');
}
if (claimType) {

View file

@ -23,4 +23,3 @@ 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

@ -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,10 +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(SETTINGS.SHOW_REPOSTS);
export const selectShowRepostedContent = makeSelectClientSetting(LBRY_REDUX_SETTINGS.SHOW_REPOSTS);
export const selectTheme = makeSelectClientSetting(SETTINGS.THEME);
export const selectAutomaticDarkModeEnabled = makeSelectClientSetting(SETTINGS.AUTOMATIC_DARK_MODE_ENABLED);