mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
0fac9817df
Summary: * Add a DevToolsSettingsManager, which has android and iOS variants, which uses a new TM (Android) or takes advantage of the Settings TM (iOS) to get/set console patch settings * This is backed by either the existing Settings module (iOS) or a new Java TM, which uses the SharedPreferences AP ## Testing Manual testing ## Changelog [General] [Added] - Add DevToolsSettingsManager Pull Request resolved: https://github.com/facebook/react-native/pull/34964 Test Plan: * Extensive manual testing Reviewed By: NickGerleman Differential Revision: D40333083 Pulled By: rbalicki2 fbshipit-source-id: f3816e3bd7dea3086f6f2269c3a099af14aebb3b
34 lines
887 B
JavaScript
34 lines
887 B
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow strict-local
|
|
* @format
|
|
*/
|
|
|
|
import type {Spec} from './NativeDevToolsSettingsManager';
|
|
|
|
import Settings from '../Settings/Settings';
|
|
|
|
const CONSOLE_PATCH_SETTINGS_KEY = 'ReactDevTools::ConsolePatchSettings';
|
|
|
|
const DevToolsSettingsManager = {
|
|
setConsolePatchSettings: (newConsolePatchSettings: string) => {
|
|
Settings.set({
|
|
[CONSOLE_PATCH_SETTINGS_KEY]: newConsolePatchSettings,
|
|
});
|
|
},
|
|
getConsolePatchSettings: () => {
|
|
const value = Settings.get(CONSOLE_PATCH_SETTINGS_KEY);
|
|
if (typeof value === 'string') {
|
|
// $FlowFixMe[unclear-type]
|
|
return ((value: any): string);
|
|
}
|
|
return null;
|
|
},
|
|
};
|
|
|
|
module.exports = (DevToolsSettingsManager: Spec);
|