mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Revert D40333083: Support persisted settings in Android + iOS
Differential Revision: D40333083 (https://github.com/facebook/react-native/commit/0fac9817df403e31d8256befe52409c948614706) Original commit changeset: f3816e3bd7de Original Phabricator Diff: D40333083 (https://github.com/facebook/react-native/commit/0fac9817df403e31d8256befe52409c948614706) fbshipit-source-id: 1a52a06b057c4c0ea6e3e4c3315ba73a883e3579
This commit is contained in:
committed by
Facebook GitHub Bot
parent
7a19af7fb6
commit
51d14b9dbd
@@ -1,28 +0,0 @@
|
||||
load("//tools/build_defs/oss:rn_defs.bzl", "react_native_dep", "react_native_root_target", "react_native_target", "rn_android_library")
|
||||
|
||||
rn_android_library(
|
||||
name = "devtoolssettings",
|
||||
srcs = glob(["**/*.java"]),
|
||||
autoglob = False,
|
||||
labels = [
|
||||
"pfh:ReactNative_CommonInfrastructurePlaceholder",
|
||||
"supermodule:xplat/default/public.react_native.infra",
|
||||
],
|
||||
language = "JAVA",
|
||||
provided_deps = [
|
||||
react_native_dep("third-party/android/androidx:annotation"),
|
||||
],
|
||||
visibility = [
|
||||
"PUBLIC",
|
||||
],
|
||||
deps = [
|
||||
react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"),
|
||||
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
|
||||
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
||||
react_native_target("java/com/facebook/react/bridge:bridge"),
|
||||
react_native_target("java/com/facebook/react/common:common"),
|
||||
react_native_target("java/com/facebook/react/module/annotations:annotations"),
|
||||
react_native_target("java/com/facebook/react/modules/core:core"),
|
||||
],
|
||||
exported_deps = [react_native_root_target(":FBReactNativeSpec")],
|
||||
)
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.facebook.react.modules.devtoolssettings;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.Editor;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.fbreact.specs.NativeDevToolsSettingsManagerSpec;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
|
||||
@ReactModule(name = DevToolsSettingsManagerModule.NAME)
|
||||
public class DevToolsSettingsManagerModule extends NativeDevToolsSettingsManagerSpec {
|
||||
public static final String NAME = "DevToolsSettingsManager";
|
||||
|
||||
private static final String SHARED_PREFERENCES_PREFIX = "ReactNative__DevToolsSettings";
|
||||
private static final String KEY_CONSOLE_PATCH_SETTINGS = "ConsolePatchSettings";
|
||||
|
||||
private final SharedPreferences mSharedPreferences;
|
||||
|
||||
public DevToolsSettingsManagerModule(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
mSharedPreferences =
|
||||
reactContext.getSharedPreferences(SHARED_PREFERENCES_PREFIX, Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable String getConsolePatchSettings() {
|
||||
return mSharedPreferences.getString(KEY_CONSOLE_PATCH_SETTINGS, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConsolePatchSettings(String newSettings) {
|
||||
Editor editor = mSharedPreferences.edit();
|
||||
editor.putString(KEY_CONSOLE_PATCH_SETTINGS, newSettings);
|
||||
editor.apply();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user