Skip to content

Commit

Permalink
Merge pull request #189 from adjust/v4230
Browse files Browse the repository at this point in the history
Version 4.23.0
  • Loading branch information
uerceg authored Aug 20, 2020
2 parents 3a7cd6f + 3fbff20 commit bfbdc65
Show file tree
Hide file tree
Showing 21 changed files with 280 additions and 92 deletions.
17 changes: 16 additions & 1 deletion Assets/Adjust/Android/AdjustAndroid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace com.adjust.sdk
#if UNITY_ANDROID
public class AdjustAndroid
{
private const string sdkPrefix = "unity4.22.1";
private const string sdkPrefix = "unity4.23.0";
private static bool launchDeferredDeeplink = true;
private static AndroidJavaClass ajcAdjust = new AndroidJavaClass("com.adjust.sdk.Adjust");
private static AndroidJavaObject ajoCurrentActivity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
Expand Down Expand Up @@ -110,6 +110,21 @@ public static void Start(AdjustConfig adjustConfig)
ajoAdjustConfig.Call("setExternalDeviceId", adjustConfig.externalDeviceId);
}

// Check if user has set custom URL strategy.
if (adjustConfig.urlStrategy != null)
{
if (adjustConfig.urlStrategy == AdjustConfig.AdjustUrlStrategyChina)
{
AndroidJavaObject ajoUrlStrategyChina = new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic<AndroidJavaObject>("URL_STRATEGY_CHINA");
ajoAdjustConfig.Call("setUrlStrategy", ajoUrlStrategyChina);
}
else if (adjustConfig.urlStrategy == AdjustConfig.AdjustUrlStrategyIndia)
{
AndroidJavaObject ajoUrlStrategyIndia = new AndroidJavaClass("com.adjust.sdk.AdjustConfig").GetStatic<AndroidJavaObject>("URL_STRATEGY_INDIA");
ajoAdjustConfig.Call("setUrlStrategy", ajoUrlStrategyIndia);
}
}

// Check if user has set app secret.
if (IsAppSecretSet(adjustConfig))
{
Expand Down
33 changes: 0 additions & 33 deletions Assets/Adjust/Android/Test/Java-WebSocket-1.3.9.jar.meta

This file was deleted.

Binary file modified Assets/Adjust/Android/Test/adjust-test.jar
Binary file not shown.
33 changes: 0 additions & 33 deletions Assets/Adjust/Android/Test/gson-2.8.1.jar.meta

This file was deleted.

Binary file modified Assets/Adjust/Android/adjust-android.jar
Binary file not shown.
50 changes: 42 additions & 8 deletions Assets/Adjust/Editor/AdjustEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,38 @@
public class AdjustEditor : AssetPostprocessor
{
private static bool isPostProcessingEnabled = true;
private static String ios14EditorPrefsKey = "adjustiOS14Support";

[MenuItem("Assets/Adjust/Check Post Processing Permission")]
public static void CheckPostProcessingPermission()
[MenuItem("Assets/Adjust/Is iOS 14 Support Enabled?")]
public static void IsiOS14SupportEnabled()
{
bool isEnabled = EditorPrefs.GetBool(ios14EditorPrefsKey, false);
EditorUtility.DisplayDialog("Adjust SDK", "iOS 14 support is " + (isEnabled ? "enabled." : "disabled."), "OK");
}

[MenuItem("Assets/Adjust/Toggle iOS 14 Support")]
public static void ToggleiOS14Support()
{
bool isEnabled = !EditorPrefs.GetBool(ios14EditorPrefsKey, false);
EditorPrefs.SetBool(ios14EditorPrefsKey, isEnabled);
EditorUtility.DisplayDialog("Adjust SDK", "iOS 14 support is now " + (isEnabled ? "enabled." : "disabled."), "OK");
}

[MenuItem("Assets/Adjust/Is Post Processing Enabled?")]
public static void IsPostProcessingEnabled()
{
EditorUtility.DisplayDialog("Adjust SDK", "The post processing for Adjust SDK is " + (isPostProcessingEnabled ? "enabled." : "disabled."), "OK");
}

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

[MenuItem("Assets/Adjust/Export Unity Package")]
static void ExportAdjustUnityPackage()
public static void ExportAdjustUnityPackage()
{
string exportedFileName = "Adjust.unitypackage";
string assetsPath = "Assets/Adjust";
Expand Down Expand Up @@ -134,9 +150,14 @@ private static void RunPostBuildScript(BuildTarget target, bool preBuild, string
PBXProject xcodeProject = new PBXProject();
xcodeProject.ReadFromFile(xcodeProjectPath);

// The Adjust SDK needs two frameworks to be added to the project:
// - AdSupport.framework
// - iAd.framework
// The Adjust SDK will try to add following frameworks to your project:
// - AdSupport.framework (needed for access to IDFA value)
// - iAd.framework (needed in case you are running ASA campaigns)
// - CoreTelephony.framework (needed to get information about network type user is connected to)
// - StoreKit.framework (needed for communication with SKAdNetwork framework)
// - AppTrackingTransparency.framework (needed for information about user's consent to be tracked)

// In case you don't need any of these, feel free to remove them from your app.

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

if (EditorPrefs.GetBool(ios14EditorPrefsKey, false))
{
UnityEngine.Debug.Log("[Adjust]: Xcode project being built with iOS 14 support.");

UnityEngine.Debug.Log("[Adjust]: Adding StoreKit.framework to Xcode project.");
xcodeProject.AddFrameworkToProject(xcodeTarget, "StoreKit.framework", true);
UnityEngine.Debug.Log("[Adjust]: StoreKit.framework added successfully.");

UnityEngine.Debug.Log("[Adjust]: Adding AppTrackingTransparency.framework to Xcode project.");
xcodeProject.AddFrameworkToProject(xcodeTarget, "AppTrackingTransparency.framework", true);
UnityEngine.Debug.Log("[Adjust]: AppTrackingTransparency.framework added successfully.");
}

// The Adjust SDK needs to have Obj-C exceptions enabled.
// GCC_ENABLE_OBJC_EXCEPTIONS=YES

Expand Down
38 changes: 38 additions & 0 deletions Assets/Adjust/Unity/Adjust.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class Adjust : MonoBehaviour

#if UNITY_IOS
// Delegate references for iOS callback triggering
private static List<Action<int>> authorizationStatusDelegates = null;
private static Action<string> deferredDeeplinkDelegate = null;
private static Action<AdjustEventSuccess> eventSuccessDelegate = null;
private static Action<AdjustEventFailure> eventFailureDelegate = null;
Expand Down Expand Up @@ -375,6 +376,26 @@ public static void trackPlayStoreSubscription(AdjustPlayStoreSubscription subscr
#endif
}

public static void requestTrackingAuthorizationWithCompletionHandler(Action<int> statusCallback)
{
if (IsEditor()) { return; }

#if UNITY_IOS
if (Adjust.authorizationStatusDelegates == null)
{
Adjust.authorizationStatusDelegates = new List<Action<int>>();
}
Adjust.authorizationStatusDelegates.Add(statusCallback);
AdjustiOS.RequestTrackingAuthorizationWithCompletionHandler();
#elif UNITY_ANDROID
Debug.Log("[Adjust]: Requesting tracking authorization is only supported for iOS platform.");
#elif (UNITY_WSA || UNITY_WP8)
Debug.Log("[Adjust]: Requesting tracking authorization is only supported for iOS platform.");
#else
Debug.Log(errorMsgPlatform);
#endif
}

public static string getAdid()
{
if (IsEditor()) { return string.Empty; }
Expand Down Expand Up @@ -593,6 +614,23 @@ public void GetNativeDeferredDeeplink(string deeplinkURL)

Adjust.deferredDeeplinkDelegate(deeplinkURL);
}

public void GetAuthorizationStatus(string authorizationStatus)
{
if (IsEditor()) { return; }

if (Adjust.authorizationStatusDelegates == null)
{
Debug.Log("[Adjust]: Authorization status delegates were not set.");
return;
}

foreach (Action<int> callback in Adjust.authorizationStatusDelegates)
{
callback(Int16.Parse(authorizationStatus));
}
Adjust.authorizationStatusDelegates.Clear();
}
#endif

private static bool IsEditor()
Expand Down
14 changes: 14 additions & 0 deletions Assets/Adjust/Unity/AdjustConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ namespace com.adjust.sdk
public class AdjustConfig
{
public const string AdjustAdRevenueSourceMopub = "mopub";
public const string AdjustUrlStrategyChina = "china";
public const string AdjustUrlStrategyIndia = "india";

internal string appToken;
internal string sceneName;
internal string userAgent;
internal string defaultTracker;
internal string externalDeviceId;
internal string urlStrategy;
internal long? info1;
internal long? info2;
internal long? info3;
Expand All @@ -21,6 +24,7 @@ public class AdjustConfig
internal bool? sendInBackground;
internal bool? eventBufferingEnabled;
internal bool? allowSuppressLogLevel;
internal bool? skAdNetworkHandling;
internal bool launchDeferredDeeplink;
internal AdjustLogLevel? logLevel;
internal AdjustEnvironment environment;
Expand Down Expand Up @@ -102,6 +106,16 @@ public void setIsDeviceKnown(bool isDeviceKnown)
this.isDeviceKnown = isDeviceKnown;
}

public void setUrlStrategy(String urlStrategy)
{
this.urlStrategy = urlStrategy;
}

public void deactivateSKAdNetworkHandling()
{
this.skAdNetworkHandling = true;
}

public void setDeferredDeeplinkDelegate(Action<string> deferredDeeplinkDelegate, string sceneName = "Adjust")
{
this.deferredDeeplinkDelegate = deferredDeeplinkDelegate;
Expand Down
2 changes: 1 addition & 1 deletion Assets/Adjust/Windows/AdjustWindows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace com.adjust.sdk
{
public class AdjustWindows
{
private const string sdkPrefix = "unity4.22.1";
private const string sdkPrefix = "unity4.23.0";
private static bool appLaunched = false;

public static void Start(AdjustConfig adjustConfig)
Expand Down
10 changes: 10 additions & 0 deletions Assets/Adjust/iOS/ADJConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,16 @@
info3:(NSUInteger)info3
info4:(NSUInteger)info4;


@property (nonatomic, assign, readonly) BOOL isSKAdNetworkHandlingActive;

- (void)deactivateSKAdNetworkHandling;

/**
* @brief Adjust url strategy.
*/
@property (nonatomic, copy, readwrite, nullable) NSString *urlStrategy;

/**
* @brief Get configuration object for the initialization of the Adjust SDK.
*
Expand Down
12 changes: 11 additions & 1 deletion Assets/Adjust/iOS/Adjust.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Adjust.h
// Adjust
//
// V4.22.1
// V4.23.0
// Created by Christian Wellenbrock (wellle) on 23rd July 2013.
// Copyright © 2012-2017 Adjust GmbH. All rights reserved.
//
Expand Down Expand Up @@ -59,6 +59,12 @@ extern NSString * __nonnull const ADJAdRevenueSourceUnityads;
extern NSString * __nonnull const ADJAdRevenueSourceAdtoapp;
extern NSString * __nonnull const ADJAdRevenueSourceTapdaq;

/**
* Constants for country apps url strategies.
*/
extern NSString * __nonnull const ADJUrlStrategyIndia;
extern NSString * __nonnull const ADJUrlStrategyChina;

/**
* @brief The main interface to Adjust.
*
Expand Down Expand Up @@ -274,6 +280,8 @@ extern NSString * __nonnull const ADJAdRevenueSourceTapdaq;
*/
+ (void)trackSubscription:(nonnull ADJSubscription *)subscription;

+ (void)requestTrackingAuthorizationWithCompletionHandler:(void (^_Nullable)(NSUInteger status))completion;

/**
* Obtain singleton Adjust object.
*/
Expand Down Expand Up @@ -333,4 +341,6 @@ extern NSString * __nonnull const ADJAdRevenueSourceTapdaq;

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

- (void)requestTrackingAuthorizationWithCompletionHandler:(void (^_Nullable)(NSUInteger status))completion;

@end
Binary file modified Assets/Adjust/iOS/AdjustSdk.a
Binary file not shown.
Loading

0 comments on commit bfbdc65

Please sign in to comment.