Skip to content

Commit bfbdc65

Browse files
authored
Merge pull request #189 from adjust/v4230
Version 4.23.0
2 parents 3a7cd6f + 3fbff20 commit bfbdc65

21 files changed

+280
-92
lines changed

Assets/Adjust/Android/AdjustAndroid.cs

+16-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace com.adjust.sdk
88
#if UNITY_ANDROID
99
public class AdjustAndroid
1010
{
11-
private const string sdkPrefix = "unity4.22.1";
11+
private const string sdkPrefix = "unity4.23.0";
1212
private static bool launchDeferredDeeplink = 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");
@@ -110,6 +110,21 @@ public static void Start(AdjustConfig adjustConfig)
110110
ajoAdjustConfig.Call("setExternalDeviceId", adjustConfig.externalDeviceId);
111111
}
112112

113+
// Check if user has set custom URL strategy.
114+
if (adjustConfig.urlStrategy != null)
115+
{
116+
if (adjustConfig.urlStrategy == AdjustConfig.AdjustUrlStrategyChina)
117+
{
118+
AndroidJavaObject ajoUrlStrategyChina = new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic<AndroidJavaObject>("URL_STRATEGY_CHINA");
119+
ajoAdjustConfig.Call("setUrlStrategy", ajoUrlStrategyChina);
120+
}
121+
else if (adjustConfig.urlStrategy == AdjustConfig.AdjustUrlStrategyIndia)
122+
{
123+
AndroidJavaObject ajoUrlStrategyIndia = new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic<AndroidJavaObject>("URL_STRATEGY_INDIA");
124+
ajoAdjustConfig.Call("setUrlStrategy", ajoUrlStrategyIndia);
125+
}
126+
}
127+
113128
// Check if user has set app secret.
114129
if (IsAppSecretSet(adjustConfig))
115130
{

Assets/Adjust/Android/Test/Java-WebSocket-1.3.9.jar.meta

-33
This file was deleted.
0 Bytes
Binary file not shown.

Assets/Adjust/Android/Test/gson-2.8.1.jar.meta

-33
This file was deleted.
14.9 KB
Binary file not shown.

Assets/Adjust/Editor/AdjustEditor.cs

+42-8
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,38 @@
1515
public class AdjustEditor : AssetPostprocessor
1616
{
1717
private static bool isPostProcessingEnabled = true;
18+
private static String ios14EditorPrefsKey = "adjustiOS14Support";
1819

19-
[MenuItem("Assets/Adjust/Check Post Processing Permission")]
20-
public static void CheckPostProcessingPermission()
20+
[MenuItem("Assets/Adjust/Is iOS 14 Support Enabled?")]
21+
public static void IsiOS14SupportEnabled()
22+
{
23+
bool isEnabled = EditorPrefs.GetBool(ios14EditorPrefsKey, false);
24+
EditorUtility.DisplayDialog("Adjust SDK", "iOS 14 support is " + (isEnabled ? "enabled." : "disabled."), "OK");
25+
}
26+
27+
[MenuItem("Assets/Adjust/Toggle iOS 14 Support")]
28+
public static void ToggleiOS14Support()
29+
{
30+
bool isEnabled = !EditorPrefs.GetBool(ios14EditorPrefsKey, false);
31+
EditorPrefs.SetBool(ios14EditorPrefsKey, isEnabled);
32+
EditorUtility.DisplayDialog("Adjust SDK", "iOS 14 support is now " + (isEnabled ? "enabled." : "disabled."), "OK");
33+
}
34+
35+
[MenuItem("Assets/Adjust/Is Post Processing Enabled?")]
36+
public static void IsPostProcessingEnabled()
2137
{
2238
EditorUtility.DisplayDialog("Adjust SDK", "The post processing for Adjust SDK is " + (isPostProcessingEnabled ? "enabled." : "disabled."), "OK");
2339
}
2440

25-
[MenuItem("Assets/Adjust/Change Post Processing Permission")]
26-
public static void ChangePostProcessingPermission()
41+
[MenuItem("Assets/Adjust/Toggle Post Processing Permission")]
42+
public static void TogglePostProcessingPermission()
2743
{
2844
isPostProcessingEnabled = !isPostProcessingEnabled;
2945
EditorUtility.DisplayDialog("Adjust SDK", "The post processing for Adjust SDK is now " + (isPostProcessingEnabled ? "enabled." : "disabled."), "OK");
3046
}
3147

3248
[MenuItem("Assets/Adjust/Export Unity Package")]
33-
static void ExportAdjustUnityPackage()
49+
public static void ExportAdjustUnityPackage()
3450
{
3551
string exportedFileName = "Adjust.unitypackage";
3652
string assetsPath = "Assets/Adjust";
@@ -134,9 +150,14 @@ private static void RunPostBuildScript(BuildTarget target, bool preBuild, string
134150
PBXProject xcodeProject = new PBXProject();
135151
xcodeProject.ReadFromFile(xcodeProjectPath);
136152

137-
// The Adjust SDK needs two frameworks to be added to the project:
138-
// - AdSupport.framework
139-
// - iAd.framework
153+
// The Adjust SDK will try to add following frameworks to your project:
154+
// - AdSupport.framework (needed for access to IDFA value)
155+
// - iAd.framework (needed in case you are running ASA campaigns)
156+
// - CoreTelephony.framework (needed to get information about network type user is connected to)
157+
// - StoreKit.framework (needed for communication with SKAdNetwork framework)
158+
// - AppTrackingTransparency.framework (needed for information about user's consent to be tracked)
159+
160+
// In case you don't need any of these, feel free to remove them from your app.
140161

141162
#if UNITY_2019_3_OR_NEWER
142163
string xcodeTarget = xcodeProject.GetUnityFrameworkTargetGuid();
@@ -156,6 +177,19 @@ private static void RunPostBuildScript(BuildTarget target, bool preBuild, string
156177
xcodeProject.AddFrameworkToProject(xcodeTarget, "CoreTelephony.framework", true);
157178
UnityEngine.Debug.Log("[Adjust]: CoreTelephony.framework added successfully.");
158179

180+
if (EditorPrefs.GetBool(ios14EditorPrefsKey, false))
181+
{
182+
UnityEngine.Debug.Log("[Adjust]: Xcode project being built with iOS 14 support.");
183+
184+
UnityEngine.Debug.Log("[Adjust]: Adding StoreKit.framework to Xcode project.");
185+
xcodeProject.AddFrameworkToProject(xcodeTarget, "StoreKit.framework", true);
186+
UnityEngine.Debug.Log("[Adjust]: StoreKit.framework added successfully.");
187+
188+
UnityEngine.Debug.Log("[Adjust]: Adding AppTrackingTransparency.framework to Xcode project.");
189+
xcodeProject.AddFrameworkToProject(xcodeTarget, "AppTrackingTransparency.framework", true);
190+
UnityEngine.Debug.Log("[Adjust]: AppTrackingTransparency.framework added successfully.");
191+
}
192+
159193
// The Adjust SDK needs to have Obj-C exceptions enabled.
160194
// GCC_ENABLE_OBJC_EXCEPTIONS=YES
161195

Assets/Adjust/Unity/Adjust.cs

+38
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public class Adjust : MonoBehaviour
2222

2323
#if UNITY_IOS
2424
// Delegate references for iOS callback triggering
25+
private static List<Action<int>> authorizationStatusDelegates = null;
2526
private static Action<string> deferredDeeplinkDelegate = null;
2627
private static Action<AdjustEventSuccess> eventSuccessDelegate = null;
2728
private static Action<AdjustEventFailure> eventFailureDelegate = null;
@@ -375,6 +376,26 @@ public static void trackPlayStoreSubscription(AdjustPlayStoreSubscription subscr
375376
#endif
376377
}
377378

379+
public static void requestTrackingAuthorizationWithCompletionHandler(Action<int> statusCallback)
380+
{
381+
if (IsEditor()) { return; }
382+
383+
#if UNITY_IOS
384+
if (Adjust.authorizationStatusDelegates == null)
385+
{
386+
Adjust.authorizationStatusDelegates = new List<Action<int>>();
387+
}
388+
Adjust.authorizationStatusDelegates.Add(statusCallback);
389+
AdjustiOS.RequestTrackingAuthorizationWithCompletionHandler();
390+
#elif UNITY_ANDROID
391+
Debug.Log("[Adjust]: Requesting tracking authorization is only supported for iOS platform.");
392+
#elif (UNITY_WSA || UNITY_WP8)
393+
Debug.Log("[Adjust]: Requesting tracking authorization is only supported for iOS platform.");
394+
#else
395+
Debug.Log(errorMsgPlatform);
396+
#endif
397+
}
398+
378399
public static string getAdid()
379400
{
380401
if (IsEditor()) { return string.Empty; }
@@ -593,6 +614,23 @@ public void GetNativeDeferredDeeplink(string deeplinkURL)
593614

594615
Adjust.deferredDeeplinkDelegate(deeplinkURL);
595616
}
617+
618+
public void GetAuthorizationStatus(string authorizationStatus)
619+
{
620+
if (IsEditor()) { return; }
621+
622+
if (Adjust.authorizationStatusDelegates == null)
623+
{
624+
Debug.Log("[Adjust]: Authorization status delegates were not set.");
625+
return;
626+
}
627+
628+
foreach (Action<int> callback in Adjust.authorizationStatusDelegates)
629+
{
630+
callback(Int16.Parse(authorizationStatus));
631+
}
632+
Adjust.authorizationStatusDelegates.Clear();
633+
}
596634
#endif
597635

598636
private static bool IsEditor()

Assets/Adjust/Unity/AdjustConfig.cs

+14
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ namespace com.adjust.sdk
55
public class AdjustConfig
66
{
77
public const string AdjustAdRevenueSourceMopub = "mopub";
8+
public const string AdjustUrlStrategyChina = "china";
9+
public const string AdjustUrlStrategyIndia = "india";
810

911
internal string appToken;
1012
internal string sceneName;
1113
internal string userAgent;
1214
internal string defaultTracker;
1315
internal string externalDeviceId;
16+
internal string urlStrategy;
1417
internal long? info1;
1518
internal long? info2;
1619
internal long? info3;
@@ -21,6 +24,7 @@ public class AdjustConfig
2124
internal bool? sendInBackground;
2225
internal bool? eventBufferingEnabled;
2326
internal bool? allowSuppressLogLevel;
27+
internal bool? skAdNetworkHandling;
2428
internal bool launchDeferredDeeplink;
2529
internal AdjustLogLevel? logLevel;
2630
internal AdjustEnvironment environment;
@@ -102,6 +106,16 @@ public void setIsDeviceKnown(bool isDeviceKnown)
102106
this.isDeviceKnown = isDeviceKnown;
103107
}
104108

109+
public void setUrlStrategy(String urlStrategy)
110+
{
111+
this.urlStrategy = urlStrategy;
112+
}
113+
114+
public void deactivateSKAdNetworkHandling()
115+
{
116+
this.skAdNetworkHandling = true;
117+
}
118+
105119
public void setDeferredDeeplinkDelegate(Action<string> deferredDeeplinkDelegate, string sceneName = "Adjust")
106120
{
107121
this.deferredDeeplinkDelegate = deferredDeeplinkDelegate;

Assets/Adjust/Windows/AdjustWindows.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace com.adjust.sdk
1717
{
1818
public class AdjustWindows
1919
{
20-
private const string sdkPrefix = "unity4.22.1";
20+
private const string sdkPrefix = "unity4.23.0";
2121
private static bool appLaunched = false;
2222

2323
public static void Start(AdjustConfig adjustConfig)

Assets/Adjust/iOS/ADJConfig.h

+10
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,16 @@
187187
info3:(NSUInteger)info3
188188
info4:(NSUInteger)info4;
189189

190+
191+
@property (nonatomic, assign, readonly) BOOL isSKAdNetworkHandlingActive;
192+
193+
- (void)deactivateSKAdNetworkHandling;
194+
195+
/**
196+
* @brief Adjust url strategy.
197+
*/
198+
@property (nonatomic, copy, readwrite, nullable) NSString *urlStrategy;
199+
190200
/**
191201
* @brief Get configuration object for the initialization of the Adjust SDK.
192202
*

Assets/Adjust/iOS/Adjust.h

+11-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Adjust.h
33
// Adjust
44
//
5-
// V4.22.1
5+
// V4.23.0
66
// Created by Christian Wellenbrock (wellle) on 23rd July 2013.
77
// Copyright © 2012-2017 Adjust GmbH. All rights reserved.
88
//
@@ -59,6 +59,12 @@ extern NSString * __nonnull const ADJAdRevenueSourceUnityads;
5959
extern NSString * __nonnull const ADJAdRevenueSourceAdtoapp;
6060
extern NSString * __nonnull const ADJAdRevenueSourceTapdaq;
6161

62+
/**
63+
* Constants for country apps url strategies.
64+
*/
65+
extern NSString * __nonnull const ADJUrlStrategyIndia;
66+
extern NSString * __nonnull const ADJUrlStrategyChina;
67+
6268
/**
6369
* @brief The main interface to Adjust.
6470
*
@@ -274,6 +280,8 @@ extern NSString * __nonnull const ADJAdRevenueSourceTapdaq;
274280
*/
275281
+ (void)trackSubscription:(nonnull ADJSubscription *)subscription;
276282

283+
+ (void)requestTrackingAuthorizationWithCompletionHandler:(void (^_Nullable)(NSUInteger status))completion;
284+
277285
/**
278286
* Obtain singleton Adjust object.
279287
*/
@@ -333,4 +341,6 @@ extern NSString * __nonnull const ADJAdRevenueSourceTapdaq;
333341

334342
- (nullable NSURL *)convertUniversalLink:(nonnull NSURL *)url scheme:(nonnull NSString *)scheme;
335343

344+
- (void)requestTrackingAuthorizationWithCompletionHandler:(void (^_Nullable)(NSUInteger status))completion;
345+
336346
@end

Assets/Adjust/iOS/AdjustSdk.a

924 KB
Binary file not shown.

0 commit comments

Comments
 (0)