add feature to enable experimental upgrades #7353

Merged
jessopb merged 1 commit from feat-prerelease-update-enable into master 2021-12-15 21:58:48 +01:00
7 changed files with 64 additions and 28 deletions
Showing only changes of commit c04ad0f676 - Show all commits

View file

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

View file

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

View file

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