Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
[GoogleAnalytics] Several fixes and additions NO API CHANGES still on…
Browse files Browse the repository at this point in the history
… 2.0beta

	* Added binding project
	* Fixed binding/Makefile to download the right version of the library
	* renamed sample to samples folder
	* Added sample builder Makefile
  • Loading branch information
dalexsoto committed Oct 30, 2013
1 parent 859806b commit 9e29560
Show file tree
Hide file tree
Showing 14 changed files with 138 additions and 66 deletions.
101 changes: 51 additions & 50 deletions GoogleAnalytics/binding/googleanalytics.cs → GoogleAnalytics/binding/ApiDefinition.cs
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -16,171 +16,172 @@ interface GAI {
[Internal]
[Export ("defaultTracker")]
IntPtr InternalDefaultTracker { get; set; }

[Export ("debug")]
bool Debug { get; set; }

[Export ("optOut")]
bool OptOut { get; set; }

[Export ("dispatchInterval")]
double DispatchInterval { get; set; }

[Export ("trackUncaughtExceptions")]
bool TrackUncaughtExceptions { get; set; }

[Static]
[Export ("sharedInstance")]
GAI SharedInstance { get; }

[Internal]
[Export ("trackerWithTrackingId:")]
IntPtr InternalGetTracker (string trackingId);

[Export ("dispatch")]
void Dispatch ();

}

[BaseType (typeof (NSObject))]
[Protocol]
interface GAITracker {
[Export ("trackingId")]
string TrackingId { get; }

[Export ("appName")]
string AppName { get; set; }

[Export ("appId")]
string AppId { get; set; }

[Export ("appVersion")]
string AppVersion { get; set; }

[Export ("anonymize")]
bool Anonymize { get; set; }

[Export ("useHttps")]
bool UseHttps { get; set; }

[Export ("sampleRate")]
double SampleRate { get; set; }

[Export ("clientId")]
string ClientId { get; }

[Export ("appScreen")]
string AppScreen { get; set; }

[Export ("referrerUrl")]
string ReferrerUrl { get; set; }

[Export ("campaignUrl")]
string CampaignUrl { get; set; }

[Export ("sessionStart")]
bool SessionStart { get; set; }

[Export ("sessionTimeout")]
double SessionTimeout { get; set; }

[Export ("trackView")]
bool TrackView ();

[Export ("trackView:")]
bool TrackView (string screen);

[Export ("trackEventWithCategory:withAction:withLabel:withValue:")]
bool TrackEvent(string category, string action, string label, NSNumber value);

[Export ("trackTransaction:")]
bool TrackTransaction (GAITransaction transaction);

[Export ("trackException:withDescription:")]
bool TrackException (bool isFatal, string format );

[Export ("trackException:withNSException:")]
bool TrackException (bool isFatal, NSException exception);

[Export ("trackException:withNSError:")]
bool TrackException (bool isFatal, NSError error);

[Export ("trackTimingWithCategory:withValue:withName:withLabel:")]
bool TrackTiming (string category, double time, string name, string label);

[Export ("trackSocial:withAction:withTarget:")]
bool TrackSocial (string network, string action, string target);

[Export ("set:value:")]
bool Setvalue (string parameterName, string value);

[Export ("get:")]
string Get (string parameterName);

[Export ("send:params:")]
bool Sendparams (string trackType, NSDictionary parameters);

[Export ("setCustom:dimension:")]
bool SetCustom (int index, string dimension);

[Export ("setCustom:metric:")]
bool SetCustom (int index, NSNumber metric);

[Export ("close")]
void Close ();

}
[BaseType (typeof (NSObject))]
interface GAITransaction {
[Export ("transactionId")]
string TransactionId { get; }

[Export ("affiliation")]
string Affiliation { get; }

[Export ("revenueMicros")]
long RevenueMicros { get; set; }

[Export ("taxMicros")]
long TaxMicros { get; set; }

[Export ("shippingMicros")]
long ShippingMicros { get; set; }

[Export ("items")]
GAITransactionItem[] Items { get; }

[Static]
[Export ("transactionWithId:withAffiliation:")]
GAITransaction TransactionFrom (string transactionId, string affiliation);

[Export ("addItem:")]
void AddItem (GAITransactionItem item);

[Export ("addItemWithCode:name:category:priceMicros:quantity:")]
void AddItem (string productCode, string productName, string productCategory, long priceMicros, int quantity);

}
[BaseType (typeof (NSObject))]
interface GAITransactionItem {
[Export ("productCode")]
string ProductCode { get; }

[Export ("productName")]
string ProductName { get; set; }

[Export ("productCategory")]
string ProductCategory { get; set; }

[Export ("priceMicros")]
long PriceMicros { get; set; }

[Export ("quantity")]
int Quantity { get; set; }

[Static]
[Export ("itemWithCode:name:category:priceMicros:quantity:")]
GAITransactionItem ItemFrom (string productCode, string productName, string productCategory, long priceMicros, int quantity);

}

}
4 changes: 0 additions & 4 deletions GoogleAnalytics/binding/AssemblyInfo.cs

This file was deleted.

58 changes: 58 additions & 0 deletions GoogleAnalytics/binding/GoogleAnalytics.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{427ECD83-C8EA-4F81-B499-6D07E4EBF026}</ProjectGuid>
<ProjectTypeGuids>{F5B4F3BC-B597-4E2B-B552-EF5D8A32436F};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>GoogleAnalytics</RootNamespace>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<AssemblyName>GoogleAnalytics</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="monotouch" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<ObjcBindingApiDefinition Include="ApiDefinition.cs" />
</ItemGroup>
<ItemGroup>
<ObjcBindingCoreSource Include="StructsAndEnums.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Xamarin.ObjcBinding.CSharp.targets" />
<ItemGroup>
<ObjcBindingNativeLibrary Include="libGoogleAnalytics.a" />
</ItemGroup>
<ItemGroup>
<Compile Include="libGoogleAnalytics.linkwith.cs">
<DependentUpon>libGoogleAnalytics.a</DependentUpon>
</Compile>
<Compile Include="extras.cs" />
</ItemGroup>
</Project>
Binary file removed GoogleAnalytics/binding/GoogleAnalytics.dll
Binary file not shown.
22 changes: 12 additions & 10 deletions GoogleAnalytics/binding/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

BUILD_FLAGS=-unsafe -target:library -nowarn:436 -nowarn:219
BTOUCH=/Developer/MonoTouch/usr/bin/btouch
SMCS=/Developer/MonoTouch/usr/bin/smcs
CLANG=clang -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk
MONOXBUILD=/Library/Frameworks/Mono.framework/Commands/xbuild

all: GoogleAnalytics.dll

GoogleAnalyticsiOS.zip:
curl -O http://dl.google.com/dl/gaformobileapps/googleanalyticsios.zip
GoogleAnalyticsiOS_2.0beta4.zip:
curl -O http://dl.google.com/dl/gaformobileapps/GoogleAnalyticsiOS_2.0beta4.zip

#STUBS = armv6.o armv7.o i386.o
#
Expand All @@ -21,13 +21,15 @@ GoogleAnalyticsiOS.zip:
# clang -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -fobjc-abi-version=2 -fobjc-legacy-dispatch -c -arch i386 stub.m -o i386.o


libGoogleAnalytics.a: GoogleAnalyticsiOS.zip
unzip -p $< 'GoogleAnalyticsiOS_2.0beta*/Library/libGoogleAnalytics.a' > $@
libGoogleAnalytics.a: GoogleAnalyticsiOS_2.0beta4.zip
unzip -p $< 'GoogleAnalyticsiOS_2.0beta4/Library/libGoogleAnalytics.a' > $@

GoogleAnalytics.dll: Makefile AssemblyInfo.cs googleanalytics.cs enums.cs extras.cs libGoogleAnalytics.a
-mkdir -p ios
$(BTOUCH) --out=$@ -e googleanalytics.cs enums.cs --sourceonly=list --tmpdir=ios
$(SMCS) $(BUILD_FLAGS) -out:$@ @list enums.cs extras.cs AssemblyInfo.cs -r:monotouch.dll -res:libGoogleAnalytics.a,libGoogleAnalytics.a
GoogleAnalytics.dll: Makefile ApiDefinition.cs StructsAndEnums.cs extras.cs libGoogleAnalytics.a
$(MONOXBUILD) /p:Configuration=Release GoogleAnalytics.csproj
cp bin/Release/GoogleAnalytics.dll GoogleAnalytics.dll
#-mkdir -p ios
#$(BTOUCH) --out=$@ -e googleanalytics.cs enums.cs --sourceonly=list --tmpdir=ios
#$(SMCS) $(BUILD_FLAGS) -out:$@ @list enums.cs extras.cs AssemblyInfo.cs -r:monotouch.dll -res:libGoogleAnalytics.a,libGoogleAnalytics.a

clean:
-rm -rf list ios *.a *.dll *.o
-rm -rf list ios *.a *.dll *.o *.zip bin/ obj/
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ namespace GoogleAnalytics {
public enum GAIErrorCode {
// This error code indicates that there was no error. Never used.
NoError = 0,

// This error code indicates that there was a database-related error.
DatabaseError,

// This error code indicates that there was a network-related error.
NetworkError,
}
Expand Down
Empty file modified GoogleAnalytics/binding/extras.cs
100755 → 100644
Empty file.
4 changes: 4 additions & 0 deletions GoogleAnalytics/binding/libGoogleAnalytics.linkwith.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
using System;
using MonoTouch.ObjCRuntime;

[assembly: LinkWith ("libGoogleAnalytics.a", LinkTarget.ArmV7 | LinkTarget.ArmV7s | LinkTarget.Simulator, ForceLoad = true, Frameworks = "SystemConfiguration CFNetwork CoreData")]
11 changes: 11 additions & 0 deletions GoogleAnalytics/samples/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#### Sample Builder
#### Author: Alex Soto alex.soto@xamarin.com

MDTOOL=/Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool
PROJECTS=GoogleAnalyticsSample/GoogleAnalyticsSample.sln

all:
for i in $(PROJECTS); do ($(MDTOOL) build -c:"Release|iPhone" $$i); done

clean:
for i in $(PROJECTS); do ($(MDTOOL) build -c:"Release|iPhone" -t:Clean $$i); done

0 comments on commit 9e29560

Please sign in to comment.