From 3ffb25e6729f72a949a8f09360e88167e8facc8d Mon Sep 17 00:00:00 2001 From: Feiyu Wong Date: Thu, 28 Jul 2022 13:56:34 -0700 Subject: [PATCH] Update UI for enabling persisted logs feature Summary: This is the first diff to implement the feature for the Flipper logs plugin to have an option to persist logs in the table between crashes, disconnections, etc. Since this is not a local change, the UI option for persistence will be located in the settings for the Flipper UI(as seen in the test plan). The setting is associated with the Redux Store `Settings` and is stored globally to be used across all plugins. So the plan is making the persistence pertain to all plugins. Reviewed By: mweststrate Differential Revision: D37786988 fbshipit-source-id: 7ffc6077cbca559b3401b16770eda657a6c45620 --- desktop/flipper-common/src/settings.tsx | 1 + desktop/flipper-server-core/src/utils/settings.tsx | 1 + .../flipper-ui-core/src/chrome/SettingsSheet.tsx | 13 +++++++++++++ desktop/scripts/jest-setup-after.tsx | 1 + 4 files changed, 16 insertions(+) diff --git a/desktop/flipper-common/src/settings.tsx b/desktop/flipper-common/src/settings.tsx index c1ea10167..02b72f8c0 100644 --- a/desktop/flipper-common/src/settings.tsx +++ b/desktop/flipper-common/src/settings.tsx @@ -39,6 +39,7 @@ export type Settings = { darkMode: 'dark' | 'light' | 'system'; showWelcomeAtStartup: boolean; suppressPluginErrors: boolean; + persistDeviceData: boolean; /** * Plugin marketplace - allow internal plugin distribution */ diff --git a/desktop/flipper-server-core/src/utils/settings.tsx b/desktop/flipper-server-core/src/utils/settings.tsx index dc483f7a7..5c4a9b3ba 100644 --- a/desktop/flipper-server-core/src/utils/settings.tsx +++ b/desktop/flipper-server-core/src/utils/settings.tsx @@ -66,6 +66,7 @@ function getDefaultSettings(): Settings { darkMode: 'light', showWelcomeAtStartup: true, suppressPluginErrors: false, + persistDeviceData: false, enablePluginMarketplace: false, marketplaceURL: '', enablePluginMarketplaceAutoUpdate: true, diff --git a/desktop/flipper-ui-core/src/chrome/SettingsSheet.tsx b/desktop/flipper-ui-core/src/chrome/SettingsSheet.tsx index 08adbde82..5ab70a300 100644 --- a/desktop/flipper-ui-core/src/chrome/SettingsSheet.tsx +++ b/desktop/flipper-ui-core/src/chrome/SettingsSheet.tsx @@ -127,6 +127,7 @@ class SettingsSheet extends Component { reactNative, darkMode, suppressPluginErrors, + persistDeviceData, enablePluginMarketplace, enablePluginMarketplaceAutoUpdate, marketplaceURL, @@ -270,6 +271,18 @@ class SettingsSheet extends Component { })); }} /> + { + this.setState((prevState) => ({ + updatedSettings: { + ...prevState.updatedSettings, + persistDeviceData: enabled, + }, + })); + }} + /> Theme Selection