diff --git a/.gitignore b/.gitignore index 20c4ba83..912e82fd 100644 --- a/.gitignore +++ b/.gitignore @@ -157,3 +157,8 @@ ProjectSettings/ # ==================== # Assembly-CSharp* unity_sdk*.sln + +# ==================== # +# Exceptions +# ==================== # +!google-play-services_lib/AndroidManifest.xml diff --git a/.gitmodules b/.gitmodules index ee167a7a..3f255c27 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ -[submodule "Assets/Plugins/iOS/src/Adjust"] - path = Assets/Plugins/iOS/src/Adjust - url = git@github.com:adjust/ios_sdk.git -[submodule "Assets/Plugins/Android/src/Adjust"] - path = Assets/Plugins/Android/src/Adjust +[submodule "ext/Android/sdk"] + path = ext/Android/sdk url = git@github.com:adjust/android_sdk.git +[submodule "ext/iOS/sdk"] + path = ext/iOS/sdk + url = git@github.com:adjust/ios_sdk.git diff --git a/Adjust_v3.4.4.unitypackage b/Adjust_v3.4.4.unitypackage deleted file mode 100644 index ed3d9461..00000000 Binary files a/Adjust_v3.4.4.unitypackage and /dev/null differ diff --git a/Assets/Adjust.cs b/Assets/Adjust.cs deleted file mode 100644 index 6ce81c28..00000000 --- a/Assets/Adjust.cs +++ /dev/null @@ -1,125 +0,0 @@ -using UnityEngine; -using System.Collections.Generic; -using com.adjust.sdk; -using System; - -public class Adjust : MonoBehaviour { - - private static IAdjust instance = null; - private static string errorMessage = "adjust: SDK not started. Start it manually using the 'appDidLaunch' method"; - private static Action responseDelegate = null; - - public string appToken = "{Your App Token}"; - public AdjustUtil.LogLevel logLevel = AdjustUtil.LogLevel.Info; - public AdjustUtil.AdjustEnvironment environment = AdjustUtil.AdjustEnvironment.Sandbox; - public bool eventBuffering = false; - public bool startManually = false; - public const string sdkPrefix = "unity3.4.4"; - - void Awake() { - if (!this.startManually) { - Adjust.appDidLaunch(this.appToken, this.environment, this.logLevel, this.eventBuffering); - } - } - - void OnApplicationPause(bool pauseStatus) { - if (Adjust.instance == null) { - return; - } - - if (pauseStatus) { - Adjust.instance.onPause(); - } else { - Adjust.instance.onResume(); - } - } - - public static void appDidLaunch(string appToken, AdjustUtil.AdjustEnvironment environment, AdjustUtil.LogLevel logLevel, bool eventBuffering) { - if (Adjust.instance != null) { - Debug.Log("adjust: error, SDK already started."); - return; - } - -#if UNITY_EDITOR - Adjust.instance = null; -#elif UNITY_ANDROID - Adjust.instance = new AdjustAndroid(); -#elif UNITY_IOS - Adjust.instance = new AdjustIOS(); -#elif UNITY_WP8 - Adjust.instance = new AdjustWP8(); -#elif UNITY_METRO - Adjust.instance = new AdjustMetro(); -#endif - - if (Adjust.instance == null) { - Debug.Log("adjust: SDK can only be used in Android, iOS, Windows Phone 8 or Windows Store apps"); - return; - } - - Adjust.instance.appDidLaunch (appToken, environment, sdkPrefix , logLevel, eventBuffering); - } - - public static void trackEvent(string eventToken, Dictionary parameters = null) { - if (Adjust.instance == null) { - Debug.Log(Adjust.errorMessage); - return; - } - - Adjust.instance.trackEvent (eventToken, parameters); - } - - public static void trackRevenue(double cents, string eventToken = null, Dictionary parameters = null) { - if (Adjust.instance == null) { - Debug.Log(Adjust.errorMessage); - return; - } - - Adjust.instance.trackRevenue(cents ,eventToken, parameters); - } - - public static void setResponseDelegate(Action responseDelegate, string sceneName = "Adjust") { - if (Adjust.instance == null) { - Debug.Log(Adjust.errorMessage); - return; - } - - Adjust.responseDelegate = responseDelegate; - Adjust.instance.setResponseDelegate (sceneName); - Adjust.instance.setResponseDelegateString (runResponseDelegate); - } - - public static void setEnabled(bool enabled) { - if (Adjust.instance == null) { - Debug.Log(Adjust.errorMessage); - return; - } - Adjust.instance.setEnabled(enabled); - } - - public static bool isEnabled() { - if (Adjust.instance == null) { - Debug.Log(Adjust.errorMessage); - return false; - } - return Adjust.instance.isEnabled (); - } - - public void getNativeMessage (string sResponseData) { - Adjust.runResponseDelegate (sResponseData); - } - - public static void runResponseDelegate(string sResponseData) { - if (instance == null) { - Debug.Log(Adjust.errorMessage); - return; - } - if (responseDelegate == null) { - Debug.Log("adjust: response delegate not set to receive callbacks"); - return; - } - - var responseData = new ResponseData (sResponseData); - responseDelegate (responseData); - } -} diff --git a/Assets/Adjust.meta b/Assets/Adjust.meta new file mode 100644 index 00000000..250b4572 --- /dev/null +++ b/Assets/Adjust.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c89f46974a101428f809f14e8f611772 +folderAsset: yes +timeCreated: 1433256975 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Adjust.prefab b/Assets/Adjust.prefab deleted file mode 100644 index 7ac456bf..00000000 Binary files a/Assets/Adjust.prefab and /dev/null differ diff --git a/Assets/Adjust/3rd Party.meta b/Assets/Adjust/3rd Party.meta new file mode 100644 index 00000000..31d5e05d --- /dev/null +++ b/Assets/Adjust/3rd Party.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b31f74f8d6fef4e00bc15ccb0d1636b5 +folderAsset: yes +timeCreated: 1433256975 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/SimpleJSON.cs b/Assets/Adjust/3rd Party/SimpleJSON.cs similarity index 100% rename from Assets/Plugins/SimpleJSON.cs rename to Assets/Adjust/3rd Party/SimpleJSON.cs diff --git a/Assets/Plugins/SimpleJSON.cs.meta b/Assets/Adjust/3rd Party/SimpleJSON.cs.meta similarity index 78% rename from Assets/Plugins/SimpleJSON.cs.meta rename to Assets/Adjust/3rd Party/SimpleJSON.cs.meta index eb801e5b..a28238d2 100644 --- a/Assets/Plugins/SimpleJSON.cs.meta +++ b/Assets/Adjust/3rd Party/SimpleJSON.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: cff67d64cfda04c55a703f1ad0e8487e +guid: 9c780c17852614618be5ffd9cc43a75f MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Adjust/Adjust.cs b/Assets/Adjust/Adjust.cs new file mode 100644 index 00000000..fd730a4e --- /dev/null +++ b/Assets/Adjust/Adjust.cs @@ -0,0 +1,193 @@ +using System; +using System.Collections.Generic; + +using UnityEngine; + +namespace com.adjust.sdk +{ + public class Adjust : MonoBehaviour + { + private const string sdkPrefix = "unity4.0.0"; + private const string errorMessage = "adjust: SDK not started. Start it manually using the 'appDidLaunch' method."; + + private static IAdjust instance = null; + private static Action attributionChangedDelegate = null; + + public bool startManually = false; + public bool eventBuffering = false; + public bool printAttribution = false; + + public string appToken = "{Your App Token}"; + + public AdjustLogLevel logLevel = AdjustLogLevel.Info; + public AdjustEnvironment environment = AdjustEnvironment.Sandbox; + + #region Unity lifecycle methods + + void Awake () + { + if (!this.startManually) { + AdjustConfig adjustConfig = new AdjustConfig (this.appToken, this.environment); + adjustConfig.setLogLevel (this.logLevel); + adjustConfig.setEventBufferingEnabled (eventBuffering); + + if (printAttribution) { + adjustConfig.setAttributionChangedDelegate(responseDelegate); + } + + Adjust.start (adjustConfig); + } + } + + void OnApplicationPause(bool pauseStatus) { + if (Adjust.instance == null) { + return; + } + + if (pauseStatus) { + Adjust.instance.onPause(); + } else { + Adjust.instance.onResume(); + } + } + + #endregion + + #region Adjust methods + + public static void start (AdjustConfig adjustConfig) + { + if (Adjust.instance != null) { + Debug.Log ("adjust: Error, SDK already started."); + return; + } + + if (adjustConfig == null) { + Debug.Log ("adjust: Missing config to start."); + return; + } + + #if UNITY_EDITOR + Adjust.instance = null; + #elif UNITY_IOS + Adjust.instance = new AdjustiOS(); + #elif UNITY_ANDROID + Adjust.instance = new AdjustAndroid(); + #else + Adjust.instance = null; + #endif + + if (Adjust.instance == null) { + Debug.Log ("adjust: SDK can only be used in Android, iOS, Windows Phone 8 or Windows Store apps."); + return; + } + + adjustConfig.setSdkPrefix(Adjust.sdkPrefix); + Adjust.attributionChangedDelegate = adjustConfig.getAttributionChangedDelegate (); + + Adjust.instance.start (adjustConfig); + } + + public static void trackEvent (AdjustEvent adjustEvent) + { + if (Adjust.instance == null) { + Debug.Log (Adjust.errorMessage); + return; + } + + if (adjustEvent == null) { + Debug.Log ("adjust: Missing event to track."); + return; + } + + Adjust.instance.trackEvent (adjustEvent); + } + + public static void setEnabled(bool enabled) { + if (Adjust.instance == null) { + Debug.Log(Adjust.errorMessage); + return; + } + + Adjust.instance.setEnabled(enabled); + } + + public static bool isEnabled() { + if (Adjust.instance == null) { + Debug.Log(Adjust.errorMessage); + return false; + } + + return Adjust.instance.isEnabled(); + } + + public static void setOfflineMode(bool enabled) { + if (Adjust.instance == null) { + Debug.Log(Adjust.errorMessage); + return; + } + + Adjust.instance.setOfflineMode(enabled); + } + + #endregion + + #region Attribution callback + + public void getNativeMessage (string sAttributionData) + { + Adjust.runAttributionChangedDelegate (sAttributionData); + } + + public static void runAttributionChangedDelegate (string stringAttributionData) + { + if (instance == null) { + Debug.Log (Adjust.errorMessage); + return; + } + if (Adjust.attributionChangedDelegate == null) { + Debug.Log ("adjust: Attribution changed delegate was not set."); + return; + } + + var attribution = new AdjustAttribution (stringAttributionData); + Adjust.attributionChangedDelegate (attribution); + } + + #endregion + + #region Private & helper methods + + // Our delegate for detecting attribution changes if choosen not to start manually. + private void responseDelegate(AdjustAttribution responseData) + { + Debug.Log ("Attribution changed!"); + + if (responseData.trackerName != null) { + Debug.Log ("trackerName " + responseData.trackerName); + } + + if (responseData.trackerToken != null) { + Debug.Log ("trackerToken " + responseData.trackerToken); + } + + if (responseData.network != null) { + Debug.Log ("network " + responseData.network); + } + + if (responseData.campaign != null) { + Debug.Log ("campaign " + responseData.campaign); + } + + if (responseData.adgroup != null) { + Debug.Log ("adgroup " + responseData.adgroup); + } + + if (responseData.creative != null) { + Debug.Log ("creative " + responseData.creative); + } + } + + #endregion + } +} diff --git a/Assets/Adjust.cs.meta b/Assets/Adjust/Adjust.cs.meta similarity index 78% rename from Assets/Adjust.cs.meta rename to Assets/Adjust/Adjust.cs.meta index edfe1300..08f7cad5 100644 --- a/Assets/Adjust.cs.meta +++ b/Assets/Adjust/Adjust.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d68ef0e1497ff45cea19e5a8c357792b +guid: 525ece82a472e4dea837e1ef938fd15d MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Adjust/Adjust.prefab b/Assets/Adjust/Adjust.prefab new file mode 100644 index 00000000..f304f9af Binary files /dev/null and b/Assets/Adjust/Adjust.prefab differ diff --git a/Assets/Adjust.prefab.meta b/Assets/Adjust/Adjust.prefab.meta similarity index 58% rename from Assets/Adjust.prefab.meta rename to Assets/Adjust/Adjust.prefab.meta index babb1792..9030dc89 100644 --- a/Assets/Adjust.prefab.meta +++ b/Assets/Adjust/Adjust.prefab.meta @@ -1,4 +1,4 @@ fileFormatVersion: 2 -guid: ced352bb34d2c4f90900501a0af55b93 +guid: a3267720e82aa41c1a05ab29824902b4 NativeFormatImporter: userData: diff --git a/Assets/Adjust/Android.meta b/Assets/Adjust/Android.meta new file mode 100644 index 00000000..b23f8a06 --- /dev/null +++ b/Assets/Adjust/Android.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 67214a0afe59c46b48818a2ac559de60 +folderAsset: yes +timeCreated: 1433256975 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Adjust/Android/AdjustAndroid.cs b/Assets/Adjust/Android/AdjustAndroid.cs new file mode 100644 index 00000000..79c42071 --- /dev/null +++ b/Assets/Adjust/Android/AdjustAndroid.cs @@ -0,0 +1,161 @@ +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +using SimpleJSON; +using UnityEngine; + +namespace com.adjust.sdk +{ +#if UNITY_ANDROID + public class AdjustAndroid : IAdjust + { + private AndroidJavaClass ajcAdjust; + private AndroidJavaObject ajoCurrentActivity; + private AttributionChangeListener onAttributionChangedListener; + + private class AttributionChangeListener : AndroidJavaProxy + { + private Action callback; + + public AttributionChangeListener (Action pCallback) : base("com.adjust.sdk.OnAttributionChangedListener") + { + this.callback = pCallback; + } + + public void onAttributionChanged (AndroidJavaObject attribution) + { + AdjustAttribution adjustAttribution = new AdjustAttribution (); + + adjustAttribution.trackerName = attribution.Get ("trackerName"); + adjustAttribution.trackerToken = attribution.Get ("trackerToken"); + adjustAttribution.network = attribution.Get ("network"); + adjustAttribution.campaign = attribution.Get ("campaign"); + adjustAttribution.adgroup = attribution.Get ("adgroup"); + adjustAttribution.creative = attribution.Get ("creative"); + + if (callback != null) { + callback (adjustAttribution); + } + } + } + + public AdjustAndroid () + { + ajcAdjust = new AndroidJavaClass ("com.adjust.sdk.Adjust"); + AndroidJavaClass ajcUnityPlayer = new AndroidJavaClass ("com.unity3d.player.UnityPlayer"); + ajoCurrentActivity = ajcUnityPlayer.GetStatic ("currentActivity"); + } + + #region Public methods + + public void onPause () + { + ajcAdjust.CallStatic ("onPause"); + } + + public void onResume () + { + ajcAdjust.CallStatic ("onResume"); + } + + public void start (AdjustConfig adjustConfig) + { + AndroidJavaObject ajoEnvironment = adjustConfig.environment == AdjustEnvironment.Sandbox ? + new AndroidJavaClass ("com.adjust.sdk.AdjustConfig").GetStatic ("ENVIRONMENT_SANDBOX") : + new AndroidJavaClass ("com.adjust.sdk.AdjustConfig").GetStatic ("ENVIRONMENT_PRODUCTION"); + + AndroidJavaObject ajoAdjustConfig = new AndroidJavaObject ("com.adjust.sdk.AdjustConfig", ajoCurrentActivity, adjustConfig.appToken, ajoEnvironment); + + if (adjustConfig.logLevel != null) { + AndroidJavaObject ajoLogLevel = new AndroidJavaClass ("com.adjust.sdk.LogLevel").GetStatic (adjustConfig.logLevel.ToString().ToUpper()); + + if (ajoLogLevel != null) { + ajoAdjustConfig.Call ("setLogLevel", ajoLogLevel); + } + } + + if (adjustConfig.attributionChangedDelegate != null) { + onAttributionChangedListener = new AttributionChangeListener (adjustConfig.attributionChangedDelegate); + ajoAdjustConfig.Call ("setOnAttributionChangedListener", onAttributionChangedListener); + } + + ajoAdjustConfig.Call ("setSdkPrefix", adjustConfig.sdkPrefix); + + ajcAdjust.CallStatic ("onCreate", ajoAdjustConfig); + } + + public void trackEvent (AdjustEvent adjustEvent) + { + AndroidJavaObject ajoAdjustEvent = new AndroidJavaObject ("com.adjust.sdk.AdjustEvent", adjustEvent.eventToken); + + if (adjustEvent.revenue != null && adjustEvent.currency != null) { + ajoAdjustEvent.Call ("setRevenue", (double)adjustEvent.revenue, adjustEvent.currency); + } + + if (adjustEvent.callbackList != null) { + for (int i = 0; i < adjustEvent.callbackList.Count; i += 2) { + string key = adjustEvent.callbackList [i]; + string value = adjustEvent.callbackList [i + 1]; + + ajoAdjustEvent.Call ("addCallbackParameter", key, value); + } + } + + if (adjustEvent.partnerList != null) { + for (int i = 0; i < adjustEvent.partnerList.Count; i += 2) { + string key = adjustEvent.partnerList [i]; + string value = adjustEvent.partnerList [i + 1]; + + ajoAdjustEvent.Call ("addPartnerParameter", key, value); + } + } + + ajcAdjust.CallStatic ("trackEvent", ajoAdjustEvent); + } + + public bool isEnabled () + { + var ajo = ajcAdjust.CallStatic ("isEnabled"); + return ConvertBoolFromJava (ajo) ?? false; + } + + public void setEnabled(bool enabled) { + ajcAdjust.CallStatic ("setEnabled", ConvertBoolToJava(enabled)); + } + + public void setOfflineMode(bool enabled) + { + ajcAdjust.CallStatic ("setOfflineMode", ConvertBoolToJava (enabled)); + } + + #endregion + + #region Private & helper methods + + private AndroidJavaObject ConvertBoolToJava(bool value) + { + AndroidJavaObject javaBool = new AndroidJavaObject ("java.lang.Boolean", value.ToString ().ToLower ()); + + return javaBool; + } + + private bool? ConvertBoolFromJava (AndroidJavaObject ajo) + { + if (ajo == null) { + return null; + } + + var sBool = ajo.Call ("toString"); + + try { + return Convert.ToBoolean (sBool); + } catch (FormatException) { + return null; + } + } + + #endregion + } +#endif +} diff --git a/Assets/Plugins/Android/AdjustAndroid.cs.meta b/Assets/Adjust/Android/AdjustAndroid.cs.meta similarity index 100% rename from Assets/Plugins/Android/AdjustAndroid.cs.meta rename to Assets/Adjust/Android/AdjustAndroid.cs.meta diff --git a/Assets/Plugins/Android/AdjustAndroidManifest.xml b/Assets/Adjust/Android/AdjustAndroidManifest.xml similarity index 91% rename from Assets/Plugins/Android/AdjustAndroidManifest.xml rename to Assets/Adjust/Android/AdjustAndroidManifest.xml index 317bf328..5e9b6b0a 100644 --- a/Assets/Plugins/Android/AdjustAndroidManifest.xml +++ b/Assets/Adjust/Android/AdjustAndroidManifest.xml @@ -18,7 +18,7 @@ android:label="@string/app_name" android:debuggable="true"> @@ -35,5 +35,4 @@ - diff --git a/Assets/Plugins/Android/AdjustAndroidManifest.xml.meta b/Assets/Adjust/Android/AdjustAndroidManifest.xml.meta similarity index 100% rename from Assets/Plugins/Android/AdjustAndroidManifest.xml.meta rename to Assets/Adjust/Android/AdjustAndroidManifest.xml.meta diff --git a/Assets/Adjust/Android/adjust-android.jar b/Assets/Adjust/Android/adjust-android.jar new file mode 100644 index 00000000..1f46f64c Binary files /dev/null and b/Assets/Adjust/Android/adjust-android.jar differ diff --git a/Assets/Plugins/Android/adjust-android-3.6.2.jar.meta b/Assets/Adjust/Android/adjust-android.jar.meta similarity index 56% rename from Assets/Plugins/Android/adjust-android-3.6.2.jar.meta rename to Assets/Adjust/Android/adjust-android.jar.meta index efd1fd27..2d58bd08 100644 --- a/Assets/Plugins/Android/adjust-android-3.6.2.jar.meta +++ b/Assets/Adjust/Android/adjust-android.jar.meta @@ -1,4 +1,4 @@ fileFormatVersion: 2 -guid: e94892fe0aae54adbb1b427abea7cf1f +guid: 56f89d8690334490ea04acc80fd22aae DefaultImporter: userData: diff --git a/Assets/ExampleGUI.meta b/Assets/Adjust/ExampleGUI.meta similarity index 55% rename from Assets/ExampleGUI.meta rename to Assets/Adjust/ExampleGUI.meta index c120e961..973d6f8a 100644 --- a/Assets/ExampleGUI.meta +++ b/Assets/Adjust/ExampleGUI.meta @@ -1,5 +1,9 @@ fileFormatVersion: 2 guid: 07c54e683897a4a0783d0db39cd9acd5 folderAsset: yes +timeCreated: 1433256975 +licenseType: Free DefaultImporter: userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Adjust/ExampleGUI/ExampleGUI.cs b/Assets/Adjust/ExampleGUI/ExampleGUI.cs new file mode 100644 index 00000000..00d3fbbf --- /dev/null +++ b/Assets/Adjust/ExampleGUI/ExampleGUI.cs @@ -0,0 +1,72 @@ +using System.Collections; +using System.Runtime.InteropServices; + +using UnityEngine; +using com.adjust.sdk; + +public class ExampleGUI : MonoBehaviour +{ + private int nr_buttons = 5; + private static bool? isEnabled; + + void OnGUI () + { + if (GUI.Button (new Rect (0, Screen.height * 0 / nr_buttons, Screen.width, Screen.height / nr_buttons), "Manual Launch")) { + AdjustConfig adjustConfig = new AdjustConfig ("{YourAppToken}", AdjustEnvironment.Sandbox); + adjustConfig.setLogLevel (AdjustLogLevel.Verbose); + adjustConfig.setAttributionChangedDelegate (this.attributionChangedDelegate); + + Adjust.start (adjustConfig); + isEnabled = true; + } + + if (GUI.Button (new Rect (0, Screen.height * 1 / nr_buttons, Screen.width, Screen.height / nr_buttons), "Track Simple Event")) { + AdjustEvent adjustEvent = new AdjustEvent ("{EventToken}"); + + Adjust.trackEvent (adjustEvent); + } + + if (GUI.Button (new Rect (0, Screen.height * 2 / nr_buttons, Screen.width, Screen.height / nr_buttons), "Track Revenue Event")) { + AdjustEvent adjustEvent = new AdjustEvent ("{EventToken}"); + adjustEvent.setRevenue (0.25, "EUR"); + + Adjust.trackEvent (adjustEvent); + } + + if (GUI.Button (new Rect (0, Screen.height * 3 / nr_buttons, Screen.width, Screen.height / nr_buttons), "Track Callback Event")) { + AdjustEvent adjustEvent = new AdjustEvent ("{EventToken}"); + + adjustEvent.addCallbackParameter ("key", "value"); + adjustEvent.addCallbackParameter ("foo", "bar"); + + Adjust.trackEvent (adjustEvent); + } + + if (GUI.Button (new Rect (0, Screen.height * 4 / nr_buttons, Screen.width, Screen.height / nr_buttons), "Track Partner Event")) { + AdjustEvent adjustEvent = new AdjustEvent ("{EventToken}"); + + adjustEvent.addPartnerParameter ("key", "value"); + adjustEvent.addPartnerParameter ("foo", "bar"); + + Adjust.trackEvent (adjustEvent); + } + } + + public void attributionChangedDelegate (AdjustAttribution attribution) + { + Debug.Log ("Attribution changed"); + + if (attribution.trackerName != null) + Debug.Log ("trackerName " + attribution.trackerName); + if (attribution.trackerToken != null) + Debug.Log ("trackerToken " + attribution.trackerToken); + if (attribution.network != null) + Debug.Log ("network " + attribution.network); + if (attribution.campaign != null) + Debug.Log ("campaign " + attribution.campaign); + if (attribution.adgroup != null) + Debug.Log ("adgroup " + attribution.adgroup); + if (attribution.creative != null) + Debug.Log ("creative " + attribution.creative); + } +} diff --git a/Assets/ExampleGUI/ExampleGUI.cs.meta b/Assets/Adjust/ExampleGUI/ExampleGUI.cs.meta similarity index 100% rename from Assets/ExampleGUI/ExampleGUI.cs.meta rename to Assets/Adjust/ExampleGUI/ExampleGUI.cs.meta diff --git a/Assets/ExampleGUI/ExampleGUI.prefab b/Assets/Adjust/ExampleGUI/ExampleGUI.prefab similarity index 100% rename from Assets/ExampleGUI/ExampleGUI.prefab rename to Assets/Adjust/ExampleGUI/ExampleGUI.prefab diff --git a/Assets/ExampleGUI/ExampleGUI.prefab.meta b/Assets/Adjust/ExampleGUI/ExampleGUI.prefab.meta similarity index 100% rename from Assets/ExampleGUI/ExampleGUI.prefab.meta rename to Assets/Adjust/ExampleGUI/ExampleGUI.prefab.meta diff --git a/Assets/Adjust/ExampleGUI/ExampleGUI.unity b/Assets/Adjust/ExampleGUI/ExampleGUI.unity new file mode 100644 index 00000000..23eb9887 Binary files /dev/null and b/Assets/Adjust/ExampleGUI/ExampleGUI.unity differ diff --git a/Assets/ExampleGUI/ExampleGUI.unity.meta b/Assets/Adjust/ExampleGUI/ExampleGUI.unity.meta similarity index 100% rename from Assets/ExampleGUI/ExampleGUI.unity.meta rename to Assets/Adjust/ExampleGUI/ExampleGUI.unity.meta diff --git a/Assets/Adjust/Unity.meta b/Assets/Adjust/Unity.meta new file mode 100644 index 00000000..0ce3fcf4 --- /dev/null +++ b/Assets/Adjust/Unity.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 645a6d09501f34568b3ff17ec6d75f84 +folderAsset: yes +timeCreated: 1433256975 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Adjust/Unity/AdjustAttribution.cs b/Assets/Adjust/Unity/AdjustAttribution.cs new file mode 100644 index 00000000..777762e3 --- /dev/null +++ b/Assets/Adjust/Unity/AdjustAttribution.cs @@ -0,0 +1,67 @@ +using System; + +using SimpleJSON; + +namespace com.adjust.sdk +{ + public class AdjustAttribution + { + public string trackerToken { get; set; } + + public string trackerName { get; set; } + + public string network { get; set; } + + public string campaign { get; set; } + + public string adgroup { get; set; } + + public string creative { get; set; } + + public AdjustAttribution () + { + } + + public AdjustAttribution (string jsonString) + { + var jsonNode = JSON.Parse (jsonString); + + if (jsonNode == null) { + return; + } + + trackerName = getJsonString (jsonNode, "trackerName"); + trackerToken = getJsonString (jsonNode, "trackerToken"); + network = getJsonString (jsonNode, "network"); + campaign = getJsonString (jsonNode, "campaign"); + adgroup = getJsonString (jsonNode, "adgroup"); + creative = getJsonString (jsonNode, "creative"); + } + + private String getJsonString (JSONNode node, string key) + { + var jsonValue = getJsonValue (node, key); + + if (jsonValue == null) { + return null; + } + + return jsonValue.Value; + } + + private JSONNode getJsonValue (JSONNode node, string key) + { + if (node == null) { + return null; + } + + var nodeValue = node[key]; + + if (nodeValue.GetType () == typeof(JSONLazyCreator)) { + return null; + } + + return nodeValue; + } + } +} diff --git a/Assets/Plugins/AdjustUtil.cs.meta b/Assets/Adjust/Unity/AdjustAttribution.cs.meta similarity index 78% rename from Assets/Plugins/AdjustUtil.cs.meta rename to Assets/Adjust/Unity/AdjustAttribution.cs.meta index 5790e463..37c4bbd4 100644 --- a/Assets/Plugins/AdjustUtil.cs.meta +++ b/Assets/Adjust/Unity/AdjustAttribution.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 744827333c89e487b8078a6636c52af6 +guid: cc46748ad0e664f6d839a4f1a23d9f47 MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Adjust/Unity/AdjustConfig.cs b/Assets/Adjust/Unity/AdjustConfig.cs new file mode 100644 index 00000000..a41fb384 --- /dev/null +++ b/Assets/Adjust/Unity/AdjustConfig.cs @@ -0,0 +1,54 @@ +using System; + +namespace com.adjust.sdk +{ + public class AdjustConfig + { + internal string appToken; + internal string sceneName; + internal string sdkPrefix; + internal string defaultTracker; + internal bool? eventBufferingEnabled; + internal AdjustLogLevel? logLevel; + internal AdjustEnvironment environment; + internal Action attributionChangedDelegate; + + public AdjustConfig (string appToken, AdjustEnvironment environment) + { + this.sceneName = ""; + this.appToken = appToken; + this.environment = environment; + } + + public void setSdkPrefix (string sdkPrefix) + { + this.sdkPrefix = sdkPrefix; + } + + public void setLogLevel (AdjustLogLevel logLevel) + { + this.logLevel = logLevel; + } + + public void setDefaultTracker (string defaultTracker) + { + this.defaultTracker = defaultTracker; + } + + public void setEventBufferingEnabled (bool eventBufferingEnabled) + { + this.eventBufferingEnabled = eventBufferingEnabled; + } + + public void setAttributionChangedDelegate(Action attributionChangedDelegate, string sceneName = "Adjust") + { + this.attributionChangedDelegate = attributionChangedDelegate; + this.sceneName = sceneName; + } + + public Action getAttributionChangedDelegate() + { + return this.attributionChangedDelegate; + } + } +} diff --git a/Assets/Plugins/Metro/AdjustMetro.cs.meta b/Assets/Adjust/Unity/AdjustConfig.cs.meta similarity index 78% rename from Assets/Plugins/Metro/AdjustMetro.cs.meta rename to Assets/Adjust/Unity/AdjustConfig.cs.meta index f3e53d8b..d98ac077 100644 --- a/Assets/Plugins/Metro/AdjustMetro.cs.meta +++ b/Assets/Adjust/Unity/AdjustConfig.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c516b92b0f1910f4a809d868619f254e +guid: 02d4cad14fc094b17afde3b685897e5e MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Adjust/Unity/AdjustEnvironment.cs b/Assets/Adjust/Unity/AdjustEnvironment.cs new file mode 100644 index 00000000..6701921d --- /dev/null +++ b/Assets/Adjust/Unity/AdjustEnvironment.cs @@ -0,0 +1,8 @@ +namespace com.adjust.sdk +{ + public enum AdjustEnvironment + { + Sandbox, + Production + } +} diff --git a/Assets/Plugins/ResponseData.cs.meta b/Assets/Adjust/Unity/AdjustEnvironment.cs.meta similarity index 78% rename from Assets/Plugins/ResponseData.cs.meta rename to Assets/Adjust/Unity/AdjustEnvironment.cs.meta index 5f61b5b8..fb472428 100644 --- a/Assets/Plugins/ResponseData.cs.meta +++ b/Assets/Adjust/Unity/AdjustEnvironment.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1fe8ce8e9e4104c23a48818dfcf76d2d +guid: 633f6fa279b2244fdb999db0441f9aac MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Adjust/Unity/AdjustEvent.cs b/Assets/Adjust/Unity/AdjustEvent.cs new file mode 100644 index 00000000..36868318 --- /dev/null +++ b/Assets/Adjust/Unity/AdjustEvent.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; + +namespace com.adjust.sdk +{ + public class AdjustEvent + { + internal double? revenue; + + internal string currency; + internal string eventToken; + + internal List partnerList; + internal List callbackList; + + public AdjustEvent(string eventToken) + { + this.eventToken = eventToken; + } + + public void setRevenue(double amount, string currency) + { + this.revenue = amount; + this.currency = currency; + } + + public void addCallbackParameter(string key, string value) + { + if (callbackList == null) { + callbackList = new List(); + } + + callbackList.Add(key); + callbackList.Add(value); + } + + public void addPartnerParameter(string key, string value) + { + if (partnerList == null) { + partnerList = new List(); + } + + partnerList.Add(key); + partnerList.Add(value); + } + } +} diff --git a/Assets/Plugins/WP8/AdjustWP8.cs.meta b/Assets/Adjust/Unity/AdjustEvent.cs.meta similarity index 78% rename from Assets/Plugins/WP8/AdjustWP8.cs.meta rename to Assets/Adjust/Unity/AdjustEvent.cs.meta index 0f5970fb..41ea634b 100644 --- a/Assets/Plugins/WP8/AdjustWP8.cs.meta +++ b/Assets/Adjust/Unity/AdjustEvent.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e26f82b17f0fe0448af9dc0e0e31297f +guid: cd89f7713977f497a862f1a1b6f60933 MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Adjust/Unity/AdjustLogLevel.cs b/Assets/Adjust/Unity/AdjustLogLevel.cs new file mode 100644 index 00000000..ceb7b5dc --- /dev/null +++ b/Assets/Adjust/Unity/AdjustLogLevel.cs @@ -0,0 +1,12 @@ +namespace com.adjust.sdk +{ + public enum AdjustLogLevel + { + Verbose = 1, + Debug, + Info, + Warn, + Error, + Assert + } +} diff --git a/Assets/Adjust/Unity/AdjustLogLevel.cs.meta b/Assets/Adjust/Unity/AdjustLogLevel.cs.meta new file mode 100644 index 00000000..226164e7 --- /dev/null +++ b/Assets/Adjust/Unity/AdjustLogLevel.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 428ab44990df24973902248a9d2b43dd +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Adjust/Unity/IAdjust.cs b/Assets/Adjust/Unity/IAdjust.cs new file mode 100644 index 00000000..6ad30fc4 --- /dev/null +++ b/Assets/Adjust/Unity/IAdjust.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace com.adjust.sdk +{ + public interface IAdjust + { + bool isEnabled(); + + void onPause (); + void onResume(); + void setEnabled(bool enabled); + void setOfflineMode(bool enabled); + void start(AdjustConfig adjustConfig); + void trackEvent (AdjustEvent adjustEvent); + } +} diff --git a/Assets/Plugins/IAdjust.cs.meta b/Assets/Adjust/Unity/IAdjust.cs.meta similarity index 78% rename from Assets/Plugins/IAdjust.cs.meta rename to Assets/Adjust/Unity/IAdjust.cs.meta index 0648103b..5091050a 100644 --- a/Assets/Plugins/IAdjust.cs.meta +++ b/Assets/Adjust/Unity/IAdjust.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f05a13156e4a84829bb65897ef5cbd33 +guid: 181112b821d5345c1a4b9421b53ae39c MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Adjust/iOS.meta b/Assets/Adjust/iOS.meta new file mode 100644 index 00000000..ffde030c --- /dev/null +++ b/Assets/Adjust/iOS.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 079be71ab0f064af09b08d816e8b9f0c +folderAsset: yes +timeCreated: 1433256975 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Adjust/iOS/ADJAttribution.h b/Assets/Adjust/iOS/ADJAttribution.h new file mode 100644 index 00000000..21faee13 --- /dev/null +++ b/Assets/Adjust/iOS/ADJAttribution.h @@ -0,0 +1,43 @@ +// +// ADJAttribution.h +// adjust +// +// Created by Pedro Filipe on 29/10/14. +// Copyright (c) 2014 adjust GmbH. All rights reserved. +// + +#import + +@interface ADJAttribution : NSObject + +// the following attributes are only set when error is nil +// (when activity was tracked successfully and response could be parsed) + +// tracker token of current device +@property (nonatomic, copy) NSString *trackerToken; + +// tracker name of current device +@property (nonatomic, copy) NSString *trackerName; + +// tracker network +@property (nonatomic, copy) NSString *network; + +// tracker campaign +@property (nonatomic, copy) NSString *campaign; + +// tracker adgroup +@property (nonatomic, copy) NSString *adgroup; + +// tracker creative +@property (nonatomic, copy) NSString *creative; + +// tracker click_label +@property (nonatomic, copy) NSString *clickLabel; + +- (BOOL)isEqualToAttribution:(ADJAttribution *)attribution; + ++ (ADJAttribution *)dataWithJsonDict:(NSDictionary *)jsonDict; +- (id)initWithJsonDict:(NSDictionary *)jsonDict; +- (NSDictionary *)dictionary; + +@end diff --git a/Assets/Plugins/Metro/AdjustUnityWS.dll.meta b/Assets/Adjust/iOS/ADJAttribution.h.meta similarity index 56% rename from Assets/Plugins/Metro/AdjustUnityWS.dll.meta rename to Assets/Adjust/iOS/ADJAttribution.h.meta index f47c6497..1d2818dc 100644 --- a/Assets/Plugins/Metro/AdjustUnityWS.dll.meta +++ b/Assets/Adjust/iOS/ADJAttribution.h.meta @@ -1,4 +1,4 @@ fileFormatVersion: 2 -guid: 4a8a5228975b874409389a74e00a6a44 +guid: 7dddf8beb94ee49a7aba11b4e22e059c DefaultImporter: userData: diff --git a/Assets/Adjust/iOS/ADJConfig.h b/Assets/Adjust/iOS/ADJConfig.h new file mode 100644 index 00000000..f9bffae4 --- /dev/null +++ b/Assets/Adjust/iOS/ADJConfig.h @@ -0,0 +1,79 @@ +// +// ADJConfig.h +// adjust +// +// Created by Pedro Filipe on 30/10/14. +// Copyright (c) 2014 adjust GmbH. All rights reserved. +// + +#import +#import "ADJLogger.h" +#import "ADJAttribution.h" + +/** + * Optional delegate that will get informed about tracking results + */ +@protocol AdjustDelegate +@optional + +/** + * Optional delegate method that gets called when the attribution information changed + * + * @param attribution The attribution information. See ADJAttribution for details. + */ +- (void)adjustAttributionChanged:(ADJAttribution *)attribution; + +@end + +@interface ADJConfig : NSObject + +@property (nonatomic, copy, readonly) NSString *appToken; +@property (nonatomic, assign) ADJLogLevel logLevel; +@property (nonatomic, copy, readonly) NSString *environment; +@property (nonatomic, copy) NSString *sdkPrefix; +@property (nonatomic, copy) NSString *defaultTracker; + +/** + * Configuration object for the initialization of the Adjust SDK. + * + * @param appToken The App Token of your app. This unique identifier can + * be found it in your dashboard at http://adjust.com and should always + * be 12 characters long. + * @param environment The current environment your app. We use this environment to + * distinguish between real traffic and artificial traffic from test devices. + * It is very important that you keep this value meaningful at all times! + * Especially if you are tracking revenue. + */ ++ (ADJConfig*)configWithAppToken:(NSString *)appToken environment:(NSString *)environment; +- (id)initWithAppToken:(NSString *)appToken environment:(NSString *)environment; + +/** + * Enable event buffering if your app triggers a lot of events. + * When enabled, events get buffered and only get tracked each + * minute. Buffered events are still persisted, of course. + * + * @param eventBufferingEnabled Enable or disable event buffering + */ +@property (nonatomic, assign) BOOL eventBufferingEnabled; + +/** + * Disable macMd5 tracking if your privacy constraints require it. + * + * @param macMd5TrackingEnabled Enable or disable tracking of + * the MD5 hash of the MAC address + */ +@property (nonatomic, assign) BOOL macMd5TrackingEnabled; + +/** + * Set the optional delegate that will inform you about attribution + * + * See the AdjustDelegate declaration above for details + * + * @param delegate The delegate that might implement the optional delegate + * methods like adjustAttributionChanged: + */ +@property (nonatomic, retain) NSObject *delegate; +@property (nonatomic, assign) BOOL hasDelegate; + +- (BOOL) isValid; +@end diff --git a/Assets/Plugins/Metro/AdjustWS.dll.meta b/Assets/Adjust/iOS/ADJConfig.h.meta similarity index 56% rename from Assets/Plugins/Metro/AdjustWS.dll.meta rename to Assets/Adjust/iOS/ADJConfig.h.meta index 84c33b5a..c3c743a6 100644 --- a/Assets/Plugins/Metro/AdjustWS.dll.meta +++ b/Assets/Adjust/iOS/ADJConfig.h.meta @@ -1,4 +1,4 @@ fileFormatVersion: 2 -guid: b8da5b92f8babfe4f872ea873473e5ca +guid: 0c958f3cabffd44b6a58b8e0621ee82e DefaultImporter: userData: diff --git a/Assets/Adjust/iOS/ADJEvent.h b/Assets/Adjust/iOS/ADJEvent.h new file mode 100644 index 00000000..0b4c7cac --- /dev/null +++ b/Assets/Adjust/iOS/ADJEvent.h @@ -0,0 +1,89 @@ +// +// ADJEvent.h +// adjust +// +// Created by Pedro Filipe on 15/10/14. +// Copyright (c) 2014 adjust GmbH. All rights reserved. +// + +#import + +@interface ADJEvent : NSObject + +@property (nonatomic, copy, readonly) NSString* eventToken; +@property (nonatomic, copy, readonly) NSNumber* revenue; +@property (nonatomic, readonly) NSDictionary* callbackParameters; +@property (nonatomic, readonly) NSDictionary* partnerParameters; +@property (nonatomic, copy, readonly) NSString* transactionId; +@property (nonatomic, copy, readonly) NSString* currency; +@property (nonatomic, copy, readonly) NSData* receipt; +@property (nonatomic, assign, readonly) BOOL emptyReceipt; + +/** + * Create Event object with Event Token. + * + * @param event Event token that is created in the dashboard + * at http://adjust.com and should be six characters long. + */ ++ (ADJEvent *)eventWithEventToken:(NSString *)eventToken; +- (id) initWithEventToken:(NSString *)eventToken; + +/** + * Add a key-pair to a callback URL. + * + * In your dashboard at http://adjust.com you can assign a callback URL to each + * event type. That URL will get called every time the event is triggered. On + * top of that you can add callback parameters to the following method that + * will be forwarded to these callbacks. + * + * @param key String key in the callback URL. + * @param value String value of the key in the Callback URL. + * + */ +- (void) addCallbackParameter:(NSString *)key + value:(NSString *)value; + +/** + * Add a key-pair to be fowarded to a partner. + * + * @param key String key to be fowarded to the partner + * @param value String value of the key to be fowarded to the partner + * + */ +- (void) addPartnerParameter:(NSString *)key + value:(NSString *)value; + +/** + * Set the revenue and associated currency of the event. + * + * The event can contain some revenue. The amount revenue is measured in units. + * It must include a currency in the ISO 4217 format. + * + * @param amount The amount in units (example: for 1.50 EUR is 1.5) + * @param currency String of the currency with ISO 4217 format. + * It should be 3 characters long (example: for 1.50 EUR is @"EUR") + */ +- (void) setRevenue:(double)amount currency:(NSString *)currency; + +/** + * Set the transaction ID of a In-App Purchases to avoid revenue duplications. + * + * A transaction ID can be used to avoid duplicate revenue events. The last ten + * transaction identifiers are remembered. + * + * @param transactionId The identifier used to avoid duplicate revenue events + */ +- (void) setTransactionId:(NSString *)transactionId; + +- (BOOL) isValid; + +/** + * + * Validate a in-app-purchase receipt. + * + * @param receipt The receipt to validate + * @param transactionId The identifier used to validate the receipt and to avoid duplicate revenue events + */ +- (void) setReceipt:(NSData *)receipt transactionId:(NSString *)transactionId; + +@end diff --git a/Assets/Plugins/Android/AdjustUnity.jar.meta b/Assets/Adjust/iOS/ADJEvent.h.meta similarity index 56% rename from Assets/Plugins/Android/AdjustUnity.jar.meta rename to Assets/Adjust/iOS/ADJEvent.h.meta index c8d2ab02..c9d73100 100644 --- a/Assets/Plugins/Android/AdjustUnity.jar.meta +++ b/Assets/Adjust/iOS/ADJEvent.h.meta @@ -1,4 +1,4 @@ fileFormatVersion: 2 -guid: 265755d3ef5ad41fbafbee2033f7f918 +guid: 426362cccd2154c908b504e138832851 DefaultImporter: userData: diff --git a/Assets/Plugins/iOS/AILogger.h b/Assets/Adjust/iOS/ADJLogger.h similarity index 57% rename from Assets/Plugins/iOS/AILogger.h rename to Assets/Adjust/iOS/ADJLogger.h index 6ad221b0..ea003c72 100644 --- a/Assets/Plugins/iOS/AILogger.h +++ b/Assets/Adjust/iOS/ADJLogger.h @@ -1,5 +1,5 @@ // -// AILogger.h +// ADJLogger.h // Adjust // // Created by Christian Wellenbrock on 2012-11-15. @@ -8,18 +8,18 @@ #import typedef enum { - AILogLevelVerbose = 1, - AILogLevelDebug = 2, - AILogLevelInfo = 3, - AILogLevelWarn = 4, - AILogLevelError = 5, - AILogLevelAssert = 6 -} AILogLevel; + ADJLogLevelVerbose = 1, + ADJLogLevelDebug = 2, + ADJLogLevelInfo = 3, + ADJLogLevelWarn = 4, + ADJLogLevelError = 5, + ADJLogLevelAssert = 6 +} ADJLogLevel; // A simple logger with multiple log levels. -@protocol AILogger +@protocol ADJLogger -- (void)setLogLevel:(AILogLevel)logLevel; +- (void)setLogLevel:(ADJLogLevel)logLevel; - (void)verbose:(NSString *)message, ...; - (void)debug: (NSString *)message, ...; @@ -30,8 +30,8 @@ typedef enum { @end -@interface AILogger : NSObject +@interface ADJLogger : NSObject -+ (AILogLevel) LogLevelFromString: (NSString *) logLevelString; ++ (ADJLogLevel) LogLevelFromString: (NSString *) logLevelString; @end diff --git a/Assets/Adjust/iOS/ADJLogger.h.meta b/Assets/Adjust/iOS/ADJLogger.h.meta new file mode 100644 index 00000000..63ee71fe --- /dev/null +++ b/Assets/Adjust/iOS/ADJLogger.h.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 79bead718d24d4562b045c8fb25619ab +DefaultImporter: + userData: diff --git a/Assets/Adjust/iOS/Adjust.a b/Assets/Adjust/iOS/Adjust.a new file mode 100644 index 00000000..117a7e9f Binary files /dev/null and b/Assets/Adjust/iOS/Adjust.a differ diff --git a/Assets/Adjust/iOS/Adjust.a.meta b/Assets/Adjust/iOS/Adjust.a.meta new file mode 100644 index 00000000..e080be24 --- /dev/null +++ b/Assets/Adjust/iOS/Adjust.a.meta @@ -0,0 +1,4 @@ +fileFormatVersion: 2 +guid: 1c5c2f163cc994a9aa2dd3144c597855 +DefaultImporter: + userData: diff --git a/Assets/Adjust/iOS/Adjust.h b/Assets/Adjust/iOS/Adjust.h new file mode 100644 index 00000000..3bdcb849 --- /dev/null +++ b/Assets/Adjust/iOS/Adjust.h @@ -0,0 +1,114 @@ +// +// Adjust.h +// Adjust +// +// Created by Christian Wellenbrock on 2012-07-23. +// Copyright (c) 2012-2014 adjust GmbH. All rights reserved. +// + +#import "ADJEvent.h" +#import "ADJAttribution.h" +#import "ADJConfig.h" + +/** + * Constants for our supported tracking environments. + */ +extern NSString * const ADJEnvironmentSandbox; +extern NSString * const ADJEnvironmentProduction; + +/** + * The main interface to Adjust. + * + * Use the methods of this class to tell Adjust about the usage of your app. + * See the README for details. + */ +@interface Adjust : NSObject + +/** + * Tell Adjust that the application did launch. + * + * This is required to initialize Adjust. Call this in the didFinishLaunching + * method of your AppDelegate. + * + * See ADJConfig.h for more configuration options + * + * @param adjustConfig The configuration object that includes the environment + * and the App Token of your app. This unique identifier can + * be found it in your dashboard at http://adjust.com and should always + * be 12 characters long. + */ ++ (void)appDidLaunch:(ADJConfig *)adjustConfig; + +/** + * Tell Adjust that a particular event has happened. + * + * See ADJEvent.h for more event options + * + * @param event The Event object for this kind of event. It needs a event token + * that is created in the dashboard at http://adjust.com and should be six + * characters long. + */ ++ (void)trackEvent:(ADJEvent *)event; + +/** + * Tell adjust that the application resumed. + * + * Only necessary if the native notifications can't be used + */ ++ (void)trackSubsessionStart; + +/** + * Tell adjust that the application paused. + * + * Only necessary if the native notifications can't be used + */ ++ (void)trackSubsessionEnd; + +/** + * Enable or disable the adjust SDK. This setting is saved + * for future sessions + * + * @param enabled The flag to enable or disable the adjust SDK + */ ++ (void)setEnabled:(BOOL)enabled; + +/** + * Check if the SDK is enabled or disabled + */ ++ (BOOL)isEnabled; + +/** + * Read the URL that opened the application to search for + * an adjust deep link + */ ++ (void)appWillOpenUrl:(NSURL *)url; + +/** + * Set the device token used by push notifications + */ ++ (void)setDeviceToken:(NSData *)deviceToken; + +/** + * Enable or disable offline mode. Activities won't be sent + * but they are saved when offline mode is disabled. This + * feature is not saved for future sessions + */ ++ (void)setOfflineMode:(BOOL)enabled; + +/** + * Obtain singleton Adjust object + */ ++ (id)getInstance; + +- (void)appDidLaunch:(ADJConfig *)adjustConfig; +- (void)trackEvent:(ADJEvent *)event; +- (void)trackSubsessionStart; +- (void)trackSubsessionEnd; +- (void)setEnabled:(BOOL)enabled; +- (BOOL)isEnabled; +- (void)appWillOpenUrl:(NSURL *)url; +- (void)setDeviceToken:(NSData *)deviceToken; +- (void)setOfflineMode:(BOOL)enabled; + +@end + diff --git a/Assets/Plugins/iOS/Adjust.h.meta b/Assets/Adjust/iOS/Adjust.h.meta similarity index 100% rename from Assets/Plugins/iOS/Adjust.h.meta rename to Assets/Adjust/iOS/Adjust.h.meta diff --git a/Assets/Plugins/iOS/AdjustUnity.h b/Assets/Adjust/iOS/AdjustUnity.h similarity index 50% rename from Assets/Plugins/iOS/AdjustUnity.h rename to Assets/Adjust/iOS/AdjustUnity.h index cc1dde02..d707cb2b 100644 --- a/Assets/Plugins/iOS/AdjustUnity.h +++ b/Assets/Adjust/iOS/AdjustUnity.h @@ -2,7 +2,6 @@ @interface AdjustUnity : NSObject -- (void)adjustFinishedTrackingWithResponse:(AIResponseData *)responseData; +- (void)adjustAttributionChanged:(ADJAttribution *)attribution; @end - diff --git a/Assets/Plugins/iOS/AdjustUnity.h.meta b/Assets/Adjust/iOS/AdjustUnity.h.meta similarity index 100% rename from Assets/Plugins/iOS/AdjustUnity.h.meta rename to Assets/Adjust/iOS/AdjustUnity.h.meta diff --git a/Assets/Adjust/iOS/AdjustUnity.mm b/Assets/Adjust/iOS/AdjustUnity.mm new file mode 100644 index 00000000..108c799e --- /dev/null +++ b/Assets/Adjust/iOS/AdjustUnity.mm @@ -0,0 +1,154 @@ +#import "AdjustUnity.h" + +#import "ADJEvent.h" +#import "ADJConfig.h" + +@implementation AdjustUnity + +static char *adjustSceneName = nil; +static id adjustUnityInstance = nil; + +- (id) init { + self = [super init]; + return self; +} + +- (void)adjustAttributionChanged:(ADJAttribution *)attribution { + NSDictionary *dicAttribution = [attribution dictionary]; + NSData *dataAttribution = [NSJSONSerialization dataWithJSONObject:dicAttribution options:0 error:nil]; + NSString *stringAttribution = [[NSString alloc] initWithBytes:[dataAttribution bytes] + length:[dataAttribution length] + encoding:NSUTF8StringEncoding]; + + const char* charArrayAttribution = [stringAttribution UTF8String]; + + UnitySendMessage(adjustSceneName, "getNativeMessage", charArrayAttribution); +} + +@end + +// Method for converting JSON stirng parameters into NSArray object. +NSArray* ConvertArrayParameters (const char* cStringJsonArrayParameters) { + if (cStringJsonArrayParameters == NULL) { + return nil; + } + + NSString *stringJsonArrayParameters = [NSString stringWithUTF8String:cStringJsonArrayParameters]; + + NSError *error = nil; + NSArray *arrayParameters = nil; + + + if (stringJsonArrayParameters != nil) { + NSData *dataJson = [stringJsonArrayParameters dataUsingEncoding:NSUTF8StringEncoding]; + arrayParameters = [NSJSONSerialization JSONObjectWithData:dataJson options:0 error:&error]; + } + + if (error != nil) { + NSString *errorMessage = @"Failed to parse json parameters!"; + NSLog(@"%@", errorMessage); + } + + return arrayParameters; +} + +extern "C" +{ + void _AdjustLaunchApp(const char* appToken, const char* environment, const char* sdkPrefix, int logLevel, int eventBuffering, const char* sceneName) { + // Mandatory fields. + NSString *stringSdkPrefix = [NSString stringWithUTF8String:sdkPrefix]; + NSString *stringAppToken = [NSString stringWithUTF8String:appToken]; + NSString *stringEnvironment = [NSString stringWithUTF8String:environment]; + NSString *stringSceneName = [NSString stringWithUTF8String:sceneName]; + + ADJConfig *adjustConfig = [ADJConfig configWithAppToken:stringAppToken + environment:stringEnvironment]; + + [adjustConfig setSdkPrefix:stringSdkPrefix]; + + // Optional fields. + if (logLevel != -1) { + [adjustConfig setLogLevel:(ADJLogLevel)logLevel]; + } + + if (eventBuffering != -1) { + [adjustConfig setEventBufferingEnabled:(BOOL)eventBuffering]; + } + + if (sceneName != NULL && [stringSceneName length] > 0) { + adjustSceneName = strdup(sceneName); + adjustUnityInstance = [[AdjustUnity alloc] init]; + [adjustConfig setDelegate:adjustUnityInstance]; + } + + NSLog(@"%@, %@, %@, %d, %d, %@", stringAppToken, stringEnvironment, stringSdkPrefix, logLevel, eventBuffering, stringSceneName); + + // Launch adjust instance. + [Adjust appDidLaunch:adjustConfig]; + } + + void _AdjustTrackEvent(const char* eventToken, double revenue, const char* currency, const char* jsonCallbackParameters, const char* jsonPartnerParameters) { + // Mandatory fields. + NSString *stringEventToken = [NSString stringWithUTF8String:eventToken]; + ADJEvent *event = [ADJEvent eventWithEventToken:stringEventToken]; + + // Optional fields. + if (revenue != -1 || currency != NULL) { + NSString *stringCurrency = [NSString stringWithUTF8String:currency]; + [event setRevenue:revenue currency:stringCurrency]; + } + + NSArray *arrayCallbackParameters = ConvertArrayParameters(jsonCallbackParameters); + + if (arrayCallbackParameters != nil) { + int count = [arrayCallbackParameters count]; + + for (int i = 0; i < count;) { + NSString *key = arrayCallbackParameters[i]; + i++; + + NSString *value = arrayCallbackParameters[i]; + i++; + + [event addCallbackParameter:key value:value]; + } + } + + NSArray *arrayPartnerParameters = ConvertArrayParameters(jsonPartnerParameters); + + if (arrayPartnerParameters != nil) { + int count = [arrayPartnerParameters count]; + + for (int i = 0; i < count;) { + NSString *key = arrayPartnerParameters[i]; + i++; + + NSString *value = arrayPartnerParameters[i]; + i++; + + [event addPartnerParameter:key value:value]; + } + } + + [Adjust trackEvent:event]; + } + + void _AdjustSetEnabled(int enabled) { + BOOL bEnabled = (BOOL)enabled; + + [Adjust setEnabled:bEnabled]; + } + + int _AdjustIsEnabled() { + BOOL isEnabled = [Adjust isEnabled]; + int iIsEnabled = (int)isEnabled; + + return iIsEnabled; + } + + void _AdjustSetOfflineMode(int enabled) { + BOOL bEnabled = (BOOL)enabled; + + [Adjust setOfflineMode:bEnabled]; + } +} diff --git a/Assets/Plugins/iOS/AdjustUnity.mm.meta b/Assets/Adjust/iOS/AdjustUnity.mm.meta similarity index 100% rename from Assets/Plugins/iOS/AdjustUnity.mm.meta rename to Assets/Adjust/iOS/AdjustUnity.mm.meta diff --git a/Assets/Adjust/iOS/AdjustiOS.cs b/Assets/Adjust/iOS/AdjustiOS.cs new file mode 100644 index 00000000..08b2e8ec --- /dev/null +++ b/Assets/Adjust/iOS/AdjustiOS.cs @@ -0,0 +1,143 @@ +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +using SimpleJSON; +using UnityEngine; + +namespace com.adjust.sdk +{ +#if UNITY_IOS + public class AdjustiOS : IAdjust + { + #region External methods + + [DllImport ("__Internal")] + private static extern void _AdjustLaunchApp (string appToken, string environment, string sdkPrefix, int logLevel, int eventBuffering, string sceneName); + + [DllImport ("__Internal")] + private static extern void _AdjustTrackEvent (string eventToken, double revenue, string currency, string jsonCallbackParameters, string jsonPartnerParameters); + + [DllImport ("__Internal")] + private static extern void _AdjustSetEnabled (int enabled); + + [DllImport ("__Internal")] + private static extern int _AdjustIsEnabled (); + + [DllImport ("__Internal")] + private static extern void _AdjustSetOfflineMode (int enabled); + + public AdjustiOS () + { + } + + #endregion + + #region Public methods + + public void start (AdjustConfig adjustConfig) + { + string appToken = adjustConfig .appToken; + string sdkPrefix = adjustConfig.sdkPrefix; + string sceneName = adjustConfig.sceneName; + string environment = adjustConfig.environment.ToString ().ToLower (); + + int logLevel = convertLogLevel (adjustConfig.logLevel); + int eventBufferingEnabled = convertBool (adjustConfig.eventBufferingEnabled); + + _AdjustLaunchApp (appToken, environment, sdkPrefix, logLevel, eventBufferingEnabled, sceneName); + } + + public void trackEvent (AdjustEvent adjustEvent) + { + double revenue = convertDouble (adjustEvent.revenue); + + string eventToken = adjustEvent.eventToken; + string currency = adjustEvent.currency; + string stringJsonCallBackParameters = ConvertListToJson (adjustEvent.callbackList); + string stringJsonPartnerParameters = ConvertListToJson (adjustEvent.partnerList); + + _AdjustTrackEvent (eventToken, revenue, currency, stringJsonCallBackParameters, stringJsonPartnerParameters); + } + + public void onPause () + { + + } + + public void onResume () + { + + } + + public void setEnabled (bool enabled) + { + _AdjustSetEnabled (convertBool (enabled)); + } + + public bool isEnabled () + { + var iIsEnabled = _AdjustIsEnabled (); + + return Convert.ToBoolean (iIsEnabled); + } + + public void setOfflineMode (bool enabled) + { + _AdjustSetOfflineMode (convertBool (enabled)); + } + + #endregion + + #region Private and helper methods + + private int convertLogLevel (AdjustLogLevel? logLevel) + { + if (logLevel == null) { + return -1; + } + + return (int)logLevel; + } + + private int convertBool (bool? value) + { + if (value == null) { + return -1; + } + + if (value.Value) { + return 1; + } else { + return 0; + } + } + + private double convertDouble (double? value) + { + if (value == null) { + return -1; + } + + return (double)value; + } + + private string ConvertListToJson (List list) + { + if (list == null) { + return null; + } + + var jsonArray = new JSONArray (); + + foreach (var listItem in list) { + jsonArray.Add (new JSONData (listItem)); + } + + return jsonArray.ToString (); + } + + #endregion + } +#endif +} diff --git a/Assets/Plugins/iOS/AdjustIOS.cs.meta b/Assets/Adjust/iOS/AdjustiOS.cs.meta similarity index 100% rename from Assets/Plugins/iOS/AdjustIOS.cs.meta rename to Assets/Adjust/iOS/AdjustiOS.cs.meta diff --git a/Assets/Editor/AdjustEditor.cs b/Assets/Editor/AdjustEditor.cs index 5f1eeffa..1760a0d0 100644 --- a/Assets/Editor/AdjustEditor.cs +++ b/Assets/Editor/AdjustEditor.cs @@ -1,16 +1,19 @@ -using UnityEngine; -using System.Collections; -using UnityEditor.Callbacks; -using UnityEditor; +using System.Collections; using System.Diagnostics; -public class AdjustEditor : MonoBehaviour { +using UnityEngine; +using UnityEditor; +using UnityEditor.Callbacks; +public class AdjustEditor : MonoBehaviour +{ static string iOSBuildPath = ""; static bool isEnabled = true; + static bool isAdjusted = false; [PostProcessBuild] - public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject) { + public static void OnPostprocessBuild (BuildTarget target, string pathToBuiltProject) + { if (!isEnabled) { return; } @@ -20,17 +23,20 @@ public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProj if (exitCode == -1) { return; } + if (exitCode != 0) { - var errorMessage = GenerateErrorScriptMessage(exitCode); + var errorMessage = GenerateErrorScriptMessage (exitCode); UnityEngine.Debug.LogError ("adjust: " + errorMessage); } } - [MenuItem("Adjust/Fix AndroidManifest.xml")] - static void FixAndroidManifest() { + [MenuItem("Assets/Adjust/Fix AndroidManifest.xml")] + static void FixAndroidManifest () + { #if UNITY_ANDROID var exitCode = RunPostBuildScript (preBuild: true); + if (exitCode == 1) { EditorUtility.DisplayDialog("Adjust", string.Format("AndroidManifest.xml changed or created at {0}/Plugins/Android/ .",Application.dataPath), @@ -46,47 +52,55 @@ static void FixAndroidManifest() { } #else - EditorUtility.DisplayDialog("Adjust", "Option only valid for the Android platform.", "OK"); + EditorUtility.DisplayDialog ("Adjust", "Option only valid for the Android platform.", "OK"); #endif } - [MenuItem("Adjust/Set iOS build path")] - static void SetiOSBuildPath() { + [MenuItem("Assets/Adjust/Set iOS build path")] + static void SetiOSBuildPath () + { #if UNITY_IOS AdjustEditor.iOSBuildPath = EditorUtility.OpenFolderPanel( title: "iOs build path", - folder: EditorUserBuildSettings.GetBuildLocation(BuildTarget.iPhone), + folder: EditorUserBuildSettings.GetBuildLocation(BuildTarget.iOS), defaultName: ""); + if (AdjustEditor.iOSBuildPath == "") { UnityEngine.Debug.Log("iOS build path reset to default path"); } else { UnityEngine.Debug.Log(string.Format("iOS build path: {0}", AdjustEditor.iOSBuildPath)); } #else - EditorUtility.DisplayDialog("Adjust", "Option only valid for the Android platform.", "OK"); + EditorUtility.DisplayDialog ("Adjust", "Option only valid for the Android platform.", "OK"); #endif } - [MenuItem("Adjust/Change post processing status")] - static void ChangePostProcessingStatus() { + [MenuItem("Assets/Adjust/Change post processing status")] + static void ChangePostProcessingStatus () + { isEnabled = !isEnabled; - EditorUtility.DisplayDialog("Adjust", + + EditorUtility.DisplayDialog ("Adjust", "The post processing for adjust is now " + - (isEnabled ? "enabled." : "disabled."), + (isEnabled ? "enabled." : "disabled."), "OK"); } - static int RunPostBuildScript (bool preBuild, string pathToBuiltProject = "") { + static int RunPostBuildScript (bool preBuild, string pathToBuiltProject = "") + { string pathToScript = null; string arguments = null; #if UNITY_ANDROID pathToScript = "/Editor/PostprocessBuildPlayer_AdjustPostBuildAndroid"; arguments = "\"" + Application.dataPath + "\""; - if (preBuild) + + if (preBuild) { arguments = "--pre-build " + arguments; + } #elif UNITY_IOS pathToScript = "/Editor/PostprocessBuildPlayer_AdjustPostBuildiOS"; + if (AdjustEditor.iOSBuildPath == "") { arguments = "\"" + pathToBuiltProject + "\""; } else { @@ -96,16 +110,18 @@ static int RunPostBuildScript (bool preBuild, string pathToBuiltProject = "") { return -1; #endif - Process proc = new Process(); - proc.EnableRaisingEvents=false; + Process proc = new Process (); + proc.EnableRaisingEvents = false; proc.StartInfo.FileName = Application.dataPath + pathToScript; proc.StartInfo.Arguments = arguments; - proc.Start(); - proc.WaitForExit(); + proc.Start (); + proc.WaitForExit (); + return proc.ExitCode; } - static string GenerateErrorScriptMessage(int exitCode) { + static string GenerateErrorScriptMessage (int exitCode) + { #if UNITY_ANDROID if (exitCode == 1) { return "The AndroidManifest.xml file was only changed or created after building the package. " + @@ -118,6 +134,7 @@ static string GenerateErrorScriptMessage(int exitCode) { " Please check the Adjust log file for more information at {0}"; string projectPath = Application.dataPath.Substring (0, Application.dataPath.Length - 7); string logFile = null; + #if UNITY_ANDROID logFile = projectPath + "/AdjustPostBuildAndroidLog.txt"; #elif UNITY_IOS @@ -125,7 +142,7 @@ static string GenerateErrorScriptMessage(int exitCode) { #else return null; #endif - return string.Format(message, logFile); + return string.Format (message, logFile); } return null; diff --git a/Assets/Editor/PostprocessBuildPlayer_AdjustPostBuildAndroid b/Assets/Editor/PostprocessBuildPlayer_AdjustPostBuildAndroid index 02b52396..ae38cba8 100755 --- a/Assets/Editor/PostprocessBuildPlayer_AdjustPostBuildAndroid +++ b/Assets/Editor/PostprocessBuildPlayer_AdjustPostBuildAndroid @@ -21,7 +21,7 @@ def main(): LogFunc = LogInput(fileLog) # get the path of the android plugin folder - android_plugin_path, pre_build = parse_input(LogFunc, parser) + android_plugin_path, adjust_android_path, pre_build = parse_input(LogFunc, parser) # try to open an existing manifest file try: @@ -40,7 +40,7 @@ def main(): LogFunc("Android manifest used in unity did not " + \ "had all the changes adjust SDK needs. " + \ "Please build again the package.") - edited_xml = edit_manifest(LogFunc, mf, check_dic) + edited_xml = edit_manifest(LogFunc, mf, check_dic, android_plugin_path) # write changed xml if edited_xml: with open(manifest_path,'w+') as mf: @@ -54,7 +54,7 @@ def main(): LogFunc("Used default Android manifest file from " + \ "unity. Please build again the package to " + "include the changes for adjust SDK") - copy_adjust_manifest(LogFunc, android_plugin_path) + copy_adjust_manifest(LogFunc, android_plugin_path, adjust_android_path) exit_code = 1 else: LogFunc(ioe) @@ -64,7 +64,7 @@ def main(): # exit with return code for unity sys.exit(exit_code) -def edit_manifest(Log, manifest_file, check_dic): +def edit_manifest(Log, manifest_file, check_dic, android_plugin_path): manifest_xml = check_dic["manifest_xml"] # add the adjust install referrer to the application element @@ -72,7 +72,7 @@ def edit_manifest(Log, manifest_file, check_dic): receiver_string = """ @@ -93,12 +93,18 @@ def edit_manifest(Log, manifest_file, check_dic): manifest_xml.documentElement.appendChild(ip_element) Log("added internet permission") + # if google play services are not included # add the access wifi state permission to the manifest element - if not check_dic["has_wifi_permission"]: - ip_element = manifest_xml.createElement("uses-permission") - ip_element.setAttribute("android:name", "android.permission.ACCESS_WIFI_STATE") - manifest_xml.documentElement.appendChild(ip_element) - Log("added access wifi permission") + # if google play services are included + # don't add + google_play_services_path = os.path.join(android_plugin_path + "google-play-services_lib") + + if not os.path.isdir(google_play_services_path): + if not check_dic["has_wifi_permission"]: + ip_element = manifest_xml.createElement("uses-permission") + ip_element.setAttribute("android:name", "android.permission.ACCESS_WIFI_STATE") + manifest_xml.documentElement.appendChild(ip_element) + Log("added access wifi permission") #Log(manifest_xml.toxml()) return manifest_xml @@ -109,7 +115,7 @@ def check_manifest(Log, manifest_file): #Log(manifest_xml.toxml()) has_adjust_receiver = has_element_attr(manifest_xml, - "receiver", "android:name", "com.adjust.sdk.ReferrerReceiver") + "receiver", "android:name", "com.adjust.sdk.AdjustReferrerReceiver") Log("has adjust install referrer receiver?: {0}", has_adjust_receiver) has_internet_permission = has_element_attr(manifest_xml, @@ -132,9 +138,13 @@ def has_element_attr(xml_dom, tag_name, attr_name, attr_value): return True return False -def copy_adjust_manifest(Log, android_plugin_path): - adjust_manifest_path = os.path.join(android_plugin_path, "AdjustAndroidManifest.xml") +def copy_adjust_manifest(Log, android_plugin_path, adjust_android_path): + adjust_manifest_path = os.path.join(adjust_android_path, "AdjustAndroidManifest.xml") new_manifest_path = os.path.join(android_plugin_path, "AndroidManifest.xml") + + if not os.path.exists(android_plugin_path): + os.makedirs(android_plugin_path) + try: shutil.copyfile(adjust_manifest_path, new_manifest_path) except Exception as e: @@ -154,9 +164,12 @@ def parse_input(Log, parser): assets_path = args.assets_path android_plugin_path = os.path.join(assets_path, "Plugins/Android/") + adjust_android_path = os.path.join(assets_path, "Adjust/Android/"); + Log("Android plugin path: {0}", android_plugin_path) + Log("Android adjust path: {0}", adjust_android_path) - return android_plugin_path, args.pre_build + return android_plugin_path, adjust_android_path, args.pre_build if __name__ == "__main__": main() diff --git a/Assets/Editor/PostprocessBuildPlayer_AdjustPostBuildiOS b/Assets/Editor/PostprocessBuildPlayer_AdjustPostBuildiOS index 5fd37a80..242a30d8 100755 --- a/Assets/Editor/PostprocessBuildPlayer_AdjustPostBuildiOS +++ b/Assets/Editor/PostprocessBuildPlayer_AdjustPostBuildiOS @@ -29,7 +29,7 @@ def main(): # change the Xcode project directly # allow objective-c exceptions - rewrite_unity_xcode_project(LogFunc, unity_xcode_project_path) + # rewrite_unity_xcode_project(LogFunc, unity_xcode_project_path) sys.exit(0) def LogInput(writeObject): @@ -54,38 +54,42 @@ def edit_unity_xcode_project(Log, unity_xcode_project_path, framework_path): # load unity iOS pbxproj project file unity_XcodeProject = XcodeProject.Load(unity_xcode_project_path) - # add adSupport framework to unity + # add adSupport framework to unity if it's not already there unity_XcodeProject.add_file_if_doesnt_exist(framework_path + "AdSupport.framework", tree="SDKROOT", create_build_files=True,weak=True) Log("added adSupport framework") - # add iAd framework to unity + # add iAd framework to unity if it's not already there unity_XcodeProject.add_file_if_doesnt_exist(framework_path + "iAd.framework", tree="SDKROOT", create_build_files=True,weak=True) Log("added iAd framework") + # don't do anything with ARC at the moment # regex for adjust sdk files - re_adjust_files = re.compile(r"AI.*\.m|.*\+AI.*\.m|Adjust\.m|AdjustUnity\.mm") - + # re_adjust_files = re.compile(r"AI.*\.m|.*\+AI.*\.m|Adjust\.m|AdjustUnity\.mm") + # + # # iterate all objects in the unity Xcode iOS project file - for key in unity_XcodeProject.get_ids(): - obj = unity_XcodeProject.get_obj(key) - - name = obj.get('name') - isa = obj.get('isa') - path = obj.get('path') - fileref = obj.get('fileRef') - - #Log("key: {0}, name: {1}, isa: {2}, path: {3}, fileref: {4}", key, name, isa, path, fileref) - - #check if file reference match any adjust file - adjust_file_match = re_adjust_files.match(name if name else "") - if (adjust_file_match): - #Log("file match, group: {0}", adjust_file_match.group()) - # get the build file, from the file reference id - build_files = unity_XcodeProject.get_build_files(key) - for build_file in build_files: - # add the ARC compiler flag to the adjust file if doesn't exist - build_file.add_compiler_flag('-fobjc-arc') - Log("added ARC flag to file {0}", name) + # for key in unity_XcodeProject.get_ids(): + # obj = unity_XcodeProject.get_obj(key) + # + # name = obj.get('name') + # isa = obj.get('isa') + # path = obj.get('path') + # fileref = obj.get('fileRef') + # + # #Log("key: {0}, name: {1}, isa: {2}, path: {3}, fileref: {4}", key, name, isa, path, fileref) + # + # #check if file reference match any adjust file + # adjust_file_match = re_adjust_files.match(name if name else "") + # if (adjust_file_match): + # #Log("file match, group: {0}", adjust_file_match.group()) + # # get the build file, from the file reference id + # build_files = unity_XcodeProject.get_build_files(key) + # for build_file in build_files: + # # add the ARC compiler flag to the adjust file if doesn't exist + # build_file.add_compiler_flag('-fobjc-arc') + # Log("added ARC flag to file {0}", name) + + unity_XcodeProject.add_other_ldflags('-all_load') # save changes unity_XcodeProject.saveFormat3_2() diff --git a/Assets/ExampleGUI/ExampleGUI.cs b/Assets/ExampleGUI/ExampleGUI.cs deleted file mode 100644 index 2902b991..00000000 --- a/Assets/ExampleGUI/ExampleGUI.cs +++ /dev/null @@ -1,78 +0,0 @@ -using UnityEngine; -using System.Collections; -using System.Runtime.InteropServices; -using com.adjust.sdk; - -public class ExampleGUI : MonoBehaviour { - - private int nr_buttons = 5; - private static bool isEnabled = false; - - void OnGUI () { - if (GUI.Button (new Rect (0, Screen.height * 0 / nr_buttons, Screen.width, Screen.height / nr_buttons), - "manual launch")) { - Adjust.appDidLaunch("querty123456", AdjustUtil.AdjustEnvironment.Sandbox, AdjustUtil.LogLevel.Verbose, false); - isEnabled = true; - } - - if (GUI.Button (new Rect (0, Screen.height * 1 / nr_buttons, Screen.width, Screen.height / nr_buttons), - "track Event")) { - Adjust.trackEvent("eve001"); - - var parameters = new System.Collections.Generic.Dictionary (2); - parameters.Add("key", "value"); - parameters.Add("foo", "bar"); - Adjust.trackEvent("eve002", parameters); - } - - if (GUI.Button (new Rect (0, Screen.height * 2 / nr_buttons, Screen.width, Screen.height / nr_buttons), - "track Revenue")) { - Adjust.trackRevenue(3.44); - - Adjust.trackRevenue(3.45, "rev001"); - - var parameters = new System.Collections.Generic.Dictionary (2); - parameters.Add("key", "value"); - parameters.Add("foo", "bar"); - Adjust.trackRevenue(0.1, "rev002", parameters); - } - - if (GUI.Button (new Rect (0, Screen.height * 3 / nr_buttons, Screen.width, Screen.height / nr_buttons), - "callback")) { - Adjust.setResponseDelegate(responseDelegate); - } - - var switch_sdk = isEnabled ? "disable sdk" : "enable sdk"; - if (GUI.Button (new Rect (0, Screen.height * 4 / nr_buttons, Screen.width, Screen.height / nr_buttons), - switch_sdk)) { - isEnabled = !Adjust.isEnabled(); - Adjust.setEnabled(isEnabled); - } - } - - public void responseDelegate (ResponseData responseData) - { - - Debug.Log ("Was success? " + responseData.success); - Debug.Log ("Will retry? " + responseData.willRetry); - - if (!string.IsNullOrEmpty (responseData.activityKindString)) - Debug.Log ("activityKind " + responseData.activityKindString); - if (responseData.trackerName != null) - Debug.Log ("trackerName " + responseData.trackerName); - if (responseData.trackerToken != null) - Debug.Log ("trackerToken " + responseData.trackerToken); - if (responseData.network != null) - Debug.Log ("network " + responseData.network); - if (responseData.campaign != null) - Debug.Log ("campaign " + responseData.campaign); - if (responseData.adgroup != null) - Debug.Log ("adgroup " + responseData.adgroup); - if (responseData.creative != null) - Debug.Log ("creative " + responseData.creative); - if (responseData.error != null) - Debug.Log ("error " + responseData.error); - - } - -} diff --git a/Assets/ExampleGUI/ExampleGUI.unity b/Assets/ExampleGUI/ExampleGUI.unity deleted file mode 100644 index e5942708..00000000 Binary files a/Assets/ExampleGUI/ExampleGUI.unity and /dev/null differ diff --git a/Assets/Plugins.meta b/Assets/Plugins.meta deleted file mode 100644 index e63830cb..00000000 --- a/Assets/Plugins.meta +++ /dev/null @@ -1,5 +0,0 @@ -fileFormatVersion: 2 -guid: 63cb9f542c192440d8470d4f45124558 -folderAsset: yes -DefaultImporter: - userData: diff --git a/Assets/Plugins/AdjustUnityWP.dll b/Assets/Plugins/AdjustUnityWP.dll deleted file mode 100644 index 7d9f3d5d..00000000 Binary files a/Assets/Plugins/AdjustUnityWP.dll and /dev/null differ diff --git a/Assets/Plugins/AdjustUnityWP.dll.meta b/Assets/Plugins/AdjustUnityWP.dll.meta deleted file mode 100644 index 194af12f..00000000 --- a/Assets/Plugins/AdjustUnityWP.dll.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 4efd0ace8df6d1b48b11abd1712ded56 -MonoAssemblyImporter: - serializedVersion: 1 - iconMap: {} - executionOrder: {} - userData: diff --git a/Assets/Plugins/AdjustUnityWS.dll b/Assets/Plugins/AdjustUnityWS.dll deleted file mode 100644 index 2f16068e..00000000 Binary files a/Assets/Plugins/AdjustUnityWS.dll and /dev/null differ diff --git a/Assets/Plugins/AdjustUnityWS.dll.meta b/Assets/Plugins/AdjustUnityWS.dll.meta deleted file mode 100644 index 9b66043e..00000000 --- a/Assets/Plugins/AdjustUnityWS.dll.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: b7807a36d2dd7d944b9bd3741ebcb75b -MonoAssemblyImporter: - serializedVersion: 1 - iconMap: {} - executionOrder: {} - userData: diff --git a/Assets/Plugins/AdjustUtil.cs b/Assets/Plugins/AdjustUtil.cs deleted file mode 100644 index 6a23a80f..00000000 --- a/Assets/Plugins/AdjustUtil.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace com.adjust.sdk { - public class AdjustUtil { - public enum LogLevel { - Verbose = 1, - Debug, - Info, - Warn, - Error, - Assert - } - - public enum AdjustEnvironment { - Sandbox, - Production - } - } -} \ No newline at end of file diff --git a/Assets/Plugins/Android.meta b/Assets/Plugins/Android.meta deleted file mode 100644 index 3aad4398..00000000 --- a/Assets/Plugins/Android.meta +++ /dev/null @@ -1,5 +0,0 @@ -fileFormatVersion: 2 -guid: fd9a67d1d063e4a8ab534d76036b6d93 -folderAsset: yes -DefaultImporter: - userData: diff --git a/Assets/Plugins/Android/AdjustAndroid.cs b/Assets/Plugins/Android/AdjustAndroid.cs deleted file mode 100644 index 7b318e63..00000000 --- a/Assets/Plugins/Android/AdjustAndroid.cs +++ /dev/null @@ -1,105 +0,0 @@ -using UnityEngine; -using System.Collections; -using System.Collections.Generic; -using System; - -namespace com.adjust.sdk { -#if UNITY_ANDROID - public class AdjustAndroid : IAdjust { - - private AndroidJavaClass ajcAdjust; - private AndroidJavaClass ajcAdjustUnity; - private AndroidJavaObject ajoCurrentActivity; - - public AdjustAndroid() { - ajcAdjust = new AndroidJavaClass("com.adjust.sdk.Adjust"); - ajcAdjustUnity = new AndroidJavaClass("com.adjust.sdk.AdjustUnity"); - AndroidJavaClass ajcUnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); - ajoCurrentActivity = ajcUnityPlayer.GetStatic("currentActivity"); - } - - public void appDidLaunch(string appToken, AdjustUtil.AdjustEnvironment environment, string sdkPrefix, AdjustUtil.LogLevel logLevel, bool eventBuffering) { - - string sEnvironment = environment.ToString ().ToLower (); - string sLogLevel = logLevel.ToString ().ToLower (); - - ajcAdjust.CallStatic("appDidLaunch", - ajoCurrentActivity, - appToken, - sEnvironment, - sLogLevel, - eventBuffering); - ajcAdjust.CallStatic("setSdkPrefix",sdkPrefix); - - onResume (); - } - - public void trackEvent(string eventToken, Dictionary parameters = null) { - var javaParameters = ConvertDicToJava (parameters); - ajcAdjust.CallStatic("trackEvent", eventToken, javaParameters); - } - - public void trackRevenue(double cents, string eventToken = null, Dictionary parameters = null) { - var javaParameters = ConvertDicToJava (parameters); - ajcAdjust.CallStatic("trackRevenue", cents, eventToken, javaParameters); - } - - public void onPause() { - ajcAdjust.CallStatic ("onPause"); - } - - public void onResume() { - ajcAdjust.CallStatic("onResume", ajoCurrentActivity); - } - - public void setResponseDelegate(string sceneName) { - ajcAdjustUnity.CallStatic ("setResponseDelegate", sceneName); - } - - public void setResponseDelegateString(Action responseDelegate) { } - - public void setEnabled(bool enabled) { - ajcAdjust.CallStatic ("setEnabled", ConvertBoolToJava(enabled)); - } - - public bool isEnabled() { - var ajo = ajcAdjust.CallStatic ("isEnabled"); - return ConvertBoolFromJava (ajo) ?? false; - } - - private AndroidJavaObject ConvertBoolToJava(bool value) { - AndroidJavaObject javaBool = new AndroidJavaObject ("java.lang.Boolean", value.ToString ().ToLower ()); - return javaBool; - } - - private bool? ConvertBoolFromJava(AndroidJavaObject ajo) { - if (ajo == null) { - return null; - } - var sBool = ajo.Call("toString"); - try { - return Convert.ToBoolean (sBool); - } catch (FormatException) { - return null; - } - } - - private AndroidJavaObject ConvertDicToJava(Dictionary dictonary) - { - if (dictonary == null) { - return null; - } - - AndroidJavaObject javaDic = new AndroidJavaObject("java.util.HashMap", dictonary.Count); - - foreach (var pair in dictonary) { - if (pair.Value != null) { - javaDic.Call("put", pair.Key, pair.Value); - } - } - - return javaDic; - } - } -#endif -} diff --git a/Assets/Plugins/Android/AdjustUnity.jar b/Assets/Plugins/Android/AdjustUnity.jar deleted file mode 100644 index ffeb50a4..00000000 Binary files a/Assets/Plugins/Android/AdjustUnity.jar and /dev/null differ diff --git a/Assets/Plugins/Android/adjust-android-3.6.2.jar b/Assets/Plugins/Android/adjust-android-3.6.2.jar deleted file mode 100644 index 70b0d49f..00000000 Binary files a/Assets/Plugins/Android/adjust-android-3.6.2.jar and /dev/null differ diff --git a/Assets/Plugins/Android/src/Adjust b/Assets/Plugins/Android/src/Adjust deleted file mode 160000 index aeb54a38..00000000 --- a/Assets/Plugins/Android/src/Adjust +++ /dev/null @@ -1 +0,0 @@ -Subproject commit aeb54a38f4adff3671bb800c4654719fceae0336 diff --git a/Assets/Plugins/Android/src/AdjustUnity.jar b/Assets/Plugins/Android/src/AdjustUnity.jar deleted file mode 100644 index ffeb50a4..00000000 Binary files a/Assets/Plugins/Android/src/AdjustUnity.jar and /dev/null differ diff --git a/Assets/Plugins/Android/src/META-INF/MANIFEST.MF b/Assets/Plugins/Android/src/META-INF/MANIFEST.MF deleted file mode 100644 index a1df1310..00000000 --- a/Assets/Plugins/Android/src/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Created-By: 1.6.0_65 (Apple Inc.) - diff --git a/Assets/Plugins/Android/src/com/adjust/sdk/AdjustUnity$1.class b/Assets/Plugins/Android/src/com/adjust/sdk/AdjustUnity$1.class deleted file mode 100644 index baea9fa8..00000000 Binary files a/Assets/Plugins/Android/src/com/adjust/sdk/AdjustUnity$1.class and /dev/null differ diff --git a/Assets/Plugins/Android/src/com/adjust/sdk/AdjustUnity.class b/Assets/Plugins/Android/src/com/adjust/sdk/AdjustUnity.class deleted file mode 100644 index 33b5ee51..00000000 Binary files a/Assets/Plugins/Android/src/com/adjust/sdk/AdjustUnity.class and /dev/null differ diff --git a/Assets/Plugins/Android/src/com/adjust/sdk/AdjustUnity.java b/Assets/Plugins/Android/src/com/adjust/sdk/AdjustUnity.java deleted file mode 100644 index 06fabeff..00000000 --- a/Assets/Plugins/Android/src/com/adjust/sdk/AdjustUnity.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.adjust.sdk; - -import java.util.Map; - -import org.json.JSONObject; - -import com.unity3d.player.UnityPlayer; - -public class AdjustUnity { - - public static void setResponseDelegate(final String sceneName) - { - Adjust.setOnFinishedListener(new OnFinishedListener() { - - @Override - public void onFinishedTracking(ResponseData responseData) { - Map responseDataMap = responseData.toDic(); - JSONObject responseDataJson = new JSONObject(responseDataMap); - UnityPlayer.UnitySendMessage(sceneName, "getNativeMessage", responseDataJson.toString()); - } - }); - } -} diff --git a/Assets/Plugins/Android/src/com/adjust/sdk/adjust.jar b/Assets/Plugins/Android/src/com/adjust/sdk/adjust.jar deleted file mode 100644 index 884d3f7e..00000000 Binary files a/Assets/Plugins/Android/src/com/adjust/sdk/adjust.jar and /dev/null differ diff --git a/Assets/Plugins/Android/src/com/adjust/sdk/android.jar b/Assets/Plugins/Android/src/com/adjust/sdk/android.jar deleted file mode 100644 index 24ae5637..00000000 Binary files a/Assets/Plugins/Android/src/com/adjust/sdk/android.jar and /dev/null differ diff --git a/Assets/Plugins/Android/src/com/adjust/sdk/classes.jar b/Assets/Plugins/Android/src/com/adjust/sdk/classes.jar deleted file mode 100644 index cbf3d630..00000000 Binary files a/Assets/Plugins/Android/src/com/adjust/sdk/classes.jar and /dev/null differ diff --git a/Assets/Plugins/Android/src/com/adjust/sdk/google-play-services.jar b/Assets/Plugins/Android/src/com/adjust/sdk/google-play-services.jar deleted file mode 100644 index 67d56476..00000000 Binary files a/Assets/Plugins/Android/src/com/adjust/sdk/google-play-services.jar and /dev/null differ diff --git a/Assets/Plugins/Android/src/com/adjust/sdk/org.json-20120521.jar b/Assets/Plugins/Android/src/com/adjust/sdk/org.json-20120521.jar deleted file mode 100644 index f11fcd06..00000000 Binary files a/Assets/Plugins/Android/src/com/adjust/sdk/org.json-20120521.jar and /dev/null differ diff --git a/Assets/Plugins/IAdjust.cs b/Assets/Plugins/IAdjust.cs deleted file mode 100644 index 5abdc57a..00000000 --- a/Assets/Plugins/IAdjust.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace com.adjust.sdk -{ - public interface IAdjust - { - void appDidLaunch (string appToken, AdjustUtil.AdjustEnvironment environment, string sdkPrefix, AdjustUtil.LogLevel logLevel, bool eventBuffering); - void trackEvent (string eventToken, Dictionary parameters = null); - void trackRevenue (double cents, string eventToken = null, Dictionary parameters = null); - void onPause (); - void onResume(); - void setResponseDelegate(string sceneName); - void setResponseDelegateString(Action responseDelegate); - void setEnabled(bool enabled); - bool isEnabled(); - } -} \ No newline at end of file diff --git a/Assets/Plugins/Metro.meta b/Assets/Plugins/Metro.meta deleted file mode 100644 index 945943c2..00000000 --- a/Assets/Plugins/Metro.meta +++ /dev/null @@ -1,5 +0,0 @@ -fileFormatVersion: 2 -guid: 98a842fa9a1c1ea418e7e1f4f95a0b66 -folderAsset: yes -DefaultImporter: - userData: diff --git a/Assets/Plugins/Metro/AdjustMetro.cs b/Assets/Plugins/Metro/AdjustMetro.cs deleted file mode 100644 index f3eb707d..00000000 --- a/Assets/Plugins/Metro/AdjustMetro.cs +++ /dev/null @@ -1,48 +0,0 @@ -using UnityEngine; -using AdjustUnityWS; -using System.Collections.Generic; -using System; - -namespace com.adjust.sdk { - - public class AdjustMetro : IAdjust { - - public void appDidLaunch (string appToken, AdjustUtil.AdjustEnvironment environment, string sdkPrefix, AdjustUtil.LogLevel logLevel, bool eventBuffering) - { - string sEnvironment = environment.ToString ().ToLower (); - string sLogLevel = logLevel.ToString ().ToLower (); - - AdjustWS.AppDidLaunch (appToken, sEnvironment, sdkPrefix, sLogLevel, eventBuffering); - } - public void trackEvent (string eventToken, Dictionary parameters = null) - { - AdjustWS.TrackEvent (eventToken, parameters); - } - public void trackRevenue (double cents, string eventToken = null, Dictionary parameters = null) - { - AdjustWS.TrackRevenue (cents, eventToken, parameters); - } - public void onPause () - { - AdjustWS.AppDidDeactivate (); - } - public void onResume () - { - AdjustWS.AppDidActivate (); - } - public void setResponseDelegate (string sceneName) { } - - public void setResponseDelegateString(Action responseDelegate) - { - AdjustWS.SetResponseDelegateString (responseDelegate); - } - public void setEnabled (bool enabled) - { - AdjustWS.SetEnabled (enabled); - } - public bool isEnabled () - { - return AdjustWS.IsEnabled (); - } - } -} diff --git a/Assets/Plugins/Metro/AdjustUnityWS.dll b/Assets/Plugins/Metro/AdjustUnityWS.dll deleted file mode 100644 index 20263af8..00000000 Binary files a/Assets/Plugins/Metro/AdjustUnityWS.dll and /dev/null differ diff --git a/Assets/Plugins/Metro/AdjustWS.dll b/Assets/Plugins/Metro/AdjustWS.dll deleted file mode 100644 index 5b8aa8fe..00000000 Binary files a/Assets/Plugins/Metro/AdjustWS.dll and /dev/null differ diff --git a/Assets/Plugins/Metro/Microsoft.Threading.Tasks.Extensions.dll b/Assets/Plugins/Metro/Microsoft.Threading.Tasks.Extensions.dll deleted file mode 100644 index 4d862e17..00000000 Binary files a/Assets/Plugins/Metro/Microsoft.Threading.Tasks.Extensions.dll and /dev/null differ diff --git a/Assets/Plugins/Metro/Microsoft.Threading.Tasks.Extensions.dll.meta b/Assets/Plugins/Metro/Microsoft.Threading.Tasks.Extensions.dll.meta deleted file mode 100644 index 81cf63fd..00000000 --- a/Assets/Plugins/Metro/Microsoft.Threading.Tasks.Extensions.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 8a8bc84fad70c3a449d8a587e1225c9b -DefaultImporter: - userData: diff --git a/Assets/Plugins/Metro/Microsoft.Threading.Tasks.dll b/Assets/Plugins/Metro/Microsoft.Threading.Tasks.dll deleted file mode 100644 index 8438577c..00000000 Binary files a/Assets/Plugins/Metro/Microsoft.Threading.Tasks.dll and /dev/null differ diff --git a/Assets/Plugins/Metro/Microsoft.Threading.Tasks.dll.meta b/Assets/Plugins/Metro/Microsoft.Threading.Tasks.dll.meta deleted file mode 100644 index 57772e5d..00000000 --- a/Assets/Plugins/Metro/Microsoft.Threading.Tasks.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: a086f0eae682208439ac228cb2ee9933 -DefaultImporter: - userData: diff --git a/Assets/Plugins/Metro/Newtonsoft.Json.dll b/Assets/Plugins/Metro/Newtonsoft.Json.dll deleted file mode 100644 index 32f143a5..00000000 Binary files a/Assets/Plugins/Metro/Newtonsoft.Json.dll and /dev/null differ diff --git a/Assets/Plugins/Metro/Newtonsoft.Json.dll.meta b/Assets/Plugins/Metro/Newtonsoft.Json.dll.meta deleted file mode 100644 index 693ddd43..00000000 --- a/Assets/Plugins/Metro/Newtonsoft.Json.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: a0714f79adc6a7e49a4ed073ec81ebde -DefaultImporter: - userData: diff --git a/Assets/Plugins/Metro/PCLStorage.Abstractions.dll b/Assets/Plugins/Metro/PCLStorage.Abstractions.dll deleted file mode 100644 index e7ab0a59..00000000 Binary files a/Assets/Plugins/Metro/PCLStorage.Abstractions.dll and /dev/null differ diff --git a/Assets/Plugins/Metro/PCLStorage.Abstractions.dll.meta b/Assets/Plugins/Metro/PCLStorage.Abstractions.dll.meta deleted file mode 100644 index 74910868..00000000 --- a/Assets/Plugins/Metro/PCLStorage.Abstractions.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 082a46034a35f77409648554c615c225 -DefaultImporter: - userData: diff --git a/Assets/Plugins/Metro/PCLStorage.dll b/Assets/Plugins/Metro/PCLStorage.dll deleted file mode 100644 index 184ea01e..00000000 Binary files a/Assets/Plugins/Metro/PCLStorage.dll and /dev/null differ diff --git a/Assets/Plugins/Metro/PCLStorage.dll.meta b/Assets/Plugins/Metro/PCLStorage.dll.meta deleted file mode 100644 index 290e39fc..00000000 --- a/Assets/Plugins/Metro/PCLStorage.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 80db7a269330ec6458af39204ad1c7cd -DefaultImporter: - userData: diff --git a/Assets/Plugins/Metro/System.Net.Http.Extensions.dll b/Assets/Plugins/Metro/System.Net.Http.Extensions.dll deleted file mode 100644 index 1aef22e8..00000000 Binary files a/Assets/Plugins/Metro/System.Net.Http.Extensions.dll and /dev/null differ diff --git a/Assets/Plugins/Metro/System.Net.Http.Extensions.dll.meta b/Assets/Plugins/Metro/System.Net.Http.Extensions.dll.meta deleted file mode 100644 index eaaaac72..00000000 --- a/Assets/Plugins/Metro/System.Net.Http.Extensions.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: ef3e9e1366158a04997b88a9b8d50afc -DefaultImporter: - userData: diff --git a/Assets/Plugins/Metro/System.Net.Http.Primitives.dll b/Assets/Plugins/Metro/System.Net.Http.Primitives.dll deleted file mode 100644 index 48679fad..00000000 Binary files a/Assets/Plugins/Metro/System.Net.Http.Primitives.dll and /dev/null differ diff --git a/Assets/Plugins/Metro/System.Net.Http.Primitives.dll.meta b/Assets/Plugins/Metro/System.Net.Http.Primitives.dll.meta deleted file mode 100644 index 0f3b846e..00000000 --- a/Assets/Plugins/Metro/System.Net.Http.Primitives.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 51a999252d44fe9478d511153c00b77b -DefaultImporter: - userData: diff --git a/Assets/Plugins/Metro/WindowsPcl.dll b/Assets/Plugins/Metro/WindowsPcl.dll deleted file mode 100644 index 537c5946..00000000 Binary files a/Assets/Plugins/Metro/WindowsPcl.dll and /dev/null differ diff --git a/Assets/Plugins/Metro/WindowsPcl.dll.meta b/Assets/Plugins/Metro/WindowsPcl.dll.meta deleted file mode 100644 index 38039ed6..00000000 --- a/Assets/Plugins/Metro/WindowsPcl.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: f5a8eddfdee90484db99cc23a0790671 -DefaultImporter: - userData: diff --git a/Assets/Plugins/Metro/WindowsPclNet40.dll b/Assets/Plugins/Metro/WindowsPclNet40.dll deleted file mode 100644 index aa1fdfe2..00000000 Binary files a/Assets/Plugins/Metro/WindowsPclNet40.dll and /dev/null differ diff --git a/Assets/Plugins/Metro/WindowsPclNet40.dll.meta b/Assets/Plugins/Metro/WindowsPclNet40.dll.meta deleted file mode 100644 index 0c73d528..00000000 --- a/Assets/Plugins/Metro/WindowsPclNet40.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 3001d4a3f65f25845bc7509ccfdfb860 -DefaultImporter: - userData: diff --git a/Assets/Plugins/Metro/WindowsUap.dll b/Assets/Plugins/Metro/WindowsUap.dll deleted file mode 100644 index e07d17d0..00000000 Binary files a/Assets/Plugins/Metro/WindowsUap.dll and /dev/null differ diff --git a/Assets/Plugins/Metro/WindowsUap.dll.meta b/Assets/Plugins/Metro/WindowsUap.dll.meta deleted file mode 100644 index b904fc36..00000000 --- a/Assets/Plugins/Metro/WindowsUap.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: f7274f2faceab44468ce45b14ea47911 -DefaultImporter: - userData: diff --git a/Assets/Plugins/Metro/src/AdjustUnityWS/AdjustUnityWS.sln b/Assets/Plugins/Metro/src/AdjustUnityWS/AdjustUnityWS.sln deleted file mode 100644 index 01c49251..00000000 --- a/Assets/Plugins/Metro/src/AdjustUnityWS/AdjustUnityWS.sln +++ /dev/null @@ -1,52 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.21005.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FakeDLL", "FakeDLL\FakeDLL.csproj", "{069404C1-D9D2-4DD4-9A3F-F586F4F2315E}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RealDLL", "RealDLL\RealDLL.csproj", "{C0CC00F7-9B1D-4923-93D5-B9548D8BEF0D}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|ARM = Debug|ARM - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|ARM = Release|ARM - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {069404C1-D9D2-4DD4-9A3F-F586F4F2315E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {069404C1-D9D2-4DD4-9A3F-F586F4F2315E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {069404C1-D9D2-4DD4-9A3F-F586F4F2315E}.Debug|ARM.ActiveCfg = Debug|Any CPU - {069404C1-D9D2-4DD4-9A3F-F586F4F2315E}.Debug|x64.ActiveCfg = Debug|Any CPU - {069404C1-D9D2-4DD4-9A3F-F586F4F2315E}.Debug|x86.ActiveCfg = Debug|Any CPU - {069404C1-D9D2-4DD4-9A3F-F586F4F2315E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {069404C1-D9D2-4DD4-9A3F-F586F4F2315E}.Release|Any CPU.Build.0 = Release|Any CPU - {069404C1-D9D2-4DD4-9A3F-F586F4F2315E}.Release|ARM.ActiveCfg = Release|Any CPU - {069404C1-D9D2-4DD4-9A3F-F586F4F2315E}.Release|x64.ActiveCfg = Release|Any CPU - {069404C1-D9D2-4DD4-9A3F-F586F4F2315E}.Release|x86.ActiveCfg = Release|Any CPU - {C0CC00F7-9B1D-4923-93D5-B9548D8BEF0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C0CC00F7-9B1D-4923-93D5-B9548D8BEF0D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C0CC00F7-9B1D-4923-93D5-B9548D8BEF0D}.Debug|ARM.ActiveCfg = Debug|ARM - {C0CC00F7-9B1D-4923-93D5-B9548D8BEF0D}.Debug|ARM.Build.0 = Debug|ARM - {C0CC00F7-9B1D-4923-93D5-B9548D8BEF0D}.Debug|x64.ActiveCfg = Debug|x64 - {C0CC00F7-9B1D-4923-93D5-B9548D8BEF0D}.Debug|x64.Build.0 = Debug|x64 - {C0CC00F7-9B1D-4923-93D5-B9548D8BEF0D}.Debug|x86.ActiveCfg = Debug|x86 - {C0CC00F7-9B1D-4923-93D5-B9548D8BEF0D}.Debug|x86.Build.0 = Debug|x86 - {C0CC00F7-9B1D-4923-93D5-B9548D8BEF0D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C0CC00F7-9B1D-4923-93D5-B9548D8BEF0D}.Release|Any CPU.Build.0 = Release|Any CPU - {C0CC00F7-9B1D-4923-93D5-B9548D8BEF0D}.Release|ARM.ActiveCfg = Release|ARM - {C0CC00F7-9B1D-4923-93D5-B9548D8BEF0D}.Release|ARM.Build.0 = Release|ARM - {C0CC00F7-9B1D-4923-93D5-B9548D8BEF0D}.Release|x64.ActiveCfg = Release|x64 - {C0CC00F7-9B1D-4923-93D5-B9548D8BEF0D}.Release|x64.Build.0 = Release|x64 - {C0CC00F7-9B1D-4923-93D5-B9548D8BEF0D}.Release|x86.ActiveCfg = Release|x86 - {C0CC00F7-9B1D-4923-93D5-B9548D8BEF0D}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Assets/Plugins/Metro/src/AdjustUnityWS/FakeDLL/AdjustWS.cs b/Assets/Plugins/Metro/src/AdjustUnityWS/FakeDLL/AdjustWS.cs deleted file mode 100644 index b3bf52cb..00000000 --- a/Assets/Plugins/Metro/src/AdjustUnityWS/FakeDLL/AdjustWS.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace AdjustUnityWS -{ - public class AdjustWS - { - public static void AppDidLaunch(string appToken, string sEnvironment, string sdkPrefix, string sLogLevel, bool eventBuffering) { } - - public static void AppDidActivate() { } - - public static void AppDidDeactivate() { } - - public static void TrackEvent(string eventToken, Dictionary callbackParameters = null) { } - - public static void TrackRevenue(double amountInCents, string eventToken = null, Dictionary callbackParameters = null) { } - - public static void SetEnabled(bool enabled) { } - - public static bool IsEnabled() - { - return false; - } - - public static void SetResponseDelegateString(Action responseDelegate) { } - } -} \ No newline at end of file diff --git a/Assets/Plugins/Metro/src/AdjustUnityWS/FakeDLL/FakeDLL.csproj b/Assets/Plugins/Metro/src/AdjustUnityWS/FakeDLL/FakeDLL.csproj deleted file mode 100644 index 096b58b6..00000000 --- a/Assets/Plugins/Metro/src/AdjustUnityWS/FakeDLL/FakeDLL.csproj +++ /dev/null @@ -1,52 +0,0 @@ - - - - - Debug - AnyCPU - {069404C1-D9D2-4DD4-9A3F-F586F4F2315E} - Library - Properties - AdjustUnityWS - AdjustUnityWS - v3.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Assets/Plugins/Metro/src/AdjustUnityWS/FakeDLL/Properties/AssemblyInfo.cs b/Assets/Plugins/Metro/src/AdjustUnityWS/FakeDLL/Properties/AssemblyInfo.cs deleted file mode 100644 index 987c2c16..00000000 --- a/Assets/Plugins/Metro/src/AdjustUnityWS/FakeDLL/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("FakeDLL")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("FakeDLL")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("e980f8d2-5836-47d2-aff2-128f9ffa8cbe")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Assets/Plugins/Metro/src/AdjustUnityWS/RealDLL/AdjustWS.cs b/Assets/Plugins/Metro/src/AdjustUnityWS/RealDLL/AdjustWS.cs deleted file mode 100644 index 02197dec..00000000 --- a/Assets/Plugins/Metro/src/AdjustUnityWS/RealDLL/AdjustWS.cs +++ /dev/null @@ -1,74 +0,0 @@ -using AdjustSdk; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; - -namespace AdjustUnityWS -{ - public class AdjustWS - { - public static void AppDidLaunch(string appToken, string sEnvironment, string sdkPrefix, string sLogLevel, bool eventBuffering) - { - Adjust.AppDidLaunch(appToken); - - if ("sandbox" == sEnvironment) - Adjust.SetEnvironment(AdjustEnvironment.Sandbox); - if ("production" == sEnvironment) - Adjust.SetEnvironment(AdjustEnvironment.Production); - - Adjust.SetSdkPrefix(sdkPrefix); - - var logLevel = AdjustSdk.ActivityKindUtil.FromString(sLogLevel); - Adjust.SetLogLevel((LogLevel)logLevel); - - Adjust.SetEventBufferingEnabled(eventBuffering); - Adjust.SetLogDelegate(msg => System.Diagnostics.Debug.WriteLine(msg)); - } - - public static void AppDidActivate() - { - Adjust.AppDidActivate(); - } - - public static void AppDidDeactivate() - { - Adjust.AppDidDeactivate(); - } - - public static void TrackEvent(string eventToken, Dictionary callbackParameters = null) - { - Adjust.TrackEvent(eventToken, callbackParameters); - } - - public static void TrackRevenue(double amountInCents, string eventToken = null, Dictionary callbackParameters = null) - { - Adjust.TrackRevenue(amountInCents, eventToken, callbackParameters); - } - - public static void SetEnabled(bool enabled) - { - Adjust.SetEnabled(enabled); - } - - public static bool IsEnabled() - { - return Adjust.IsEnabled(); - } - - /// - /// Sets the response delegate that takes a ResponseData from a response delegate that takes a Json string - /// - /// Response delegate that takes a Json string - public static void SetResponseDelegateString(Action responseDelegate) - { - // function to convert a ResponseData object to a Json String - Func convertResponseDataToString = (responseData => JsonConvert.SerializeObject(responseData.ToDic())); - - // Convert the response delegate from taking a string, to taking a ResponseData using a function that converts from ResponseData to string - Action responseDelegateConverted = (responseData => responseDelegate(convertResponseDataToString(responseData))); - - // Sets the converted response delegate that takes the ResponseData - Adjust.SetResponseDelegate(responseDelegateConverted); - } - } -} \ No newline at end of file diff --git a/Assets/Plugins/Metro/src/AdjustUnityWS/RealDLL/Properties/AssemblyInfo.cs b/Assets/Plugins/Metro/src/AdjustUnityWS/RealDLL/Properties/AssemblyInfo.cs deleted file mode 100644 index da87b653..00000000 --- a/Assets/Plugins/Metro/src/AdjustUnityWS/RealDLL/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("RealDLL")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("RealDLL")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: ComVisible(false)] \ No newline at end of file diff --git a/Assets/Plugins/Metro/src/AdjustUnityWS/RealDLL/RealDLL.csproj b/Assets/Plugins/Metro/src/AdjustUnityWS/RealDLL/RealDLL.csproj deleted file mode 100644 index 3345ffda..00000000 --- a/Assets/Plugins/Metro/src/AdjustUnityWS/RealDLL/RealDLL.csproj +++ /dev/null @@ -1,168 +0,0 @@ - - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {C0CC00F7-9B1D-4923-93D5-B9548D8BEF0D} - Library - Properties - AdjustUnityWS - AdjustUnityWS - en-US - 8.1 - 12 - 512 - {BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 40f77ebc - - - true - full - false - bin\Debug\ - DEBUG;TRACE;NETFX_CORE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE;NETFX_CORE - prompt - 4 - - - true - bin\ARM\Debug\ - DEBUG;TRACE;NETFX_CORE - ;2008 - full - ARM - false - prompt - true - - - bin\ARM\Release\ - TRACE;NETFX_CORE - true - ;2008 - pdbonly - ARM - false - prompt - true - - - true - bin\x64\Debug\ - DEBUG;TRACE;NETFX_CORE - ;2008 - full - x64 - false - prompt - true - - - bin\x64\Release\ - TRACE;NETFX_CORE - true - ;2008 - pdbonly - x64 - false - prompt - true - - - true - bin\x86\Debug\ - DEBUG;TRACE;NETFX_CORE - ;2008 - full - x86 - false - prompt - true - - - bin\x86\Release\ - TRACE;NETFX_CORE - true - ;2008 - pdbonly - x86 - false - prompt - true - - - - - - - - - - - - False - ..\packages\Adjust.3.5.0\lib\netcore45\AdjustWS.dll - - - False - ..\packages\Microsoft.Bcl.Async.1.0.168\lib\win8\Microsoft.Threading.Tasks.dll - - - False - ..\packages\Microsoft.Bcl.Async.1.0.168\lib\win8\Microsoft.Threading.Tasks.Extensions.dll - - - False - ..\packages\Newtonsoft.Json.6.0.5\lib\netcore45\Newtonsoft.Json.dll - - - False - ..\packages\PCLStorage.0.9.6\lib\portable-win8+wpa81\PCLStorage.dll - - - False - ..\packages\PCLStorage.0.9.6\lib\portable-win8+wpa81\PCLStorage.Abstractions.dll - - - False - ..\packages\Microsoft.Net.Http.2.2.28\lib\win8\System.Net.Http.Extensions.dll - - - False - ..\packages\Microsoft.Net.Http.2.2.28\lib\win8\System.Net.Http.Primitives.dll - - - False - ..\packages\Adjust.3.5.0\lib\netcore45\WindowsPcl.dll - - - - 12.0 - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - \ No newline at end of file diff --git a/Assets/Plugins/Metro/src/AdjustUnityWS/RealDLL/packages.config b/Assets/Plugins/Metro/src/AdjustUnityWS/RealDLL/packages.config deleted file mode 100644 index fa8970a7..00000000 --- a/Assets/Plugins/Metro/src/AdjustUnityWS/RealDLL/packages.config +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/Assets/Plugins/ResponseData.cs b/Assets/Plugins/ResponseData.cs deleted file mode 100644 index a6304010..00000000 --- a/Assets/Plugins/ResponseData.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using SimpleJSON; -using UnityEngine; - -namespace com.adjust.sdk -{ - public class ResponseData - { - public enum ActivityKind { - UNKNOWN, SESSION, EVENT, REVENUE, REATTRIBUTION - } - - public ActivityKind? activityKind { get; private set; } - public string activityKindString { get; private set; } - public bool? success { get; private set; } - public bool? willRetry { get; private set; } - public string error { get; private set; } - public string trackerToken { get; private set; } - public string trackerName { get; private set; } - public string network { get; private set; } - public string campaign { get; private set; } - public string adgroup { get; private set; } - public string creative { get; private set; } - - public ResponseData(string jsonString) { - var jsonNode = JSON.Parse (jsonString); - - if (jsonNode == null) { - return; - } - - activityKind = ParseActivityKind(getJsonString (jsonNode, "activityKind")); - activityKindString = activityKind.ToString ().ToLower (); - - success = getJsonBool(jsonNode, "success"); - willRetry = getJsonBool(jsonNode, "willRetry"); - - error = getJsonString(jsonNode, "error"); - trackerName = getJsonString(jsonNode, "trackerName"); - trackerToken = getJsonString(jsonNode, "trackerToken"); - network = getJsonString(jsonNode, "network"); - campaign = getJsonString(jsonNode, "campaign"); - adgroup = getJsonString(jsonNode, "adgroup"); - creative = getJsonString(jsonNode, "creative"); - } - - private String getJsonString(JSONNode node, string key) { - var jsonValue = getJsonValue (node, key); - - if (jsonValue == null) - return null; - - return jsonValue.Value; - } - - private bool? getJsonBool(JSONNode node, string key) { - var jsonValue = getJsonValue (node, key); - - if (jsonValue == null) - return null; - - return jsonValue.AsBool; - } - - private JSONNode getJsonValue(JSONNode node, string key) { - if (node == null) - return null; - - var nodeValue = node [key]; - if (nodeValue.GetType() == typeof(JSONLazyCreator)) - return null; - - return nodeValue; - } - - private ActivityKind ParseActivityKind(string sActivityKind) - { - if ("session" == sActivityKind) - return ActivityKind.SESSION; - else if ("event" == sActivityKind) - return ActivityKind.EVENT; - else if ("revenue" == sActivityKind) - return ActivityKind.REVENUE; - else if ("reattribution" == sActivityKind) - return ActivityKind.REATTRIBUTION; - else - return ActivityKind.UNKNOWN; - } - } -} - diff --git a/Assets/Plugins/WP8.meta b/Assets/Plugins/WP8.meta deleted file mode 100644 index e3e89034..00000000 --- a/Assets/Plugins/WP8.meta +++ /dev/null @@ -1,5 +0,0 @@ -fileFormatVersion: 2 -guid: 5981adb58d095ce4b9b7e52a3e342a19 -folderAsset: yes -DefaultImporter: - userData: diff --git a/Assets/Plugins/WP8/AdjustUnityWP.dll b/Assets/Plugins/WP8/AdjustUnityWP.dll deleted file mode 100644 index 24873d30..00000000 Binary files a/Assets/Plugins/WP8/AdjustUnityWP.dll and /dev/null differ diff --git a/Assets/Plugins/WP8/AdjustUnityWP.dll.meta b/Assets/Plugins/WP8/AdjustUnityWP.dll.meta deleted file mode 100644 index 8d45b250..00000000 --- a/Assets/Plugins/WP8/AdjustUnityWP.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 767c3bdc76f3160418b1624245c8df5d -DefaultImporter: - userData: diff --git a/Assets/Plugins/WP8/AdjustWP8.cs b/Assets/Plugins/WP8/AdjustWP8.cs deleted file mode 100644 index 9f6b725a..00000000 --- a/Assets/Plugins/WP8/AdjustWP8.cs +++ /dev/null @@ -1,47 +0,0 @@ -using UnityEngine; -using System.Collections.Generic; -using AdjustUnityWP; -using System; - -namespace com.adjust.sdk { - public class AdjustWP8 : IAdjust { - - public void appDidLaunch (string appToken, AdjustUtil.AdjustEnvironment environment, string sdkPrefix, AdjustUtil.LogLevel logLevel, bool eventBuffering) - { - string sEnvironment = environment.ToString ().ToLower (); - string sLogLevel = logLevel.ToString ().ToLower (); - - AdjustWP.AppDidLaunch (appToken, sEnvironment, sdkPrefix, sLogLevel, eventBuffering); - } - public void trackEvent (string eventToken, Dictionary parameters = null) - { - AdjustWP.TrackEvent (eventToken, parameters); - } - public void trackRevenue (double cents, string eventToken = null, Dictionary parameters = null) - { - AdjustWP.TrackRevenue (cents, eventToken, parameters); - } - public void onPause () - { - AdjustWP.AppDidDeactivate (); - } - public void onResume () - { - AdjustWP.AppDidActivate (); - } - public void setResponseDelegate (string sceneName) { } - - public void setResponseDelegateString(Action responseDelegate) - { - AdjustWP.SetResponseDelegateString (responseDelegate); - } - public void setEnabled (bool enabled) - { - AdjustWP.SetEnabled (enabled); - } - public bool isEnabled () - { - return AdjustWP.IsEnabled (); - } - } -} diff --git a/Assets/Plugins/WP8/AdjustWP80.dll b/Assets/Plugins/WP8/AdjustWP80.dll deleted file mode 100644 index c48d0b87..00000000 Binary files a/Assets/Plugins/WP8/AdjustWP80.dll and /dev/null differ diff --git a/Assets/Plugins/WP8/AdjustWP80.dll.meta b/Assets/Plugins/WP8/AdjustWP80.dll.meta deleted file mode 100644 index b2412d63..00000000 --- a/Assets/Plugins/WP8/AdjustWP80.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: d90659d4f79f649fdbc0577220864091 -DefaultImporter: - userData: diff --git a/Assets/Plugins/WP8/Md5.WP7.dll b/Assets/Plugins/WP8/Md5.WP7.dll deleted file mode 100644 index 71e9f8de..00000000 Binary files a/Assets/Plugins/WP8/Md5.WP7.dll and /dev/null differ diff --git a/Assets/Plugins/WP8/Md5.WP7.dll.meta b/Assets/Plugins/WP8/Md5.WP7.dll.meta deleted file mode 100644 index 1ed5575d..00000000 --- a/Assets/Plugins/WP8/Md5.WP7.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: e79c85e657840d944b384167aefcdb70 -DefaultImporter: - userData: diff --git a/Assets/Plugins/WP8/Microsoft.Threading.Tasks.Extensions.Phone.dll b/Assets/Plugins/WP8/Microsoft.Threading.Tasks.Extensions.Phone.dll deleted file mode 100644 index b9812870..00000000 Binary files a/Assets/Plugins/WP8/Microsoft.Threading.Tasks.Extensions.Phone.dll and /dev/null differ diff --git a/Assets/Plugins/WP8/Microsoft.Threading.Tasks.Extensions.Phone.dll.meta b/Assets/Plugins/WP8/Microsoft.Threading.Tasks.Extensions.Phone.dll.meta deleted file mode 100644 index d404c03e..00000000 --- a/Assets/Plugins/WP8/Microsoft.Threading.Tasks.Extensions.Phone.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 1ac2bc8ce71125a42a4a1a8fb8607478 -DefaultImporter: - userData: diff --git a/Assets/Plugins/WP8/Microsoft.Threading.Tasks.Extensions.dll b/Assets/Plugins/WP8/Microsoft.Threading.Tasks.Extensions.dll deleted file mode 100644 index 4d862e17..00000000 Binary files a/Assets/Plugins/WP8/Microsoft.Threading.Tasks.Extensions.dll and /dev/null differ diff --git a/Assets/Plugins/WP8/Microsoft.Threading.Tasks.Extensions.dll.meta b/Assets/Plugins/WP8/Microsoft.Threading.Tasks.Extensions.dll.meta deleted file mode 100644 index 0a6e6fce..00000000 --- a/Assets/Plugins/WP8/Microsoft.Threading.Tasks.Extensions.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 5a93967acbd2586439bff5dd6485c4d5 -DefaultImporter: - userData: diff --git a/Assets/Plugins/WP8/Microsoft.Threading.Tasks.dll b/Assets/Plugins/WP8/Microsoft.Threading.Tasks.dll deleted file mode 100644 index 8438577c..00000000 Binary files a/Assets/Plugins/WP8/Microsoft.Threading.Tasks.dll and /dev/null differ diff --git a/Assets/Plugins/WP8/Microsoft.Threading.Tasks.dll.meta b/Assets/Plugins/WP8/Microsoft.Threading.Tasks.dll.meta deleted file mode 100644 index a4d6932c..00000000 --- a/Assets/Plugins/WP8/Microsoft.Threading.Tasks.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 9a9a04ce1306cb84bac443955d35462a -DefaultImporter: - userData: diff --git a/Assets/Plugins/WP8/Newtonsoft.Json.dll b/Assets/Plugins/WP8/Newtonsoft.Json.dll deleted file mode 100644 index 8b6147dd..00000000 Binary files a/Assets/Plugins/WP8/Newtonsoft.Json.dll and /dev/null differ diff --git a/Assets/Plugins/WP8/Newtonsoft.Json.dll.meta b/Assets/Plugins/WP8/Newtonsoft.Json.dll.meta deleted file mode 100644 index 2eb0a7ae..00000000 --- a/Assets/Plugins/WP8/Newtonsoft.Json.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 532081630e78d4d49b9e56e37fac2088 -DefaultImporter: - userData: diff --git a/Assets/Plugins/WP8/PCLStorage.Abstractions.dll b/Assets/Plugins/WP8/PCLStorage.Abstractions.dll deleted file mode 100644 index e7ab0a59..00000000 Binary files a/Assets/Plugins/WP8/PCLStorage.Abstractions.dll and /dev/null differ diff --git a/Assets/Plugins/WP8/PCLStorage.Abstractions.dll.meta b/Assets/Plugins/WP8/PCLStorage.Abstractions.dll.meta deleted file mode 100644 index 56ee9b67..00000000 --- a/Assets/Plugins/WP8/PCLStorage.Abstractions.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 929a12650f9aeea41bf2ad9d3126127b -DefaultImporter: - userData: diff --git a/Assets/Plugins/WP8/PCLStorage.dll b/Assets/Plugins/WP8/PCLStorage.dll deleted file mode 100644 index 9e7d728b..00000000 Binary files a/Assets/Plugins/WP8/PCLStorage.dll and /dev/null differ diff --git a/Assets/Plugins/WP8/PCLStorage.dll.meta b/Assets/Plugins/WP8/PCLStorage.dll.meta deleted file mode 100644 index 91258ad9..00000000 --- a/Assets/Plugins/WP8/PCLStorage.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 47a6bb9c9b6897745b6d7295189dbee5 -DefaultImporter: - userData: diff --git a/Assets/Plugins/WP8/System.Net.Http.Extensions.dll b/Assets/Plugins/WP8/System.Net.Http.Extensions.dll deleted file mode 100644 index aecc82ea..00000000 Binary files a/Assets/Plugins/WP8/System.Net.Http.Extensions.dll and /dev/null differ diff --git a/Assets/Plugins/WP8/System.Net.Http.Extensions.dll.meta b/Assets/Plugins/WP8/System.Net.Http.Extensions.dll.meta deleted file mode 100644 index 318744e7..00000000 --- a/Assets/Plugins/WP8/System.Net.Http.Extensions.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 5ab2a21a3432ac649b6aae749d8adddc -DefaultImporter: - userData: diff --git a/Assets/Plugins/WP8/System.Net.Http.Primitives.dll b/Assets/Plugins/WP8/System.Net.Http.Primitives.dll deleted file mode 100644 index 3a26074c..00000000 Binary files a/Assets/Plugins/WP8/System.Net.Http.Primitives.dll and /dev/null differ diff --git a/Assets/Plugins/WP8/System.Net.Http.Primitives.dll.meta b/Assets/Plugins/WP8/System.Net.Http.Primitives.dll.meta deleted file mode 100644 index 806a8a12..00000000 --- a/Assets/Plugins/WP8/System.Net.Http.Primitives.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: e9b61a5cdff53b44aa7d71b9c27a4456 -DefaultImporter: - userData: diff --git a/Assets/Plugins/WP8/System.Net.Http.dll b/Assets/Plugins/WP8/System.Net.Http.dll deleted file mode 100644 index f69b4fc6..00000000 Binary files a/Assets/Plugins/WP8/System.Net.Http.dll and /dev/null differ diff --git a/Assets/Plugins/WP8/System.Net.Http.dll.meta b/Assets/Plugins/WP8/System.Net.Http.dll.meta deleted file mode 100644 index f4f86a41..00000000 --- a/Assets/Plugins/WP8/System.Net.Http.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: f4777f803e4d0db4f97fbf85f4868efa -DefaultImporter: - userData: diff --git a/Assets/Plugins/WP8/WindowsPcl.dll b/Assets/Plugins/WP8/WindowsPcl.dll deleted file mode 100644 index 537c5946..00000000 Binary files a/Assets/Plugins/WP8/WindowsPcl.dll and /dev/null differ diff --git a/Assets/Plugins/WP8/WindowsPcl.dll.meta b/Assets/Plugins/WP8/WindowsPcl.dll.meta deleted file mode 100644 index 74481f5d..00000000 --- a/Assets/Plugins/WP8/WindowsPcl.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 1f1e458f485ac2b4a954b052f2c579ae -DefaultImporter: - userData: diff --git a/Assets/Plugins/WP8/WindowsPclNet40.dll b/Assets/Plugins/WP8/WindowsPclNet40.dll deleted file mode 100644 index aa1fdfe2..00000000 Binary files a/Assets/Plugins/WP8/WindowsPclNet40.dll and /dev/null differ diff --git a/Assets/Plugins/WP8/WindowsPclNet40.dll.meta b/Assets/Plugins/WP8/WindowsPclNet40.dll.meta deleted file mode 100644 index d3bde8b0..00000000 --- a/Assets/Plugins/WP8/WindowsPclNet40.dll.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: c25676faa7b8c2a4f9c622bf3a85a2e9 -DefaultImporter: - userData: diff --git a/Assets/Plugins/WP8/src/AdjustUnityWP/AdjustUnityWP.sln b/Assets/Plugins/WP8/src/AdjustUnityWP/AdjustUnityWP.sln deleted file mode 100644 index eabfd106..00000000 --- a/Assets/Plugins/WP8/src/AdjustUnityWP/AdjustUnityWP.sln +++ /dev/null @@ -1,44 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.21005.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RealDLL", "RealDLL\RealDLL.csproj", "{3CD610A1-5452-4D0A-B855-A68B1C4BE38D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FakeDLL", "FakeDLL\FakeDLL.csproj", "{64CE3F3C-A516-4606-AC29-511556F965D5}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|ARM = Debug|ARM - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|ARM = Release|ARM - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3CD610A1-5452-4D0A-B855-A68B1C4BE38D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3CD610A1-5452-4D0A-B855-A68B1C4BE38D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3CD610A1-5452-4D0A-B855-A68B1C4BE38D}.Debug|ARM.ActiveCfg = Debug|ARM - {3CD610A1-5452-4D0A-B855-A68B1C4BE38D}.Debug|ARM.Build.0 = Debug|ARM - {3CD610A1-5452-4D0A-B855-A68B1C4BE38D}.Debug|x86.ActiveCfg = Debug|x86 - {3CD610A1-5452-4D0A-B855-A68B1C4BE38D}.Debug|x86.Build.0 = Debug|x86 - {3CD610A1-5452-4D0A-B855-A68B1C4BE38D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3CD610A1-5452-4D0A-B855-A68B1C4BE38D}.Release|Any CPU.Build.0 = Release|Any CPU - {3CD610A1-5452-4D0A-B855-A68B1C4BE38D}.Release|ARM.ActiveCfg = Release|ARM - {3CD610A1-5452-4D0A-B855-A68B1C4BE38D}.Release|ARM.Build.0 = Release|ARM - {3CD610A1-5452-4D0A-B855-A68B1C4BE38D}.Release|x86.ActiveCfg = Release|x86 - {3CD610A1-5452-4D0A-B855-A68B1C4BE38D}.Release|x86.Build.0 = Release|x86 - {64CE3F3C-A516-4606-AC29-511556F965D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {64CE3F3C-A516-4606-AC29-511556F965D5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {64CE3F3C-A516-4606-AC29-511556F965D5}.Debug|ARM.ActiveCfg = Debug|Any CPU - {64CE3F3C-A516-4606-AC29-511556F965D5}.Debug|x86.ActiveCfg = Debug|Any CPU - {64CE3F3C-A516-4606-AC29-511556F965D5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {64CE3F3C-A516-4606-AC29-511556F965D5}.Release|Any CPU.Build.0 = Release|Any CPU - {64CE3F3C-A516-4606-AC29-511556F965D5}.Release|ARM.ActiveCfg = Release|Any CPU - {64CE3F3C-A516-4606-AC29-511556F965D5}.Release|x86.ActiveCfg = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Assets/Plugins/WP8/src/AdjustUnityWP/FakeDLL/AdjustWP.cs b/Assets/Plugins/WP8/src/AdjustUnityWP/FakeDLL/AdjustWP.cs deleted file mode 100644 index be6b8594..00000000 --- a/Assets/Plugins/WP8/src/AdjustUnityWP/FakeDLL/AdjustWP.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace AdjustUnityWP -{ - public class AdjustWP - { - public static void AppDidLaunch(string appToken, string sEnvironment, string sdkPrefix, string sLogLevel, bool eventBuffering) { } - - public static void AppDidActivate() { } - - public static void AppDidDeactivate() { } - - public static void TrackEvent(string eventToken, Dictionary callbackParameters = null) { } - - public static void TrackRevenue(double amountInCents, string eventToken = null, Dictionary callbackParameters = null) { } - - public static void SetEnabled(bool enabled) { } - - public static bool IsEnabled() - { - return false; - } - - public static void SetResponseDelegateString(Action responseDelegate) { } - } -} \ No newline at end of file diff --git a/Assets/Plugins/WP8/src/AdjustUnityWP/FakeDLL/FakeDLL.csproj b/Assets/Plugins/WP8/src/AdjustUnityWP/FakeDLL/FakeDLL.csproj deleted file mode 100644 index 2fe8d754..00000000 --- a/Assets/Plugins/WP8/src/AdjustUnityWP/FakeDLL/FakeDLL.csproj +++ /dev/null @@ -1,52 +0,0 @@ - - - - - Debug - AnyCPU - {64CE3F3C-A516-4606-AC29-511556F965D5} - Library - Properties - AdjustUnityWP - AdjustUnityWP - v3.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Assets/Plugins/WP8/src/AdjustUnityWP/FakeDLL/Properties/AssemblyInfo.cs b/Assets/Plugins/WP8/src/AdjustUnityWP/FakeDLL/Properties/AssemblyInfo.cs deleted file mode 100644 index 3c82b6e9..00000000 --- a/Assets/Plugins/WP8/src/AdjustUnityWP/FakeDLL/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("FakeDLL")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("FakeDLL")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("aab95a7a-d872-4c51-b806-41af19eeef74")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Assets/Plugins/WP8/src/AdjustUnityWP/RealDLL/AdjustWP.cs b/Assets/Plugins/WP8/src/AdjustUnityWP/RealDLL/AdjustWP.cs deleted file mode 100644 index 3cf06ad7..00000000 --- a/Assets/Plugins/WP8/src/AdjustUnityWP/RealDLL/AdjustWP.cs +++ /dev/null @@ -1,74 +0,0 @@ -using AdjustSdk; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; - -namespace AdjustUnityWP -{ - public class AdjustWP - { - public static void AppDidLaunch(string appToken, string sEnvironment, string sdkPrefix, string sLogLevel, bool eventBuffering) - { - Adjust.AppDidLaunch(appToken); - - if ("sandbox" == sEnvironment) - Adjust.SetEnvironment(AdjustEnvironment.Sandbox); - if ("production" == sEnvironment) - Adjust.SetEnvironment(AdjustEnvironment.Production); - - Adjust.SetSdkPrefix(sdkPrefix); - - var logLevel = AdjustSdk.ActivityKindUtil.FromString(sLogLevel); - Adjust.SetLogLevel((LogLevel)logLevel); - - Adjust.SetEventBufferingEnabled(eventBuffering); - Adjust.SetLogDelegate(msg => System.Diagnostics.Debug.WriteLine(msg)); - } - - public static void AppDidActivate() - { - Adjust.AppDidActivate(); - } - - public static void AppDidDeactivate() - { - Adjust.AppDidDeactivate(); - } - - public static void TrackEvent(string eventToken, Dictionary callbackParameters = null) - { - Adjust.TrackEvent(eventToken, callbackParameters); - } - - public static void TrackRevenue(double amountInCents, string eventToken = null, Dictionary callbackParameters = null) - { - Adjust.TrackRevenue(amountInCents, eventToken, callbackParameters); - } - - public static void SetEnabled(bool enabled) - { - Adjust.SetEnabled(enabled); - } - - public static bool IsEnabled() - { - return Adjust.IsEnabled(); - } - - /// - /// Sets the response delegate that takes a ResponseData from a response delegate that takes a Json string - /// - /// Response delegate that takes a Json string - public static void SetResponseDelegateString(Action responseDelegate) - { - // function to convert a ResponseData object to a Json String - Func convertResponseDataToString = (responseData => JsonConvert.SerializeObject(responseData.ToDic())); - - // Convert the response delegate from taking a string, to taking a ResponseData using a function that converts from ResponseData to string - Action responseDelegateConverted = (responseData => responseDelegate(convertResponseDataToString(responseData))); - - // Sets the converted response delegate that takes the ResponseData - Adjust.SetResponseDelegate(responseDelegateConverted); - } - } -} \ No newline at end of file diff --git a/Assets/Plugins/WP8/src/AdjustUnityWP/RealDLL/Properties/AssemblyInfo.cs b/Assets/Plugins/WP8/src/AdjustUnityWP/RealDLL/Properties/AssemblyInfo.cs deleted file mode 100644 index 518d1f0a..00000000 --- a/Assets/Plugins/WP8/src/AdjustUnityWP/RealDLL/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Resources; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("RealDLL")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("RealDLL")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("3cd610a1-5452-4d0a-b855-a68b1c4be38d")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: NeutralResourcesLanguageAttribute("en-US")] diff --git a/Assets/Plugins/WP8/src/AdjustUnityWP/RealDLL/RealDLL.csproj b/Assets/Plugins/WP8/src/AdjustUnityWP/RealDLL/RealDLL.csproj deleted file mode 100644 index 1eb8e42f..00000000 --- a/Assets/Plugins/WP8/src/AdjustUnityWP/RealDLL/RealDLL.csproj +++ /dev/null @@ -1,159 +0,0 @@ - - - - Debug - AnyCPU - 10.0.20506 - 2.0 - {3CD610A1-5452-4D0A-B855-A68B1C4BE38D} - {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - AdjustUnityWP - AdjustUnityWP - WindowsPhone - v8.0 - $(TargetFrameworkVersion) - false - true - 11.0 - true - ad77222a - - - true - full - false - Bin\Debug - DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - - - pdbonly - true - Bin\Release - TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - - - true - full - false - Bin\x86\Debug - DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - - - pdbonly - true - Bin\x86\Release - TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - - - true - full - false - Bin\ARM\Debug - DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - - - pdbonly - true - Bin\ARM\Release - TRACE;SILVERLIGHT;WINDOWS_PHONE - true - true - prompt - 4 - - - - - - - - - - - - ..\packages\Adjust.3.5.0\lib\wp8\AdjustWP80.dll - - - ..\packages\Md5.WP7.1.0.3\lib\wp7\Md5.WP7.dll - - - False - ..\packages\Microsoft.Bcl.Async.1.0.168\lib\wp8\Microsoft.Threading.Tasks.dll - - - False - ..\packages\Microsoft.Bcl.Async.1.0.168\lib\wp8\Microsoft.Threading.Tasks.Extensions.dll - - - False - ..\packages\Microsoft.Bcl.Async.1.0.168\lib\wp8\Microsoft.Threading.Tasks.Extensions.Phone.dll - - - False - ..\packages\Newtonsoft.Json.6.0.5\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll - - - False - ..\packages\PCLStorage.0.9.6\lib\wp8\PCLStorage.dll - - - False - ..\packages\PCLStorage.0.9.6\lib\wp8\PCLStorage.Abstractions.dll - - - False - ..\packages\Microsoft.Net.Http.2.2.28\lib\sl4-windowsphone71\System.Net.Http.dll - - - False - ..\packages\Microsoft.Net.Http.2.2.28\lib\sl4-windowsphone71\System.Net.Http.Extensions.dll - - - False - ..\packages\Microsoft.Net.Http.2.2.28\lib\sl4-windowsphone71\System.Net.Http.Primitives.dll - - - False - ..\packages\Adjust.3.5.0\lib\wp8\WindowsPcl.dll - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - \ No newline at end of file diff --git a/Assets/Plugins/WP8/src/AdjustUnityWP/RealDLL/packages.config b/Assets/Plugins/WP8/src/AdjustUnityWP/RealDLL/packages.config deleted file mode 100644 index 7f706143..00000000 --- a/Assets/Plugins/WP8/src/AdjustUnityWP/RealDLL/packages.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/Assets/Plugins/iOS.meta b/Assets/Plugins/iOS.meta deleted file mode 100644 index 684f8f1b..00000000 --- a/Assets/Plugins/iOS.meta +++ /dev/null @@ -1,5 +0,0 @@ -fileFormatVersion: 2 -guid: 90c47f5befda64706afd9da4d2a4b57f -folderAsset: yes -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AIActivityHandler.h b/Assets/Plugins/iOS/AIActivityHandler.h deleted file mode 100644 index 8f72a09f..00000000 --- a/Assets/Plugins/iOS/AIActivityHandler.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// AIActivityHandler.h -// Adjust -// -// Created by Christian Wellenbrock on 2013-07-01. -// Copyright (c) 2013 adjust GmbH. All rights reserved. -// - -#import "Adjust.h" - -@protocol AIActivityHandler - -@property (nonatomic, copy) NSString *environment; -@property (nonatomic, assign) BOOL bufferEvents; -@property (nonatomic, assign) BOOL trackMacMd5; -@property (nonatomic, assign) NSObject *delegate; -@property (nonatomic, assign) BOOL isIad; - -- (id)initWithAppToken:(NSString *)appToken; -- (void)setSdkPrefix:(NSString *)sdkPrefix; - -- (void)trackSubsessionStart; -- (void)trackSubsessionEnd; - -- (void)trackEvent:(NSString *)eventToken - withParameters:(NSDictionary *)parameters; - -- (void)trackRevenue:(double)amount - transactionId:(NSString *)transactionId - forEvent:(NSString *)eventToken - withParameters:(NSDictionary *)parameters; - -- (void)finishedTrackingWithResponse:(AIResponseData *)response deepLink:(NSString *)deepLink; -- (void)setEnabled:(BOOL)enabled; -- (BOOL)isEnabled; -- (void)readOpenUrl:(NSURL*)url; -- (void)savePushToken:(NSData *)pushToken; - -@end - -@interface AIActivityHandler : NSObject - -+ (id)handlerWithAppToken:(NSString *)appToken; - -@end diff --git a/Assets/Plugins/iOS/AIActivityHandler.h.meta b/Assets/Plugins/iOS/AIActivityHandler.h.meta deleted file mode 100644 index 1d966467..00000000 --- a/Assets/Plugins/iOS/AIActivityHandler.h.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 872f21d6d357548dfb7ed6d2e4dc27aa -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AIActivityHandler.m b/Assets/Plugins/iOS/AIActivityHandler.m deleted file mode 100644 index 9afe5db5..00000000 --- a/Assets/Plugins/iOS/AIActivityHandler.m +++ /dev/null @@ -1,612 +0,0 @@ -// -// AIActivityHandler.m -// Adjust -// -// Created by Christian Wellenbrock on 2013-07-01. -// Copyright (c) 2013 adjust GmbH. All rights reserved. -// - -#import "AIActivityPackage.h" -#import "AIActivityHandler.h" -#import "AIActivityState.h" -#import "AIPackageBuilder.h" -#import "AIPackageHandler.h" -#import "AILogger.h" -#import "AITimer.h" -#import "AIUtil.h" -#import "UIDevice+AIAdditions.h" -#import "NSString+AIAdditions.h" -#import "AIAdjustFactory.h" - -static NSString * const kActivityStateFilename = @"AdjustIoActivityState"; -static NSString * const kAdjustPrefix = @"adjust_"; -static const char * const kInternalQueueName = "io.adjust.ActivityQueue"; - -static const uint64_t kTimerInterval = 60 * NSEC_PER_SEC; // 1 minute -static const uint64_t kTimerLeeway = 1 * NSEC_PER_SEC; // 1 second - - -#pragma mark - -@interface AIActivityHandler() - -@property (nonatomic) dispatch_queue_t internalQueue; -@property (nonatomic, retain) id packageHandler; -@property (nonatomic, retain) AIActivityState *activityState; -@property (nonatomic, retain) AITimer *timer; -@property (nonatomic, retain) id logger; - -@property (nonatomic, copy) NSString *appToken; -@property (nonatomic, copy) NSString *macSha1; -@property (nonatomic, copy) NSString *macShortMd5; -@property (nonatomic, copy) NSString *idForAdvertisers; -@property (nonatomic, copy) NSString *fbAttributionId; -@property (nonatomic, copy) NSString *userAgent; -@property (nonatomic, copy) NSString *clientSdk; -@property (nonatomic, assign) BOOL trackingEnabled; -@property (nonatomic, assign) BOOL internalEnabled; -@property (nonatomic, copy) NSString *vendorId; -@property (nonatomic, copy) NSString *pushToken; - -@end - - -#pragma mark - -@implementation AIActivityHandler - -@synthesize environment; -@synthesize bufferEvents; -@synthesize trackMacMd5; -@synthesize delegate; -@synthesize isIad; - -+ (id)handlerWithAppToken:(NSString *)appToken { - return [[AIActivityHandler alloc] initWithAppToken:appToken]; -} - -- (id)initWithAppToken:(NSString *)yourAppToken { - self = [super init]; - if (self == nil) return nil; - - [self addNotificationObserver]; - self.internalQueue = dispatch_queue_create(kInternalQueueName, DISPATCH_QUEUE_SERIAL); - self.clientSdk = AIUtil.clientSdk; - self.logger = AIAdjustFactory.logger; - - // default values - self.environment = @"unknown"; - self.trackMacMd5 = YES; - self.internalEnabled = YES; - - dispatch_async(self.internalQueue, ^{ - [self initInternal:yourAppToken]; - }); - - return self; -} - -- (void)setSdkPrefix:(NSString *)sdkPrefix { - self.clientSdk = [NSString stringWithFormat:@"%@@%@", sdkPrefix, self.clientSdk]; -} - -- (void)trackSubsessionStart { - dispatch_async(self.internalQueue, ^{ - [self startInternal]; - }); -} - -- (void)trackSubsessionEnd { - dispatch_async(self.internalQueue, ^{ - [self endInternal]; - }); -} - -- (void)trackEvent:(NSString *)eventToken - withParameters:(NSDictionary *)parameters -{ - dispatch_async(self.internalQueue, ^{ - [self eventInternal:eventToken parameters:parameters]; - }); -} - -- (void)trackRevenue:(double)amount - transactionId:(NSString *)transactionId - forEvent:(NSString *)eventToken - withParameters:(NSDictionary *)parameters -{ - dispatch_async(self.internalQueue, ^{ - [self revenueInternal:amount transactionId:transactionId event:eventToken parameters:parameters]; - }); -} - -- (void)finishedTrackingWithResponse:(AIResponseData *)response deepLink:(NSString *)deepLink{ - [self runDelegate:response]; - [self launchDeepLink:deepLink]; -} - -- (void)runDelegate:(AIResponseData *)response { - if (![self.delegate respondsToSelector:@selector(adjustFinishedTrackingWithResponse:)]) { - return; - } - if (response == nil) { - return; - } - [self.delegate performSelectorOnMainThread:@selector(adjustFinishedTrackingWithResponse:) - withObject:response waitUntilDone:NO]; - -} - -- (void)launchDeepLink:(NSString *) deepLink{ - if (deepLink == nil) return; - - NSURL* deepLinkUrl = [NSURL URLWithString:deepLink]; - - if (![[UIApplication sharedApplication] - canOpenURL:deepLinkUrl]) { - [self.logger error:@"Unable to open deep link (%@)", deepLink]; - return; - } - - [self.logger info:@"Open deep link (%@)", deepLink]; - - [[UIApplication sharedApplication] openURL:deepLinkUrl]; -} - -- (void)setEnabled:(BOOL)enabled { - self.internalEnabled = enabled; - if ([self checkActivityState:self.activityState]) { - self.activityState.enabled = enabled; - } - if (enabled) { - [self trackSubsessionStart]; - } else { - [self trackSubsessionEnd]; - } -} - -- (BOOL)isEnabled { - if ([self checkActivityState:self.activityState]) { - return self.activityState.enabled; - } else { - return self.internalEnabled; - } -} - -- (void)readOpenUrl:(NSURL*)url { - dispatch_async(self.internalQueue, ^{ - [self readOpenUrlInternal:url]; - }); -} - -- (void)savePushToken:(NSData *)pushToken { - dispatch_async(self.internalQueue, ^{ - [self savePushTokenInternal:pushToken]; - }); -} - -#pragma mark - internal -- (void)initInternal:(NSString *)yourAppToken { - if (![self checkAppTokenNotNil:yourAppToken]) return; - if (![self checkAppTokenLength:yourAppToken]) return; - - NSString *macAddress = UIDevice.currentDevice.aiMacAddress; - NSString *macShort = macAddress.aiRemoveColons; - - self.appToken = yourAppToken; - self.macSha1 = macAddress.aiSha1; - self.macShortMd5 = macShort.aiMd5; - self.trackingEnabled = UIDevice.currentDevice.aiTrackingEnabled; - self.idForAdvertisers = UIDevice.currentDevice.aiIdForAdvertisers; - self.fbAttributionId = UIDevice.currentDevice.aiFbAttributionId; - self.userAgent = AIUtil.userAgent; - self.vendorId = UIDevice.currentDevice.aiVendorId; - - [[UIDevice currentDevice] aiSetIad:self]; - - self.packageHandler = [AIAdjustFactory packageHandlerForActivityHandler:self]; - [self readActivityState]; - - [self startInternal]; -} - -- (void)startInternal { - if (![self checkAppTokenNotNil:self.appToken]) return; - - if (self.activityState != nil - && !self.activityState.enabled) { - return; - } - - [self.packageHandler resumeSending]; - [self startTimer]; - - double now = [NSDate.date timeIntervalSince1970]; - - // very first session - if (self.activityState == nil) { - self.activityState = [[AIActivityState alloc] init]; - self.activityState.sessionCount = 1; // this is the first session - self.activityState.createdAt = now; // starting now - - [self transferSessionPackage]; - [self.activityState resetSessionAttributes:now]; - self.activityState.enabled = self.internalEnabled; - [self writeActivityState]; - [self.logger info:@"First session"]; - return; - } - - double lastInterval = now - self.activityState.lastActivity; - if (lastInterval < 0) { - [self.logger error:@"Time travel!"]; - self.activityState.lastActivity = now; - [self writeActivityState]; - return; - } - - // new session - if (lastInterval > AIAdjustFactory.sessionInterval) { - self.activityState.sessionCount++; - self.activityState.createdAt = now; - self.activityState.lastInterval = lastInterval; - - [self transferSessionPackage]; - [self.activityState resetSessionAttributes:now]; - [self writeActivityState]; - [self.logger debug:@"Session %d", self.activityState.sessionCount]; - return; - } - - // new subsession - if (lastInterval > AIAdjustFactory.subsessionInterval) { - self.activityState.subsessionCount++; - self.activityState.sessionLength += lastInterval; - self.activityState.lastActivity = now; - [self writeActivityState]; - [self.logger info:@"Processed Subsession %d of Session %d", - self.activityState.subsessionCount, - self.activityState.sessionCount]; - } -} - -- (void)endInternal { - if (![self checkAppTokenNotNil:self.appToken]) return; - - [self.packageHandler pauseSending]; - [self stopTimer]; - double now = [NSDate.date timeIntervalSince1970]; - [self updateActivityState:now]; - [self writeActivityState]; -} - -- (void)eventInternal:(NSString *)eventToken - parameters:(NSDictionary *)parameters -{ - if (![self checkAppTokenNotNil:self.appToken]) return; - if (![self checkActivityState:self.activityState]) return; - if (![self checkEventTokenNotNil:eventToken]) return; - if (![self checkEventTokenLength:eventToken]) return; - - if (!self.activityState.enabled) { - return; - } - - AIPackageBuilder *eventBuilder = [[AIPackageBuilder alloc] init]; - eventBuilder.eventToken = eventToken; - eventBuilder.callbackParameters = parameters; - - double now = [NSDate.date timeIntervalSince1970]; - [self updateActivityState:now]; - self.activityState.createdAt = now; - self.activityState.eventCount++; - - [self injectGeneralAttributes:eventBuilder]; - [self.activityState injectEventAttributes:eventBuilder]; - AIActivityPackage *eventPackage = [eventBuilder buildEventPackage]; - [self.packageHandler addPackage:eventPackage]; - - if (self.bufferEvents) { - [self.logger info:@"Buffered event%@", eventPackage.suffix]; - } else { - [self.packageHandler sendFirstPackage]; - } - - [self writeActivityState]; - [self.logger debug:@"Event %d", self.activityState.eventCount]; -} - -- (void)revenueInternal:(double)amount - transactionId:(NSString *)transactionId - event:(NSString *)eventToken - parameters:(NSDictionary *)parameters -{ - if (![self checkAppTokenNotNil:self.appToken]) return; - if (![self checkActivityState:self.activityState]) return; - if (![self checkAmount:amount]) return; - if (![self checkEventTokenLength:eventToken]) return; - if (![self checkTransactionId:transactionId]) return; - - if (!self.activityState.enabled) { - return; - } - - AIPackageBuilder *revenueBuilder = [[AIPackageBuilder alloc] init]; - revenueBuilder.amountInCents = amount; - revenueBuilder.eventToken = eventToken; - revenueBuilder.callbackParameters = parameters; - - double now = [NSDate.date timeIntervalSince1970]; - [self updateActivityState:now]; - self.activityState.createdAt = now; - self.activityState.eventCount++; - - [self injectGeneralAttributes:revenueBuilder]; - [self.activityState injectEventAttributes:revenueBuilder]; - AIActivityPackage *revenuePackage = [revenueBuilder buildRevenuePackage]; - [self.packageHandler addPackage:revenuePackage]; - - if (self.bufferEvents) { - [self.logger info:@"Buffered revenue%@", revenuePackage.suffix]; - } else { - [self.packageHandler sendFirstPackage]; - } - - [self writeActivityState]; - [self.logger debug:@"Event %d (revenue)", self.activityState.eventCount]; -} - -- (void) readOpenUrlInternal:(NSURL *)url { - NSArray* queryArray = [url.query componentsSeparatedByString:@"&"]; - NSMutableDictionary* adjustDeepLinks = [NSMutableDictionary dictionary]; - - for (NSString* fieldValuePair in queryArray) { - NSArray* pairComponents = [fieldValuePair componentsSeparatedByString:@"="]; - if (pairComponents.count != 2) continue; - - NSString* key = [pairComponents objectAtIndex:0]; - if (![key hasPrefix:kAdjustPrefix]) continue; - - NSString* value = [pairComponents objectAtIndex:1]; - if (value.length == 0) continue; - - NSString* keyWOutPrefix = [key substringFromIndex:kAdjustPrefix.length]; - if (keyWOutPrefix.length == 0) continue; - - [adjustDeepLinks setObject:value forKey:keyWOutPrefix]; - } - - if (adjustDeepLinks.count == 0) { - return; - } - - AIPackageBuilder *reattributionBuilder = [[AIPackageBuilder alloc] init]; - reattributionBuilder.deeplinkParameters = adjustDeepLinks; - [self injectGeneralAttributes:reattributionBuilder]; - AIActivityPackage *reattributionPackage = [reattributionBuilder buildReattributionPackage]; - [self.packageHandler addPackage:reattributionPackage]; - [self.packageHandler sendFirstPackage]; - - [self.logger debug:@"Reattribution %@", adjustDeepLinks]; -} - -- (void) savePushTokenInternal:(NSData *)pushToken { - if (pushToken == nil) { - return; - } - - NSString *token = [pushToken.description stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@"<>"]]; - token = [token stringByReplacingOccurrencesOfString:@" " withString:@""]; - - self.pushToken = token; -} - -#pragma mark - private - -// returns whether or not the activity state should be written -- (BOOL)updateActivityState:(double)now { - if (![self checkActivityState:self.activityState]) return NO; - - double lastInterval = now - self.activityState.lastActivity; - if (lastInterval < 0) { - [self.logger error:@"Time travel!"]; - self.activityState.lastActivity = now; - return YES; - } - - // ignore late updates - if (lastInterval > AIAdjustFactory.sessionInterval) return NO; - - self.activityState.sessionLength += lastInterval; - self.activityState.timeSpent += lastInterval; - self.activityState.lastActivity = now; - - return (lastInterval > AIAdjustFactory.subsessionInterval); -} - -- (void)readActivityState { - @try { - NSString *filename = self.activityStateFilename; - id object = [NSKeyedUnarchiver unarchiveObjectWithFile:filename]; - if ([object isKindOfClass:[AIActivityState class]]) { - self.activityState = object; - [self.logger debug:@"Read activity state: %@ uuid:%@", self.activityState, self.activityState.uuid]; - return; - } else if (object == nil) { - [self.logger verbose:@"Activity state file not found"]; - } else { - [self.logger error:@"Failed to read activity state"]; - } - } @catch (NSException *ex ) { - [self.logger error:@"Failed to read activity state (%@)", ex]; - } - - // start with a fresh activity state in case of any exception - self.activityState = nil; -} - -- (void)writeActivityState { - NSString *filename = self.activityStateFilename; - BOOL result = [NSKeyedArchiver archiveRootObject:self.activityState toFile:filename]; - if (result == YES) { - [AIUtil excludeFromBackup:filename]; - [self.logger debug:@"Wrote activity state: %@", self.activityState]; - } else { - [self.logger error:@"Failed to write activity state"]; - } -} - -- (NSString *)activityStateFilename { - NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); - NSString *path = [paths objectAtIndex:0]; - NSString *filename = [path stringByAppendingPathComponent:kActivityStateFilename]; - return filename; -} - -- (void)transferSessionPackage { - AIPackageBuilder *sessionBuilder = [[AIPackageBuilder alloc] init]; - [self injectGeneralAttributes:sessionBuilder]; - [self.activityState injectSessionAttributes:sessionBuilder]; - AIActivityPackage *sessionPackage = [sessionBuilder buildSessionPackage]; - [self.packageHandler addPackage:sessionPackage]; - [self.packageHandler sendFirstPackage]; -} - -- (void)injectGeneralAttributes:(AIPackageBuilder *)builder { - builder.userAgent = self.userAgent; - builder.clientSdk = self.clientSdk; - builder.appToken = self.appToken; - builder.macSha1 = self.macSha1; - builder.trackingEnabled = self.trackingEnabled; - builder.idForAdvertisers = self.idForAdvertisers; - builder.fbAttributionId = self.fbAttributionId; - builder.environment = self.environment; - builder.isIad = self.isIad; - builder.vendorId = self.vendorId; - builder.pushToken = self.pushToken; - - if (self.trackMacMd5) { - builder.macShortMd5 = self.macShortMd5; - } -} - -# pragma mark - timer -- (void)startTimer { - if (self.timer == nil) { - self.timer = [AITimer timerWithInterval:kTimerInterval - leeway:kTimerLeeway - queue:self.internalQueue - block:^{ [self timerFired]; }]; - } - [self.timer resume]; -} - -- (void)stopTimer { - [self.timer suspend]; -} - -- (void)timerFired { - if (self.activityState != nil - && !self.activityState.enabled) { - return; - } - [self.packageHandler sendFirstPackage]; - double now = [NSDate.date timeIntervalSince1970]; - if ([self updateActivityState:now]) { - [self writeActivityState]; - } -} - -#pragma mark - notifications -- (void)addNotificationObserver { - NSNotificationCenter *center = NSNotificationCenter.defaultCenter; - - [center removeObserver:self]; - [center addObserver:self - selector:@selector(trackSubsessionStart) - name:UIApplicationDidBecomeActiveNotification - object:nil]; - - [center addObserver:self - selector:@selector(trackSubsessionEnd) - name:UIApplicationWillResignActiveNotification - object:nil]; - - [center addObserver:self - selector:@selector(removeNotificationObserver) - name:UIApplicationWillTerminateNotification - object:nil]; -} - -- (void)removeNotificationObserver { - [NSNotificationCenter.defaultCenter removeObserver:self]; -} - -#pragma mark - checks -- (BOOL)checkActivityState:(AIActivityState *)activityState { - if (activityState == nil) { - [self.logger error:@"Missing activity state"]; - return NO; - } - return YES; -} - -- (BOOL)checkAppTokenNotNil:(NSString *)appToken { - if (appToken == nil) { - [self.logger error:@"Missing App Token"]; - return NO; - } - return YES; -} - -- (BOOL)checkAppTokenLength:(NSString *)appToken { - if (appToken.length != 12) { - [self.logger error:@"Malformed App Token '%@'", appToken]; - return NO; - } - return YES; -} - -- (BOOL)checkEventTokenNotNil:(NSString *)eventToken { - if (eventToken == nil) { - [self.logger error:@"Missing Event Token"]; - return NO; - } - return YES; -} - -- (BOOL)checkEventTokenLength:(NSString *)eventToken { - if (eventToken == nil) { - return YES; - } - if (eventToken.length != 6) { - [self.logger error:@"Malformed Event Token '%@'", eventToken]; - return NO; - } - return YES; -} - -- (BOOL)checkAmount:(double)amount { - if (amount < 0.0) { - [self.logger error:@"Invalid amount %.1f", amount]; - return NO; - } - return YES; -} - -- (BOOL) checkTransactionId:(NSString *)transactionId { - if (transactionId.length == 0) { - return YES; // no transaction ID given - } - - if ([self.activityState findTransactionId:transactionId]) { - [self.logger info:@"Skipping duplicate transaction ID '%@'", transactionId]; - [self.logger verbose:@"Found transaction ID in %@", self.activityState.transactionIds]; - return NO; // transaction ID found -> used already - } - - [self.activityState addTransactionId:transactionId]; - [self.logger verbose:@"Added transaction ID %@", self.activityState.transactionIds]; - // activity state will get written by caller - return YES; -} - -@end diff --git a/Assets/Plugins/iOS/AIActivityHandler.m.meta b/Assets/Plugins/iOS/AIActivityHandler.m.meta deleted file mode 100644 index 34200ceb..00000000 --- a/Assets/Plugins/iOS/AIActivityHandler.m.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: e405736f98bee43ffa6bfc528236cca1 -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AIActivityKind.h b/Assets/Plugins/iOS/AIActivityKind.h deleted file mode 100644 index 756f7066..00000000 --- a/Assets/Plugins/iOS/AIActivityKind.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// AIActivityKind.h -// Adjust -// -// Created by Christian Wellenbrock on 11.02.14. -// Copyright (c) 2014 adjust GmbH. All rights reserved. -// - -#import - -typedef enum { - AIActivityKindUnknown = 0, - AIActivityKindSession = 1, - AIActivityKindEvent = 2, - AIActivityKindRevenue = 3, - AIActivityKindReattribution = 4, -} AIActivityKind; - -AIActivityKind AIActivityKindFromString(NSString *string); -NSString* AIActivityKindToString(AIActivityKind activityKind); diff --git a/Assets/Plugins/iOS/AIActivityKind.h.meta b/Assets/Plugins/iOS/AIActivityKind.h.meta deleted file mode 100644 index 57aaed5e..00000000 --- a/Assets/Plugins/iOS/AIActivityKind.h.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 15bcc00bc724247cc82ef8591f762dc8 -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AIActivityKind.m b/Assets/Plugins/iOS/AIActivityKind.m deleted file mode 100644 index 5c3f1fee..00000000 --- a/Assets/Plugins/iOS/AIActivityKind.m +++ /dev/null @@ -1,33 +0,0 @@ -// -// AIActivityKind.m -// Adjust -// -// Created by Christian Wellenbrock on 11.02.14. -// Copyright (c) 2014 adjust GmbH. All rights reserved. -// - -#import "AIActivityKind.h" - -AIActivityKind AIActivityKindFromString(NSString *string) { - if ([@"session" isEqualToString:string]) { - return AIActivityKindSession; - } else if ([@"event" isEqualToString:string]) { - return AIActivityKindEvent; - } else if ([@"revenue" isEqualToString:string]) { - return AIActivityKindRevenue; - } else if ([@"reattribution" isEqualToString:string]) { - return AIActivityKindReattribution; - } else { - return AIActivityKindUnknown; - } -} - -NSString* AIActivityKindToString(AIActivityKind activityKind) { - switch (activityKind) { - case AIActivityKindSession: return @"session"; - case AIActivityKindEvent: return @"event"; - case AIActivityKindRevenue: return @"revenue"; - case AIActivityKindReattribution: return @"reattribution"; - case AIActivityKindUnknown: return @"unknown"; - } -} diff --git a/Assets/Plugins/iOS/AIActivityKind.m.meta b/Assets/Plugins/iOS/AIActivityKind.m.meta deleted file mode 100644 index f9126e70..00000000 --- a/Assets/Plugins/iOS/AIActivityKind.m.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 2ffb0ba1ae53a4de88f03204251c68de -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AIActivityPackage.h b/Assets/Plugins/iOS/AIActivityPackage.h deleted file mode 100644 index da36d6d2..00000000 --- a/Assets/Plugins/iOS/AIActivityPackage.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// AIActivityPackage.h -// Adjust -// -// Created by Christian Wellenbrock on 2013-07-03. -// Copyright (c) 2013 adjust GmbH. All rights reserved. -// - -#import "AIActivityKind.h" - -@interface AIActivityPackage : NSObject - -// data -@property (nonatomic, copy) NSString *path; -@property (nonatomic, copy) NSString *userAgent; -@property (nonatomic, copy) NSString *clientSdk; -@property (nonatomic, retain) NSDictionary *parameters; - -// logs -@property (nonatomic, assign) AIActivityKind activityKind; -@property (nonatomic, copy) NSString *suffix; - -- (NSString *)extendedString; -- (NSString *)successMessage; -- (NSString *)failureMessage; - -@end diff --git a/Assets/Plugins/iOS/AIActivityPackage.h.meta b/Assets/Plugins/iOS/AIActivityPackage.h.meta deleted file mode 100644 index 4ee99c08..00000000 --- a/Assets/Plugins/iOS/AIActivityPackage.h.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: c1d57273aea3a450e80f1f04c9beaa83 -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AIActivityPackage.m b/Assets/Plugins/iOS/AIActivityPackage.m deleted file mode 100644 index 3fae228b..00000000 --- a/Assets/Plugins/iOS/AIActivityPackage.m +++ /dev/null @@ -1,78 +0,0 @@ -// -// AIActivityPackage.m -// Adjust -// -// Created by Christian Wellenbrock on 2013-07-03. -// Copyright (c) 2013 adjust GmbH. All rights reserved. -// - -#import "AIActivityPackage.h" -#import "AIActivityKind.h" - -#pragma mark - -@implementation AIActivityPackage - -- (NSString *)description { - return [NSString stringWithFormat:@"%@%@", - AIActivityKindToString(self.activityKind), - self.suffix]; -} - -- (NSString *)extendedString { - NSMutableString *builder = [NSMutableString string]; - [builder appendFormat:@"Path: %@\n", self.path]; - [builder appendFormat:@"UserAgent: %@\n", self.userAgent]; - [builder appendFormat:@"ClientSdk: %@\n", self.clientSdk]; - - if (self.parameters != nil) { - [builder appendFormat:@"Parameters:"]; - for (NSString *key in self.parameters) { - NSString *value = [self.parameters objectForKey:key]; - [builder appendFormat:@"\n\t\t%-16s %@", [key UTF8String], value]; - } - } - - return builder; -} - -- (NSString *)successMessage { - return [NSString stringWithFormat:@"Tracked %@%@", - AIActivityKindToString(self.activityKind), - self.suffix]; -} - -- (NSString *)failureMessage { - return [NSString stringWithFormat:@"Failed to track %@%@", - AIActivityKindToString(self.activityKind), - self.suffix]; -} - -#pragma mark NSCoding -- (id)initWithCoder:(NSCoder *)decoder { - self = [super init]; - if (self == nil) return self; - - self.path = [decoder decodeObjectForKey:@"path"]; - self.userAgent = [decoder decodeObjectForKey:@"userAgent"]; - self.clientSdk = [decoder decodeObjectForKey:@"clientSdk"]; - self.parameters = [decoder decodeObjectForKey:@"parameters"]; - NSString *kindString = [decoder decodeObjectForKey:@"kind"]; - self.suffix = [decoder decodeObjectForKey:@"suffix"]; - - self.activityKind = AIActivityKindFromString(kindString); - - return self; -} - -- (void)encodeWithCoder:(NSCoder *)encoder { - NSString *kindString = AIActivityKindToString(self.activityKind); - - [encoder encodeObject:self.path forKey:@"path"]; - [encoder encodeObject:self.userAgent forKey:@"userAgent"]; - [encoder encodeObject:self.clientSdk forKey:@"clientSdk"]; - [encoder encodeObject:self.parameters forKey:@"parameters"]; - [encoder encodeObject:kindString forKey:@"kind"]; - [encoder encodeObject:self.suffix forKey:@"suffix"]; -} - -@end diff --git a/Assets/Plugins/iOS/AIActivityPackage.m.meta b/Assets/Plugins/iOS/AIActivityPackage.m.meta deleted file mode 100644 index 76b299c9..00000000 --- a/Assets/Plugins/iOS/AIActivityPackage.m.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 5b8fdbed93ac94f26a6689c46c05e72c -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AIActivityState.h b/Assets/Plugins/iOS/AIActivityState.h deleted file mode 100644 index a8ebfd7c..00000000 --- a/Assets/Plugins/iOS/AIActivityState.h +++ /dev/null @@ -1,44 +0,0 @@ -// -// AIActivityState.h -// Adjust -// -// Created by Christian Wellenbrock on 2013-07-02. -// Copyright (c) 2013 adjust GmbH. All rights reserved. -// -#import - -@class AIPackageBuilder; - -@interface AIActivityState : NSObject - -// persistent data -@property (nonatomic, copy) NSString *uuid; -@property (nonatomic, assign) BOOL enabled; - -// global counters -@property (nonatomic, assign) int eventCount; -@property (nonatomic, assign) int sessionCount; - -// session attributes -@property (nonatomic, assign) int subsessionCount; -@property (nonatomic, assign) double sessionLength; // all durations in seconds -@property (nonatomic, assign) double timeSpent; -@property (nonatomic, assign) double lastActivity; // all times in seconds since 1970 -@property (nonatomic, assign) double createdAt; - -// last ten transaction identifiers -@property (nonatomic, retain) NSMutableArray *transactionIds; - -// not persisted, only injected -@property (nonatomic, assign) double lastInterval; - -- (void)resetSessionAttributes:(double)now; - -- (void)injectSessionAttributes:(AIPackageBuilder *)packageBilder; -- (void)injectEventAttributes:(AIPackageBuilder *)packageBilder; - -// transaction ID management -- (void)addTransactionId:(NSString *)transactionId; -- (BOOL)findTransactionId:(NSString *)transactionId; - -@end diff --git a/Assets/Plugins/iOS/AIActivityState.h.meta b/Assets/Plugins/iOS/AIActivityState.h.meta deleted file mode 100644 index 5b8973d7..00000000 --- a/Assets/Plugins/iOS/AIActivityState.h.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: c5eb04e2b95ef4eadae09938166612ca -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AIActivityState.m b/Assets/Plugins/iOS/AIActivityState.m deleted file mode 100644 index b116a51d..00000000 --- a/Assets/Plugins/iOS/AIActivityState.m +++ /dev/null @@ -1,141 +0,0 @@ -// -// AIActivityState.m -// Adjust -// -// Created by Christian Wellenbrock on 2013-07-02. -// Copyright (c) 2013 adjust GmbH. All rights reserved. -// - -#import "AIActivityState.h" -#import "AIPackageBuilder.h" -#import "UIDevice+AIAdditions.h" - - -static const int kTransactionIdCount = 10; - -#pragma mark public implementation -@implementation AIActivityState - -- (id)init { - self = [super init]; - if (self == nil) return nil; - - // create UUID for new devices - self.uuid = [UIDevice.currentDevice aiCreateUuid]; - - self.eventCount = 0; - self.sessionCount = 0; - self.subsessionCount = -1; // -1 means unknown - self.sessionLength = -1; - self.timeSpent = -1; - self.lastActivity = -1; - self.createdAt = -1; - self.lastInterval = -1; - self.transactionIds = [NSMutableArray arrayWithCapacity:kTransactionIdCount]; - self.enabled = YES; - - return self; -} - -- (void)resetSessionAttributes:(double)now { - self.subsessionCount = 1; - self.sessionLength = 0; - self.timeSpent = 0; - self.lastActivity = now; - self.createdAt = -1; - self.lastInterval = -1; -} - -- (void)injectSessionAttributes:(AIPackageBuilder *)builder { - [self injectGeneralAttributes:builder]; - builder.lastInterval = self.lastInterval; -} - -- (void)injectEventAttributes:(AIPackageBuilder *)builder { - [self injectGeneralAttributes:builder]; - builder.eventCount = self.eventCount; -} - -- (void)addTransactionId:(NSString *)transactionId { - if (self.transactionIds == nil) { // create array - self.transactionIds = [NSMutableArray arrayWithCapacity:kTransactionIdCount]; - } - - if (self.transactionIds.count == kTransactionIdCount) { - [self.transactionIds removeObjectAtIndex:0]; // make space - } - - [self.transactionIds addObject:transactionId]; // add new ID -} - -- (BOOL)findTransactionId:(NSString *)transactionId { - return [self.transactionIds containsObject:transactionId]; -} - -- (NSString *)description { - return [NSString stringWithFormat:@"ec:%d sc:%d ssc:%d sl:%.1f ts:%.1f la:%.1f", - self.eventCount, self.sessionCount, self.subsessionCount, self.sessionLength, - self.timeSpent, self.lastActivity]; -} - -#pragma mark NSCoding - -- (id)initWithCoder:(NSCoder *)decoder { - self = [super init]; - if (self == nil) return nil; - - self.eventCount = [decoder decodeIntForKey:@"eventCount"]; - self.sessionCount = [decoder decodeIntForKey:@"sessionCount"]; - self.subsessionCount = [decoder decodeIntForKey:@"subsessionCount"]; - self.sessionLength = [decoder decodeDoubleForKey:@"sessionLength"]; - self.timeSpent = [decoder decodeDoubleForKey:@"timeSpent"]; - self.createdAt = [decoder decodeDoubleForKey:@"createdAt"]; - self.lastActivity = [decoder decodeDoubleForKey:@"lastActivity"]; - self.uuid = [decoder decodeObjectForKey:@"uuid"]; - self.transactionIds = [decoder decodeObjectForKey:@"transactionIds"]; - self.enabled = [decoder decodeBoolForKey:@"enabled"]; - - // create UUID for migrating devices - if (self.uuid == nil) { - self.uuid = [UIDevice.currentDevice aiCreateUuid]; - } - - if (self.transactionIds == nil) { - self.transactionIds = [NSMutableArray arrayWithCapacity:kTransactionIdCount]; - } - - if (![decoder containsValueForKey:@"enabled"]) { - self.enabled = YES; - } - - self.lastInterval = -1; - - return self; -} - -- (void)encodeWithCoder:(NSCoder *)encoder { - [encoder encodeInt:self.eventCount forKey:@"eventCount"]; - [encoder encodeInt:self.sessionCount forKey:@"sessionCount"]; - [encoder encodeInt:self.subsessionCount forKey:@"subsessionCount"]; - [encoder encodeDouble:self.sessionLength forKey:@"sessionLength"]; - [encoder encodeDouble:self.timeSpent forKey:@"timeSpent"]; - [encoder encodeDouble:self.createdAt forKey:@"createdAt"]; - [encoder encodeDouble:self.lastActivity forKey:@"lastActivity"]; - [encoder encodeObject:self.uuid forKey:@"uuid"]; - [encoder encodeObject:self.transactionIds forKey:@"transactionIds"]; - [encoder encodeBool:self.enabled forKey:@"enabled"]; -} - - -#pragma mark private implementation - -- (void)injectGeneralAttributes:(AIPackageBuilder *)builder { - builder.sessionCount = self.sessionCount; - builder.subsessionCount = self.subsessionCount; - builder.sessionLength = self.sessionLength; - builder.timeSpent = self.timeSpent; - builder.createdAt = self.createdAt; - builder.uuid = self.uuid; -} - -@end diff --git a/Assets/Plugins/iOS/AIActivityState.m.meta b/Assets/Plugins/iOS/AIActivityState.m.meta deleted file mode 100644 index 3541232f..00000000 --- a/Assets/Plugins/iOS/AIActivityState.m.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 5ff25937bda664fd5b20f571cb38e442 -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AIAdjustFactory.h b/Assets/Plugins/iOS/AIAdjustFactory.h deleted file mode 100644 index d666b943..00000000 --- a/Assets/Plugins/iOS/AIAdjustFactory.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// AIAdjustFactory.h -// Adjust -// -// Created by Pedro Filipe on 07/02/14. -// Copyright (c) 2014 adjust GmbH. All rights reserved. -// -#import - -@class Adjust; - -@protocol AIPackageHandler; -@protocol AIRequestHandler; -@protocol AIActivityHandler; -@protocol AILogger; - -@interface AIAdjustFactory : NSObject - -+ (id)packageHandlerForActivityHandler:(id)activityHandler; -+ (id)requestHandlerForPackageHandler:(id)packageHandler; -+ (id)activityHandlerWithAppToken:(NSString *)appToken; -+ (id)logger; -+ (double)sessionInterval; -+ (double)subsessionInterval; - -+ (void)setPackageHandler:(id)packageHandler; -+ (void)setRequestHandler:(id)requestHandler; -+ (void)setActivityHandler:(id)activityHandler; -+ (void)setLogger:(id)logger; -+ (void)setSessionInterval:(double)sessionInterval; -+ (void)setSubsessionInterval:(double)subsessionInterval; - -@end diff --git a/Assets/Plugins/iOS/AIAdjustFactory.h.meta b/Assets/Plugins/iOS/AIAdjustFactory.h.meta deleted file mode 100644 index 5db02773..00000000 --- a/Assets/Plugins/iOS/AIAdjustFactory.h.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 05b24977b30c6460e9604834100babfb -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AIAdjustFactory.m b/Assets/Plugins/iOS/AIAdjustFactory.m deleted file mode 100644 index adfbf829..00000000 --- a/Assets/Plugins/iOS/AIAdjustFactory.m +++ /dev/null @@ -1,93 +0,0 @@ -// -// AIAdjustFactory.m -// Adjust -// -// Created by Pedro Filipe on 07/02/14. -// Copyright (c) 2014 adjust GmbH. All rights reserved. -// - -#import "AIAdjustFactory.h" -#import "AIActivityHandler.h" -#import "AIPackageHandler.h" -#import "AIRequestHandler.h" -#import "AILogger.h" - -static id internalPackageHandler = nil; -static id internalRequestHandler = nil; -static id internalActivityHandler = nil; -static id internalLogger = nil; - -static double internalSessionInterval = -1; -static double intervalSubsessionInterval = -1; - -@implementation AIAdjustFactory - -+ (id)packageHandlerForActivityHandler:(id)activityHandler { - if (internalPackageHandler == nil) { - return [AIPackageHandler handlerWithActivityHandler:activityHandler]; - } - - return [internalPackageHandler initWithActivityHandler:activityHandler]; -} - -+ (id)requestHandlerForPackageHandler:(id)packageHandler { - if (internalRequestHandler == nil) { - return [AIRequestHandler handlerWithPackageHandler:packageHandler]; - } - return [internalRequestHandler initWithPackageHandler:packageHandler]; -} - -+ (id)activityHandlerWithAppToken:(NSString *)appToken { - if (internalActivityHandler == nil) { - return [AIActivityHandler handlerWithAppToken:appToken]; - } - return [internalActivityHandler initWithAppToken:appToken]; -} - -+ (id)logger { - if (internalLogger == nil) { - // same instance of logger - internalLogger = [[AILogger alloc] init]; - } - return internalLogger; -} - -+ (double)sessionInterval { - if (internalSessionInterval == -1) { - return 30 * 60; // 30 minutes - } - return internalSessionInterval; -} - -+ (double)subsessionInterval { - if (intervalSubsessionInterval == -1) { - return 1; // 1 second - } - return intervalSubsessionInterval; -} - -+ (void)setPackageHandler:(id)packageHandler { - internalPackageHandler = packageHandler; -} - -+ (void)setRequestHandler:(id)requestHandler { - internalRequestHandler = requestHandler; -} - -+ (void)setActivityHandler:(id)activityHandler { - internalActivityHandler = activityHandler; -} - -+ (void)setLogger:(id)logger { - internalLogger = logger; -} - -+ (void)setSessionInterval:(double)sessionInterval { - internalSessionInterval = sessionInterval; -} - -+ (void)setSubsessionInterval:(double)subsessionInterval { - intervalSubsessionInterval = subsessionInterval; -} - -@end diff --git a/Assets/Plugins/iOS/AIAdjustFactory.m.meta b/Assets/Plugins/iOS/AIAdjustFactory.m.meta deleted file mode 100644 index bef15a11..00000000 --- a/Assets/Plugins/iOS/AIAdjustFactory.m.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 5510a56fbfb0048128f9869bb4d4d5db -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AILogger.h.meta b/Assets/Plugins/iOS/AILogger.h.meta deleted file mode 100644 index 0249dde9..00000000 --- a/Assets/Plugins/iOS/AILogger.h.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 418e939869c0e443893aab9440c7cebb -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AILogger.m b/Assets/Plugins/iOS/AILogger.m deleted file mode 100644 index 4e06b632..00000000 --- a/Assets/Plugins/iOS/AILogger.m +++ /dev/null @@ -1,97 +0,0 @@ -// -// AILogger.m -// Adjust -// -// Created by Christian Wellenbrock on 2012-11-15. -// Copyright (c) 2012-2014 adjust GmbH. All rights reserved. -// - -#import "AILogger.h" - -static NSString * const kLogTag = @"Adjust"; - -@interface AILogger() - -@property (nonatomic, assign) AILogLevel loglevel; - -@end - -#pragma mark - -@implementation AILogger - - -- (void)setLogLevel:(AILogLevel)logLevel { - self.loglevel = logLevel; -} - -- (void)verbose:(NSString *)format, ... { - if (self.loglevel > AILogLevelVerbose) return; - va_list parameters; va_start(parameters, format); - [self logLevel:@"v" format:format parameters:parameters]; -} - -- (void)debug:(NSString *)format, ... { - if (self.loglevel > AILogLevelDebug) return; - va_list parameters; va_start(parameters, format); - [self logLevel:@"d" format:format parameters:parameters]; -} - -- (void)info:(NSString *)format, ... { - if (self.loglevel > AILogLevelInfo) return; - va_list parameters; va_start(parameters, format); - [self logLevel:@"i" format:format parameters:parameters]; -} - -- (void)warn:(NSString *)format, ... { - if (self.loglevel > AILogLevelWarn) return; - va_list parameters; va_start(parameters, format); - [self logLevel:@"w" format:format parameters:parameters]; -} - -- (void)error:(NSString *)format, ... { - if (self.loglevel > AILogLevelError) return; - va_list parameters; va_start(parameters, format); - [self logLevel:@"e" format:format parameters:parameters]; -} - -- (void)assert:(NSString *)format, ... { - if (self.loglevel > AILogLevelAssert) return; - va_list parameters; va_start(parameters, format); - [self logLevel:@"a" format:format parameters:parameters]; -} - -// private implementation -- (void)logLevel:(NSString *)logLevel format:(NSString *)format parameters:(va_list)parameters { - NSString *string = [[NSString alloc] initWithFormat:format arguments:parameters]; - va_end(parameters); - - NSArray *lines = [string componentsSeparatedByString:@"\n"]; - for (NSString *line in lines) { - NSLog(@"\t[%@]%@: %@", kLogTag, logLevel, line); - } -} - -+ (AILogLevel)LogLevelFromString:(NSString *)logLevelString { - if ([logLevelString isEqualToString:@"verbose"]) - return AILogLevelVerbose; - - if ([logLevelString isEqualToString:@"debug"]) - return AILogLevelDebug; - - if ([logLevelString isEqualToString:@"info"]) - return AILogLevelInfo; - - if ([logLevelString isEqualToString:@"warn"]) - return AILogLevelWarn; - - if ([logLevelString isEqualToString:@"error"]) - return AILogLevelError; - - if ([logLevelString isEqualToString:@"assert"]) - return AILogLevelAssert; - - // default value if string does not match - return AILogLevelInfo; -} - -@end diff --git a/Assets/Plugins/iOS/AILogger.m.meta b/Assets/Plugins/iOS/AILogger.m.meta deleted file mode 100644 index 7304bba2..00000000 --- a/Assets/Plugins/iOS/AILogger.m.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: fdfbbf62846a14cb98c7c36487e7b2e4 -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AIPackageBuilder.h b/Assets/Plugins/iOS/AIPackageBuilder.h deleted file mode 100644 index 87268e86..00000000 --- a/Assets/Plugins/iOS/AIPackageBuilder.h +++ /dev/null @@ -1,52 +0,0 @@ -// -// AIPackageBuilder.h -// Adjust -// -// Created by Christian Wellenbrock on 2013-07-03. -// Copyright (c) 2013 adjust GmbH. All rights reserved. -// -#import - -@class AIActivityPackage; - -@interface AIPackageBuilder : NSObject - -// general -@property (nonatomic, copy) NSString *appToken; -@property (nonatomic, copy) NSString *macSha1; -@property (nonatomic, copy) NSString *macShortMd5; -@property (nonatomic, copy) NSString *idForAdvertisers; -@property (nonatomic, copy) NSString *fbAttributionId; -@property (nonatomic, copy) NSString *environment; -@property (nonatomic, copy) NSString *userAgent; -@property (nonatomic, copy) NSString *clientSdk; -@property (nonatomic, copy) NSString *uuid; -@property (nonatomic, assign) BOOL trackingEnabled; -@property (nonatomic, assign) BOOL isIad; -@property (nonatomic, copy) NSString *vendorId; -@property (nonatomic, copy) NSString *pushToken; - -// sessions -@property (nonatomic, assign) int sessionCount; -@property (nonatomic, assign) int subsessionCount; -@property (nonatomic, assign) double createdAt; -@property (nonatomic, assign) double sessionLength; -@property (nonatomic, assign) double timeSpent; -@property (nonatomic, assign) double lastInterval; - -// events -@property (nonatomic, assign) int eventCount; -@property (nonatomic, copy) NSString *eventToken; -@property (nonatomic, copy) NSDictionary *callbackParameters; -@property (nonatomic, assign) double amountInCents; - -// reattributions -@property (nonatomic, copy) NSDictionary* deeplinkParameters; - - -- (AIActivityPackage *)buildSessionPackage; -- (AIActivityPackage *)buildEventPackage; -- (AIActivityPackage *)buildRevenuePackage; -- (AIActivityPackage *)buildReattributionPackage; - -@end diff --git a/Assets/Plugins/iOS/AIPackageBuilder.h.meta b/Assets/Plugins/iOS/AIPackageBuilder.h.meta deleted file mode 100644 index 642025e3..00000000 --- a/Assets/Plugins/iOS/AIPackageBuilder.h.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: a881be96a83c3412aa87f9ff08106d4d -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AIPackageBuilder.m b/Assets/Plugins/iOS/AIPackageBuilder.m deleted file mode 100644 index 8f58855c..00000000 --- a/Assets/Plugins/iOS/AIPackageBuilder.m +++ /dev/null @@ -1,181 +0,0 @@ -// -// AIPackageBuilder.m -// Adjust -// -// Created by Christian Wellenbrock on 2013-07-03. -// Copyright (c) 2013 adjust GmbH. All rights reserved. -// - -#import "AIPackageBuilder.h" -#import "AIActivityPackage.h" -#import "NSData+AIAdditions.h" -#import "AIUtil.h" - -#pragma mark - -@implementation AIPackageBuilder - -- (AIActivityPackage *)buildSessionPackage { - NSMutableDictionary *parameters = [self defaultParameters]; - [self parameters:parameters setDuration:self.lastInterval forKey:@"last_interval"]; - - AIActivityPackage *sessionPackage = [self defaultActivityPackage]; - sessionPackage.path = @"/startup"; - sessionPackage.activityKind = AIActivityKindSession; - sessionPackage.suffix = @""; - sessionPackage.parameters = parameters; - - return sessionPackage; -} - -- (AIActivityPackage *)buildEventPackage { - NSMutableDictionary *parameters = [self defaultParameters]; - [self injectEventParameters:parameters]; - - AIActivityPackage *eventPackage = [self defaultActivityPackage]; - eventPackage.path = @"/event"; - eventPackage.activityKind = AIActivityKindEvent; - eventPackage.suffix = self.eventSuffix; - eventPackage.parameters = parameters; - - return eventPackage; -} - -- (AIActivityPackage *)buildRevenuePackage { - NSMutableDictionary *parameters = [self defaultParameters]; - [self parameters:parameters setString:self.amountString forKey:@"amount"]; - [self injectEventParameters:parameters]; - - AIActivityPackage *revenuePackage = [self defaultActivityPackage]; - revenuePackage.path = @"/revenue"; - revenuePackage.activityKind = AIActivityKindRevenue; - revenuePackage.suffix = self.revenueSuffix; - revenuePackage.parameters = parameters; - - return revenuePackage; -} - -- (AIActivityPackage *)buildReattributionPackage { - NSMutableDictionary *parameters = [self defaultParameters]; - [self parameters:parameters setDictionaryJson:self.deeplinkParameters forKey:@"deeplink_parameters"]; - - AIActivityPackage *reattributionPackage = [self defaultActivityPackage]; - reattributionPackage.path = @"/reattribute"; - reattributionPackage.activityKind = AIActivityKindReattribution; - reattributionPackage.suffix = @""; - reattributionPackage.parameters = parameters; - - return reattributionPackage; -} - -#pragma mark private -- (AIActivityPackage *)defaultActivityPackage { - AIActivityPackage *activityPackage = [[AIActivityPackage alloc] init]; - activityPackage.userAgent = self.userAgent; - activityPackage.clientSdk = self.clientSdk; - return activityPackage; -} - -- (NSMutableDictionary *)defaultParameters { - NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; - - // general - [self parameters:parameters setDate:self.createdAt forKey:@"created_at"]; - [self parameters:parameters setString:self.appToken forKey:@"app_token"]; - [self parameters:parameters setString:self.macSha1 forKey:@"mac_sha1"]; - [self parameters:parameters setString:self.macShortMd5 forKey:@"mac_md5"]; - [self parameters:parameters setString:self.uuid forKey:@"ios_uuid"]; - [self parameters:parameters setString:self.idForAdvertisers forKey:@"idfa"]; - [self parameters:parameters setString:self.fbAttributionId forKey:@"fb_id"]; - [self parameters:parameters setString:self.environment forKey:@"environment"]; - [self parameters:parameters setInt:self.trackingEnabled forKey:@"tracking_enabled"]; - [self parameters:parameters setBool:self.isIad forKey:@"is_iad"]; - [self parameters:parameters setString:self.vendorId forKey:@"idfv"]; - [self parameters:parameters setString:self.pushToken forKey:@"push_token"]; - - // session related (used for events as well) - [self parameters:parameters setInt:self.sessionCount forKey:@"session_count"]; - [self parameters:parameters setInt:self.subsessionCount forKey:@"subsession_count"]; - [self parameters:parameters setDuration:self.sessionLength forKey:@"session_length"]; - [self parameters:parameters setDuration:self.timeSpent forKey:@"time_spent"]; - - return parameters; -} - -- (void)injectEventParameters:(NSMutableDictionary *)parameters { - // event specific - [self parameters:parameters setInt:self.eventCount forKey:@"event_count"]; - [self parameters:parameters setString:self.eventToken forKey:@"event_token"]; - [self parameters:parameters setDictionaryBase64:self.callbackParameters forKey:@"params"]; -} - -- (NSString *)amountString { - int amountInMillis = round(10 * self.amountInCents); - self.amountInCents = amountInMillis / 10.0; // now rounded to one decimal point - NSString *amountString = [NSNumber numberWithInt:amountInMillis].stringValue; - return amountString; -} - -- (NSString *)eventSuffix { - return [NSString stringWithFormat:@" '%@'", self.eventToken]; -} - -- (NSString *)revenueSuffix { - if (self.eventToken != nil) { - return [NSString stringWithFormat:@" (%.1f cent, '%@')", self.amountInCents, self.eventToken]; - } else { - return [NSString stringWithFormat:@" (%.1f cent)", self.amountInCents]; - } -} - -- (void)parameters:(NSMutableDictionary *)parameters setString:(NSString *)value forKey:(NSString *)key { - if (value == nil || [value isEqualToString:@""]) return; - - [parameters setObject:value forKey:key]; -} - -- (void)parameters:(NSMutableDictionary *)parameters setInt:(int)value forKey:(NSString *)key { - if (value < 0) return; - - NSString *valueString = [NSString stringWithFormat:@"%d", value]; - [self parameters:parameters setString:valueString forKey:key]; -} - -- (void)parameters:(NSMutableDictionary *)parameters setDate:(double)value forKey:(NSString *)key { - if (value < 0) return; - - NSString *dateString = [AIUtil dateFormat:value]; - [self parameters:parameters setString:dateString forKey:key]; -} - -- (void)parameters:(NSMutableDictionary *)parameters setDuration:(double)value forKey:(NSString *)key { - if (value < 0) return; - - int intValue = round(value); - [self parameters:parameters setInt:intValue forKey:key]; -} - -- (void)parameters:(NSMutableDictionary *)parameters setDictionaryBase64:(NSDictionary *)dictionary forKey:(NSString *)key { - if (dictionary == nil) return; - - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dictionary options:0 error:nil]; - NSString *dictionaryString = jsonData.aiEncodeBase64; - [self parameters:parameters setString:dictionaryString forKey:key]; -} - -- (void)parameters:(NSMutableDictionary *)parameters setDictionaryJson:(NSDictionary *)dictionary forKey:(NSString *)key { - if (dictionary == nil) return; - - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dictionary options:0 error:nil]; - NSString *dictionaryString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; - [self parameters:parameters setString:dictionaryString forKey:key]; -} - -- (void)parameters:(NSMutableDictionary *)parameters setBool:(BOOL)value forKey:(NSString *)key { - if (value < 0) return; - - int valueInt = [[NSNumber numberWithBool:value] intValue]; - - [self parameters:parameters setInt:valueInt forKey:key]; -} -@end - diff --git a/Assets/Plugins/iOS/AIPackageBuilder.m.meta b/Assets/Plugins/iOS/AIPackageBuilder.m.meta deleted file mode 100644 index ad765a03..00000000 --- a/Assets/Plugins/iOS/AIPackageBuilder.m.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 1960445aa19234d75b73652f1fb5ab39 -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AIPackageHandler.h b/Assets/Plugins/iOS/AIPackageHandler.h deleted file mode 100644 index e01aa5d4..00000000 --- a/Assets/Plugins/iOS/AIPackageHandler.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// AIPackageHandler.h -// Adjust -// -// Created by Christian Wellenbrock on 2013-07-03. -// Copyright (c) 2013 adjust GmbH. All rights reserved. -// -#import - -@class AIActivityPackage; -@class AIResponseData; -@protocol AIActivityHandler; - -@protocol AIPackageHandler - -- (id)initWithActivityHandler:(id)activityHandler; - -- (void)addPackage:(AIActivityPackage *)package; -- (void)sendFirstPackage; -- (void)sendNextPackage; -- (void)closeFirstPackage; -- (void)pauseSending; -- (void)resumeSending; - -- (void)finishedTrackingActivity:(AIActivityPackage *)activityPackage withResponse:(AIResponseData *)response jsonDict:(NSDictionary *)jsonDict; - -@end - -@interface AIPackageHandler : NSObject - -+ (id)handlerWithActivityHandler:(id)activityHandler; - -@end diff --git a/Assets/Plugins/iOS/AIPackageHandler.h.meta b/Assets/Plugins/iOS/AIPackageHandler.h.meta deleted file mode 100644 index 5b10e5db..00000000 --- a/Assets/Plugins/iOS/AIPackageHandler.h.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 157f9e1897aa843cca7ece5085df3c00 -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AIPackageHandler.m b/Assets/Plugins/iOS/AIPackageHandler.m deleted file mode 100644 index 3885b85d..00000000 --- a/Assets/Plugins/iOS/AIPackageHandler.m +++ /dev/null @@ -1,187 +0,0 @@ -// -// AIPackageHandler.m -// Adjust -// -// Created by Christian Wellenbrock on 2013-07-03. -// Copyright (c) 2013 adjust GmbH. All rights reserved. -// - -#import "AIPackageHandler.h" -#import "AIActivityHandler.h" -#import "AIRequestHandler.h" -#import "AIActivityPackage.h" -#import "AIResponseData.h" -#import "AILogger.h" -#import "AIUtil.h" -#import "AIAdjustFactory.h" - -static NSString * const kPackageQueueFilename = @"AdjustIoPackageQueue"; -static const char * const kInternalQueueName = "io.adjust.PackageQueue"; - - -#pragma mark - private -@interface AIPackageHandler() - -@property (nonatomic) dispatch_queue_t internalQueue; -@property (nonatomic) dispatch_semaphore_t sendingSemaphore; -@property (nonatomic, assign) id activityHandler; -@property (nonatomic, retain) id requestHandler; -@property (nonatomic, retain) id logger; -@property (nonatomic, retain) NSMutableArray *packageQueue; -@property (nonatomic, assign, getter = isPaused) BOOL paused; - -@end - - -#pragma mark - -@implementation AIPackageHandler - -+ (id)handlerWithActivityHandler:(id)activityHandler { - return [[AIPackageHandler alloc] initWithActivityHandler:activityHandler]; -} - -- (id)initWithActivityHandler:(id)activityHandler { - self = [super init]; - if (self == nil) return nil; - - self.internalQueue = dispatch_queue_create(kInternalQueueName, DISPATCH_QUEUE_SERIAL); - self.activityHandler = activityHandler; - - dispatch_async(self.internalQueue, ^{ - [self initInternal]; - }); - - return self; -} - -- (void)addPackage:(AIActivityPackage *)package { - dispatch_async(self.internalQueue, ^{ - [self addInternal:package]; - }); -} - -- (void)sendFirstPackage { - dispatch_async(self.internalQueue, ^{ - [self sendFirstInternal]; - }); -} - -- (void)sendNextPackage { - dispatch_async(self.internalQueue, ^{ - [self sendNextInternal]; - }); -} - -- (void)closeFirstPackage { - dispatch_semaphore_signal(self.sendingSemaphore); -} - -- (void)pauseSending { - self.paused = YES; -} - -- (void)resumeSending { - self.paused = NO; -} - -- (void)finishedTrackingActivity:(AIActivityPackage *)activityPackage withResponse:(AIResponseData *)response jsonDict:(NSDictionary *)jsonDict{ - - response.activityKind = activityPackage.activityKind; - - NSString * deepLink = nil; - - if (jsonDict != nil) { - deepLink = [jsonDict objectForKey:@"deeplink"]; - } - - [self.activityHandler finishedTrackingWithResponse:response deepLink:deepLink]; -} - - -#pragma mark - internal -- (void)initInternal { - self.requestHandler = [AIAdjustFactory requestHandlerForPackageHandler:self]; - self.logger = AIAdjustFactory.logger; - self.sendingSemaphore = dispatch_semaphore_create(1); - [self readPackageQueue]; -} - -- (void)addInternal:(AIActivityPackage *)newPackage { - [self.packageQueue addObject:newPackage]; - [self.logger debug:@"Added package %d (%@)", self.packageQueue.count, newPackage]; - [self.logger verbose:@"%@", newPackage.extendedString]; - - [self writePackageQueue]; -} - -- (void)sendFirstInternal { - if (self.packageQueue.count == 0) return; - - if (self.isPaused) { - [self.logger debug:@"Package handler is paused"]; - return; - } - - if (dispatch_semaphore_wait(self.sendingSemaphore, DISPATCH_TIME_NOW) != 0) { - [self.logger verbose:@"Package handler is already sending"]; - return; - } - - AIActivityPackage *activityPackage = [self.packageQueue objectAtIndex:0]; - if (![activityPackage isKindOfClass:[AIActivityPackage class]]) { - [self.logger error:@"Failed to read activity package"]; - [self sendNextInternal]; - return; - } - - [self.requestHandler sendPackage:activityPackage]; -} - -- (void)sendNextInternal { - [self.packageQueue removeObjectAtIndex:0]; - [self writePackageQueue]; - dispatch_semaphore_signal(self.sendingSemaphore); - [self sendFirstInternal]; -} - -#pragma mark - private -- (void)readPackageQueue { - @try { - NSString *filename = self.packageQueueFilename; - id object = [NSKeyedUnarchiver unarchiveObjectWithFile:filename]; - if ([object isKindOfClass:[NSArray class]]) { - self.packageQueue = object; - [self.logger debug:@"Package handler read %d packages", self.packageQueue.count]; - return; - } else if (object == nil) { - [self.logger verbose:@"Package queue file not found"]; - } else { - [self.logger error:@"Failed to read package queue"]; - } - } @catch (NSException *exception) { - [self.logger error:@"Failed to read package queue (%@)", exception]; - } - - // start with a fresh package queue in case of any exception - self.packageQueue = [NSMutableArray array]; -} - -- (void)writePackageQueue { - NSString *filename = self.packageQueueFilename; - BOOL result = [NSKeyedArchiver archiveRootObject:self.packageQueue toFile:filename]; - if (result == YES) { - [AIUtil excludeFromBackup:filename]; - [self.logger debug:@"Package handler wrote %d packages", self.packageQueue.count]; - } else { - [self.logger error:@"Failed to write package queue"]; - } -} - -- (NSString *)packageQueueFilename { - NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); - NSString *path = [paths objectAtIndex:0]; - NSString *filename = [path stringByAppendingPathComponent:kPackageQueueFilename]; - return filename; -} - -@end diff --git a/Assets/Plugins/iOS/AIPackageHandler.m.meta b/Assets/Plugins/iOS/AIPackageHandler.m.meta deleted file mode 100644 index 9be61712..00000000 --- a/Assets/Plugins/iOS/AIPackageHandler.m.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: a98423ad0ff36403082426726e468615 -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AIRequestHandler.h b/Assets/Plugins/iOS/AIRequestHandler.h deleted file mode 100644 index 18c71ce4..00000000 --- a/Assets/Plugins/iOS/AIRequestHandler.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// AIRequestHandler.h -// Adjust -// -// Created by Christian Wellenbrock on 2013-07-04. -// Copyright (c) 2013 adjust GmbH. All rights reserved. -// -#import - -#include "AIPackageHandler.h" -@class AIPackageHandler, AIActivityPackage; - -@protocol AIRequestHandler - -- (id)initWithPackageHandler:(id) packageHandler; - -- (void)sendPackage:(AIActivityPackage *)activityPackage; - -@end - - -@interface AIRequestHandler : NSObject - -+ (id) handlerWithPackageHandler:(id)packageHandler; - -@end diff --git a/Assets/Plugins/iOS/AIRequestHandler.h.meta b/Assets/Plugins/iOS/AIRequestHandler.h.meta deleted file mode 100644 index 36e8535a..00000000 --- a/Assets/Plugins/iOS/AIRequestHandler.h.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 205709bb3639847b8a6cfb156963cc52 -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AIRequestHandler.m b/Assets/Plugins/iOS/AIRequestHandler.m deleted file mode 100644 index 8f143d1b..00000000 --- a/Assets/Plugins/iOS/AIRequestHandler.m +++ /dev/null @@ -1,131 +0,0 @@ -// -// AIRequestHandler.m -// Adjust -// -// Created by Christian Wellenbrock on 2013-07-04. -// Copyright (c) 2013 adjust GmbH. All rights reserved. -// - -#import "AIRequestHandler.h" -#import "AIPackageHandler.h" -#import "AIActivityPackage.h" -#import "AIResponseData.h" -#import "AILogger.h" -#import "AIUtil.h" -#import "NSString+AIAdditions.h" -#import "AIAdjustFactory.h" - -static const char * const kInternalQueueName = "io.adjust.RequestQueue"; -static const double kRequestTimeout = 60; // 60 seconds - - -#pragma mark - private -@interface AIRequestHandler() - -@property (nonatomic) dispatch_queue_t internalQueue; -@property (nonatomic, assign) id packageHandler; -@property (nonatomic, assign) id logger; -@property (nonatomic, retain) NSURL *baseUrl; - -@end - - -#pragma mark - -@implementation AIRequestHandler - -+ (AIRequestHandler *)handlerWithPackageHandler:(id)packageHandler { - return [[AIRequestHandler alloc] initWithPackageHandler:packageHandler]; -} - -- (id)initWithPackageHandler:(id) packageHandler { - self = [super init]; - if (self == nil) return nil; - - self.internalQueue = dispatch_queue_create(kInternalQueueName, DISPATCH_QUEUE_SERIAL); - self.packageHandler = packageHandler; - self.logger = AIAdjustFactory.logger; - self.baseUrl = [NSURL URLWithString:AIUtil.baseUrl]; - - return self; -} - -- (void)sendPackage:(AIActivityPackage *)activityPackage { - dispatch_async(self.internalQueue, ^{ - [self sendInternal:activityPackage]; - }); -} - - -#pragma mark - internal -- (void)sendInternal:(AIActivityPackage *)package { - if (self.packageHandler == nil) return; - - NSMutableURLRequest *request = [self requestForPackage:package]; - NSHTTPURLResponse *response = nil; - NSError *error = nil; - NSData *data = [NSURLConnection sendSynchronousRequest:request - returningResponse:&response - error:&error]; - - // connection error - if (error != nil) { - AIResponseData *responseData = [AIResponseData dataWithError:error.localizedDescription]; - responseData.willRetry = YES; - [self.logger error:@"%@. (%@) Will retry later.", package.failureMessage, responseData.error]; - [self.packageHandler finishedTrackingActivity:package withResponse:responseData jsonDict:nil]; - [self.packageHandler closeFirstPackage]; - return; - } - - NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; - NSDictionary *jsonDict = [AIUtil buildJsonDict:responseString]; - AIResponseData *responseData = [AIResponseData dataWithJsonDict:jsonDict jsonString:responseString]; - - if (response.statusCode == 200) { - // success - responseData.success = YES; - [self.logger info:@"%@", package.successMessage]; - } else { - // wrong status code - [self.logger error:@"%@. (%@)", package.failureMessage, responseData.error]; - } - - [self.packageHandler finishedTrackingActivity:package withResponse:responseData jsonDict:jsonDict]; - [self.packageHandler sendNextPackage]; -} - -#pragma mark - private -- (NSMutableURLRequest *)requestForPackage:(AIActivityPackage *)package { - NSURL *url = [NSURL URLWithString:package.path relativeToURL:self.baseUrl]; - NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; - request.timeoutInterval = kRequestTimeout; - request.HTTPMethod = @"POST"; - - [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; - [request setValue:package.clientSdk forHTTPHeaderField:@"Client-Sdk"]; - [request setValue:package.userAgent forHTTPHeaderField:@"User-Agent"]; - [request setHTTPBody:[self bodyForParameters:package.parameters]]; - - return request; -} - -- (NSData *)bodyForParameters:(NSDictionary *)parameters { - NSMutableArray *pairs = [NSMutableArray array]; - for (NSString *key in parameters) { - NSString *value = [parameters objectForKey:key]; - NSString *escapedValue = [value aiUrlEncode]; - NSString *pair = [NSString stringWithFormat:@"%@=%@", key, escapedValue]; - [pairs addObject:pair]; - } - - double now = [NSDate.date timeIntervalSince1970]; - NSString *dateString = [AIUtil dateFormat:now]; - NSString *escapedDate = [dateString aiUrlEncode]; - NSString *sentAtPair = [NSString stringWithFormat:@"%@=%@", @"sent_at", escapedDate]; - [pairs addObject:sentAtPair]; - - NSString *bodyString = [pairs componentsJoinedByString:@"&"]; - NSData *body = [NSData dataWithBytes:bodyString.UTF8String length:bodyString.length]; - return body; -} -@end diff --git a/Assets/Plugins/iOS/AIRequestHandler.m.meta b/Assets/Plugins/iOS/AIRequestHandler.m.meta deleted file mode 100644 index 4b5f834f..00000000 --- a/Assets/Plugins/iOS/AIRequestHandler.m.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: ec871342b5fd1493d98b9f88b84ebd63 -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AIResponseData.h b/Assets/Plugins/iOS/AIResponseData.h deleted file mode 100644 index cb70ccec..00000000 --- a/Assets/Plugins/iOS/AIResponseData.h +++ /dev/null @@ -1,77 +0,0 @@ -// -// AIResponseData.h -// Adjust -// -// Created by Christian Wellenbrock on 07.02.14. -// Copyright (c) 2014 adjust GmbH. All rights reserved. -// - -#import "AIActivityKind.h" - -@class AIActivityPackage; - -/* - * Information about the result of a tracking attempt - * - * Will be passed to the delegate function adjustFinishedTrackingWithResponse: - */ -@interface AIResponseData : NSObject - -#pragma mark set by SDK - -// the kind of activity (AIActivityKindSession etc.) -// see the AIActivityKind definition -@property (nonatomic, assign) AIActivityKind activityKind; - -// true when the activity was tracked successfully -// might be true even if response could not be parsed -@property (nonatomic, assign) BOOL success; - -// true if the server was not reachable and the request will be tried again later -@property (nonatomic, assign) BOOL willRetry; - -#pragma mark set by server or SDK -// nil if activity was tracked successfully and response could be parsed -// might be not nil even when activity was tracked successfully -@property (nonatomic, copy) NSString *error; - -#pragma mark returned by server -// the following attributes are only set when error is nil -// (when activity was tracked successfully and response could be parsed) - -// tracker token of current device -@property (nonatomic, copy) NSString *trackerToken; - -// tracker name of current device -@property (nonatomic, copy) NSString *trackerName; - -// tracker network -@property (nonatomic, copy) NSString *network; - -// tracker campaign -@property (nonatomic, copy) NSString *campaign; - -// tracker adgroup -@property (nonatomic, copy) NSString *adgroup; - -// tracker creative -@property (nonatomic, copy) NSString *creative; - - -// returns human readable version of activityKind -// (session, event, revenue), see above -- (NSString *)activityKindString; - -// returns a NSDictonary representation -- (NSDictionary *)dictionary; - - -#pragma mark internals - -+ (AIResponseData *)dataWithJsonDict:(NSDictionary *)jsonDict jsonString:(NSString *)jsonString; -+ (AIResponseData *)dataWithError:(NSString *)error; - -- (id)initWithJsonDict:(NSDictionary *)jsonDict jsonString:(NSString *)jsonString; -- (id)initWithError:(NSString *)error; - -@end diff --git a/Assets/Plugins/iOS/AIResponseData.h.meta b/Assets/Plugins/iOS/AIResponseData.h.meta deleted file mode 100644 index f7094b65..00000000 --- a/Assets/Plugins/iOS/AIResponseData.h.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 7c9dd0a8d35be4a6293654d86bf033d3 -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AIResponseData.m b/Assets/Plugins/iOS/AIResponseData.m deleted file mode 100644 index 7d474438..00000000 --- a/Assets/Plugins/iOS/AIResponseData.m +++ /dev/null @@ -1,110 +0,0 @@ -// -// AIResponseData.m -// Adjust -// -// Created by Christian Wellenbrock on 07.02.14. -// Copyright (c) 2014 adjust GmbH. All rights reserved. -// - -#import "AIResponseData.h" -#import "NSString+AIAdditions.h" - -@implementation AIResponseData - -+ (AIResponseData *)dataWithJsonDict:(NSDictionary *)jsonDict jsonString:(NSString *)jsonString { - return [[AIResponseData alloc] initWithJsonDict:jsonDict jsonString:jsonString]; -} - -+ (AIResponseData *)dataWithError:(NSString *)error { - return [[AIResponseData alloc] initWithError:error]; -} - -- (id)initWithJsonDict:(NSDictionary *)jsonDict jsonString:(NSString *)jsonString { - self = [super init]; - if (self == nil) return nil; - - if (jsonDict == nil) { - self.error = [NSString stringWithFormat:@"Failed to parse json response: %@", jsonString.aiTrim]; - return self; - } - - self.error = [jsonDict objectForKey:@"error"]; - self.trackerToken = [jsonDict objectForKey:@"tracker_token"]; - self.trackerName = [jsonDict objectForKey:@"tracker_name"]; - self.network = [jsonDict objectForKey:@"network"]; - self.campaign = [jsonDict objectForKey:@"campaign"]; - self.adgroup = [jsonDict objectForKey:@"adgroup"]; - self.creative = [jsonDict objectForKey:@"creative"]; - - return self; -} - -- (id)initWithError:(NSString *)error { - self = [super init]; - if (self == nil) return nil; - - self.success = NO; - self.error = error; - - return self; -} - -- (NSString *)activityKindString { - return AIActivityKindToString(self.activityKind); -} - -- (NSString *)description { - return [NSString stringWithFormat:@"[kind:%@ success:%d willRetry:%d " - "error:%@ trackerToken:%@ trackerName:%@ " - "network:%@ campaign:%@ adgroup:%@ creative:%@]", - self.activityKindString, - self.success, - self.willRetry, - self.error.aiQuote, - self.trackerToken, - self.trackerName.aiQuote, - self.network.aiQuote, - self.campaign.aiQuote, - self.adgroup.aiQuote, - self.creative.aiQuote]; -} - -- (NSDictionary *)dictionary { - NSMutableDictionary * responseDataDic = [NSMutableDictionary dictionaryWithDictionary:@{ - @"activityKind" : self.activityKindString, - @"success" : (self.success ? @"true" : @"false"), - @"willRetry" : (self.willRetry ? @"true" : @"false"), - }]; - - if (self.error != nil) { - [responseDataDic setObject:self.error forKey:@"error"]; - } - - if (self.trackerToken != nil) { - [responseDataDic setObject:self.trackerToken forKey:@"trackerToken"]; - } - - if (self.trackerName != nil) { - [responseDataDic setObject:self.trackerName forKey:@"trackerName"]; - } - - if (self.network != nil) { - [responseDataDic setObject:self.network forKey:@"network"]; - } - - if (self.campaign != nil) { - [responseDataDic setObject:self.campaign forKey:@"campaign"]; - } - - if (self.adgroup != nil) { - [responseDataDic setObject:self.adgroup forKey:@"adgroup"]; - } - - if (self.creative != nil) { - [responseDataDic setObject:self.creative forKey:@"creative"]; - } - - return responseDataDic; -} - -@end diff --git a/Assets/Plugins/iOS/AIResponseData.m.meta b/Assets/Plugins/iOS/AIResponseData.m.meta deleted file mode 100644 index 6b26fbcc..00000000 --- a/Assets/Plugins/iOS/AIResponseData.m.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 4d89b5731a2344643aa53abd51176521 -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AITimer.h b/Assets/Plugins/iOS/AITimer.h deleted file mode 100644 index a09d27e2..00000000 --- a/Assets/Plugins/iOS/AITimer.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// AITimer.h -// Adjust -// -// Created by Christian Wellenbrock on 2013-07-02. -// Copyright (c) 2013 adjust GmbH. All rights reserved. -// -#import - -@interface AITimer : NSObject - -+ (AITimer *)timerWithInterval:(uint64_t)interval - leeway:(uint64_t)leeway - queue:(dispatch_queue_t)queue - block:(dispatch_block_t)block; - -- (id)initWithInterval:(uint64_t)interval - leeway:(uint64_t)leeway - queue:(dispatch_queue_t)queue - block:(dispatch_block_t)block; - -- (void)resume; -- (void)suspend; - -@end diff --git a/Assets/Plugins/iOS/AITimer.h.meta b/Assets/Plugins/iOS/AITimer.h.meta deleted file mode 100644 index 38145ecb..00000000 --- a/Assets/Plugins/iOS/AITimer.h.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: f72999ac51f284c6c8e0219633103efd -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AITimer.m b/Assets/Plugins/iOS/AITimer.m deleted file mode 100644 index d513af94..00000000 --- a/Assets/Plugins/iOS/AITimer.m +++ /dev/null @@ -1,63 +0,0 @@ -// -// AITimer.m -// Adjust -// -// Created by Christian Wellenbrock on 2013-07-02. -// Copyright (c) 2013 adjust GmbH. All rights reserved. -// - -#import "AITimer.h" - -#pragma mark - private -@interface AITimer() - -@property (nonatomic) dispatch_source_t source; -@property (nonatomic, assign) BOOL suspended; - -@end - - -#pragma mark - -@implementation AITimer - -+ (AITimer *)timerWithInterval:(uint64_t)interval - leeway:(uint64_t)leeway - queue:(dispatch_queue_t)queue - block:(dispatch_block_t)block -{ - return [[AITimer alloc] initWithInterval:interval leeway:leeway queue:queue block:block]; -} - -- (id)initWithInterval:(uint64_t)interval - leeway:(uint64_t)leeway - queue:(dispatch_queue_t)queue - block:(dispatch_block_t)block -{ - self = [super init]; - if (self == nil) return nil; - - self.source = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue); - if (self.source != nil) { - dispatch_source_set_timer(self.source, dispatch_walltime(NULL, 0), interval, leeway); - dispatch_source_set_event_handler(self.source, block); - } - self.suspended = YES; - - return self; -} - -- (void)resume { - if (!self.suspended) return; - - dispatch_resume(self.source); - self.suspended = NO; -} - -- (void)suspend { - if (self.suspended) return; - - dispatch_suspend(self.source); - self.suspended = YES; -} - -@end diff --git a/Assets/Plugins/iOS/AITimer.m.meta b/Assets/Plugins/iOS/AITimer.m.meta deleted file mode 100644 index 564b273c..00000000 --- a/Assets/Plugins/iOS/AITimer.m.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 54ac449e112a24277a2c0c6c40cce0cd -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AIUtil.h b/Assets/Plugins/iOS/AIUtil.h deleted file mode 100644 index 120ab929..00000000 --- a/Assets/Plugins/iOS/AIUtil.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// AIUtil.h -// Adjust -// -// Created by Christian Wellenbrock on 2013-07-05. -// Copyright (c) 2013 adjust GmbH. All rights reserved. -// -#import - -@interface AIUtil : NSObject - -+ (NSString *)baseUrl; -+ (NSString *)clientSdk; -+ (NSString *)userAgent; - -+ (void)excludeFromBackup:(NSString *)filename; -+ (NSString *)dateFormat:(double)value; -+ (NSDictionary *) buildJsonDict:(NSString *)jsonString; - -@end diff --git a/Assets/Plugins/iOS/AIUtil.h.meta b/Assets/Plugins/iOS/AIUtil.h.meta deleted file mode 100644 index d6b65385..00000000 --- a/Assets/Plugins/iOS/AIUtil.h.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: e047508965dec4bffa928a7abaa6fe7d -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AIUtil.m b/Assets/Plugins/iOS/AIUtil.m deleted file mode 100644 index 7211e6a6..00000000 --- a/Assets/Plugins/iOS/AIUtil.m +++ /dev/null @@ -1,140 +0,0 @@ -// -// AIUtil.m -// Adjust -// -// Created by Christian Wellenbrock on 2013-07-05. -// Copyright (c) 2013 adjust GmbH. All rights reserved. -// - -#import "AIUtil.h" -#import "AILogger.h" -#import "UIDevice+AIAdditions.h" -#import "AIAdjustFactory.h" -#import "NSString+AIAdditions.h" - -#include - -static NSString * const kBaseUrl = @"https://app.adjust.io"; -static NSString * const kClientSdk = @"ios3.4.0"; - -static NSString * const kDateFormat = @"yyyy-MM-dd'T'HH:mm:ss'Z'Z"; -static NSDateFormatter * dateFormat; - - -#pragma mark - -@implementation AIUtil - -+ (NSString *)baseUrl { - return kBaseUrl; -} - -+ (NSString *)clientSdk { - return kClientSdk; -} - -+ (NSString *)userAgent { - UIDevice *device = UIDevice.currentDevice; - NSLocale *locale = NSLocale.currentLocale; - NSBundle *bundle = NSBundle.mainBundle; - NSDictionary *infoDictionary = bundle.infoDictionary; - - NSString *bundeIdentifier = [infoDictionary objectForKey:(NSString *)kCFBundleIdentifierKey]; - NSString *bundleVersion = [infoDictionary objectForKey:(NSString *)kCFBundleVersionKey]; - NSString *languageCode = [locale objectForKey:NSLocaleLanguageCode]; - NSString *countryCode = [locale objectForKey:NSLocaleCountryCode]; - NSString *osName = @"ios"; - - NSString *userAgent = [NSString stringWithFormat:@"%@ %@ %@ %@ %@ %@ %@ %@", - [self.class sanitizeU:bundeIdentifier], - [self.class sanitizeU:bundleVersion], - [self.class sanitizeU:device.aiDeviceType], - [self.class sanitizeU:device.aiDeviceName], - [self.class sanitizeU:osName], - [self.class sanitizeU:device.systemVersion], - [self.class sanitizeZ:languageCode], - [self.class sanitizeZ:countryCode]]; - - return userAgent; -} - -#pragma mark - sanitization -+ (NSString *)sanitizeU:(NSString *)string { - return [self.class sanitize:string defaultString:@"unknown"]; -} - -+ (NSString *)sanitizeZ:(NSString *)string { - return [self.class sanitize:string defaultString:@"zz"]; -} - -+ (NSString *)sanitize:(NSString *)string defaultString:(NSString *)defaultString { - if (string == nil) { - return defaultString; - } - - NSString *result = [string stringByReplacingOccurrencesOfString:@" " withString:@""]; - if (result.length == 0) { - return defaultString; - } - - return result; -} - -// inspired by https://gist.github.com/kevinbarrett/2002382 -+ (void)excludeFromBackup:(NSString *)path { - NSURL *url = [NSURL fileURLWithPath:path]; - const char* filePath = [[url path] fileSystemRepresentation]; - const char* attrName = "com.apple.MobileBackup"; - id logger = AIAdjustFactory.logger; - - if (&NSURLIsExcludedFromBackupKey == nil) { // iOS 5.0.1 and lower - u_int8_t attrValue = 1; - int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0); - if (result != 0) { - [logger debug:@"Failed to exclude '%@' from backup", url.lastPathComponent]; - } - } else { // iOS 5.0 and higher - // First try and remove the extended attribute if it is present - ssize_t result = getxattr(filePath, attrName, NULL, sizeof(u_int8_t), 0, 0); - if (result != -1) { - // The attribute exists, we need to remove it - int removeResult = removexattr(filePath, attrName, 0); - if (removeResult == 0) { - [logger debug:@"Removed extended attribute on file '%@'", url]; - } - } - - // Set the new key - NSError *error = nil; - BOOL success = [url setResourceValue:[NSNumber numberWithBool:YES] - forKey:NSURLIsExcludedFromBackupKey - error:&error]; - if (!success) { - [logger debug:@"Failed to exclude '%@' from backup (%@)", url.lastPathComponent, error.localizedDescription]; - } - } -} - -+ (NSString *)dateFormat:(double) value { - if (dateFormat == nil) { - dateFormat = [[NSDateFormatter alloc] init]; - [dateFormat setDateFormat:kDateFormat]; - } - - NSDate *date = [NSDate dateWithTimeIntervalSince1970:value]; - - return [dateFormat stringFromDate:date]; -} - -+ (NSDictionary *)buildJsonDict:(NSString *)jsonString { - NSError *error = nil; - NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; - NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error]; - - if (error != nil) { - return nil; - } - - return jsonDict; -} - -@end diff --git a/Assets/Plugins/iOS/AIUtil.m.meta b/Assets/Plugins/iOS/AIUtil.m.meta deleted file mode 100644 index 058b3b79..00000000 --- a/Assets/Plugins/iOS/AIUtil.m.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: e15fe221b42a64a838cc9104ae960490 -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/Adjust.h b/Assets/Plugins/iOS/Adjust.h deleted file mode 100644 index 3801a168..00000000 --- a/Assets/Plugins/iOS/Adjust.h +++ /dev/null @@ -1,198 +0,0 @@ -// -// Adjust.h -// Adjust -// -// Created by Christian Wellenbrock on 2012-07-23. -// Copyright (c) 2012-2014 adjust GmbH. All rights reserved. -// - -#import "AILogger.h" -#import "AIResponseData.h" - -@protocol AdjustDelegate; - -/** - * Constants for our supported tracking environments. - */ -static NSString * const AIEnvironmentSandbox = @"sandbox"; -static NSString * const AIEnvironmentProduction = @"production"; - -/** - * The main interface to Adjust. - * - * Use the methods of this class to tell Adjust about the usage of your app. - * See the README for details. - */ -@interface Adjust : NSObject - -/** - * Tell Adjust that the application did launch. - * - * This is required to initialize Adjust. Call this in the didFinishLaunching - * method of your AppDelegate. - * - * @param appToken The App Token of your app. This unique identifier can - * be found it in your dashboard at http://adjust.com and should always - * be 12 characters long. - */ -+ (void)appDidLaunch:(NSString *)appToken; - -/** - * Set the optional delegate that will get informed about tracking results - * - * See the AdjustDelegate declaration below for details - * - * @param delegate The delegate that might implement the optional delegate - * methods like adjustFinishedTrackingWithResponse: - */ -+ (void)setDelegate:(id)delegate; - -/** - * Tell Adjust that a particular event has happened. - * - * In your dashboard at http://adjust.com you can assign a callback URL to each - * event type. That URL will get called every time the event is triggered. On - * top of that you can pass a set of parameters to the following method that - * will be forwarded to these callbacks. - * - * @param eventToken The Event Token for this kind of event. They are created - * in the dashboard at http://adjust.com and should be six characters long. - * @param parameters An optional dictionary containing the callback parameters. - * Provide key-value-pairs to be forwarded to your callbacks. - */ -+ (void)trackEvent:(NSString *)eventToken; -+ (void)trackEvent:(NSString *)eventToken withParameters:(NSDictionary *)parameters; - -/** - * Tell Adjust that a user generated some revenue. - * - * The amount is measured in cents and rounded to on digit after the - * decimal point. If you want to differentiate between several revenue - * types, you can do so by using different event tokens. If your revenue - * events have callbacks, you can also pass in parameters that will be - * forwarded to your end point. - * - * A transaction ID can be used to avoid duplicate revenue events. The last ten transaction identifiers are remembered. - * This is useful for in-app purchase tracking where you can pass in the identifier of the reported transaction. - * - * @param amountInCents The amount in cents (example: 1.5 means one and a half cents) - * @param transactionIdentifier The identifier used to avoid duplicate revenue events (optional, see above) - * @param eventToken The token for this revenue event (optional, see above) - * @param parameters Parameters for this revenue event (optional, see above) - */ -+ (void)trackRevenue:(double)amountInCents; -+ (void)trackRevenue:(double)amountInCents forEvent:(NSString *)eventToken; -+ (void)trackRevenue:(double)amountInCents forEvent:(NSString *)eventToken withParameters:(NSDictionary *)parameters; - -+ (void)trackRevenue:(double)amountInCents transactionId:(NSString *)transactionId; -+ (void)trackRevenue:(double)amountInCents transactionId:(NSString *)transactionId forEvent:(NSString *)eventToken; -+ (void)trackRevenue:(double)amountInCents - transactionId:(NSString *)transactionId - forEvent:(NSString *)eventToken - withParameters:(NSDictionary *)parameters; - -/** - * Change the verbosity of Adjust's logs. - * - * You can increase or reduce the amount of logs from Adjust by passing - * one of the following parameters. Use Log.ASSERT to disable all logging. - * - * @param logLevel The desired minimum log level (default: info) - * Must be one of the following: - * - AILogLevelVerbose (enable all logging) - * - AILogLevelDebug (enable more logging) - * - AILogLevelInfo (the default) - * - AILogLevelWarn (disable info logging) - * - AILogLevelError (disable warnings as well) - * - AILogLevelAssert (disable errors as well) - */ -+ (void)setLogLevel:(AILogLevel)logLevel; - -/** - * Set the tracking environment to sandbox or production. - * - * Use sandbox for testing and production for the final build that you release. - * - * @param environment The new environment. Supported values: - * - AIEnvironmentSandbox - * - AIEnvironmentProduction - */ -+ (void)setEnvironment:(NSString *)environment; - -/** - * Enable or disable event buffering. - * - * Enable event buffering if your app triggers a lot of events. - * When enabled, events get buffered and only get tracked each - * minute. Buffered events are still persisted, of course. - */ -+ (void)setEventBufferingEnabled:(BOOL)enabled; - -/** - * Enable or disable tracking of the MD5 hash of the MAC address - * - * Disable macMd5 tracking if your privacy constraints require it. - */ -+ (void)setMacMd5TrackingEnabled:(BOOL)enabled; - -// Special method used by wrapper JS bridge. Do not call directly. -+ (void)setSdkPrefix:(NSString *)sdkPrefix; - -/** - * Tell adjust that the application resumed. - * - * Only necessary if the native notifications can't be used - */ -+ (void)trackSubsessionStart; - -/** - * Tell adjust that the application paused. - * - * Only necessary if the native notifications can't be used - */ -+ (void)trackSubsessionEnd; - -/** - * Enable or disable the adjust SDK - * - * @param enabled The flag to enable or disable the adjust SDK - */ -+ (void)setEnabled:(BOOL)enabled; - -/** - * Check if the SDK is enabled or disabled - */ -+ (BOOL)isEnabled; - -/** - * Read the URL that opened the application to search for - * an adjust deep link - */ -+ (void)appWillOpenUrl:(NSURL *)url; - -/** - * Set the device token used by push notifications - */ -+ (void)setDeviceToken:(NSData *)deviceToken; -@end - - -@class AIActivityPackage; -@class AIResponseData; - -#pragma mark - -/** - * Optional delegate that will get informed about tracking results - */ -@protocol AdjustDelegate -@optional - -/** - * Optional delegate method that will get called when a tracking attempt finished - * - * @param responseData The response data containing information about the activity - * and it's server response. See AIResponseData for details. - */ -- (void)adjustFinishedTrackingWithResponse:(AIResponseData *)responseData; - -@end diff --git a/Assets/Plugins/iOS/Adjust.m b/Assets/Plugins/iOS/Adjust.m deleted file mode 100644 index 924c2fab..00000000 --- a/Assets/Plugins/iOS/Adjust.m +++ /dev/null @@ -1,143 +0,0 @@ -// -// Adjust.m -// Adjust -// -// Created by Christian Wellenbrock on 2012-07-23. -// Copyright (c) 2012-2014 adjust GmbH. All rights reserved. -// - -#import "Adjust.h" -#import "AIActivityHandler.h" -#import "AIAdjustFactory.h" - -#if !__has_feature(objc_arc) -#error Adjust requires ARC -// see README for details -#endif - -static id activityHandler; -static id logger; - -#pragma mark - -@implementation Adjust - -+ (void)appDidLaunch:(NSString *)yourAppToken { - activityHandler = [AIAdjustFactory activityHandlerWithAppToken:yourAppToken]; -} - -+ (void)setDelegate:(NSObject *)delegate { - [activityHandler setDelegate:delegate]; -} - -+ (void)setSdkPrefix:(NSString *)sdkPrefix { - [activityHandler setSdkPrefix:sdkPrefix]; -} - -+ (void)trackEvent:(NSString *)eventToken { - [activityHandler trackEvent:eventToken withParameters:nil]; -} - -+ (void)trackEvent:(NSString *)eventToken withParameters:(NSDictionary *)parameters { - [activityHandler trackEvent:eventToken withParameters:parameters]; -} - -+ (void)trackRevenue:(double)amountInCents { - [activityHandler trackRevenue:amountInCents transactionId:nil forEvent:nil withParameters:nil]; -} - -+ (void)trackRevenue:(double)amountInCents forEvent:(NSString *)eventToken { - [activityHandler trackRevenue:amountInCents transactionId:nil forEvent:eventToken withParameters:nil]; -} - -+ (void)trackRevenue:(double)amountInCents - forEvent:(NSString *)eventToken - withParameters:(NSDictionary *)parameters -{ - [activityHandler trackRevenue:amountInCents transactionId:nil forEvent:eventToken withParameters:parameters]; -} - -+ (void)trackRevenue:(double)amountInCents transactionId:(NSString *)transactionId { - [activityHandler trackRevenue:amountInCents transactionId:transactionId forEvent:nil withParameters:nil]; -} - -+ (void)trackRevenue:(double)amountInCents transactionId:(NSString *)transactionId forEvent:(NSString *)eventToken { - [activityHandler trackRevenue:amountInCents transactionId:transactionId forEvent:eventToken withParameters:nil]; -} - -+ (void)trackRevenue:(double)amountInCents - transactionId:(NSString *)transactionId - forEvent:(NSString *)eventToken - withParameters:(NSDictionary *)parameters -{ - [activityHandler trackRevenue:amountInCents - transactionId:transactionId - forEvent:eventToken - withParameters:parameters]; -} - -+ (void)setLogLevel:(AILogLevel)logLevel { - [AIAdjustFactory.logger setLogLevel:logLevel]; -} - -+ (void)setEnvironment:(NSString *)environment { - id logger = AIAdjustFactory.logger; - if (activityHandler == nil) { - [logger error:@"Please call `setEnvironment` after `appDidLaunch`!"]; - } else if ([environment isEqualToString:AIEnvironmentSandbox]) { - activityHandler.environment = environment; - [logger assert:@"SANDBOX: Adjust is running in Sandbox mode. Use this setting for testing. Don't forget to set the environment to AIEnvironmentProduction before publishing!"]; - } else if ([environment isEqualToString:AIEnvironmentProduction]) { - activityHandler.environment = environment; - [logger assert:@"PRODUCTION: Adjust is running in Production mode. Use this setting only for the build that you want to publish. Set the environment to AIEnvironmentSandbox if you want to test your app!"]; - [logger setLogLevel:AILogLevelAssert]; - } else { - activityHandler.environment = @"malformed"; - [logger error:@"Malformed environment '%@'", environment]; - } -} - -+ (void)setEventBufferingEnabled:(BOOL)enabled { - if (activityHandler == nil) { - [AIAdjustFactory.logger error:@"Please call `setEventBufferingEnabled` after `appDidLaunch`!"]; - return; - } - - activityHandler.bufferEvents = enabled; - if (enabled) [AIAdjustFactory.logger info:@"Event buffering is enabled"]; -} - -+ (void)setMacMd5TrackingEnabled:(BOOL)enabled { - if (activityHandler == nil) { - [AIAdjustFactory.logger error:@"Please call `setMacMd5TrackingEnabled` after `appDidLaunch`!"]; - return; - } - - activityHandler.trackMacMd5 = enabled; - [AIAdjustFactory.logger info:@"Tracking of macMd5 is %@", enabled ? @"enabled" : @"disabled"]; -} - -+ (void)trackSubsessionStart { - [activityHandler trackSubsessionStart]; -} - -+ (void)trackSubsessionEnd { - [activityHandler trackSubsessionEnd]; -} - -+ (void)setEnabled:(BOOL)enabled { - [activityHandler setEnabled:enabled]; -} - -+ (BOOL)isEnabled { - return [activityHandler isEnabled]; -} - -+ (void)appWillOpenUrl:(NSURL *)url { - [activityHandler readOpenUrl:url]; -} - -+ (void)setDeviceToken:(NSData *)deviceToken { - [activityHandler savePushToken:deviceToken]; -} - -@end diff --git a/Assets/Plugins/iOS/Adjust.m.meta b/Assets/Plugins/iOS/Adjust.m.meta deleted file mode 100644 index 8a3c45c4..00000000 --- a/Assets/Plugins/iOS/Adjust.m.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: be6151fdbac4344f6b72fcb78d06c506 -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/AdjustIOS.cs b/Assets/Plugins/iOS/AdjustIOS.cs deleted file mode 100644 index 82815325..00000000 --- a/Assets/Plugins/iOS/AdjustIOS.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System.Collections.Generic; -using System.Runtime.InteropServices; -using UnityEngine; -using System; -using SimpleJSON; - -namespace com.adjust.sdk { - - public class AdjustIOS : IAdjust { - - [DllImport ("__Internal")] - private static extern void _AdjustLaunchApp(string appToken, string environment, string sdkPrefix, int logLevel, int eventBuffering); - - [DllImport ("__Internal")] - private static extern void _AdjustTrackEvent(string eventToken, string jsonParameters); - - [DllImport ("__Internal")] - private static extern void _AdjustTrackRevenue(double cents, string eventToken, string jsonParameters); - - [DllImport ("__Internal")] - private static extern void _AdjustOnPause(); - - [DllImport ("__Internal")] - private static extern void _AdjustOnResume(); - - [DllImport ("__Internal")] - private static extern void _AdjustSetResponseDelegate (string sceneName); - - [DllImport ("__Internal")] - private static extern void _AdjustSetEnabled (int enabled); - - [DllImport ("__Internal")] - private static extern int _AdjustIsEnabled (); - - public AdjustIOS() { } - - public void appDidLaunch(string appToken, AdjustUtil.AdjustEnvironment environment, string sdkPrefix, AdjustUtil.LogLevel logLevel, bool eventBuffering) { - string sEnvironment = environment.ToString ().ToLower (); - - _AdjustLaunchApp(appToken, sEnvironment, sdkPrefix, (int)logLevel, Convert.ToInt32(eventBuffering)); - } - public void trackEvent (string eventToken, Dictionary parameters = null) { - string sJsonParameters = ConvertDicToJson(parameters); - - _AdjustTrackEvent (eventToken, sJsonParameters); - } - public void trackRevenue (double cents, string eventToken = null, Dictionary parameters = null) { - string sJsonParameters = ConvertDicToJson(parameters); - - _AdjustTrackRevenue (cents, eventToken, sJsonParameters); - } - public void onPause () { - _AdjustOnPause (); - } - public void onResume() { - _AdjustOnResume (); - } - public void setResponseDelegate(string sceneName) { - _AdjustSetResponseDelegate (sceneName); - } - public void setResponseDelegateString(Action responseDelegate) { - } - public void setEnabled(bool enabled) { - _AdjustSetEnabled (Convert.ToInt32 (enabled)); - } - public bool isEnabled() { - var iIsEnabled = _AdjustIsEnabled (); - return Convert.ToBoolean (iIsEnabled); - } - - private string ConvertDicToJson (Dictionary dictionary) { - if (dictionary == null) { - return null; - } - var jsonClass = new JSONClass(); - foreach (KeyValuePair kvp in dictionary) { - if (kvp.Value != null) { - jsonClass.Add(kvp.Key, new JSONData(kvp.Value)); - } - } - return jsonClass.ToString(); - } - } -} diff --git a/Assets/Plugins/iOS/AdjustUnity.mm b/Assets/Plugins/iOS/AdjustUnity.mm deleted file mode 100644 index fba8dd59..00000000 --- a/Assets/Plugins/iOS/AdjustUnity.mm +++ /dev/null @@ -1,118 +0,0 @@ -#import "NSString+AIAdditions.h" -#import "AIAdjustFactory.h" -#import "AdjustUnity.h" - -@implementation AdjustUnity - -static char *adjustSceneName = nil; -static id adjustUnityInstance = nil; - -- (id) init { - self = [super init]; - return self; -} - -- (void)adjustFinishedTrackingWithResponse:(AIResponseData *)responseData { - NSDictionary *dicResponseData = [responseData dictionary]; - NSData *dResponseData = [NSJSONSerialization dataWithJSONObject:dicResponseData options:0 error:nil]; - NSString *sResponseData = [[NSString alloc] initWithBytes:[dResponseData bytes] - length:[dResponseData length] - encoding:NSUTF8StringEncoding]; - const char * cResponseData= [sResponseData UTF8String]; - - UnitySendMessage(adjustSceneName, "getNativeMessage", cResponseData); -} - -@end - -NSDictionary* ConvertParameters (const char* cJsonParameters) -{ - if (cJsonParameters == nil) { - return nil; - } - NSString *sJsonParameters = [NSString stringWithUTF8String: cJsonParameters]; - - NSDictionary * parameters = nil; - NSError *error = nil; - - if (sJsonParameters != nil) { - NSData *jsonData = [sJsonParameters dataUsingEncoding:NSUTF8StringEncoding]; - parameters = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error]; - } - if (error != nil) { - NSString *errorMessage = [NSString stringWithFormat:@"Failed to parse json parameters: %@, (%@)", sJsonParameters.aiTrim, [error localizedDescription]]; - [AIAdjustFactory.logger error:errorMessage]; - } - - return parameters; -} - -extern "C" -{ - void _AdjustLaunchApp(const char* appToken, const char* environment, const char* sdkPrefix, int logLevel, int eventBuffering) { - NSString* sAppToken = [NSString stringWithUTF8String: appToken]; - NSString* sEnvironment = [NSString stringWithUTF8String: environment]; - NSString* sSdkPrefix = [NSString stringWithUTF8String: sdkPrefix]; - AILogLevel eLogLevel = (AILogLevel)logLevel; - BOOL bEventBuffering = (BOOL) eventBuffering; - - NSLog(@"%@, %@, %d, %d", sAppToken, sEnvironment, eLogLevel, bEventBuffering); - [Adjust appDidLaunch:sAppToken]; - [Adjust setEnvironment:sEnvironment]; - [Adjust setLogLevel:eLogLevel]; - [Adjust setSdkPrefix:sSdkPrefix]; - } - - void _AdjustTrackEvent(const char* eventToken, const char* cJsonParameters) { - NSString *sEventToken = [NSString stringWithUTF8String: eventToken]; - NSDictionary * parameters = ConvertParameters(cJsonParameters); - - if (parameters == nil) { - [Adjust trackEvent:sEventToken]; - } else { - [Adjust trackEvent:sEventToken withParameters:parameters]; - } - } - - void _AdjustTrackRevenue(double cents, const char* eventToken, const char* cJsonParameters) { - NSString *sEventToken = nil; - if (eventToken != nil) { - sEventToken = [NSString stringWithUTF8String: eventToken]; - } - - NSDictionary * parameters = ConvertParameters(cJsonParameters); - - if (sEventToken == nil) { - [Adjust trackRevenue:cents]; - } else if (parameters == nil) { - [Adjust trackRevenue:cents forEvent:sEventToken]; - } else { - [Adjust trackRevenue:cents forEvent:sEventToken withParameters:parameters]; - } - } - - void _AdjustOnPause() { - [Adjust trackSubsessionEnd]; - } - - void _AdjustOnResume() { - [Adjust trackSubsessionStart]; - } - - void _AdjustSetResponseDelegate(const char* sceneName) { - adjustSceneName = strdup(sceneName); - adjustUnityInstance = [[AdjustUnity alloc] init]; - [Adjust setDelegate:adjustUnityInstance]; - } - - void _AdjustSetEnabled(int enabled) { - BOOL bEnabled = (BOOL) enabled; - [Adjust setEnabled:bEnabled]; - } - - int _AdjustIsEnabled() { - BOOL isEnabled = [Adjust isEnabled]; - int iIsEnabled = (int) isEnabled; - return iIsEnabled; - } -} diff --git a/Assets/Plugins/iOS/NSData+AIAdditions.h b/Assets/Plugins/iOS/NSData+AIAdditions.h deleted file mode 100644 index 14010c32..00000000 --- a/Assets/Plugins/iOS/NSData+AIAdditions.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// NSData+AIAdditions.h -// Adjust -// -// Created by Christian Wellenbrock on 01.10.12. -// Copyright (c) 2012-2014 adjust GmbH. All rights reserved. -// -#import - -@interface NSData(AIAdditions) - -- (NSString *)aiEncodeBase64; - -@end diff --git a/Assets/Plugins/iOS/NSData+AIAdditions.h.meta b/Assets/Plugins/iOS/NSData+AIAdditions.h.meta deleted file mode 100644 index 7240fb0e..00000000 --- a/Assets/Plugins/iOS/NSData+AIAdditions.h.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 164743f4080264165a2f2365b396aee7 -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/NSData+AIAdditions.m b/Assets/Plugins/iOS/NSData+AIAdditions.m deleted file mode 100644 index 30ec53ce..00000000 --- a/Assets/Plugins/iOS/NSData+AIAdditions.m +++ /dev/null @@ -1,64 +0,0 @@ -// -// NSData+AIAdditions.m -// Adjust -// -// Created by Christian Wellenbrock on 01.10.12. -// Copyright (c) 2012-2014 adjust GmbH. All rights reserved. -// - -#import "NSData+AIAdditions.h" - -@implementation NSData(AIAdditions) - -static const char _base64EncodingTable[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -// http://stackoverflow.com/a/4727124 -- (NSString *)aiEncodeBase64 { - const unsigned char * objRawData = self.bytes; - char * objPointer; - char * strResult; - - // Get the Raw Data length and ensure we actually have data - NSUInteger intLength = self.length; - if (intLength == 0) return nil; - - // Setup the String-based Result placeholder and pointer within that placeholder - strResult = (char *)calloc((((intLength + 2) / 3) * 4) + 1, sizeof(char)); - objPointer = strResult; - - // Iterate through everything - while (intLength > 2) { // keep going until we have less than 24 bits - *objPointer++ = _base64EncodingTable[objRawData[0] >> 2]; - *objPointer++ = _base64EncodingTable[((objRawData[0] & 0x03) << 4) + (objRawData[1] >> 4)]; - *objPointer++ = _base64EncodingTable[((objRawData[1] & 0x0f) << 2) + (objRawData[2] >> 6)]; - *objPointer++ = _base64EncodingTable[objRawData[2] & 0x3f]; - - // we just handled 3 octets (24 bits) of data - objRawData += 3; - intLength -= 3; - } - - // now deal with the tail end of things - if (intLength != 0) { - *objPointer++ = _base64EncodingTable[objRawData[0] >> 2]; - if (intLength > 1) { - *objPointer++ = _base64EncodingTable[((objRawData[0] & 0x03) << 4) + (objRawData[1] >> 4)]; - *objPointer++ = _base64EncodingTable[(objRawData[1] & 0x0f) << 2]; - *objPointer++ = '='; - } else { - *objPointer++ = _base64EncodingTable[(objRawData[0] & 0x03) << 4]; - *objPointer++ = '='; - *objPointer++ = '='; - } - } - - // Terminate the string-based result - *objPointer = '\0'; - - // Return the results as an NSString object - NSString *encodedString = [NSString stringWithCString:strResult encoding:NSASCIIStringEncoding]; - free(strResult); - return encodedString; -} - -@end diff --git a/Assets/Plugins/iOS/NSData+AIAdditions.m.meta b/Assets/Plugins/iOS/NSData+AIAdditions.m.meta deleted file mode 100644 index 30e7c77a..00000000 --- a/Assets/Plugins/iOS/NSData+AIAdditions.m.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: b062c764526134ee196adf95b7c1e393 -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/NSString+AIAdditions.h b/Assets/Plugins/iOS/NSString+AIAdditions.h deleted file mode 100644 index 75157b68..00000000 --- a/Assets/Plugins/iOS/NSString+AIAdditions.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// NSString+AIAdditions.h -// Adjust -// -// Created by Christian Wellenbrock on 23.07.12. -// Copyright (c) 2012-2014 adjust GmbH. All rights reserved. -// -#import - -@interface NSString(AIAdditions) - -- (NSString *)aiTrim; -- (NSString *)aiQuote; -- (NSString *)aiMd5; -- (NSString *)aiSha1; -- (NSString *)aiUrlEncode; -- (NSString *)aiRemoveColons; - -+ (NSString *)aiJoin:(NSString *)strings, ...; - -@end diff --git a/Assets/Plugins/iOS/NSString+AIAdditions.h.meta b/Assets/Plugins/iOS/NSString+AIAdditions.h.meta deleted file mode 100644 index 9e121218..00000000 --- a/Assets/Plugins/iOS/NSString+AIAdditions.h.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 4f1c087a94ac34824a90100264468937 -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/NSString+AIAdditions.m b/Assets/Plugins/iOS/NSString+AIAdditions.m deleted file mode 100644 index 183cf327..00000000 --- a/Assets/Plugins/iOS/NSString+AIAdditions.m +++ /dev/null @@ -1,82 +0,0 @@ -// -// NSString+AIAdditions.m -// Adjust -// -// Created by Christian Wellenbrock on 23.07.12. -// Copyright (c) 2012-2014 adjust GmbH. All rights reserved. -// - -#import "NSString+AIAdditions.h" - -#import "CommonCrypto/CommonDigest.h" - -@implementation NSString(AIAdditions) - -- (NSString *)aiTrim { - return [self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; -} - -- (NSString *)aiQuote { - if (self == nil) { - return nil; - } - - if ([self rangeOfCharacterFromSet:[NSCharacterSet whitespaceCharacterSet]].location == NSNotFound) { - return self; - } - return [NSString stringWithFormat:@"'%@'", self]; -} - -- (NSString *)aiMd5 { - const char *cStr = [self UTF8String]; - unsigned char digest[16]; - CC_MD5(cStr, (CC_LONG)strlen(cStr), digest); - - NSMutableString *output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2]; - for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++) { - [output appendFormat:@"%02x", digest[i]]; - } - return output; -} - -- (NSString *)aiSha1 { - const char *cstr = [self cStringUsingEncoding:NSUTF8StringEncoding]; - NSData *data = [NSData dataWithBytes:cstr length:self.length]; - uint8_t digest[CC_SHA1_DIGEST_LENGTH]; - CC_SHA1(data.bytes, (CC_LONG)data.length, digest); - - NSMutableString* output = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2]; - for(int i = 0; i < CC_SHA1_DIGEST_LENGTH; i++) { - [output appendFormat:@"%02x", digest[i]]; - } - return output; -} - --(NSString *)aiUrlEncode { - return (NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes( - NULL, - (CFStringRef)self, - NULL, - (CFStringRef)@"!*'\"();:@&=+$,/?%#[]% ", - CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding))); -} - -- (NSString *)aiRemoveColons { - return [self stringByReplacingOccurrencesOfString:@":" withString:@""]; -} - -+ (NSString *)aiJoin:(NSString *)first, ... { - NSString *iter, *result = first; - va_list strings; - va_start(strings, first); - - while ((iter = va_arg(strings, NSString*))) { - NSString *capitalized = iter.capitalizedString; - result = [result stringByAppendingString:capitalized]; - } - - va_end(strings); - return result; -} - -@end diff --git a/Assets/Plugins/iOS/NSString+AIAdditions.m.meta b/Assets/Plugins/iOS/NSString+AIAdditions.m.meta deleted file mode 100644 index 1479c4e9..00000000 --- a/Assets/Plugins/iOS/NSString+AIAdditions.m.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 588e1a56852f2475490086f40e8022d9 -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/UIDevice+AIAdditions.h b/Assets/Plugins/iOS/UIDevice+AIAdditions.h deleted file mode 100644 index 615e49c5..00000000 --- a/Assets/Plugins/iOS/UIDevice+AIAdditions.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// UIDevice+AIAdditions.h -// Adjust -// -// Created by Christian Wellenbrock on 23.07.12. -// Copyright (c) 2012-2014 adjust GmbH. All rights reserved. -// -#import -#import -#import "AIActivityHandler.h" - -@interface UIDevice(AIAdditions) - -- (BOOL)aiTrackingEnabled; -- (NSString *)aiIdForAdvertisers; -- (NSString *)aiFbAttributionId; -- (NSString *)aiMacAddress; -- (NSString *)aiDeviceType; -- (NSString *)aiDeviceName; -- (NSString *)aiCreateUuid; -- (NSString *)aiVendorId; -- (void)aiSetIad:(AIActivityHandler *)activityHandler; -@end diff --git a/Assets/Plugins/iOS/UIDevice+AIAdditions.h.meta b/Assets/Plugins/iOS/UIDevice+AIAdditions.h.meta deleted file mode 100644 index e05fcf68..00000000 --- a/Assets/Plugins/iOS/UIDevice+AIAdditions.h.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 528e707dd951a40daa13d0444a8bd41b -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/UIDevice+AIAdditions.m b/Assets/Plugins/iOS/UIDevice+AIAdditions.m deleted file mode 100644 index 81081152..00000000 --- a/Assets/Plugins/iOS/UIDevice+AIAdditions.m +++ /dev/null @@ -1,193 +0,0 @@ -// -// UIDevice+AIAdditions.m -// Adjust -// -// Created by Christian Wellenbrock on 23.07.12. -// Copyright (c) 2012-2014 adjust GmbH. All rights reserved. -// - -#import "UIDevice+AIAdditions.h" -#import "NSString+AIAdditions.h" - -#import -#import -#import -#import - -#if !ADJUST_NO_IDFA -#import -#endif - -#if !ADJUST_NO_IDA -#import -#endif - -@implementation UIDevice(AIAdditions) - -- (BOOL)aiTrackingEnabled { -#if !ADJUST_NO_IDFA - NSString *className = [NSString aiJoin:@"A", @"S", @"identifier", @"manager", nil]; - NSString *keyManager = [NSString aiJoin:@"shared", @"manager", nil]; - NSString *keyEnabled = [NSString aiJoin:@"is", @"advertising", @"tracking", @"enabled", nil]; - - Class class = NSClassFromString(className); - if (class) { - @try { - SEL selManager = NSSelectorFromString(keyManager); - SEL selEnabled = NSSelectorFromString(keyEnabled); - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Warc-performSelector-leaks" - id manager = [class performSelector:selManager]; - BOOL enabled = (BOOL)[manager performSelector:selEnabled]; -#pragma clang diagnostic pop - - return enabled; - } @catch (NSException *e) { - return NO; - } - } else -#endif - { - return NO; - } -} - -- (NSString *)aiIdForAdvertisers { -#if !ADJUST_NO_IDFA - NSString *className = [NSString aiJoin:@"A", @"S", @"identifier", @"manager", nil]; - NSString *keyManager = [NSString aiJoin:@"shared", @"manager", nil]; - NSString *keyIdentifier = [NSString aiJoin:@"advertising", @"identifier", nil]; - NSString *keyString = [NSString aiJoin:@"UUID", @"string", nil]; - - Class class = NSClassFromString(className); - if (class) { - @try { - SEL selManager = NSSelectorFromString(keyManager); - SEL selIdentifier = NSSelectorFromString(keyIdentifier); - SEL selString = NSSelectorFromString(keyString); - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Warc-performSelector-leaks" - id manager = [class performSelector:selManager]; - id identifier = [manager performSelector:selIdentifier]; - NSString *string = [identifier performSelector:selString]; -#pragma clang diagnostic pop - - return string; - } @catch (NSException *e) { - return @""; - } - } else -#endif - { - return @""; - } -} - -- (NSString *)aiFbAttributionId { - NSString *result = [UIPasteboard pasteboardWithName:@"fb_app_attribution" create:NO].string; - if (result == nil) return @""; - return result; -} - -- (NSString *)aiMacAddress { - int mib[6]; - size_t len; - char *buf; - unsigned char *ptr; - struct if_msghdr *ifm; - struct sockaddr_dl *sdl; - - mib[0] = CTL_NET; - mib[1] = AF_ROUTE; - mib[2] = 0; - mib[3] = AF_LINK; - mib[4] = NET_RT_IFLIST; - - if ((mib[5] = if_nametoindex("en0")) == 0) { - printf("Error: if_nametoindex error\n"); - return NULL; - } - - if (sysctl(mib, 6, NULL, &len, NULL, 0) < 0) { - printf("Error: sysctl, take 1\n"); - return NULL; - } - - if ((buf = malloc(len)) == NULL) { - printf("Could not allocate memory. error!\n"); - return NULL; - } - - if (sysctl(mib, 6, buf, &len, NULL, 0) < 0) { - printf("Error: sysctl, take 2"); - free(buf); - return NULL; - } - - ifm = (struct if_msghdr *)buf; - sdl = (struct sockaddr_dl *)(ifm + 1); - ptr = (unsigned char *)LLADDR(sdl); - - NSString *macAddress = [NSString stringWithFormat:@"%02X:%02X:%02X:%02X:%02X:%02X", - *ptr, *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4), *(ptr+5)]; - - free(buf); - - return macAddress; -} - -- (NSString *)aiDeviceType { - NSString *type = [self.model stringByReplacingOccurrencesOfString:@" " withString:@""]; - return type; -} - -- (NSString *)aiDeviceName { - size_t size; - sysctlbyname("hw.machine", NULL, &size, NULL, 0); - char *name = malloc(size); - sysctlbyname("hw.machine", name, &size, NULL, 0); - NSString *machine = [NSString stringWithUTF8String:name]; - free(name); - return machine; -} - -- (NSString *)aiCreateUuid { - CFUUIDRef newUniqueId = CFUUIDCreate(kCFAllocatorDefault); - CFStringRef stringRef = CFUUIDCreateString(kCFAllocatorDefault, newUniqueId); - NSString *uuidString = (__bridge_transfer NSString*)stringRef; - NSString *lowerUuid = [uuidString lowercaseString]; - CFRelease(newUniqueId); - return lowerUuid; -} - -- (NSString *)aiVendorId { - if ([UIDevice.currentDevice respondsToSelector:@selector(identifierForVendor)]) { - return [UIDevice.currentDevice.identifierForVendor UUIDString]; - } - return @""; -} - -- (void) aiSetIad:(AIActivityHandler *) activityHandler{ -#if !ADJUST_NO_IDA - Class ADClientClass = NSClassFromString(@"ADClient"); - if (ADClientClass) { - @try { - SEL sharedClientSelector = NSSelectorFromString(@"sharedClient"); - SEL iadSelector = NSSelectorFromString(@"determineAppInstallationAttributionWithCompletionHandler:"); -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Warc-performSelector-leaks" - id ADClientSharedClientInstance = [ADClientClass performSelector:sharedClientSelector]; - - [ADClientSharedClientInstance performSelector:iadSelector withObject:^(BOOL appInstallationWasAttributedToiAd) { - activityHandler.isIad = appInstallationWasAttributedToiAd; - }]; -#pragma clang diagnostic pop - } - @catch (NSException *exception) { - } - } -#endif -} -@end diff --git a/Assets/Plugins/iOS/UIDevice+AIAdditions.m.meta b/Assets/Plugins/iOS/UIDevice+AIAdditions.m.meta deleted file mode 100644 index cd6ea7bb..00000000 --- a/Assets/Plugins/iOS/UIDevice+AIAdditions.m.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: f6875094150a6426c8e520d170c50c7c -DefaultImporter: - userData: diff --git a/Assets/Plugins/iOS/src/Adjust b/Assets/Plugins/iOS/src/Adjust deleted file mode 160000 index 414aa6de..00000000 --- a/Assets/Plugins/iOS/src/Adjust +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 414aa6de0139a8b19a4e5db92aad392d5d737317 diff --git a/README.md b/README.md index c94d9042..b1f2e8da 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## Summary -This is the Unity3d SDK of adjust™. It supports iOS, Android, Windows Phone 8 and Windows Store App targets. You can read more about adjust™ at [adjust.com]. +This is the Unity3d SDK of adjust™. It supports iOS and Android targets. You can read more about adjust™ at [adjust.com]. ## Basic Installation @@ -9,19 +9,19 @@ Unity3d project. ### 1. Get the SDK -Download the latest version from our [releases page][releases]. Download the -unityPackge in a folder of your choice. +Download the latest version from our [releases page][releases]. Unzip the +Unity package in a folder of your choice. ### 2. Add it to your project -Open your project in the Unity Editor and navigate to `Assets → Import Package → Custom Package` and select the downloaded unityPackage file. +Open your project in the Unity Editor and navigate to `Assets → Import Package → Custom Package` and select the downloaded Unity package file. ![][import_package] ### 3. Integrate adjust into your app -Add the prefab located at `Assets/Adjust.prefab` to the first scene. +Add the prefab located at `Assets/Adjust/Adjust.prefab` to the first scene. Edit the parameters of the Adjust script in the Inspector menu of the added prefab. @@ -60,56 +60,66 @@ If your app makes heavy use of event tracking, you might want to delay some HTTP requests in order to send them in one batch every minute. You can enable event buffering by ticking the box for `Event Buffering`. -If you don't want to start the adjust SDK at the `Awake` event of the game, tick the box `Start Manually`. Call the method `Adjust.appDidLaunch` with the respective parameters to start the adjust SDK instead. +If you don't want to start the adjust SDK at the `Awake` event of the game, tick the box `Start Manually`. Call the method `Adjust.start` with the `AdjustConfig` object as a parameter to start the adjust SDK instead. For an example of scene with of a button menu with these options and others, open the example scene located at -`Assets/ExampleGUI/ExampleGUI.unity`. The source for this scene is located at `Assets/ExampleGUI/ExampleGUI.cs`. +`Assets/Adjust/ExampleGUI/ExampleGUI.unity`. The source for this scene is located at `Assets/Adjust/ExampleGUI/ExampleGUI.cs`. -#### Windows Store Apps +### 4. Add Google Play Services -Currently for the Windows Store Apps target only the typle `C++` solutions are functional. This include the `D3D11 C++ Solution` and the `XAML C++ Solution` types. +Since August 1st, 2014, apps in the Google Play Store must use the +[Google Advertising ID][google_ad_id] to uniquely identify devices. To allow +the adjust SDK to use the Google Advertising ID, you must integrate the [Google +Play Services][google_play_services]. If you haven't done this yet, you should +copy `google-play-services_lib` folder into the `Assets/Plugins/Android` +folder of your Unity project and after building your app, Google Play Services +should be integrated. -By default, the Windows Store Apps target apps do not have the Internet client capability activated. To activate it, first switch to the target `Windows Store App` in the `File → Build Settings...` menu. Click the `Player Settings...` button on the `Build Settings`. In the main Unity3d window, the `Inspector` tab will be selected with the Windows Store App settings. Expand the `Publishing Settings` list. Find the `Capabilities` box on the bottom and tick the `InternetClient` checkbox button. +`google-play-services_lib` is part of the Android SDK, which you may already have installed. -Unfortunatly the Windows Store Apps target apps generated by Unity3d does not link correctly the assembly `System.Core`. The consequense is that, some `System.IO.FileLoadException` errors from different libraries are generated on the first build. To correct it, just build again. This time the assembly should to be correctly linked. +There are two main ways to download the Android SDK. If you are using any tool which has the +`Android SDK Manager`, you should download `Android SDK Tools`. Once installed, you can find +the libraries in the `SDK_FOLDER/extras/google/google_play_services/libproject/` folder. -### 4. Build scripts +![][android_sdk_location] + +If you are not using any tool which has Android SDK Manager, you should download the standalone version +of Android SDK from [official page][android_sdk_download]. By downloading this, you will have only a basic +version of the Android SDK which doesn't include the Android SDK Tools. There are more detailed instructions +on how to download these in the readme file provided by Google, called `SDK Readme.txt`, which is placed in +Android SDK folder. + + +### 5. Build scripts To facilitate the build process we integrated build scripts for both Android and iOS. The script runs after each build and is called by the file `Assets/Editor/AdjustEditor.cs`. They require at least `python 2.7` installed to work. -It's possible to disable the post processing by clicking on the menu `Adjust → Change post processing status`. +It's possible to disable the post processing by clicking on the menu `Assets → Adjust → Change post processing status`. Press the same button to re-enable it. #### iOS -The iOS build script is located at `Assets/Editor/AdjustPostBuildiOS`. It changes the Unity3d iOS generated project in -the following ways: +The iOS build script is located at `Assets/Editor/PostprocessBuildPlayer_AdjustPostBuildiOS`. It changes the Unity3d iOS generated project in the following ways: -1. Adds the adSupport framework to the project. It is needed for the adjust SDK, consult the adjust +1. Adds the iAd and AdSupport frameworks to the project. This is required by the adjust SDK - check out the adjust [iOS][ios] page for more details. -2. Adds the compilation flag `-fobjc-arc` to the adjust project files in the project. This allows the adjust `ARC` based project to work with the `non-ARC` Unity3d iOS project. - -3. Enables the flag `GCC_ENABLE_OBJC_EXCEPTIONS`, to allow the adjust SDK to use objective-c exceptions. +2. Adds the other linker flag `-all_load`. This allows the adjust Objective-C categories to be recognized during the build time. If you have a custom build that puts the Unity3d iOS generated project in a different location, -inform the script by clicking on the menu `Adjust → Set iOS build path` and choosing the build path of the iOS project. +inform the script by clicking on the menu `Assets → Adjust → Set iOS build path` and choosing the build path of the iOS project. -After running, the script writes the log file `AdjustPostBuildiOSLog.txt` at the root of the Unity3d project with log -messages of the script run. +After running, the script writes the log file `AdjustPostBuildiOSLog.txt` at the root of the Unity3d project with log messages of the script run. #### Android -The android build script is located at `Assets/Editor/AdjustPostBuildAndroid`. It changes the `AndroidManifest.xml` file -located at `Assets/Plugins/Android/`. The problem with this approach is that, the manifest file used for the Android -package was the one before the build process ended. +The android build script is located at `Assets/Editor/PostprocessBuildPlayer_AdjustPostBuildAndroid`. It changes the `AndroidManifest.xml` file located at `Assets/Plugins/Android/`. The problem with this approach is that, the manifest file used for the Android package was the one before the build process ended. -To mitigate this, simply run the build again, using the manifest created or changed by the previous run, or click on the menu `Adjust → Fix AndroidManifest.xml` so the script can run before the build process. Either way, it is only necessary to do this step once, as long the manifest file remains compatible with the adjust SDK. +To mitigate this, simply run the build again, using the manifest created or changed by the previous run, or click on the menu `Assets → Adjust → Fix AndroidManifest.xml` so the script can run before the build process. Either way, it is only necessary to do this step once, as long the manifest file remains compatible with the adjust SDK. ![][menu_android] -If there is not a `AndroidManifest.xml` file at `Assets/Plugins/Android/` it creates a copy from our compatible manifest -file `AdjustAndroidManifest.xml`. If there is already an `AndroidManifest.xml` file, it checks and changes the following: +If there is not a `AndroidManifest.xml` file at `Assets/Plugins/Android/` it creates a copy from our compatible manifest file `AdjustAndroidManifest.xml`. If there is already an `AndroidManifest.xml` file, it checks and changes the following: 1. Adds a broadcast receiver. For more details consult the adjust [Android][android] page for more details. @@ -117,25 +127,37 @@ file `AdjustAndroidManifest.xml`. If there is already an `AndroidManifest.xml` f 3. Adds the permission to access information about Wi-Fi networks. -After running, the script writes the log file `AdjustPostBuildAndroidLog.txt` at the root of the Unity3d project with log -messages of the script run. +After running, the script writes the log file `AdjustPostBuildAndroidLog.txt` at the root of the Unity3d project with log messages of the script run. ## Additional features Once you integrated the adjust SDK into your project, you can take advantage of the following features. -### 5. Add tracking of custom events. +### 6. Add tracking of custom events -You can tell adjust about every event you want. Suppose you want to track +You can tell adjust about any event you wish. Suppose you want to track every tap on a button. You would have to create a new Event Token in your [dashboard]. Let's say that Event Token is `abc123`. In your button's click handler method you could then add the following line to track the click: ```cs -Adjust.trackEvent("abc123"); +AdjustEvent adjustEvent = new AdjustEvent ("abc123"); +Adjust.trackEvent (adjustEvent); +``` + +### 7. Add tracking of revenue + +If your users can generate revenue by tapping on advertisements or making in-app purchases you can track those revenues with events. Lets say a tap is worth one Euro cent. You could then track the revenue event like this: + +```cs +AdjustEvent adjustEvent = new AdjustEvent ("abc123"); +adjustEvent.setRevenue (0.01, "EUR"); +Adjust.trackEvent (adjustEvent); ``` +### 8. Add callback parameters + You can also register a callback URL for that event in your [dashboard] and we will send a GET request to that URL whenever the event gets tracked. In that case you can also put some key-value-pairs in an object and pass it to the @@ -147,11 +169,12 @@ For example, suppose you have registered the URL execute the following lines: ```cs -Dictionary parameters = new Dictionary(); -parameters.Add("key","value"); -parameters.Add("foo","bar"); +AdjustEvent adjustEvent = new AdjustEvent ("abc123"); + +adjustEvent.addCallbackParameter ("key", "value"); +adjustEvent.addCallbackParameter ("foo", "bar"); -Adjust.trackEvent("abc123", parameters); +Adjust.trackEvent (adjustEvent); ``` In that case we would track the event and send a request to: @@ -169,94 +192,47 @@ we don't store any of your custom parameters, but only append them to your callbacks. If you haven't registered a callback for an event, these parameters won't even be read. -### 6. Add tracking of revenue - -If your users can generate revenue by clicking on advertisements or making -in-app purchases you can track those revenues. If, for example, a click is -worth one cent, you could make the following call to track that revenue: +### 9. Partner parameters -```cs -Adjust.trackRevenue(1.0); -``` +You can also add parameters to be transmitted to network partners, for the integrations that have been activated in your adjust dashboard. -The parameter is supposed to be in cents and will get rounded to one decimal -point. If you want to differentiate between different kinds of revenue you can -get different Event Tokens for each kind. Again, you need to create those Event -Tokens in your [dashboard]. In that case you would make a call like this: +This works similarly to the callback parameters mentioned above, but can be added by calling the addPartnerParameter method on your `AdjustEvent` instance. ```cs -Adjust.trackRevenue(1.0, "abc123"); -``` +AdjustEvent adjustEvent = new AdjustEvent ("abc123"); -Again, you can register a callback and provide a dictionary of named -parameters, just like it worked with normal events. +adjustEvent.addPartnerParameter ("key", "value"); +adjustEvent.addPartnerParameter ("foo", "bar"); -```cs -Dictionary parameters = new Dictionary(); -parameters.Add("key","value"); -parameters.Add("foo","bar"); - -Adjust.trackRevenue(1.0, "abc123", parameters); +Adjust.trackEvent (adjustEvent); ``` -### 7. Receive delegate callbacks +You can read more about special partners and these integrations in our [guide to special partners.][special-partners] + +### 9. Receive attribution change callback -Every time your app tries to track a session, an event or some revenue, you can -be notified about the success of that operation and receive additional -information about the current install. Follow these steps to implement a -delegate to this event. +You can register a callback to be notified of tracker attribution changes. Due to the different sources considered for attribution, this information can not by provided synchronously. Follow these steps to implement the optional callback in your application: Please make sure to consider [applicable attribution data policies.][attribution_data] -1. Create a method with the signature of the delegate `Action`. +1. Create a method with the signature of the delegate `Action`. -2. After calling the launch of the adjust SDK, call the `Adjust.setResponseDelegate` +2. After creating the `AdjustConfig` object, call the `adjustConfig.setAttributionChangedDelegate` with the previously created method. It is also be possible to use a lambda with the same signature. 3. If instead of using the `Adjust.prefab`, the `Adjust.cs` script was added to another `GameObject`. -Don't forget to pass the name of that `GameObject` as the second parameter of `Adjust.setResponseDelegate`. - -The delegate method will get called every time any activity was tracked or -failed to track. Within the delegate method you have access to the -`responseData` parameter. Here is a quick summary of its attributes: - -- `ActivityKind activityKind` indicates what kind of activity was tracked. It has -one of these values: - - ``` - ActivityKind.SESSION - ActivityKind.EVENT - ActivityKind.REVENUE - ActivityKind.REATTRIBUTION - ``` - -- `string activityKindString` human readable version of the activity kind. -Possible values: - - ``` - session - event - revenue - reattribution - ``` - -- `bool success` indicates whether or not the tracking attempt was - successful. -- `bool willRetry` is true when the request failed, but will be retried. -- `string error` an error message when the activity failed to track or - the response could not be parsed. Is `null` otherwise. -- `string trackerToken` the tracker token of the current install. Is `null` if - request failed or response could not be parsed. -- `string trackerName` the tracker name of the current install. Is `null` if - request failed or response could not be parsed. -- `string network` the network grouping level of the current install. Is `null` if - request failed, unavailable or response could not be parsed. -- `string campaign` the campaign grouping level of the current install. Is `null` if - request failed, unavailable or response could not be parsed. -- `string adgroup` the ad group grouping level of the current install. Is `null` if - request failed, unavailable or response could not be parsed. -- `string creative` the creative grouping level of the current install. Is `null` if - request failed, unavailable or response could not be parsed. +Don't forget to pass the name of that `GameObject` as the second parameter of `AdjustConfig.setAttributionChangedDelegate`. + +As the callback is configured using the AdjustConfig instance, you should call `adjustConfig.setAttributionChangedDelegate` before calling `Adjust.start`. + +The callback function will get called when the SDK receives final attribution data. Within the callback function you have access to the `attribution` parameter. Here is a quick summary of its properties: + +- `string trackerToken` the tracker token of the current install. +- `string trackerName` the tracker name of the current install. +- `string network` the network grouping level of the current install. +- `string campaign` the campaign grouping level of the current install. +- `string adgroup` the ad group grouping level of the current install. +- `string creative` the creative grouping level of the current install. ```cs using com.adjust.sdk; @@ -265,35 +241,39 @@ public class ExampleGUI : MonoBehaviour { { void OnGUI () { { - if (GUI.Button (new Rect (0, 0, Screen.width, Screen.height), - "callback")) { - Adjust.setResponseDelegate(responseDelegate); - } + if (GUI.Button (new Rect (0, 0, Screen.width, Screen.height), "callback")) + { + AdjustConfig adjustConfig = new AdjustConfig ("{Your App Token}", AdjustEnvironment.Sandbox); + adjustConfig.setLogLevel (AdjustLogLevel.Verbose); + adjustConfig.setAttributionChangedDelegate (this.attributionChangedDelegate); + + Adjust.start (adjustConfig); + } + } + + public void attributionChangedDelegate (AdjustAttribution attribution) + { + Debug.Log ("Attribution changed"); + + // ... } - - public void responseDelegate (ResponseData responseData) - { - Debug.Log ("activityKind " + responseData.activityKindString); - Debug.Log ("trackerName " + responseData.trackerName); - //... - } } ``` -### 8. Disable tracking +### 10. Disable tracking You can disable the adjust SDK from tracking by invoking the method `setEnabled` with the enabled parameter as `false`. This setting is remembered between sessions, but it can only be activated after the first session. ```cs -Adjust.setEnabled(enabled: false); +Adjust.setEnabled(false); ``` You can verify if the adjust SDK is currently active with the method `isEnabled`. It is always possible -to activate the adjust SDK by invoking `setEnabled` with the enabled parameter as `true`. +to activate the adjust SDK by invoking `setEnabled` with the `enabled` parameter set to `true`. -## Possible problems +## Troubleshooting ### iOS Even with the post build script it is possible that the project is not ready to run out of the box. @@ -307,12 +287,17 @@ The post build scripts require execute permissions to be able to run. If the bui [adjust.com]: http://adjust.com [dashboard]: http://adjust.com [releases]: https://github.com/adjust/adjust_unity_sdk/releases -[import_package]: https://raw.github.com/adjust/adjust_sdk/master/Resources/unity/01_import_package.png -[adjust_editor]: https://raw.github.com/adjust/adjust_sdk/master/Resources/unity/02_adjust_editor.png -[menu_android]: https://raw.github.com/adjust/adjust_sdk/master/Resources/unity/03_menu_android.png +[import_package]: https://raw.github.com/adjust/adjust_sdk/master/Resources/unity/v4/import_package.png +[adjust_editor]: https://raw.github.com/adjust/adjust_sdk/master/Resources/unity/v4/adjust_editor.png +[menu_android]: https://raw.github.com/adjust/adjust_sdk/master/Resources/unity/v4/menu_android.png [ios]: https://github.com/adjust/ios_sdk -[android]: https://github.com/adjust/ios_sdk +[android]: https://github.com/adjust/android_sdk [attribution_data]: https://github.com/adjust/sdks/blob/master/doc/attribution-data.md +[special-partners]: https://docs.adjust.com/en/special-partners +[google_ad_id]: https://developer.android.com/google/play-services/id.html +[google_play_services]: http://developer.android.com/google/play-services/setup.html +[android_sdk_download]: https://developer.android.com/sdk/index.html#Other +[android_sdk_location]: https://raw.github.com/adjust/adjust_sdk/master/Resources/unity/v4/android_sdk_download.png ## License @@ -322,7 +307,7 @@ You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2 The adjust-sdk is licensed under the MIT License. -Copyright (c) 2012-2014 adjust GmbH, +Copyright (c) 2012-2015 adjust GmbH, http://www.adjust.com Permission is hereby granted, free of charge, to any person obtaining a copy of diff --git a/VERSION b/VERSION index f9892605..fcdb2e10 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.4.4 +4.0.0 diff --git a/adjust_uninstall.py b/adjust_uninstall.py new file mode 100755 index 00000000..a5555fd5 --- /dev/null +++ b/adjust_uninstall.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +import os +import re +import sys +import shutil + +def main(): + assets_path = os.getcwd() + "/Assets"; + + re_adjust_files = re.compile(r"AI.*\.m|.*\+AI.*\.m|.*\+AI.*\.h|AI.*\.h|ADJ.*\.m|ADJ.*\.h|Adjust\.*|adjust\.*|ExampleGUI\.*|.*AdjustPostBuild.*|mod_pbxproj\.*|IAdjust\.*|ResponseData\.*|SimpleJSON\.*") + re_adjust_folders = re.compile(r"Adjust|3rd Party|ExampleGUI|adjust") + + for path, subdirs, files in os.walk(assets_path): + for name in files: + adjust_file_match = re_adjust_files.match(name if name else "") + + if (adjust_file_match): + file_path = os.path.join(path, name) + + if (os.path.exists(file_path)): + print "Removing file: " + file_path + os.remove(file_path) + + for path, subdirs, files in os.walk(assets_path): + for name in subdirs: + adjust_folder_match = re_adjust_folders.match(name if name else "") + + if (adjust_folder_match): + folder_path = os.path.join(path, name) + + if (os.path.exists(folder_path)): + print "Removing folder: " + folder_path + shutil.rmtree(folder_path) + + print "Adjust successfully removed from your project" + + sys.exit(0) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/doc/migrate.md b/doc/migrate.md new file mode 100644 index 00000000..5b722059 --- /dev/null +++ b/doc/migrate.md @@ -0,0 +1,102 @@ +## Migrate your adjust SDK for Unity3d to 4.0.0 from 3.4.4 + +N.B. At the moment, SDK 4.0 for Unity supports Android and iOS, but not Windows. If you are planning to release your Unity app on Windows, please migrate to 4.0 only when we add full support for Windows. + +### Migration procedure + +Starting from version 4.0.0, the structure of this repository is adjusted to Unity 5. All files which are part of the +adjust SDK are now moved to the `Assets/Adjust` folder, since Unity 5 allows that native files can now be placed +outside of `Assets/Plugins` folder. This is done so that adjust files are no longer mixed with files you may be +keeping in `Assets/Plugins` folder. + +For migration purposes, we have prepared two Unity packages: + + * `Adjust_v4.0.0_Unity_4.unitypackage` (for Unity 4 users) + * `Adjust_v4.0.0_Unity_5.unitypackage` (for Unity 5 users) + +and the adjust SDK uninstall script written in Python (`adjust_uninstall.py`). + +Migration to version 4.0.0 of our SDK requires the following steps: + +1. Copy the `adjust_uninstall.py` script to your root Unity project directory and run it. This script should +delete all adjust source files from the previous SDK version you had. + +2. Depending on which Unity version you are using, import the appropriate Unity package file into your `Assets` folder. + +After this, the adjust SDK should be successfully integrated into your Unity project. + +### SDK initialization + +We have changed how you configure and start the adjust SDK. All initial setup is now done with a new +instance of the `AdjustConfig` object. The following steps should now be taken to configure the adjust SDK: + +1. Create an instance of an `AdjustConfig` config object with the app token and environment. +2. Optionally, you can now call methods of the `AdjustConfig` object to specify available options. +3. Launch the SDK by invoking `Adjust.start` with the config object. + +Here is an example of how the setup might look before and after the migration: + +##### Before + +```cs +Adjust.appDidLaunch("{YourAppToken}", AdjustUtil.AdjustEnvironment.Sandbox, AdjustUtil.LogLevel.Verbose, false); +``` + +##### After + +```cs +AdjustConfig adjustConfig = new AdjustConfig ("{YourAppToken}", AdjustEnvironment.Sandbox); +adjustConfig.setLogLevel (AdjustLogLevel.Verbose); + +Adjust.start (adjustConfig); +``` + +### Event tracking + +We also introduced proper event objects that are set up before they are tracked. Again, an example of how it +might look like before and after: + +##### Before + +```cs +var parameters = new System.Collections.Generic.Dictionary (2); +parameters.Add("key", "value"); +parameters.Add("foo", "bar"); + +Adjust.trackEvent("{EventToken}", parameters); +``` + +##### After + +```cs +AdjustEvent adjustEvent = new AdjustEvent ("{EventToken}"); +adjustEvent.addCallbackParameter ("key", "value"); +adjustEvent.addCallbackParameter ("foo", "bar"); + +Adjust.trackEvent (adjustEvent); +``` + +### Revenue tracking + +Revenues are now handled like normal events. You just set a revenue and a currency to track revenues. +Note that it is no longer possible to track revenues without associated event tokens. You might need +to create an additional event token in your dashboard. + +*Please note* - the revenue format has been changed from a cent float to a whole currency-unit float. +Current revenue tracking must be adjusted to whole currency units (i.e., divided by 100) in order to +remain consistent. + +##### Before + +```cs +Adjust.trackRevenue(1.0, "{EventToken}"); +``` + +##### After + +```cs +AdjustEvent adjustEvent = new AdjustEvent ("{EventToken}"); +adjustEvent.setRevenue (0.01, "EUR"); + +Adjust.trackEvent (adjustEvent); +``` diff --git a/ext/Android/Makefile b/ext/Android/Makefile new file mode 100644 index 00000000..e8b821ac --- /dev/null +++ b/ext/Android/Makefile @@ -0,0 +1,18 @@ +MVNDIR = ./sdk/Adjust +JARINDIR = ./sdk/Adjust/target +JAROUTDIR = ../../Assets/Plugins/Android + +default: copy + +build: clean + cd $(MVNDIR); mvn package + +clean: + cd $(MVNDIR); mvn clean + +copy: build + rm $(JAROUTDIR)/adjust-android*; \ + cp $(JARINDIR)/adjust-android-*.*.*.jar $(JAROUTDIR); \ + rm $(JAROUTDIR)/*-javadoc.jar; \ + rm $(JAROUTDIR)/*-sources.jar; \ + mv $(JAROUTDIR)/adjust-android-*.*.*.jar $(JAROUTDIR)/adjust-android.jar diff --git a/ext/Android/sdk b/ext/Android/sdk new file mode 160000 index 00000000..18d8932c --- /dev/null +++ b/ext/Android/sdk @@ -0,0 +1 @@ +Subproject commit 18d8932cad3d2f9ebfaee1ac5223ed9b29c690bb diff --git a/ext/iOS/Makefile b/ext/iOS/Makefile new file mode 100644 index 00000000..a9cb6149 --- /dev/null +++ b/ext/iOS/Makefile @@ -0,0 +1,12 @@ +SRCDIR = ./sdk +LIBOUTDIR = ../../Assets/Plugins/iOS + +default: copy + +build: + cd $(SRCDIR); \ + xcodebuild -target framework -configuration Release + +copy: build + cp $(SRCDIR)/Adjust.a $(LIBOUTDIR); \ + rm $(SRCDIR)/Adjust.a diff --git a/ext/iOS/sdk b/ext/iOS/sdk new file mode 160000 index 00000000..952fb51b --- /dev/null +++ b/ext/iOS/sdk @@ -0,0 +1 @@ +Subproject commit 952fb51bbf8cba91719713bd082497d357de0b54