Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setConsentData type issue #528

Closed
artyorsh opened this issue Feb 20, 2024 · 6 comments
Closed

setConsentData type issue #528

artyorsh opened this issue Feb 20, 2024 · 6 comments

Comments

@artyorsh
Copy link

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-appsflyer/index.d.ts b/node_modules/react-native-appsflyer/index.d.ts
index e1ae493..ba6ace1 100644
--- a/node_modules/react-native-appsflyer/index.d.ts
+++ b/node_modules/react-native-appsflyer/index.d.ts
@@ -115,8 +115,8 @@ declare module "react-native-appsflyer" {
     }
 
     export const AppsFlyerConsent: {
-        forGDPRUser: (hasConsentForDataUsage: boolean, hasConsentForAdsPersonalization: boolean) => void;
-        forNonGDPRUser: () => void;
+        forGDPRUser: (hasConsentForDataUsage: boolean, hasConsentForAdsPersonalization: boolean) => AppsFlyerConsentType;
+        forNonGDPRUser: () => AppsFlyerConsentType;
     }
 
     export type AppsFlyerConsentType = typeof AppsFlyerConsent;

This issue body was partially generated by patch-package.

@chriskurzeja
Copy link

I believe the proposed patch above doesn't go far enough in correcting the broken types. The following should actually fix the issue (ensuring that the object returned from forGDPRUser and forNonGDPRUser actually matches the expected type (an object containing isUserSubjectToGDPR, hasConsentForDataUsage and hasConsentForAdsPersonalization) based on the two platform specific implementations :

diff --git a/node_modules/react-native-appsflyer/index.d.ts b/node_modules/react-native-appsflyer/index.d.ts
index e1ae493..d6d8442 100644
--- a/node_modules/react-native-appsflyer/index.d.ts
+++ b/node_modules/react-native-appsflyer/index.d.ts
@@ -115,11 +115,15 @@ declare module "react-native-appsflyer" {
    }

    export const AppsFlyerConsent: {
-        forGDPRUser: (hasConsentForDataUsage: boolean, hasConsentForAdsPersonalization: boolean) => void;
-        forNonGDPRUser: () => void;
+        forGDPRUser: (hasConsentForDataUsage: boolean, hasConsentForAdsPersonalization: boolean) => AppsFlyerConsentType;
+        forNonGDPRUser: () => AppsFlyerConsentType;
    }

-    export type AppsFlyerConsentType = typeof AppsFlyerConsent;
+    export interface AppsFlyerConsentType {
+        isUserSubjectToGDPR: boolean;
+        hasConsentForDataUsage?: boolean;
+        hasConsentForAdsPersonalization?: boolean;
+    }

    const appsFlyer: {
        onInstallConversionData(callback: (data: ConversionData) => any): () => void;

@walterholohan
Copy link

@amit-kremer93 can we get a fix for this merged. Seems like its very important with the March 6th deadline quickly approaching

@buuuudzik
Copy link

+1

@walterholohan
Copy link

@chriskurzeja @artyorsh thanks for the above. Super helpful.

Just wondering what method did you use to determine if the user was in a GDPR region or not? I was thinking to use the Timezone string to determine. Been keen to see if there is a better way

@artyorsh
Copy link
Author

artyorsh commented Mar 6, 2024

@chriskurzeja @artyorsh thanks for the above. Super helpful.

Just wondering what method did you use to determine if the user was in a GDPR region or not? I was thinking to use the Timezone string to determine. Been keen to see if there is a better way

A bit different for us since I work on "EU only" app. But I guess I'd rely on IP ranges.

@amit-kremer93
Copy link
Contributor

Fixed in 6.13.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants