Skip to content

Commit 02c985c

Browse files
Merge pull request #18 from SourcePointUSA/DIA-5863-add-fun-loadPreferenceCenter
[DIA-5863] Add `loadPreferenceCenter` and the button for example app
2 parents 637057a + 47cc7a3 commit 02c985c

File tree

9 files changed

+36
-9
lines changed

9 files changed

+36
-9
lines changed

ReactNativeCmp.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Pod::Spec.new do |s|
1515
s.platforms = { :ios => min_ios_version_supported }
1616
s.source = { :git => "https://github.com/SourcePointUSA/react-native-sourcepoint-cmp.git", :tag => "#{s.version}" }
1717

18-
s.dependency "ConsentViewController", "7.10.0"
18+
s.dependency "ConsentViewController", "7.11.0"
1919
s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
2020
s.private_header_files = "ios/**/*.h"
2121

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ dependencies {
7777
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3"
7878
implementation "org.jetbrains.kotlinx:kotlinx-datetime:0.6.1"
7979

80-
implementation "com.sourcepoint.cmplibrary:cmplibrary:7.15.0"
80+
implementation "com.sourcepoint.cmplibrary:cmplibrary:7.15.1"
8181
}
8282

8383
react {

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ class ReactNativeCmpModule(reactContext: ReactApplicationContext) : NativeReactN
110110
runOnMainThread { spConsentLib?.loadPrivacyManager(pmId, GLOBALCMP) }
111111
}
112112

113+
override fun loadPreferenceCenter(id: String) {
114+
runOnMainThread { spConsentLib?.loadPrivacyManager(id, PREFERENCES) }
115+
}
116+
113117
companion object {
114118
const val NAME = "ReactNativeCmp"
115119
}

example/ios/Podfile.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
PODS:
22
- boost (1.84.0)
3-
- ConsentViewController (7.10.0):
3+
- ConsentViewController (7.11.0):
44
- Down (~> 0.11.0)
5-
- SPMobileCore (= 0.1.9)
5+
- SPMobileCore (= 0.1.10)
66
- DoubleConversion (1.1.6)
77
- fast_float (6.1.4)
88
- FBLazyVector (0.79.2)
@@ -1660,7 +1660,7 @@ PODS:
16601660
- React-perflogger (= 0.79.2)
16611661
- React-utils (= 0.79.2)
16621662
- ReactNativeCmp (1.0.2):
1663-
- ConsentViewController (= 7.10.0)
1663+
- ConsentViewController (= 7.11.0)
16641664
- DoubleConversion
16651665
- glog
16661666
- hermes-engine
@@ -1685,7 +1685,7 @@ PODS:
16851685
- ReactCommon/turbomodule/core
16861686
- Yoga
16871687
- SocketRocket (0.7.1)
1688-
- SPMobileCore (0.1.9)
1688+
- SPMobileCore (0.1.10)
16891689
- Yoga (0.0.0)
16901690

16911691
DEPENDENCIES:
@@ -1919,7 +1919,7 @@ EXTERNAL SOURCES:
19191919

19201920
SPEC CHECKSUMS:
19211921
boost: 7e761d76ca2ce687f7cc98e698152abd03a18f90
1922-
ConsentViewController: 079fad8b149491cfb52ec8bd7cf47c67eabb2b47
1922+
ConsentViewController: 1548d9e77c75b5be5136200be406f0f3b9ae173c
19231923
DoubleConversion: cb417026b2400c8f53ae97020b2be961b59470cb
19241924
fast_float: 06eeec4fe712a76acc9376682e4808b05ce978b6
19251925
FBLazyVector: 84b955f7b4da8b895faf5946f73748267347c975
@@ -1989,9 +1989,9 @@ SPEC CHECKSUMS:
19891989
ReactAppDependencyProvider: 04d5eb15eb46be6720e17a4a7fa92940a776e584
19901990
ReactCodegen: c63eda03ba1d94353fb97b031fc84f75a0d125ba
19911991
ReactCommon: 76d2dc87136d0a667678668b86f0fca0c16fdeb0
1992-
ReactNativeCmp: fdc85cdc42332372a5cdac25012b9102d27e4765
1992+
ReactNativeCmp: 1ff6c3f35f9a8cd411a67c870425d8f29b6ad44d
19931993
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
1994-
SPMobileCore: c3bfa7dacf26f6101900afa096a9b945a89f726a
1994+
SPMobileCore: 50aecf97a8fa8134bb84aaed4349a3a20a7e22b2
19951995
Yoga: c758bfb934100bb4bf9cbaccb52557cee35e8bdf
19961996

19971997
PODFILE CHECKSUM: decdc7519d77aa5eae65b167fa59bcfce25e15d2

example/src/App.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const config = {
3434
gdprPMId: '488393',
3535
usnatPMId: '988851',
3636
globalCmpPMId: '1323762',
37+
preferencesCenterId: '1306779',
3738
campaigns: {
3839
gdpr: {},
3940
usnat: { supportLegacyUSPString: true },
@@ -115,6 +116,11 @@ export default function App() {
115116
consentManager.current?.loadGlobalCmpPrivacyManager(config.globalCmpPMId);
116117
}, []);
117118

119+
const onPreferencesPress = useCallback(() => {
120+
setSDKStatus(SDKStatus.Networking);
121+
consentManager.current?.loadPreferenceCenter(config.preferencesCenterId);
122+
}, []);
123+
118124
const onClearDataPress = useCallback(() => {
119125
consentManager.current?.clearLocalData();
120126
consentManager.current?.build(
@@ -165,6 +171,11 @@ export default function App() {
165171
onPress={onGlobalCMPPress}
166172
disabled={disable || config.campaigns.globalcmp == undefined}
167173
/>
174+
<Button
175+
title="Load Preferences Center"
176+
onPress={onPreferencesPress}
177+
disabled={disable || config.campaigns.preferences == undefined}
178+
/>
168179
<Button title="Clear All" onPress={onClearDataPress} />
169180
<Text testID="sdkStatus" style={styles.status}>
170181
{sdkStatus}

ios/RNSourcepointCmp.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ import React
7272
consentManager?.loadGlobalCmpPrivacyManager(withId: pmId)
7373
}
7474

75+
public func loadPreferenceCenter(_ id: String) {
76+
consentManager?.loadPreferenceCenter(withId: id)
77+
}
78+
7579
weak var rootViewController: UIViewController? {
7680
UIApplication.shared.delegate?.window??.rootViewController
7781
}

ios/ReactNativeCmp.mm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ - (void)loadGlobalCmpPrivacyManager:(nonnull NSString *)pmId {
9494
[sdk loadGlobalCMPPrivacyManager: pmId];
9595
}
9696

97+
- (void)loadPreferenceCenter:(nonnull NSString *)id {
98+
[sdk loadPreferenceCenter: id];
99+
}
97100

98101
// MARK: SPDelegate
99102
- (void)onAction:(RNAction*)action {

src/NativeReactNativeCmp.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ export interface Spec extends TurboModule {
153153
loadGDPRPrivacyManager(pmId: string): void;
154154
loadUSNatPrivacyManager(pmId: string): void;
155155
loadGlobalCmpPrivacyManager(pmId: string): void;
156+
loadPreferenceCenter(id: string): void;
156157

157158
readonly onAction: EventEmitter<SPAction>;
158159
readonly onSPUIReady: EventEmitter<void>;

src/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ export default class SPConsentManager implements Spec {
4444
ReactNativeCmp.loadGlobalCmpPrivacyManager(pmId);
4545
}
4646

47+
loadPreferenceCenter(id: string) {
48+
ReactNativeCmp.loadPreferenceCenter(id);
49+
}
50+
4751
onAction: EventEmitter<SPAction> = ReactNativeCmp.onAction;
4852
onSPUIReady: EventEmitter<void> = ReactNativeCmp.onSPUIReady;
4953
onSPUIFinished: EventEmitter<void> = ReactNativeCmp.onSPUIFinished;

0 commit comments

Comments
 (0)