Skip to content

Commit 6eaaa2b

Browse files
authored
Merge pull request #332 from adjust/v530
Version 5.3.0
2 parents 0512415 + 01b0935 commit 6eaaa2b

File tree

13 files changed

+339
-25
lines changed

13 files changed

+339
-25
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<dependencies>
33
<androidPackages>
4-
<androidPackage spec="com.adjust.sdk:adjust-android:5.1.0">
4+
<androidPackage spec="com.adjust.sdk:adjust-android:5.3.0">
55
</androidPackage>
66
<androidPackage spec="com.android.installreferrer:installreferrer:2.2">
77
</androidPackage>
88
</androidPackages>
99
<iosPods>
10-
<iosPod name="Adjust" version="5.1.1" minTargetSdk="12.0">
10+
<iosPod name="Adjust" version="5.3.0" minTargetSdk="12.0">
1111
</iosPod>
1212
</iosPods>
1313
</dependencies>

Assets/Adjust/Native/iOS/AdjustUnity.mm

+44-3
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ void _AdjustInitSdk(
102102
int isLinkMeEnabled,
103103
int isCostDataInAttributionEnabled,
104104
int isDeviceIdsReadingOnceEnabled,
105+
int isAppTrackingTransparencyUsageEnabled,
106+
int isFirstSessionDelayEnabled,
105107
int isDeferredDeeplinkOpeningEnabled,
106108
AdjustDelegateAttributionCallback attributionCallback,
107109
AdjustDelegateEventSuccessCallback eventSuccessCallback,
@@ -201,6 +203,20 @@ void _AdjustInitSdk(
201203
[adjustConfig setAttConsentWaitingInterval:attConsentWaitingInterval];
202204
}
203205

206+
// disable AppTrackingTransparency.framework interaction
207+
if (isAppTrackingTransparencyUsageEnabled != -1) {
208+
if ((BOOL)isAppTrackingTransparencyUsageEnabled == NO) {
209+
[adjustConfig disableAppTrackingTransparencyUsage];
210+
}
211+
}
212+
213+
// first session delay
214+
if (isFirstSessionDelayEnabled != -1) {
215+
if ((BOOL)isFirstSessionDelayEnabled == YES) {
216+
[adjustConfig enableFirstSessionDelay];
217+
}
218+
}
219+
204220
// deduplication IDs max number
205221
if (eventDeduplicationIdsMaxSize != -1) {
206222
[adjustConfig setEventDeduplicationIdsMaxSize:eventDeduplicationIdsMaxSize];
@@ -343,12 +359,18 @@ void _AdjustSetPushToken(const char* pushToken) {
343359
}
344360
}
345361

346-
void _AdjustProcessDeeplink(const char* deeplink) {
362+
void _AdjustProcessDeeplink(const char* deeplink, const char* referrer) {
347363
if (deeplink != NULL) {
348364
NSString *strDeeplink = [NSString stringWithUTF8String:deeplink];
349365
NSURL *urlDeeplink = [NSURL URLWithString:strDeeplink];
350-
ADJDeeplink *deeplink = [[ADJDeeplink alloc] initWithDeeplink:urlDeeplink];
351-
[Adjust processDeeplink:deeplink];
366+
ADJDeeplink *adjustDeeplink = [[ADJDeeplink alloc] initWithDeeplink:urlDeeplink];
367+
368+
if (referrer != NULL) {
369+
NSString *strReferrer = [NSString stringWithUTF8String:referrer];
370+
NSURL *urlReferrer = [NSURL URLWithString:strReferrer];
371+
[adjustDeeplink setReferrer:urlReferrer];
372+
}
373+
[Adjust processDeeplink:adjustDeeplink];
352374
}
353375
}
354376

@@ -813,6 +835,25 @@ void _AdjustVerifyAndTrackAppStorePurchase(
813835
}];
814836
}
815837

838+
void _AdjustEndFirstSessionDelay() {
839+
[Adjust endFirstSessionDelay];
840+
}
841+
842+
void _AdjustEnableCoppaComplianceInDelay() {
843+
[Adjust enableCoppaComplianceInDelay];
844+
}
845+
846+
void _AdjustDisableCoppaComplianceInDelay() {
847+
[Adjust disableCoppaComplianceInDelay];
848+
}
849+
850+
void _AdjustSetExternalDeviceIdInDelay(const char* externalDeviceId) {
851+
if (externalDeviceId != NULL) {
852+
NSString *strExternalDeviceId = [NSString stringWithUTF8String:externalDeviceId];
853+
[Adjust setExternalDeviceIdInDelay:strExternalDeviceId];
854+
}
855+
}
856+
816857
void _AdjustSetTestOptions(const char* overwriteUrl,
817858
const char* extraPath,
818859
long timerIntervalInMilliseconds,

Assets/Adjust/Scripts/Adjust.cs

+96
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,102 @@ public static void VerifyAndTrackPlayStorePurchase(
714714
#endif
715715
}
716716

717+
public static void EndFirstSessionDelay()
718+
{
719+
if (IsEditor())
720+
{
721+
return;
722+
}
723+
724+
#if UNITY_IOS
725+
AdjustiOS.EndFirstSessionDelay();
726+
#elif UNITY_ANDROID
727+
AdjustAndroid.EndFirstSessionDelay();
728+
#else
729+
Debug.Log(errorMsgPlatform);
730+
#endif
731+
}
732+
733+
public static void EnableCoppaComplianceInDelay()
734+
{
735+
if (IsEditor())
736+
{
737+
return;
738+
}
739+
740+
#if UNITY_IOS
741+
AdjustiOS.EnableCoppaComplianceInDelay();
742+
#elif UNITY_ANDROID
743+
AdjustAndroid.EnableCoppaComplianceInDelay();
744+
#else
745+
Debug.Log(errorMsgPlatform);
746+
#endif
747+
}
748+
749+
public static void DisableCoppaComplianceInDelay()
750+
{
751+
if (IsEditor())
752+
{
753+
return;
754+
}
755+
756+
#if UNITY_IOS
757+
AdjustiOS.DisableCoppaComplianceInDelay();
758+
#elif UNITY_ANDROID
759+
AdjustAndroid.DisableCoppaComplianceInDelay();
760+
#else
761+
Debug.Log(errorMsgPlatform);
762+
#endif
763+
}
764+
765+
public static void EnablePlayStoreKidsComplianceInDelay()
766+
{
767+
if (IsEditor())
768+
{
769+
return;
770+
}
771+
772+
#if UNITY_IOS
773+
Debug.Log("[Adjust]: Play Store kids feature is only supported for Android platform.");
774+
#elif UNITY_ANDROID
775+
AdjustAndroid.EnablePlayStoreKidsComplianceInDelay();
776+
#else
777+
Debug.Log(errorMsgPlatform);
778+
#endif
779+
}
780+
781+
public static void DisablePlayStoreKidsComplianceInDelay()
782+
{
783+
if (IsEditor())
784+
{
785+
return;
786+
}
787+
788+
#if UNITY_IOS
789+
Debug.Log("[Adjust]: Play Store kids feature is only supported for Android platform.");
790+
#elif UNITY_ANDROID
791+
AdjustAndroid.DisablePlayStoreKidsComplianceInDelay();
792+
#else
793+
Debug.Log(errorMsgPlatform);
794+
#endif
795+
}
796+
797+
public static void SetExternalDeviceIdInDelay(string externalDeviceId)
798+
{
799+
if (IsEditor())
800+
{
801+
return;
802+
}
803+
804+
#if UNITY_IOS
805+
AdjustiOS.SetExternalDeviceIdInDelay(externalDeviceId);
806+
#elif UNITY_ANDROID
807+
AdjustAndroid.SetExternalDeviceIdInDelay(externalDeviceId);
808+
#else
809+
Debug.Log(errorMsgPlatform);
810+
#endif
811+
}
812+
717813
private static bool IsEditor()
718814
{
719815
#if UNITY_EDITOR

Assets/Adjust/Scripts/AdjustAndroid.cs

+68-13
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace AdjustSdk
88
#if UNITY_ANDROID
99
public class AdjustAndroid
1010
{
11-
private const string sdkPrefix = "unity5.1.3";
11+
private const string sdkPrefix = "unity5.3.0";
1212
private static bool isDeferredDeeplinkOpeningEnabled = true;
1313
private static AndroidJavaClass ajcAdjust = new AndroidJavaClass("com.adjust.sdk.Adjust");
1414
private static AndroidJavaObject ajoCurrentActivity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
@@ -127,6 +127,15 @@ public static void InitSdk(AdjustConfig adjustConfig)
127127
}
128128
}
129129

130+
// check if first session delay has been enabled
131+
if (adjustConfig.IsFirstSessionDelayEnabled != null)
132+
{
133+
if (adjustConfig.IsFirstSessionDelayEnabled == true)
134+
{
135+
ajoAdjustConfig.Call("enableFirstSessionDelay");
136+
}
137+
}
138+
130139
// check if user has set custom preinstall file path
131140
if (adjustConfig.PreinstallFilePath != null)
132141
{
@@ -396,6 +405,14 @@ public static void ProcessDeeplink(AdjustDeeplink deeplink)
396405
using (AndroidJavaObject ajoUri = ajcUri.CallStatic<AndroidJavaObject>("parse", deeplink.Deeplink))
397406
using (AndroidJavaObject ajoAdjustDeeplink = new AndroidJavaObject("com.adjust.sdk.AdjustDeeplink", ajoUri))
398407
{
408+
if (deeplink.Referrer != null)
409+
{
410+
using (AndroidJavaObject ajoReferrer = ajcUri.CallStatic<AndroidJavaObject>("parse", deeplink.Referrer))
411+
{
412+
ajoAdjustDeeplink.Call("setReferrer", ajoReferrer);
413+
}
414+
}
415+
399416
ajcAdjust.CallStatic("processDeeplink", ajoAdjustDeeplink, ajoCurrentActivity);
400417
}
401418
}
@@ -576,6 +593,38 @@ public static void GetAttribution(Action<AdjustAttribution> onAttributionRead)
576593
ajcAdjust.CallStatic("getAttribution", onAttributionReadProxy);
577594
}
578595

596+
public static void GetSdkVersion(Action<string> onSdkVersionRead)
597+
{
598+
SdkVersionReadListener onSdkVersionReadProxy = new SdkVersionReadListener(onSdkVersionRead, sdkPrefix);
599+
ajcAdjust.CallStatic("getSdkVersion", onSdkVersionReadProxy);
600+
}
601+
602+
public static void GetLastDeeplink(Action<string> onLastDeeplinkRead)
603+
{
604+
LastDeeplinkListener onLastDeeplinkReadProxy = new LastDeeplinkListener(onLastDeeplinkRead);
605+
ajcAdjust.CallStatic("getLastDeeplink", ajoCurrentActivity, onLastDeeplinkReadProxy);
606+
}
607+
608+
public static void EndFirstSessionDelay()
609+
{
610+
ajcAdjust.CallStatic("endFirstSessionDelay");
611+
}
612+
613+
public static void EnableCoppaComplianceInDelay()
614+
{
615+
ajcAdjust.CallStatic("enableCoppaComplianceInDelay");
616+
}
617+
618+
public static void DisableCoppaComplianceInDelay()
619+
{
620+
ajcAdjust.CallStatic("disableCoppaComplianceInDelay");
621+
}
622+
623+
public static void SetExternalDeviceIdInDelay(string externalDeviceId)
624+
{
625+
ajcAdjust.CallStatic("setExternalDeviceIdInDelay", externalDeviceId);
626+
}
627+
579628
// android specific methods
580629
public static void GetGoogleAdId(Action<string> onDeviceIdsRead)
581630
{
@@ -589,18 +638,6 @@ public static void GetAmazonAdId(Action<string> onAmazonAdIdRead)
589638
ajcAdjust.CallStatic("getAmazonAdId", ajoCurrentActivity, onAmazonAdIdReadProxy);
590639
}
591640

592-
public static void GetSdkVersion(Action<string> onSdkVersionRead)
593-
{
594-
SdkVersionReadListener onSdkVersionReadProxy = new SdkVersionReadListener(onSdkVersionRead, sdkPrefix);
595-
ajcAdjust.CallStatic("getSdkVersion", onSdkVersionReadProxy);
596-
}
597-
598-
public static void GetLastDeeplink(Action<string> onLastDeeplinkRead)
599-
{
600-
LastDeeplinkListener onLastDeeplinkReadProxy = new LastDeeplinkListener(onLastDeeplinkRead);
601-
ajcAdjust.CallStatic("getLastDeeplink", ajoCurrentActivity, onLastDeeplinkReadProxy);
602-
}
603-
604641
public static void VerifyPlayStorePurchase(
605642
AdjustPlayStorePurchase purchase,
606643
Action<AdjustPurchaseVerificationResult> verificationInfoCallback)
@@ -621,6 +658,14 @@ public static void ProcessAndResolveDeeplink(AdjustDeeplink deeplink, Action<str
621658
using (AndroidJavaObject ajoUri = ajcUri.CallStatic<AndroidJavaObject>("parse", deeplink.Deeplink))
622659
using (AndroidJavaObject ajoAdjustDeeplink = new AndroidJavaObject("com.adjust.sdk.AdjustDeeplink", ajoUri))
623660
{
661+
if (deeplink.Referrer != null)
662+
{
663+
using (AndroidJavaObject ajoReferrer = ajcUri.CallStatic<AndroidJavaObject>("parse", deeplink.Referrer))
664+
{
665+
ajoAdjustDeeplink.Call("setReferrer", ajoReferrer);
666+
}
667+
}
668+
624669
ajcAdjust.CallStatic(
625670
"processAndResolveDeeplink",
626671
ajoAdjustDeeplink,
@@ -693,6 +738,16 @@ public static void VerifyAndTrackPlayStorePurchase(
693738
}
694739
}
695740

741+
public static void EnablePlayStoreKidsComplianceInDelay()
742+
{
743+
ajcAdjust.CallStatic("enablePlayStoreKidsComplianceInDelay");
744+
}
745+
746+
public static void DisablePlayStoreKidsComplianceInDelay()
747+
{
748+
ajcAdjust.CallStatic("disablePlayStoreKidsComplianceInDelay");
749+
}
750+
696751
// used for testing only
697752
public static void SetTestOptions(Dictionary<string, string> testOptions)
698753
{

Assets/Adjust/Scripts/AdjustConfig.cs

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ public class AdjustConfig
1313
public bool? IsCostDataInAttributionEnabled { get; set; }
1414
public bool? IsDeviceIdsReadingOnceEnabled { get; set; }
1515
public bool? IsDeferredDeeplinkOpeningEnabled { get; set; }
16+
public bool? IsAppTrackingTransparencyUsageEnabled { get; set; }
17+
public bool? IsFirstSessionDelayEnabled { get; set; }
1618
public bool? AllowSuppressLogLevel { get; private set; }
1719
public bool? IsDataResidency { get; private set; }
1820
public bool? ShouldUseSubdomains { get; private set; }

Assets/Adjust/Scripts/AdjustDeeplink.cs

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace AdjustSdk
55
public class AdjustDeeplink
66
{
77
public string Deeplink { get; private set; }
8+
public string Referrer { get; set; }
89

910
public AdjustDeeplink(string deeplink)
1011
{

0 commit comments

Comments
 (0)