Skip to content

Commit 8162c79

Browse files
implement onActionSimplified
1 parent 2d11946 commit 8162c79

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,11 @@ class ReactNativeCmpModule(reactContext: ReactApplicationContext) : NativeReactN
162162
}
163163

164164
override fun onAction(view: View, consentAction: ConsentAction): ConsentAction {
165-
emitOnAction(createMap().apply {
166-
putString("actionType", RNSourcepointActionType.from(consentAction.actionType).name)
167-
putString("customActionId", consentAction.customActionId)
168-
})
165+
// emitOnAction(createMap().apply {
166+
// putString("actionType", RNSourcepointActionType.from(consentAction.actionType).name)
167+
// putString("customActionId", consentAction.customActionId)
168+
// })
169+
emitOnActionSimplified("hello world")
169170
return consentAction
170171
}
171172

example/src/App.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ export default function App() {
9292
console.log(`action: ${actionType}`)
9393
);
9494

95+
consentManager.current?.onActionSimplified((value) =>
96+
console.log(`actionSimplified: ${value}`)
97+
);
98+
9599
consentManager.current?.onMessageInactivityTimeout(() => {
96100
console.log("User inactive");
97101
});

src/NativeReactNativeCmp.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ export interface Spec extends TurboModule {
231231
): void;
232232

233233
readonly onAction: EventEmitter<SPAction>;
234+
readonly onActionSimplified: EventEmitter<string>;
234235
readonly onSPUIReady: EventEmitter<void>;
235236
readonly onSPUIFinished: EventEmitter<void>;
236237
readonly onFinished: EventEmitter<void>;

src/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,12 @@ export default class SPConsentManager implements Spec {
7474
categories: string[],
7575
legIntCategories: string[],
7676
callback: (consent: GDPRConsent) => void
77-
) {
78-
ReactNativeCmp.postDeleteCustomConsentGDPR(vendors, categories, legIntCategories, callback);
77+
) {
78+
ReactNativeCmp.postDeleteCustomConsentGDPR(vendors, categories, legIntCategories, callback);
7979
}
8080

8181
onAction: EventEmitter<SPAction> = ReactNativeCmp.onAction;
82+
onActionSimplified: EventEmitter<string> = ReactNativeCmp.onActionSimplified;
8283
onSPUIReady: EventEmitter<void> = ReactNativeCmp.onSPUIReady;
8384
onSPUIFinished: EventEmitter<void> = ReactNativeCmp.onSPUIFinished;
8485
onFinished: EventEmitter<void> = ReactNativeCmp.onFinished;

0 commit comments

Comments
 (0)