Skip to content

Commit 6fa1864

Browse files
mateoguzmanafacebook-github-bot
authored andcommitted
Make ModuleDataCleaner internal (#51060)
Summary: This class can be internalized as part of the initiative to reduce the public API surface. I've checked there are [no relevant OSS usages](https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+NOT+repo%3Areact-native-tvos%2Freact-native-tvos+NOT+repo%3Anuagoz%2Freact-native+NOT+repo%3A2lambda123%2Freact-native+NOT+repo%3Abeanchips%2Ffacebookreactnative+NOT+repo%3AfabOnReact%2Freact-native-notes+NOT+user%3Ahuntie+NOT+user%3Acortinico+NOT+repo%3AMaxdev18%2Fpowersync_app+NOT+repo%3Acarter-0%2Finstagram-decompiled+NOT+repo%3Am0mosenpai%2Finstadamn+NOT+repo%3AA-Star100%2FA-Star100-AUG2-2024+NOT+repo%3Alclnrd%2Fdetox-scrollview-reproductible+NOT+repo%3ADionisisChytiris%2FWorldWiseTrivia_Main+NOT+repo%3Apast3l%2Fhi2+NOT+repo%3AoneDotpy%2FCaribouQuest+NOT+repo%3Abejayoharen%2Fdailytodo+NOT+repo%3Amolangning%2Freversing-discord+NOT+repo%3AScottPrzy%2Freact-native+NOT+repo%3Agabrieldonadel%2Freact-native-visionos+NOT+repo%3AGabriel2308%2FTestes-Soft+NOT+repo%3Adawnzs03%2FflakyBuild+NOT+repo%3Acga2351%2Fcode+NOT+repo%3Astreeg%2Ftcc+NOT+repo%3Asoftware-mansion-labs%2Freact-native-swiftui+NOT+repo%3Apkcsecurity%2Fdecompiled-lightbulb+com.facebook.react.modules.common.ModuleDataCleaner). Only one library uses it (https://github.com/jbrodriguez/react-native-android-sqlite), but it's hasn't been updated for 10 years. Marking it as breaking, but it's unlikely that the library is used nowadays. See: ## Changelog: [ANDROID][BREAKING] - Make com.facebook.react.modules.common.ModuleDataCleaner internal Pull Request resolved: #51060 Test Plan: ```bash yarn test-android yarn android ``` Reviewed By: cortinico, shwanton Differential Revision: D74036994 Pulled By: arushikesarwani94 fbshipit-source-id: 520fc3dfdc1ecfb27f161a1b59ad5d79dfc854cf
1 parent f4d99d6 commit 6fa1864

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

packages/react-native/ReactAndroid/api/ReactAndroid.api

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2698,15 +2698,6 @@ public final class com/facebook/react/modules/blob/FileReaderModule$Companion {
26982698
public final fun getNAME ()Ljava/lang/String;
26992699
}
27002700

2701-
public final class com/facebook/react/modules/common/ModuleDataCleaner {
2702-
public static final field INSTANCE Lcom/facebook/react/modules/common/ModuleDataCleaner;
2703-
public static final fun cleanDataFromModules (Lcom/facebook/react/bridge/ReactContext;)V
2704-
}
2705-
2706-
public abstract interface class com/facebook/react/modules/common/ModuleDataCleaner$Cleanable {
2707-
public abstract fun clearSensitiveData ()V
2708-
}
2709-
27102701
public abstract interface class com/facebook/react/modules/core/DefaultHardwareBackBtnHandler {
27112702
public abstract fun invokeDefaultOnBackPressed ()V
27122703
}

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/common/ModuleDataCleaner.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import com.facebook.react.common.ReactConstants
1515
* Cleans sensitive user data from native modules that implement the [Cleanable] interface. This is
1616
* useful e.g. when a user logs out from an app.
1717
*/
18-
public object ModuleDataCleaner {
18+
internal object ModuleDataCleaner {
1919

2020
@JvmStatic
21-
public fun cleanDataFromModules(reactContext: ReactContext) {
21+
fun cleanDataFromModules(reactContext: ReactContext) {
2222
reactContext.nativeModules.forEach { nativeModule ->
2323
if (nativeModule is Cleanable) {
2424
FLog.d(ReactConstants.TAG, "Cleaning data from ${nativeModule.getName()}")
@@ -40,7 +40,7 @@ public object ModuleDataCleaner {
4040
* instance is destroyed. This is because logout implies that the instance is destroyed. Apps
4141
* should enforce this.
4242
*/
43-
public fun interface Cleanable {
44-
public fun clearSensitiveData()
43+
fun interface Cleanable {
44+
fun clearSensitiveData()
4545
}
4646
}

0 commit comments

Comments
 (0)