Skip to content

Commit 8027775

Browse files
authored
Merge pull request #323 from AppsFlyerSDK/releases/6.x.x/6.16.x/6.16.2-rc3
Releases/6.x.x/6.16.x/6.16.2 rc3
2 parents 2280e8c + 0d25ed4 commit 8027775

23 files changed

+114
-52
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
with:
3838
name: Build
3939
path: build
40-
- uses: actions/cache@v2
40+
- uses: actions/cache@v4
4141
with:
4242
path: ${{ matrix.projectPath }}/Library
4343
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}-${{ hashFiles(matrix.projectPath) }}

Assets/AppsFlyer/AppsFlyer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace AppsFlyerSDK
66
{
77
public class AppsFlyer : MonoBehaviour
88
{
9-
public static readonly string kAppsFlyerPluginVersion = "6.16.0";
9+
public static readonly string kAppsFlyerPluginVersion = "6.16.2";
1010
public static string CallBackObjectName = null;
1111
private static EventHandler onRequestResponse;
1212
private static EventHandler onInAppResponse;

Assets/AppsFlyer/AppsFlyerAndroid.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,12 @@ public void enableFacebookDeferredApplinks(bool isEnabled)
398398
public void setConsentData(AppsFlyerConsent appsFlyerConsent)
399399
{
400400
#if !UNITY_EDITOR
401-
appsFlyerAndroid.CallStatic("setConsentData", appsFlyerConsent.isUserSubjectToGDPR, appsFlyerConsent.hasConsentForDataUsage, appsFlyerConsent.hasConsentForAdsPersonalization);
401+
string isUserSubjectToGDPR = appsFlyerConsent.isUserSubjectToGDPR?.ToString().ToLower() ?? "null";
402+
string hasConsentForDataUsage = appsFlyerConsent.hasConsentForDataUsage?.ToString().ToLower() ?? "null";
403+
string hasConsentForAdsPersonalization = appsFlyerConsent.hasConsentForAdsPersonalization?.ToString().ToLower() ?? "null";
404+
string hasConsentForAdStorage = appsFlyerConsent.hasConsentForAdStorage?.ToString().ToLower() ?? "null";
405+
406+
appsFlyerAndroid.CallStatic("setConsentData", isUserSubjectToGDPR, hasConsentForDataUsage, hasConsentForAdsPersonalization, hasConsentForAdStorage);
402407
#endif
403408
}
404409

Assets/AppsFlyer/AppsFlyerConsent.cs

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,42 +10,62 @@ namespace AppsFlyerSDK
1010
// This class should be used to notify and record the user's applicability
1111
// under GDPR, their general consent to data usage, and their consent to personalized
1212
// advertisements based on user data.
13-
14-
// Note that the consent for data usage and ads personalization pair is only applicable when the user is
15-
// subject to GDPR guidelines. Therefore, the following factory methods should be used accordingly:
16-
// - Use [forGDPRUser] when the user is subject to GDPR.
17-
// - Use [forNonGDPRUser] when the user is not subject to GDPR.
1813

19-
// @property isUserSubjectToGDPR Indicates whether GDPR regulations apply to the user (true if the user is
20-
// a subject of GDPR). It also serves as a flag for compliance with relevant aspects of DMA regulations.
21-
// @property hasConsentForDataUsage Indicates whether the user has consented to the use of their data for advertising
22-
// purposes under both GDPR and DMA guidelines (true if the user has consented, nullable if not subject to GDPR).
23-
// @property hasConsentForAdsPersonalization Indicates whether the user has consented to the use of their data for
24-
// personalized advertising within the boundaries of GDPR and DMA rules (true if the user has consented to
25-
// personalized ads, nullable if not subject to GDPR).
14+
/// ## Properties:
15+
/// - `isUserSubjectToGDPR` (optional) - Indicates whether GDPR regulations apply to the user.
16+
/// This may also serve as a general compliance flag for other regional regulations.
17+
/// - `hasConsentForDataUsage` (optional) - Indicates whether the user consents to the processing
18+
/// of their data for advertising purposes.
19+
/// - `hasConsentForAdsPersonalization` (optional) - Indicates whether the user consents to the
20+
/// use of their data for personalized advertising.
21+
/// - `hasConsentForAdStorage` (optional) - Indicates whether the user consents to ad-related storage access.
22+
///
23+
/// **Usage Example:**
24+
/// ```csharp
25+
/// var consent = new AppsFlyerConsent(
26+
/// isUserSubjectToGDPR: true,
27+
/// hasConsentForDataUsage: true,
28+
/// hasConsentForAdsPersonalization: false,
29+
/// hasConsentForAdStorage: true
30+
/// );
31+
/// **Deprecated APIs:**
32+
/// - `ForGDPRUser(...)` and `ForNonGDPRUser(...)` should no longer be used.
33+
/// - Use `new AppsFlyerConsent(...)` instead with relevant consent fields.
34+
///
2635
/// </summary>
2736
public class AppsFlyerConsent
2837
{
29-
public bool isUserSubjectToGDPR { get; private set; }
30-
public bool hasConsentForDataUsage { get; private set; }
31-
public bool hasConsentForAdsPersonalization { get; private set; }
38+
public bool? isUserSubjectToGDPR { get; private set; }
39+
public bool? hasConsentForDataUsage { get; private set; }
40+
public bool? hasConsentForAdsPersonalization { get; private set; }
41+
public bool? hasConsentForAdStorage { get; private set; }
3242

43+
public AppsFlyerConsent( bool? isUserSubjectToGDPR = null, bool? hasConsentForDataUsage = null, bool? hasConsentForAdsPersonalization = null, bool? hasConsentForAdStorage = null)
44+
{
45+
this.isUserSubjectToGDPR = isUserSubjectToGDPR;
46+
this.hasConsentForDataUsage = hasConsentForDataUsage;
47+
this.hasConsentForAdsPersonalization = hasConsentForAdsPersonalization;
48+
this.hasConsentForAdStorage = hasConsentForAdStorage;
49+
}
50+
51+
[Obsolete("Use the new constructor with optional booleans instead.")]
3352
private AppsFlyerConsent(bool isGDPR, bool hasForDataUsage, bool hasForAdsPersonalization)
3453
{
3554
isUserSubjectToGDPR = isGDPR;
3655
hasConsentForDataUsage = hasForDataUsage;
3756
hasConsentForAdsPersonalization = hasForAdsPersonalization;
3857
}
3958

59+
[Obsolete("Use new AppsFlyerConsent(...) instead.")]
4060
public static AppsFlyerConsent ForGDPRUser(bool hasConsentForDataUsage, bool hasConsentForAdsPersonalization)
4161
{
4262
return new AppsFlyerConsent(true, hasConsentForDataUsage, hasConsentForAdsPersonalization);
4363
}
4464

65+
[Obsolete("Use new AppsFlyerConsent(...) instead.")]
4566
public static AppsFlyerConsent ForNonGDPRUser()
4667
{
4768
return new AppsFlyerConsent(false, false, false);
4869
}
4970
}
50-
5171
}

Assets/AppsFlyer/AppsFlyeriOS.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,12 @@ public void enableTCFDataCollection(bool shouldCollectTcfData)
215215
public void setConsentData(AppsFlyerConsent appsFlyerConsent)
216216
{
217217
#if !UNITY_EDITOR
218-
_setConsentData(appsFlyerConsent.isUserSubjectToGDPR, appsFlyerConsent.hasConsentForDataUsage, appsFlyerConsent.hasConsentForAdsPersonalization);
218+
string isUserSubjectToGDPR = appsFlyerConsent.isUserSubjectToGDPR?.ToString().ToLower() ?? "null";
219+
string hasConsentForDataUsage = appsFlyerConsent.hasConsentForDataUsage?.ToString().ToLower() ?? "null";
220+
string hasConsentForAdsPersonalization = appsFlyerConsent.hasConsentForAdsPersonalization?.ToString().ToLower() ?? "null";
221+
string hasConsentForAdStorage = appsFlyerConsent.hasConsentForAdStorage?.ToString().ToLower() ?? "null";
222+
223+
_setConsentData(isUserSubjectToGDPR, hasConsentForDataUsage, hasConsentForAdsPersonalization, hasConsentForAdStorage);
219224
#endif
220225
}
221226

@@ -760,7 +765,7 @@ public static void getCallback(string gameObjectName, string callbackName, strin
760765
#elif UNITY_STANDALONE_OSX
761766
[DllImport("AppsFlyerBundle")]
762767
#endif
763-
private static extern void _setConsentData(bool isUserSubjectToGDPR, bool hasConsentForDataUsage, bool hasConsentForAdsPersonalization);
768+
private static extern void _setConsentData(string isUserSubjectToGDPR, string hasConsentForDataUsage, string hasConsentForAdsPersonalization, string hasConsentForAdStorage);
764769

765770
#if UNITY_IOS
766771
[DllImport("__Internal")]

Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
<dependencies>
33

44
<androidPackages>
5-
<androidPackage spec="com.appsflyer:af-android-sdk:6.16.0">
5+
<androidPackage spec="com.appsflyer:af-android-sdk:6.16.2">
66
</androidPackage>
7-
<androidPackage spec="com.appsflyer:unity-wrapper:6.16.0">
7+
<androidPackage spec="com.appsflyer:unity-wrapper:6.16.2">
88
</androidPackage>
99
<androidPackage spec="com.android.installreferrer:installreferrer:2.1">
1010
</androidPackage>
1111
</androidPackages>
1212

1313
<iosPods>
14-
<iosPod name="AppsFlyerFramework" version="6.16.0" minTargetSdk="12.0">
14+
<iosPod name="AppsFlyerFramework" version="6.16.2" minTargetSdk="12.0">
1515
</iosPod>
1616
</iosPods>
1717

Assets/AppsFlyer/Plugins/iOS/AFUnityUtils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ static char* getCString(const char* string);
1818
static AppsFlyerLinkGenerator* generatorFromDictionary(NSDictionary* dictionary, AppsFlyerLinkGenerator* generator);
1919
static EmailCryptType emailCryptTypeFromInt(int emailCryptTypeInt);
2020
static AppsFlyerAdRevenueMediationNetworkType mediationNetworkTypeFromInt(int mediationNetwork);
21+
static NSNumber *intFromNullableBool(const char *cStr);
2122
static NSString* stringFromDeepLinkResultStatus(AFSDKDeepLinkResultStatus deepLinkResult);
2223
static NSString* stringFromDeepLinkResultError(AppsFlyerDeepLinkResult *result);
2324

Assets/AppsFlyer/Plugins/iOS/AFUnityUtils.mm

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,18 @@ static EmailCryptType emailCryptTypeFromInt(int emailCryptTypeInt){
108108
return emailCryptType;
109109
}
110110

111+
static NSNumber *intFromNullableBool(const char *cStr) {
112+
if (!cStr) return nil;
113+
NSString *str = [NSString stringWithUTF8String:cStr];
114+
115+
if ([str caseInsensitiveCompare:@"true"] == NSOrderedSame) {
116+
return @YES;
117+
} else if ([str caseInsensitiveCompare:@"false"] == NSOrderedSame) {
118+
return @NO;
119+
}
120+
return nil;
121+
}
122+
111123
static AppsFlyerAdRevenueMediationNetworkType mediationNetworkTypeFromInt(int mediationNetworkInt){
112124

113125
AppsFlyerAdRevenueMediationNetworkType mediationNetworkType;

Assets/AppsFlyer/Plugins/iOS/AppsFlyeriOSWrapper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
#import "AppsFlyerAttribution.h"
1111
#if __has_include(<AppsFlyerLib/AppsFlyerLib.h>)
1212
#import <AppsFlyerLib/AppsFlyerLib.h>
13+
#import "AppsFlyerLib/AppsFlyerLib-Swift.h"
1314
#else
1415
#import "AppsFlyerLib.h"
16+
#import "AppsFlyerLib-Swift.h"
1517
#endif
1618

1719
@interface AppsFlyeriOSWarpper : NSObject <AppsFlyerLibDelegate, AppsFlyerDeepLinkDelegate>

Assets/AppsFlyer/Plugins/iOS/AppsFlyeriOSWrapper.mm

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static void unityCallBack(NSString* objectName, const char* method, const char*
1818

1919
const void _startSDK(bool shouldCallback, const char* objectName) {
2020
[[AppsFlyerLib shared] setPluginInfoWith: AFSDKPluginUnity
21-
pluginVersion:@"6.16.0"
21+
pluginVersion:@"6.16.2"
2222
additionalParams:nil];
2323
startRequestObjectName = stringFromChar(objectName);
2424
AppsFlyeriOSWarpper.didCallStart = YES;
@@ -87,14 +87,19 @@ const void _enableTCFDataCollection (bool shouldCollectTcfData) {
8787
[[AppsFlyerLib shared] enableTCFDataCollection:shouldCollectTcfData];
8888
}
8989

90-
const void _setConsentData(bool isUserSubjectToGDPR, bool hasConsentForDataUsage, bool hasConsentForAdsPersonalization) {
91-
AppsFlyerConsent *consentData = nil;
92-
if (isUserSubjectToGDPR) {
93-
consentData = [[AppsFlyerConsent alloc] initForGDPRUserWithHasConsentForDataUsage:hasConsentForDataUsage hasConsentForAdsPersonalization:hasConsentForAdsPersonalization];
94-
} else {
95-
consentData = [[AppsFlyerConsent alloc] initNonGDPRUser];
96-
}
97-
[[AppsFlyerLib shared] setConsentData:consentData];
90+
const void _setConsentData(const char* isUserSubjectToGDPR, const char* hasConsentForDataUsage, const char* hasConsentForAdsPersonalization, const char* hasConsentForAdStorage) {
91+
92+
NSNumber *gdpr = intFromNullableBool(isUserSubjectToGDPR);
93+
NSNumber *dataUsage = intFromNullableBool(hasConsentForDataUsage);
94+
NSNumber *adsPersonalization = intFromNullableBool(hasConsentForAdsPersonalization);
95+
NSNumber *adStorage = intFromNullableBool(hasConsentForAdStorage);
96+
97+
AppsFlyerConsent *consentData = [[AppsFlyerConsent alloc] initWithIsUserSubjectToGDPR:gdpr
98+
hasConsentForDataUsage:dataUsage
99+
hasConsentForAdsPersonalization:adsPersonalization
100+
hasConsentForAdStorage:adStorage];
101+
102+
[[AppsFlyerLib shared] setConsentData:consentData];
98103
}
99104

100105
const void _logAdRevenue(const char* monetizationNetwork, int mediationNetworkInt, const char* currencyIso4217Code, double eventRevenue, const char* additionalParameters) {

0 commit comments

Comments
 (0)