Setting to choose release channel
Summary: Add possibility to choose release channel in Flipper Settings Reviewed By: passy Differential Revision: D25300775 fbshipit-source-id: 55fc86f0e12b9f3a4603bb40b038f5c0e5f30b3b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
dd7c2ab96d
commit
a7573139a2
16
desktop/app/src/ReleaseChannel.tsx
Normal file
16
desktop/app/src/ReleaseChannel.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
export enum ReleaseChannel {
|
||||
DEFAULT = 'default',
|
||||
STABLE = 'stable',
|
||||
INSIDERS = 'insiders',
|
||||
}
|
||||
|
||||
export default ReleaseChannel;
|
||||
@@ -233,6 +233,15 @@ class SettingsSheet extends Component<Props, State> {
|
||||
},
|
||||
});
|
||||
}}
|
||||
releaseChannel={this.state.updatedLauncherSettings.releaseChannel}
|
||||
onReleaseChannelChange={(v) => {
|
||||
this.setState({
|
||||
updatedLauncherSettings: {
|
||||
...this.state.updatedLauncherSettings,
|
||||
releaseChannel: v,
|
||||
},
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<SandySettingsPanel
|
||||
toggled={this.state.updatedSettings.disableSandy}
|
||||
|
||||
@@ -22,14 +22,14 @@ import {promises as fs} from 'fs';
|
||||
import {remote} from 'electron';
|
||||
import path from 'path';
|
||||
|
||||
const ConfigFieldContainer = styled(FlexRow)({
|
||||
export const ConfigFieldContainer = styled(FlexRow)({
|
||||
paddingLeft: 10,
|
||||
paddingRight: 10,
|
||||
marginBottom: 5,
|
||||
paddingTop: 5,
|
||||
});
|
||||
|
||||
const InfoText = styled(Text)({
|
||||
export const InfoText = styled(Text)({
|
||||
lineHeight: 1.35,
|
||||
paddingTop: 5,
|
||||
});
|
||||
|
||||
@@ -8,12 +8,15 @@
|
||||
*/
|
||||
|
||||
import {Tristate} from '../reducers/settings';
|
||||
import ReleaseChannel from '../ReleaseChannel';
|
||||
|
||||
export default function (_props: {
|
||||
isPrefetchingEnabled: Tristate;
|
||||
onEnablePrefetchingChange: (v: Tristate) => void;
|
||||
isLocalPinIgnored: boolean;
|
||||
onIgnoreLocalPinChange: (v: boolean) => void;
|
||||
releaseChannel: ReleaseChannel;
|
||||
onReleaseChannelChange: (v: ReleaseChannel) => void;
|
||||
}) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -8,8 +8,10 @@
|
||||
*/
|
||||
|
||||
import {Actions} from './index';
|
||||
import ReleaseChannel from '../ReleaseChannel';
|
||||
|
||||
export type LauncherSettings = {
|
||||
releaseChannel: ReleaseChannel;
|
||||
ignoreLocalPin: boolean;
|
||||
};
|
||||
|
||||
@@ -19,6 +21,7 @@ export type Action = {
|
||||
};
|
||||
|
||||
export const defaultLauncherSettings: LauncherSettings = {
|
||||
releaseChannel: ReleaseChannel.DEFAULT,
|
||||
ignoreLocalPin: false,
|
||||
};
|
||||
|
||||
|
||||
@@ -9,12 +9,13 @@
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import TOML from '@iarna/toml';
|
||||
import TOML, {JsonMap} from '@iarna/toml';
|
||||
import {Storage} from 'redux-persist/es/types';
|
||||
import {
|
||||
defaultLauncherSettings,
|
||||
LauncherSettings,
|
||||
} from '../reducers/launcherSettings';
|
||||
import ReleaseChannel from '../ReleaseChannel';
|
||||
|
||||
export default class LauncherSettingsStorage implements Storage {
|
||||
constructor(readonly filepath: string) {}
|
||||
@@ -60,20 +61,26 @@ export default class LauncherSettingsStorage implements Storage {
|
||||
|
||||
interface FormattedSettings {
|
||||
ignore_local_pin?: boolean;
|
||||
release_channel?: ReleaseChannel;
|
||||
}
|
||||
|
||||
function serialize(value: LauncherSettings): string {
|
||||
const {ignoreLocalPin, ...rest} = value;
|
||||
return TOML.stringify({
|
||||
const {ignoreLocalPin, releaseChannel, ...rest} = value;
|
||||
const formattedSettings: FormattedSettings = {
|
||||
...rest,
|
||||
ignore_local_pin: ignoreLocalPin,
|
||||
});
|
||||
release_channel: releaseChannel,
|
||||
};
|
||||
return TOML.stringify(formattedSettings as JsonMap);
|
||||
}
|
||||
|
||||
function deserialize(content: string): LauncherSettings {
|
||||
const {ignore_local_pin, ...rest} = TOML.parse(content) as FormattedSettings;
|
||||
const {ignore_local_pin, release_channel, ...rest} = TOML.parse(
|
||||
content,
|
||||
) as FormattedSettings;
|
||||
return {
|
||||
...rest,
|
||||
ignoreLocalPin: !!ignore_local_pin,
|
||||
releaseChannel: release_channel ?? ReleaseChannel.DEFAULT,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user