mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
deduplicate code in cleanDataFromModules (#39767)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39767 deduplicate code in cleanDataFromModules changelog: [internal] internal bypass-github-export-checks Reviewed By: cortinico Differential Revision: D49834866 fbshipit-source-id: 6b54a0cfcd58e9c963125d07b736e1377a548393
This commit is contained in:
committed by
Facebook GitHub Bot
parent
d0bb2e49c7
commit
353d8d3980
+7
-7
@@ -12,6 +12,7 @@ import com.facebook.react.bridge.CatalystInstance;
|
||||
import com.facebook.react.bridge.NativeModule;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Cleans sensitive user data from native modules that implement the {@code Cleanable} interface.
|
||||
@@ -45,16 +46,15 @@ public class ModuleDataCleaner {
|
||||
*/
|
||||
@Deprecated
|
||||
public static void cleanDataFromModules(CatalystInstance catalystInstance) {
|
||||
for (NativeModule nativeModule : catalystInstance.getNativeModules()) {
|
||||
if (nativeModule instanceof Cleanable) {
|
||||
FLog.d(ReactConstants.TAG, "Cleaning data from " + nativeModule.getName());
|
||||
((Cleanable) nativeModule).clearSensitiveData();
|
||||
}
|
||||
}
|
||||
cleanDataFromModules(catalystInstance.getNativeModules());
|
||||
}
|
||||
|
||||
public static void cleanDataFromModules(ReactContext reactContext) {
|
||||
for (NativeModule nativeModule : reactContext.getNativeModules()) {
|
||||
cleanDataFromModules(reactContext.getNativeModules());
|
||||
}
|
||||
|
||||
private static void cleanDataFromModules(Collection<NativeModule> nativeModules) {
|
||||
for (NativeModule nativeModule : nativeModules) {
|
||||
if (nativeModule instanceof Cleanable) {
|
||||
FLog.d(ReactConstants.TAG, "Cleaning data from " + nativeModule.getName());
|
||||
((Cleanable) nativeModule).clearSensitiveData();
|
||||
|
||||
Reference in New Issue
Block a user