add feature to enable experimental upgrades (#7353)

This commit is contained in:
jessopb 2021-12-15 15:58:47 -05:00 committed by GitHub
parent 05d5e6c05d
commit a0917908bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 64 additions and 28 deletions

View file

@ -2225,5 +2225,6 @@
"Buy LBC": "Buy LBC",
"This is information like error logging, performance tracking, and usage statistics. It includes your IP address and basic system details, but no other identifying information (unless you connect to a cloud service)": "This is information like error logging, performance tracking, and usage statistics. It includes your IP address and basic system details, but no other identifying information (unless you connect to a cloud service)",
"Use official LBRY wallet servers": "Use official LBRY wallet servers",
"Enable Prerelease Updates": "Enable Prerelease Updates",
"--end--": "--end--"
}

View file

@ -0,0 +1,17 @@
import SettingEnablePrereleases from './view';
import * as SETTINGS from 'constants/settings';
import { connect } from 'react-redux';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import { doSetClientSetting } from 'redux/actions/settings';
const select = (state) => {
return {
enablePrereleases: makeSelectClientSetting(SETTINGS.ENABLE_PRERELEASE_UPDATES)(state),
};
};
const perform = (dispatch) => ({
setClientSetting: (value) => dispatch(doSetClientSetting(SETTINGS.ENABLE_PRERELEASE_UPDATES, value)),
});
export default connect(select, perform)(SettingEnablePrereleases);

View file

@ -0,0 +1,25 @@
// @flow
import React from 'react';
import { FormField } from 'component/common/form';
type Props = {
setClientSetting: (boolean) => void,
enablePrereleases: boolean,
};
function SettingEnablePrereleases(props: Props) {
const { setClientSetting, enablePrereleases } = props;
return (
<React.Fragment>
<FormField
type="checkbox"
name="prereleases"
onChange={() => {
setClientSetting(!enablePrereleases);
}}
checked={enablePrereleases}
/>
</React.Fragment>
);
}
export default SettingEnablePrereleases;

View file

@ -17,10 +17,9 @@ import Spinner from 'component/spinner';
import { getPasswordFromCookie } from 'util/saved-passwords';
import * as DAEMON_SETTINGS from 'constants/daemon_settings';
import { formatBytes } from 'util/format-bytes';
import SettingEnablePrereleases from 'component/settingEnablePrereleases';
// @if TARGET='app'
const IS_MAC = process.platform === 'darwin';
// @endif
const BYTES_PER_MB = 1048576;
type Price = {
@ -96,10 +95,7 @@ export default function SettingSystem(props: Props) {
const [blobSpaceLimitGB, setBlobSpaceLimit] = React.useState(blobLimitSetting ? blobLimitSetting / 1024 : 0);
// const debouncedBlobSpaceLimitGB = useDebounce(blobSpaceLimitGB || 0, 500);
const [limitSpace, setLimitSpace] = React.useState(Boolean(blobLimitSetting));
console.log('spaceUsed', spaceUsed, 'blobLimit', blobLimitSetting);
// @if TARGET='app'
const { available: ffmpegAvailable, which: ffmpegPath } = ffmpegStatus;
// @endif
function onChangeEncryptWallet() {
if (walletEncrypted) {
@ -140,7 +136,6 @@ export default function SettingSystem(props: Props) {
// Update ffmpeg variables
React.useEffect(() => {
// @if TARGET='app'
const { available } = ffmpegStatus;
const { ffmpeg_path: ffmpegPath } = daemonSettings;
if (!available) {
@ -149,7 +144,6 @@ export default function SettingSystem(props: Props) {
}
findFFmpeg();
}
// @endif
}, []); // eslint-disable-line react-hooks/exhaustive-deps
// Update storedPassword state
@ -186,7 +180,6 @@ export default function SettingSystem(props: Props) {
</SettingsRow>
{/* @endif */}
{/* @if TARGET='app' */}
<SettingsRow
title={__('Save all viewed content to your downloads directory')}
subtitle={__(
@ -259,9 +252,6 @@ export default function SettingSystem(props: Props) {
/>
)}
</SettingsRow>
{/* @endif */}
{/* @if TARGET='app' */}
<SettingsRow
title={__('Share usage and diagnostic data')}
subtitle={
@ -296,9 +286,6 @@ export default function SettingSystem(props: Props) {
helper={__('We use detailed analytics to improve all aspects of the LBRY experience.')}
/>
</SettingsRow>
{/* @endif */}
{/* @if TARGET='app' */}
{/* Auto launch in a hidden state doesn't work on mac https://github.com/Teamwork/node-auto-launch/issues/81 */}
{!IS_MAC && (
<SettingsRow
@ -310,15 +297,15 @@ export default function SettingSystem(props: Props) {
<SettingAutoLaunch noLabels />
</SettingsRow>
)}
{/* @endif */}
{/* @if TARGET='app' */}
<SettingsRow title={__('Leave app running in notification area when the window is closed')}>
<SettingClosingBehavior noLabels />
</SettingsRow>
{/* @endif */}
{/* @if TARGET='app' */}
<SettingsRow
title={__('Enable Upgrade to Test Builds')}
subtitle={__('Prereleases may break things and we may not be able to fix them for you.')}
>
<SettingEnablePrereleases />
</SettingsRow>
<SettingsRow
title={
<span>
@ -379,9 +366,6 @@ export default function SettingSystem(props: Props) {
)}
</p>
</SettingsRow>
{/* @endif */}
{/* @if TARGET='app' */}
<SettingsRow
title={__('Encrypt my wallet with a custom password')}
subtitle={
@ -424,9 +408,6 @@ export default function SettingSystem(props: Props) {
/>
</SettingsRow>
)}
{/* @endif */}
{/* @if TARGET='app' */}
<SettingsRow
title={__('Max connections')}
subtitle={__(
@ -475,8 +456,6 @@ export default function SettingSystem(props: Props) {
<SettingsRow title={__('Share url')} multirow>
<SettingShareUrl />
</SettingsRow>
{/* @endif */}
<SettingsRow
title={__('Clear application cache')}
subtitle={__('This might fix issues that you are having. Your wallet will not be affected.')}

View file

@ -43,6 +43,7 @@ export const CUSTOM_COMMENTS_SERVER_ENABLED = 'custom_comments_server_enabled';
export const CUSTOM_COMMENTS_SERVER_URL = 'custom_comments_server_url';
export const CUSTOM_SHARE_URL_ENABLED = 'custom_share_url_enabled';
export const CUSTOM_SHARE_URL = 'custom_share_url';
export const ENABLE_PRERELEASE_UPDATES = 'enable_prerelease_updates';
export const SETTINGS_GRP = {
APPEARANCE: 'appearance',

View file

@ -11,6 +11,7 @@ import * as MODALS from 'constants/modal_types';
import React, { Fragment, useState, useEffect } from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import * as SETTINGS from 'constants/settings';
import {
doDaemonReady,
doAutoUpdate,
@ -33,6 +34,7 @@ import { PersistGate } from 'redux-persist/integration/react';
import analytics from 'analytics';
import { doToast } from 'redux/actions/notifications';
import { getAuthToken, setAuthToken, doAuthTokenRefresh } from 'util/saved-passwords';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import { DEFAULT_LANGUAGE, LBRY_API_URL } from 'config';
// Import 3rd-party styles before ours for the current way we are code-splitting.
@ -185,6 +187,16 @@ function AppWrapper() {
const [readyToLaunch, setReadyToLaunch] = useState(IS_WEB);
const [persistDone, setPersistDone] = useState(false);
useEffect(() => {
if (persistDone) {
const state = store.getState();
const enabled = makeSelectClientSetting(SETTINGS.ENABLE_PRERELEASE_UPDATES)(state);
if (enabled) {
autoUpdater.allowPrerelease = true;
}
}
}, [persistDone]);
useEffect(() => {
// @if TARGET='app'
moment.locale(remote.app.getLocale());

View file

@ -80,6 +80,7 @@ const defaultState = {
// OS
[SETTINGS.AUTO_LAUNCH]: true,
[SETTINGS.TO_TRAY_WHEN_CLOSED]: true,
[SETTINGS.ENABLE_PRERELEASE_UPDATES]: false,
},
};
defaultState.clientSettings[SETTINGS.AUTOPLAY_NEXT] = defaultState.clientSettings[SETTINGS.AUTOPLAY_MEDIA];