Skip to content

Commit e1245fd

Browse files
rename dismissMessageOnBackPressForAndroid to androidDismissMessageOnBackPress
1 parent 1e6dac6 commit e1245fd

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,8 @@ export default function App() {
240240
// is disabled in the Sourcepoint dashboard
241241
language: SPMessageLanguage.ENGLISH,
242242
messageTimeoutInSeconds: 20,
243-
// Preventing android users from dismissing the consent message on back press
244-
// `true` is the default value, allowing users to dismiss the consent message on back press
245-
dismissMessageOnBackPress: true,
243+
// Allows Android users to dismiss the consent message on back press. True by default. Set it to false if you wish to prevent this users from dismissing the message on back press.
244+
androidDismissMessageOnBackPress: true,
246245
}
247246
);
248247

android/src/main/java/com/sourcepoint/reactnativecmp/ReactNativeCmpModule.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class ReactNativeCmpModule(reactContext: ReactApplicationContext) : NativeReactN
6767
}.build()
6868

6969
reactApplicationContext.currentActivity?.let {
70-
spConsentLib = makeConsentLib(config, it, this, parsedOptions.dismissMessageOnBackPressForAndroid)
70+
spConsentLib = makeConsentLib(config, it, this, parsedOptions.androidDismissMessageOnBackPress)
7171
} ?: run {
7272
onError(Error("No activity found when building the SDK"))
7373
}

android/src/main/java/com/sourcepoint/reactnativecmp/arguments/BuildOptions.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ import com.sourcepoint.cmplibrary.model.MessageLanguage.ENGLISH
77
data class BuildOptions(
88
val language: MessageLanguage,
99
val messageTimeoutInSeconds: Long,
10-
val dismissMessageOnBackPressForAndroid: Boolean
10+
val androidDismissMessageOnBackPress: Boolean
1111
) {
1212
val messageTimeoutInMilliseconds = messageTimeoutInSeconds * 1000L
1313

1414
constructor(options: ReadableMap?) : this(
1515
language = MessageLanguage.entries.find { it.value == options?.getString("language") } ?: ENGLISH,
1616
messageTimeoutInSeconds = options?.getDoubleOrNull("messageTimeoutInSeconds")?.toLong() ?: 30L,
17-
dismissMessageOnBackPressForAndroid = options?.getBooleanOrNull("dismissMessageOnBackPressForAndroid") ?: true
17+
androidDismissMessageOnBackPress = options?.getBooleanOrNull("androidDismissMessageOnBackPress") ?: true
1818
)
1919
}

example/src/App.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ const config = {
3737
// is disabled in the Sourcepoint dashboard
3838
language: SPMessageLanguage.ENGLISH,
3939
messageTimeoutInSeconds: 20,
40-
// Preventing android users from dismissing the consent message on back press
41-
// `true` is the default value, allowing users to dismiss the consent message on back press
42-
dismissMessageOnBackPressForAndroid: true,
40+
// Allows Android users to dismiss the consent message on back press.
41+
// True by default.
42+
// Set it to false if you wish to prevent this users from dismissing the message on back press.
43+
androidDismissMessageOnBackPress: false,
4344
},
4445
gdprPMId: '488393',
4546
usnatPMId: '988851',

src/NativeReactNativeCmp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export type PreferencesConsent = {
198198
export type SPBuildOptions = {
199199
language?: SPMessageLanguage;
200200
messageTimeoutInSeconds?: number;
201-
dismissMessageOnBackPressForAndroid?: boolean;
201+
androidDismissMessageOnBackPress?: boolean;
202202
}
203203

204204
export interface Spec extends TurboModule {

0 commit comments

Comments
 (0)