Skip to content

Commit

Permalink
Update native sdks, add isUserStatusPartial + update test app
Browse files Browse the repository at this point in the history
  • Loading branch information
pmerlet-at-didomi committed Jan 15, 2024
1 parent 83fbe48 commit 89a93a0
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 3 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,5 @@ dependencies {

implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

implementation "io.didomi.sdk:android:1.87.0"
implementation "io.didomi.sdk:android:1.88.0"
}
9 changes: 9 additions & 0 deletions android/src/main/java/com/reactnativedidomi/DidomiModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,15 @@ class DidomiModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
}
}

@ReactMethod
fun isUserStatusPartial(promise: Promise) {
try {
promise.resolve(Didomi.getInstance().isUserStatusPartial)
} catch (e: DidomiNotReadyException) {
promise.reject(e)
}
}

@ReactMethod
fun isNoticeVisible(promise: Promise) {
try {
Expand Down
5 changes: 5 additions & 0 deletions ios/RNDidomi.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ class RNDidomi: RCTEventEmitter {
func isUserConsentStatusPartial(resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) {
resolve(Didomi.shared.isUserConsentStatusPartial())
}

@objc(isUserStatusPartial:reject:)
func isUserStatusPartial(resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) {
resolve(Didomi.shared.isUserStatusPartial())
}

@objc(isUserLegitimateInterestStatusPartial:reject:)
func isUserLegitimateInterestStatusPartial(resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) {
Expand Down
2 changes: 1 addition & 1 deletion react-native-didomi.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ Pod::Spec.new do |s|
s.source_files = "ios/**/*.{h,m,mm,swift}"

s.dependency "React-Core"
s.dependency "Didomi-XCFramework", "1.96.0"
s.dependency "Didomi-XCFramework", "1.97.0"
end
1 change: 1 addition & 0 deletions sampleApp/src/Getters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export default function Getters() {
getVendor
isConsentRequired
isUserConsentStatusPartial
isUserStatusPartial
isNoticeVisible
isPreferencesVisible
isError
Expand Down
1 change: 1 addition & 0 deletions sampleApp/src/GettersParams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export default function GettersParams() {
getVendor
isConsentRequired
isUserConsentStatusPartial
isUserStatusPartial
isNoticeVisible
isPreferencesVisible
isError
Expand Down
6 changes: 6 additions & 0 deletions src/Didomi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,12 @@ export const Didomi = {
*/
isUserConsentStatusPartial: (): Promise<boolean> => RNDidomi.isUserConsentStatusPartial(),

/**
* Determine if user did not express a choice for any purpose or vendor that is required
* @returns: **true** if user choice is required and a choice is not expressed, **false** otherwise.
*/
isUserStatusPartial: (): Promise<boolean> => RNDidomi.isUserStatusPartial(),

/**
* Check if the consent notice is currently displayed
* @returns: **true** if the notice is displayed, **false** if is not.
Expand Down
2 changes: 1 addition & 1 deletion testApp/src/GetterCall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function Getter(props: GetterCallProps) {
title={props.name}
testID={props.name}
/>
{called && result != '' ? (
{called && (typeof(result) == "boolean" || result != '') ? (
<Text testID={props.name + '-result'} style={styles.result}>
{convertResultToString(result)}
</Text>
Expand Down
11 changes: 11 additions & 0 deletions testApp/src/Getters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ export default function Getters() {
}}
/>

<Getter
name="isUserStatusPartial"
call={async () => {
return await Didomi.isUserStatusPartial();
}}
test={() => {
return true;
}}
/>

<Getter
name="getUserStatus"
call={async () => {
Expand Down Expand Up @@ -166,6 +176,7 @@ export default function Getters() {
getVendor
isConsentRequired
isUserConsentStatusPartial
isUserStatusPartial
isNoticeVisible
isPreferencesVisible
isError
Expand Down

0 comments on commit 89a93a0

Please sign in to comment.