Skip to content

Commit

Permalink
Merge pull request #10 from adjust/development
Browse files Browse the repository at this point in the history
Windows Phone 8 and Windows Store Apps targets
  • Loading branch information
nonelse committed May 14, 2014
2 parents fb3ee2f + 2780b95 commit d12052d
Show file tree
Hide file tree
Showing 88 changed files with 1,320 additions and 53 deletions.
63 changes: 63 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
115 changes: 113 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,123 @@ Library/
ExportedObj/
*.svd
*.userprefs
*.csproj
*.pidb
*.suo
*.sln
*.user
*.unityproj
*.booproj

nuget
*.nupkg

# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
[Bb]in/
[Oo]bj/

# mstest test results
TestResults

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates

# Build results
[Dd]ebug/
[Rr]elease/
x64/
*_i.c
*_p.c
*.ilk
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.log
*.vspscc
*.vssscc
.builds

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*

# NCrunch
*.ncrunch*
.*crunch*.local.xml

# Installshield output folder
[Ee]xpress

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish

# Publish Web Output
*.Publish.xml

# NuGet Packages Directory
packages

# Windows Azure Build Output
csx
*.build.csdef

# Windows Store app package directory
AppPackages/

# Others
[Bb]in
[Oo]bj
sql
TestResults
[Tt]est[Rr]esult*
*.Cache
ClientBin
[Ss]tyle[Cc]op.*
~$*
*.dbmdl
Generated_Code #added for RIA/Silverlight projects

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML

# ============ #
# OS generated #
# ============ #
Expand All @@ -31,9 +140,11 @@ ExportedObj/
Icon?
ehthumbs.db
Thumbs.db
*.orig

# ==================== #
# Adjust SDK generated #
# ==================== #
*.pyc*
AndroidManifest.xml*
MetroTestCertificate.pfx*
Binary file modified Adjust.unitypackage
Binary file not shown.
22 changes: 16 additions & 6 deletions Assets/Adjust.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class Adjust : MonoBehaviour {
public Util.Environment environment = Util.Environment.Sandbox;
public bool eventBuffering = false;
public bool startManually = false;
public const string sdkPrefix = "unity3.2.1";

void Awake() {
if (!this.startManually) {
Expand Down Expand Up @@ -42,14 +43,18 @@ public static void appDidLaunch(string appToken, Util.Environment environment, U
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 or iOS");
Debug.Log("adjust: SDK can only be used in Android, iOS, Windows Phone 8 or Windows Store apps");
return;
}

Adjust.instance.appDidLaunch (appToken, environment, logLevel, eventBuffering);
Adjust.instance.appDidLaunch (appToken, environment, sdkPrefix , logLevel, eventBuffering);
}

public static void trackEvent(string eventToken, Dictionary<string,string> parameters = null) {
Expand Down Expand Up @@ -78,6 +83,7 @@ public static void setResponseDelegate(Action<ResponseData> responseDelegate, st

Adjust.responseDelegate = responseDelegate;
Adjust.instance.setResponseDelegate (sceneName);
Adjust.instance.setResponseDelegateString (runResponseDelegate);
}

public static void setEnabled(bool enabled) {
Expand All @@ -97,16 +103,20 @@ public static bool isEnabled() {
}

public void getNativeMessage (string sResponseData) {
if (Adjust.instance == null) {
Adjust.runResponseDelegate (sResponseData);
}

public static void runResponseDelegate(string sResponseData) {
if (instance == null) {
Debug.Log(Adjust.errorMessage);
return;
}
if (Adjust.responseDelegate == null) {
if (responseDelegate == null) {
Debug.Log("adjust: response delegate not set to receive callbacks");
return;
}

var responseData = new ResponseData (sResponseData);
Adjust.responseDelegate (responseData);
responseDelegate (responseData);
}
}
}
1 change: 1 addition & 0 deletions Assets/ExampleGUI/ExampleGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public void responseDelegate (ResponseData responseData)
{
Debug.Log ("activitykind " + responseData.activityKind.ToString ());
Debug.Log ("trackerName " + responseData.trackerName);
Debug.Log ("error " + responseData.error);
}

}
Binary file added Assets/Plugins/AdjustUnityWP.dll
Binary file not shown.
7 changes: 7 additions & 0 deletions Assets/Plugins/AdjustUnityWP.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Assets/Plugins/AdjustUnityWS.dll
Binary file not shown.
7 changes: 7 additions & 0 deletions Assets/Plugins/AdjustUnityWS.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Assets/Plugins/Android/AdjustAndroid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public AdjustAndroid() {
ajoCurrentActivity = ajcUnityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
}

public void appDidLaunch(string appToken, Util.Environment environment, Util.LogLevel logLevel, bool eventBuffering) {
public void appDidLaunch(string appToken, Util.Environment environment, string sdkPrefix, Util.LogLevel logLevel, bool eventBuffering) {

string sEnvironment = environment.ToString ().ToLower ();
string sLogLevel = logLevel.ToString ().ToLower ();
Expand All @@ -29,7 +29,7 @@ public void appDidLaunch(string appToken, Util.Environment environment, Util.Log
sEnvironment,
sLogLevel,
eventBuffering);
ajcAdjust.CallStatic("setSdkPrefix","unity3.0.0");
ajcAdjust.CallStatic("setSdkPrefix",sdkPrefix);

onResume ();
}
Expand All @@ -56,6 +56,8 @@ public void setResponseDelegate(string sceneName) {
ajcAdjustUnity.CallStatic ("setResponseDelegate", sceneName);
}

public void setResponseDelegateString(Action<string> responseDelegate) { }

public void setEnabled(bool enabled) {
ajcAdjust.CallStatic ("setEnabled", ConvertBoolToJava(enabled));
}
Expand Down
3 changes: 2 additions & 1 deletion Assets/Plugins/IAdjust.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ namespace com.adjust.sdk
{
public interface IAdjust
{
void appDidLaunch (string appToken, Util.Environment environment, Util.LogLevel logLevel, bool eventBuffering);
void appDidLaunch (string appToken, Util.Environment environment, string sdkPrefix, Util.LogLevel logLevel, bool eventBuffering);
void trackEvent (string eventToken, Dictionary<string,string> parameters = null);
void trackRevenue (double cents, string eventToken = null, Dictionary<string,string> parameters = null);
void onPause ();
void onResume();
void setResponseDelegate(string sceneName);
void setResponseDelegateString(Action<string> responseDelegate);
void setEnabled(bool enabled);
bool isEnabled();
}
Expand Down
5 changes: 5 additions & 0 deletions Assets/Plugins/Metro.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions Assets/Plugins/Metro/AdjustMetro.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using UnityEngine;
using AdjustUnityWS;
using System.Collections.Generic;
using System;

namespace com.adjust.sdk {

public class AdjustMetro : IAdjust {

public void appDidLaunch (string appToken, Util.Environment environment, string sdkPrefix, Util.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<string, string> parameters = null)
{
AdjustWS.TrackEvent (eventToken, parameters);
}
public void trackRevenue (double cents, string eventToken = null, Dictionary<string, string> 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<string> responseDelegate)
{
AdjustWS.SetResponseDelegateString (responseDelegate);
}
public void setEnabled (bool enabled)
{
AdjustWS.SetEnabled (enabled);
}
public bool isEnabled ()
{
return AdjustWS.IsEnabled ();
}
}
}
8 changes: 8 additions & 0 deletions Assets/Plugins/Metro/AdjustMetro.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Assets/Plugins/Metro/AdjustUnityWS.dll
Binary file not shown.
4 changes: 4 additions & 0 deletions Assets/Plugins/Metro/AdjustUnityWS.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Assets/Plugins/Metro/AdjustWS.dll
Binary file not shown.
Loading

0 comments on commit d12052d

Please sign in to comment.