Rename variables names and text labels to be more descriptive.
This commit is contained in:
parent
5527df97eb
commit
5c65ca7a47
6 changed files with 15 additions and 18 deletions
|
@ -14,4 +14,4 @@ export const THEMES = 'themes';
|
|||
export const AUTOMATIC_DARK_MODE_ENABLED = 'automaticDarkModeEnabled';
|
||||
export const AUTOPLAY = 'autoplay';
|
||||
export const RESULT_COUNT = 'resultCount';
|
||||
export const DESKTOP_NOTIFICATIONS_ENABLED = 'desktopNotificationsEnabled';
|
||||
export const OS_NOTIFICATIONS_ENABLED = 'osNotificationsEnabled';
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
makeSelectClientSetting,
|
||||
selectDaemonSettings,
|
||||
selectLanguages,
|
||||
selectDesktopNotificationsEnabled,
|
||||
selectosNotificationsEnabled,
|
||||
} from 'redux/selectors/settings';
|
||||
import { selectCurrentLanguage } from 'redux/selectors/app';
|
||||
import { doWalletStatus, selectWalletIsEncrypted } from 'lbry-redux';
|
||||
|
@ -29,7 +29,7 @@ const select = state => ({
|
|||
automaticDarkModeEnabled: makeSelectClientSetting(settings.AUTOMATIC_DARK_MODE_ENABLED)(state),
|
||||
autoplay: makeSelectClientSetting(settings.AUTOPLAY)(state),
|
||||
walletEncrypted: selectWalletIsEncrypted(state),
|
||||
desktopNotificationsEnabled: selectDesktopNotificationsEnabled(state),
|
||||
osNotificationsEnabled: selectosNotificationsEnabled(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
|
|
|
@ -34,7 +34,7 @@ type Props = {
|
|||
encryptWallet: () => void,
|
||||
decryptWallet: () => void,
|
||||
walletEncrypted: boolean,
|
||||
desktopNotificationsEnabled: boolean,
|
||||
osNotificationsEnabled: boolean,
|
||||
};
|
||||
|
||||
type State = {
|
||||
|
@ -129,7 +129,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
|||
}
|
||||
|
||||
onDesktopNotificationsChange(event: SyntheticInputEvent<*>) {
|
||||
this.props.setClientSetting(settings.DESKTOP_NOTIFICATIONS_ENABLED, event.target.checked);
|
||||
this.props.setClientSetting(settings.OS_NOTIFICATIONS_ENABLED, event.target.checked);
|
||||
}
|
||||
|
||||
clearCache() {
|
||||
|
@ -156,7 +156,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
|||
automaticDarkModeEnabled,
|
||||
autoplay,
|
||||
walletEncrypted,
|
||||
desktopNotificationsEnabled,
|
||||
osNotificationsEnabled,
|
||||
} = this.props;
|
||||
|
||||
const noDaemonSettings = !daemonSettings || Object.keys(daemonSettings).length === 0;
|
||||
|
@ -286,8 +286,8 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
|||
type="checkbox"
|
||||
name="desktopNotification"
|
||||
onChange={this.onDesktopNotificationsChange}
|
||||
checked={desktopNotificationsEnabled}
|
||||
postfix={__('On Download Completion')}
|
||||
checked={osNotificationsEnabled}
|
||||
postfix={__('Show OS notifications')}
|
||||
/>
|
||||
</section>
|
||||
|
||||
|
|
|
@ -28,10 +28,7 @@ import {
|
|||
MODALS,
|
||||
doNotify,
|
||||
} from 'lbry-redux';
|
||||
import {
|
||||
makeSelectClientSetting,
|
||||
selectDesktopNotificationsEnabled,
|
||||
} from 'redux/selectors/settings';
|
||||
import { makeSelectClientSetting, selectosNotificationsEnabled } from 'redux/selectors/settings';
|
||||
import setBadge from 'util/setBadge';
|
||||
import setProgressBar from 'util/setProgressBar';
|
||||
import analytics from 'analytics';
|
||||
|
@ -142,7 +139,7 @@ export function doUpdateLoadStatus(uri, outpoint) {
|
|||
0
|
||||
);
|
||||
|
||||
if (selectDesktopNotificationsEnabled(getState())) {
|
||||
if (selectosNotificationsEnabled(getState())) {
|
||||
const notif = new window.Notification(notifications[uri].subscription.channelName, {
|
||||
body: `Posted ${fileInfo.metadata.title}${
|
||||
count > 1 && count < 10 ? ` and ${count - 1} other new items` : ''
|
||||
|
@ -166,7 +163,7 @@ export function doUpdateLoadStatus(uri, outpoint) {
|
|||
);
|
||||
} else {
|
||||
// If notifications are disabled(false) just return
|
||||
if (!selectDesktopNotificationsEnabled(getState())) return;
|
||||
if (!selectosNotificationsEnabled(getState())) return;
|
||||
const notif = new window.Notification('LBRY Download Complete', {
|
||||
body: fileInfo.metadata.title,
|
||||
silent: false,
|
||||
|
|
|
@ -26,8 +26,8 @@ const defaultState = {
|
|||
automaticDarkModeEnabled: getLocalStorageSetting(SETTINGS.AUTOMATIC_DARK_MODE_ENABLED, false),
|
||||
autoplay: getLocalStorageSetting(SETTINGS.AUTOPLAY, false),
|
||||
resultCount: Number(getLocalStorageSetting(SETTINGS.RESULT_COUNT, 50)),
|
||||
desktopNotificationsEnabled: Boolean(
|
||||
getLocalStorageSetting(SETTINGS.DESKTOP_NOTIFICATIONS_ENABLED, true)
|
||||
osNotificationsEnabled: Boolean(
|
||||
getLocalStorageSetting(SETTINGS.OS_NOTIFICATIONS_ENABLED, true)
|
||||
),
|
||||
},
|
||||
isNight: false,
|
||||
|
|
|
@ -34,6 +34,6 @@ export const selectThemePath = createSelector(
|
|||
}
|
||||
);
|
||||
|
||||
export const selectDesktopNotificationsEnabled = makeSelectClientSetting(
|
||||
SETTINGS.DESKTOP_NOTIFICATIONS_ENABLED
|
||||
export const selectosNotificationsEnabled = makeSelectClientSetting(
|
||||
SETTINGS.OS_NOTIFICATIONS_ENABLED
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue