Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ReactNativeCmp.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Pod::Spec.new do |s|
s.platforms = { :ios => min_ios_version_supported }
s.source = { :git => "https://github.com/SourcePointUSA/react-native-sourcepoint-cmp.git", :tag => "#{s.version}" }

s.dependency "ConsentViewController", "7.10.0"
s.dependency "ConsentViewController", "7.11.0"
s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
s.private_header_files = "ios/**/*.h"

Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3"
implementation "org.jetbrains.kotlinx:kotlinx-datetime:0.6.1"

implementation "com.sourcepoint.cmplibrary:cmplibrary:7.15.0"
implementation "com.sourcepoint.cmplibrary:cmplibrary:7.15.1"
}

react {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ class ReactNativeCmpModule(reactContext: ReactApplicationContext) : NativeReactN
runOnMainThread { spConsentLib?.loadPrivacyManager(pmId, GLOBALCMP) }
}

override fun loadPreferenceCenter(id: String) {
runOnMainThread { spConsentLib?.loadPrivacyManager(id, PREFERENCES) }
}

companion object {
const val NAME = "ReactNativeCmp"
}
Expand Down
14 changes: 7 additions & 7 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PODS:
- boost (1.84.0)
- ConsentViewController (7.10.0):
- ConsentViewController (7.11.0):
- Down (~> 0.11.0)
- SPMobileCore (= 0.1.9)
- SPMobileCore (= 0.1.10)
- DoubleConversion (1.1.6)
- fast_float (6.1.4)
- FBLazyVector (0.79.2)
Expand Down Expand Up @@ -1660,7 +1660,7 @@ PODS:
- React-perflogger (= 0.79.2)
- React-utils (= 0.79.2)
- ReactNativeCmp (1.0.2):
- ConsentViewController (= 7.10.0)
- ConsentViewController (= 7.11.0)
- DoubleConversion
- glog
- hermes-engine
Expand All @@ -1685,7 +1685,7 @@ PODS:
- ReactCommon/turbomodule/core
- Yoga
- SocketRocket (0.7.1)
- SPMobileCore (0.1.9)
- SPMobileCore (0.1.10)
- Yoga (0.0.0)

DEPENDENCIES:
Expand Down Expand Up @@ -1919,7 +1919,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
boost: 7e761d76ca2ce687f7cc98e698152abd03a18f90
ConsentViewController: 079fad8b149491cfb52ec8bd7cf47c67eabb2b47
ConsentViewController: 1548d9e77c75b5be5136200be406f0f3b9ae173c
DoubleConversion: cb417026b2400c8f53ae97020b2be961b59470cb
fast_float: 06eeec4fe712a76acc9376682e4808b05ce978b6
FBLazyVector: 84b955f7b4da8b895faf5946f73748267347c975
Expand Down Expand Up @@ -1989,9 +1989,9 @@ SPEC CHECKSUMS:
ReactAppDependencyProvider: 04d5eb15eb46be6720e17a4a7fa92940a776e584
ReactCodegen: c63eda03ba1d94353fb97b031fc84f75a0d125ba
ReactCommon: 76d2dc87136d0a667678668b86f0fca0c16fdeb0
ReactNativeCmp: fdc85cdc42332372a5cdac25012b9102d27e4765
ReactNativeCmp: 1ff6c3f35f9a8cd411a67c870425d8f29b6ad44d
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
SPMobileCore: c3bfa7dacf26f6101900afa096a9b945a89f726a
SPMobileCore: 50aecf97a8fa8134bb84aaed4349a3a20a7e22b2
Yoga: c758bfb934100bb4bf9cbaccb52557cee35e8bdf

PODFILE CHECKSUM: decdc7519d77aa5eae65b167fa59bcfce25e15d2
Expand Down
11 changes: 11 additions & 0 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
gdprPMId: '488393',
usnatPMId: '988851',
globalCmpPMId: '1323762',
preferencesCenterId: '1306779',
campaigns: {
gdpr: {},
usnat: { supportLegacyUSPString: true },
Expand Down Expand Up @@ -115,6 +116,11 @@
consentManager.current?.loadGlobalCmpPrivacyManager(config.globalCmpPMId);
}, []);

const onPreferencesPress = useCallback(() => {
setSDKStatus(SDKStatus.Networking);
consentManager.current?.loadPreferenceCenter(config.preferencesCenterId);
}, []);

const onClearDataPress = useCallback(() => {
consentManager.current?.clearLocalData();
consentManager.current?.build(
Expand Down Expand Up @@ -153,18 +159,23 @@
<Button
title="Load GDPR PM"
onPress={onGDPRPMPress}
disabled={disable || config.campaigns.gdpr == undefined}

Check warning on line 162 in example/src/App.tsx

View workflow job for this annotation

GitHub Actions / lint

Expected '===' and instead saw '=='
/>
<Button
title="Load USNAT PM"
onPress={onUSNATPMPress}
disabled={disable || config.campaigns.usnat == undefined}

Check warning on line 167 in example/src/App.tsx

View workflow job for this annotation

GitHub Actions / lint

Expected '===' and instead saw '=='
/>
<Button
title="Load GlobalCMP PM"
onPress={onGlobalCMPPress}
disabled={disable || config.campaigns.globalcmp == undefined}

Check warning on line 172 in example/src/App.tsx

View workflow job for this annotation

GitHub Actions / lint

Expected '===' and instead saw '=='
/>
<Button
title="Load Preferences Center"
onPress={onPreferencesPress}
disabled={disable || config.campaigns.preferences == undefined}

Check warning on line 177 in example/src/App.tsx

View workflow job for this annotation

GitHub Actions / lint

Expected '===' and instead saw '=='
/>
<Button title="Clear All" onPress={onClearDataPress} />
<Text testID="sdkStatus" style={styles.status}>
{sdkStatus}
Expand Down
4 changes: 4 additions & 0 deletions ios/RNSourcepointCmp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ import React
consentManager?.loadGlobalCmpPrivacyManager(withId: pmId)
}

public func loadPreferenceCenter(_ id: String) {
consentManager?.loadPreferenceCenter(withId: id)
}

weak var rootViewController: UIViewController? {
UIApplication.shared.delegate?.window??.rootViewController
}
Expand Down
3 changes: 3 additions & 0 deletions ios/ReactNativeCmp.mm
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ - (void)loadGlobalCmpPrivacyManager:(nonnull NSString *)pmId {
[sdk loadGlobalCMPPrivacyManager: pmId];
}

- (void)loadPreferenceCenter:(nonnull NSString *)id {
[sdk loadPreferenceCenter: id];
}

// MARK: SPDelegate
- (void)onAction:(RNAction*)action {
Expand Down
1 change: 1 addition & 0 deletions src/NativeReactNativeCmp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export interface Spec extends TurboModule {
loadGDPRPrivacyManager(pmId: string): void;
loadUSNatPrivacyManager(pmId: string): void;
loadGlobalCmpPrivacyManager(pmId: string): void;
loadPreferenceCenter(id: string): void;

readonly onAction: EventEmitter<SPAction>;
readonly onSPUIReady: EventEmitter<void>;
Expand Down
4 changes: 4 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export default class SPConsentManager implements Spec {
ReactNativeCmp.loadGlobalCmpPrivacyManager(pmId);
}

loadPreferenceCenter(id: string) {
ReactNativeCmp.loadPreferenceCenter(id);
}

onAction: EventEmitter<SPAction> = ReactNativeCmp.onAction;
onSPUIReady: EventEmitter<void> = ReactNativeCmp.onSPUIReady;
onSPUIFinished: EventEmitter<void> = ReactNativeCmp.onSPUIFinished;
Expand Down
Loading