Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge branch 'feature/update-native-sdks' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Wendt committed Feb 18, 2016
2 parents 28a4d2f + 050259e commit d02aa35
Show file tree
Hide file tree
Showing 60 changed files with 13,557 additions and 974 deletions.
2 changes: 1 addition & 1 deletion ApplicationInsightsXamarinSDK/AI.XamarinSDK.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<title>ApplicationInsights SDK for Xamarin.Forms</title>
<authors>Microsoft</authors>
<dependencies>
<dependency id="Xamarin.Forms" version="1.4.3.6376" />
<dependency id="Xamarin.Forms" version="2.0.1.6505" />
</dependencies>
<projectUrl>https://github.com/Microsoft/ApplicationInsights-Xamarin</projectUrl>
<licenseUrl>https://github.com/Microsoft/ApplicationInsights-Xamarin/blob/master/LICENSE</licenseUrl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@
<Compile Include="Utils.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="..\..\packages\Xamarin.Forms.1.4.3.6376\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.1.4.3.6376\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
<Import Project="..\..\packages\Xamarin.Forms.2.0.1.6505\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.2.0.1.6505\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
<ItemGroup>
<Reference Include="Xamarin.Forms.Core">
<HintPath>..\..\packages\Xamarin.Forms.1.4.3.6376\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Core.dll</HintPath>
<HintPath>..\..\packages\Xamarin.Forms.2.0.1.6505\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Core.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Xaml">
<HintPath>..\..\packages\Xamarin.Forms.1.4.3.6376\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Xaml.dll</HintPath>
<HintPath>..\..\packages\Xamarin.Forms.2.0.1.6505\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform">
<HintPath>..\..\packages\Xamarin.Forms.1.4.3.6376\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Platform.dll</HintPath>
<HintPath>..\..\packages\Xamarin.Forms.2.0.1.6505\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Platform.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
using Xamarin.Forms;

namespace AI.XamarinSDK.Abstractions
{
namespace AI.XamarinSDK.Abstractions {
/// <summary>
/// This class exposes methods to configure and start the SDK. This is required in order to enable auto collection, crash reporting, and sending of telemetry data.
/// </summary>
public class ApplicationInsights
{
public class ApplicationInsights {

private static readonly IApplicationInsights target = GetTarget();

Expand All @@ -17,8 +17,7 @@ private ApplicationInsights() {}
/// Setup the SDK with the instrumentation key of your app.
/// </summary>
/// <param name="instrumentationKey">The instrumentation key of your app.</param>
public static void Setup (string instrumentationKey)
{
public static void Setup (string instrumentationKey) {
if (Utils.IsSupportedPlatform ()) {
target.Setup (instrumentationKey);
}
Expand All @@ -27,8 +26,7 @@ public static void Setup (string instrumentationKey)
/// <summary>
/// Starts the SDK. This should be called after setup().
/// </summary>
public static void Start ()
{
public static void Start () {
if (Utils.IsSupportedPlatform()) {
target.Start ();
}
Expand All @@ -38,8 +36,7 @@ public static void Start ()
/// Gets the server URL
/// </summary>
/// <returns>The server URL.</returns>
public static string GetServerUrl ()
{
public static string GetServerUrl () {
if (Utils.IsSupportedPlatform()) {
return target.GetServerUrl ();
}
Expand All @@ -50,30 +47,17 @@ public static string GetServerUrl ()
/// Sets the server URL.
/// </summary>
/// <param name="serverUrl">Server URL.</param>
public static void SetServerUrl (string serverUrl)
{
public static void SetServerUrl (string serverUrl) {
if (Utils.IsSupportedPlatform()) {
target.SetServerUrl (serverUrl);
}
}

/// <summary>
/// Configures the auto collection of app crashes. This method should be called in between setup() and start()
/// </summary>
/// <param name="crashManagerDisabled">If set to <c>true</c> the crash manager will be disabled. Default is <c>false</c>.</param>
public static void SetCrashManagerDisabled (bool crashManagerDisabled)
{
if (Utils.IsSupportedPlatform()) {
target.SetCrashManagerDisabled (crashManagerDisabled);
}
}

/// <summary>
/// Configures the tracking of custom events. This method should be called in between setup() and start()
/// </summary>
/// <param name="telemetryManagerDisabled">If set to <c>true</c> the telemetry manager disabled. Default is <c>false</c>.</param>
public static void SetTelemetryManagerDisabled (bool telemetryManagerDisabled)
{
public static void SetTelemetryManagerDisabled (bool telemetryManagerDisabled) {
if (Utils.IsSupportedPlatform()) {
target.SetTelemetryManagerDisabled (telemetryManagerDisabled);
}
Expand All @@ -83,8 +67,7 @@ public static void SetTelemetryManagerDisabled (bool telemetryManagerDisabled)
/// Configures the auto collection of page views. This method should be called in between setup() and start()
/// </summary>
/// <param name="autoPageViewTrackingDisabled">If set to <c>true</c> auto page view tracking will be disabled. Default is <c>false</c>.</param>
public static void SetAutoPageViewTrackingDisabled (bool autoPageViewTrackingDisabled)
{
public static void SetAutoPageViewTrackingDisabled (bool autoPageViewTrackingDisabled) {
if (Utils.IsSupportedPlatform()) {
target.SetAutoPageViewTrackingDisabled (autoPageViewTrackingDisabled);
}
Expand All @@ -94,29 +77,36 @@ public static void SetAutoPageViewTrackingDisabled (bool autoPageViewTrackingDis
/// Configures the auto session management. This method should be called in between setup() and start()
/// </summary>
/// <param name="autoSessionManagementDisabled">If set to <c>true</c> the auto session management will be disabled. Default is <c>false</c>.</param>
public static void SetAutoSessionManagementDisabled (bool autoSessionManagementDisabled)
{
public static void SetAutoSessionManagementDisabled (bool autoSessionManagementDisabled) {
if (Utils.IsSupportedPlatform()) {
target.SetAutoSessionManagementDisabled (autoSessionManagementDisabled);
}
}

/// <summary>
/// Sets a custom user identifier.
/// Sets the Id of the azhenticated user.
/// </summary>
/// <param name="authUserId">Authenticated user identifier.</param>
public static void SetAuthUserId (string authUserId) {
if (Utils.IsSupportedPlatform()) {
target.SetAuthUserId (authUserId);
}
}

/// <summary>
/// Sets common properties that are added to all telemetry items.
/// </summary>
/// <param name="userId">User identifier.</param>
public static void SetUserId (string userId)
{
/// <param name="properties">A dictionary with .</param>
public static void SetCommonProperties(Dictionary<string, string> properties) {
if (Utils.IsSupportedPlatform()) {
target.SetUserId (userId);
target.SetCommonProperties (properties);
}
}

/// <summary>
/// Forces the SDK to start a new session.
/// </summary>
public static void StartNewSession ()
{
public static void StartNewSession () {
if (Utils.IsSupportedPlatform()) {
target.StartNewSession ();
}
Expand All @@ -126,8 +116,7 @@ public static void StartNewSession ()
/// Sets the time for session renewal. If the app stays in background longer than that, a new session will be created automatically. This is only available with auto session management enabled
/// </summary>
/// <param name="appBackgroundTime">The interval at which sessions are renewed.</param>
public static void SetSessionExpirationTime (int appBackgroundTime)
{
public static void SetSessionExpirationTime (int appBackgroundTime) {
if (Utils.IsSupportedPlatform()) {
target.SetSessionExpirationTime (appBackgroundTime);
}
Expand All @@ -137,8 +126,7 @@ public static void SetSessionExpirationTime (int appBackgroundTime)
/// Manually renews the session with a custom identifier.
/// </summary>
/// <param name="sessionId">Custom session identifier.</param>
public static void RenewSessionWithId (string sessionId)
{
public static void RenewSessionWithId (string sessionId) {
if (Utils.IsSupportedPlatform()) {
target.RenewSessionWithId (sessionId);
}
Expand All @@ -148,8 +136,7 @@ public static void RenewSessionWithId (string sessionId)
/// Gets the debug log enabled.
/// </summary>
/// <returns><c>true</c>, if debug log is enabled, <c>false</c> otherwise.</returns>
public static bool GetDebugLogEnabled()
{
public static bool GetDebugLogEnabled() {
if (Utils.IsSupportedPlatform()) {
return target.GetDebugLogEnabled ();
}
Expand All @@ -160,8 +147,7 @@ public static bool GetDebugLogEnabled()
/// Sets the debug log enabled.
/// </summary>
/// <param name="debugLogEnabled">If set to <c>true</c> debug log is enabled.</param>
public static void SetDebugLogEnabled(bool debugLogEnabled)
{
public static void SetDebugLogEnabled(bool debugLogEnabled) {
if (Utils.IsSupportedPlatform()) {
target.SetDebugLogEnabled (debugLogEnabled);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;

namespace AI.XamarinSDK.Abstractions
{
Expand All @@ -12,15 +13,15 @@ public interface IApplicationInsights

void SetServerUrl (string serverUrl);

void SetCrashManagerDisabled (bool crashManagerDisabled);

void SetTelemetryManagerDisabled (bool telemetryManagerDisabled);

void SetAutoPageViewTrackingDisabled (bool autoPageViewTrackingDisabled);

void SetAutoSessionManagementDisabled (bool autoSessionManagementDisabled);

void SetUserId (string userId);
void SetAuthUserId (string authUserId);

void SetCommonProperties (Dictionary<string, string> properties);

void StartNewSession ();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,5 @@ public interface ITelemetryManager
void TrackPageView (string pageName, int duration);

void TrackPageView (string pageName, int duration, Dictionary<string, string> properties);

void TrackManagedException (Exception exception, bool handled);
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
using System;
using Xamarin.Forms;
using System.Collections.Generic;
using Xamarin.Forms;

namespace AI.XamarinSDK.Abstractions {

namespace AI.XamarinSDK.Abstractions
{
/// <summary>
/// This class exposes functions to track differnt types of telemetry data. Tracked data will be created, persisted, and sent to the server.
/// </summary>
public class TelemetryManager
{
public class TelemetryManager {
public TelemetryManager(){}

/// <summary>
/// Tracks a custom event object
/// </summary>
/// <param name="eventName">The name of the custom event.</param>
public static void TrackEvent (string eventName)
{
public static void TrackEvent (string eventName) {
if (Utils.IsSupportedPlatform ()) {
DependencyService.Get<ITelemetryManager>().TrackEvent(eventName);
}
Expand All @@ -27,8 +25,7 @@ public static void TrackEvent (string eventName)
/// </summary>
/// <param name="eventName">The name of the custom event.</param>
/// <param name="properties">Custom properties that should be added to this event.</param>
public static void TrackEvent (string eventName, Dictionary<string, string> properties)
{
public static void TrackEvent (string eventName, Dictionary<string, string> properties) {
if (Utils.IsSupportedPlatform ()) {
DependencyService.Get<ITelemetryManager>().TrackEvent(eventName, properties);
}
Expand All @@ -38,8 +35,7 @@ public static void TrackEvent (string eventName, Dictionary<string, string> prop
/// Tracks a custom message
/// </summary>
/// <param name="message">The message to be tracked.</param>
public static void TrackTrace (string message)
{
public static void TrackTrace (string message) {
if (Utils.IsSupportedPlatform ()) {
DependencyService.Get<ITelemetryManager>().TrackTrace(message);
}
Expand All @@ -50,8 +46,7 @@ public static void TrackTrace (string message)
/// </summary>
/// <param name="message">The message to be tracked.</param>
/// <param name="properties">Custom properties that should be added to this message.</param>
public static void TrackTrace (string message, Dictionary<string, string> properties)
{
public static void TrackTrace (string message, Dictionary<string, string> properties){
if (Utils.IsSupportedPlatform ()) {
DependencyService.Get<ITelemetryManager>().TrackTrace(message, properties);
}
Expand All @@ -62,8 +57,7 @@ public static void TrackTrace (string message, Dictionary<string, string> proper
/// </summary>
/// <param name="metricName">The name of the metric.</param>
/// <param name="value">The numeric metric value.</param>
public static void TrackMetric (string metricName, double value)
{
public static void TrackMetric (string metricName, double value){
if (Utils.IsSupportedPlatform ()) {
DependencyService.Get<ITelemetryManager>().TrackMetric(metricName, value);
}
Expand All @@ -75,8 +69,7 @@ public static void TrackMetric (string metricName, double value)
/// <param name="metricName">The name of the metric.</param>
/// <param name="value">The numeric metric value.</param>
/// <param name="properties">Custom properties that should be added to this metric.</param>
public static void TrackMetric (string metricName, double value, Dictionary<string, string> properties)
{
public static void TrackMetric (string metricName, double value, Dictionary<string, string> properties){
if (Utils.IsSupportedPlatform ()) {
DependencyService.Get<ITelemetryManager>().TrackMetric(metricName, value, properties);
}
Expand All @@ -86,8 +79,7 @@ public static void TrackMetric (string metricName, double value, Dictionary<stri
/// Tracks a page view.
/// </summary>
/// <param name="pageName">The name of the page.</param>
public static void TrackPageView (string pageName)
{
public static void TrackPageView (string pageName) {
if (Utils.IsSupportedPlatform ()) {
DependencyService.Get<ITelemetryManager>().TrackPageView(pageName);
}
Expand All @@ -98,8 +90,7 @@ public static void TrackPageView (string pageName)
/// </summary>
/// <param name="pageName">The name of the page.</param>
/// <param name="duration">The time the page was visible to the user</param>
public static void TrackPageView (string pageName, int duration)
{
public static void TrackPageView (string pageName, int duration) {
if (Utils.IsSupportedPlatform ()) {
DependencyService.Get<ITelemetryManager>().TrackPageView(pageName, duration);
}
Expand All @@ -111,23 +102,10 @@ public static void TrackPageView (string pageName, int duration)
/// <param name="pageName">The name of the page.</param>
/// <param name="duration">The time the page was visible to the user</param>
/// <param name="properties">Custom properties that should be added to this page view object.</param>
public static void TrackPageView (string pageName, int duration, Dictionary<string, string> properties)
{
public static void TrackPageView (string pageName, int duration, Dictionary<string, string> properties) {
if (Utils.IsSupportedPlatform ()) {
DependencyService.Get<ITelemetryManager>().TrackPageView(pageName, duration, properties);
}
}

/// <summary>
/// Tracks a managed handled/unhandled exception
/// </summary>
/// <param name="exception">The exception object that should be tracked</param>
/// <param name="handled">If set to <c>true</c> the exception has been handled by the developer.</param>
public static void TrackManagedException (Exception exception, bool handled)
{
if (Utils.IsSupportedPlatform ()) {
DependencyService.Get<ITelemetryManager>().TrackManagedException(exception, handled);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
using System;
using Xamarin.Forms;

namespace AI.XamarinSDK.Abstractions
{
public class Utils
{
public Utils ()
{
namespace AI.XamarinSDK.Abstractions {
public class Utils {
public Utils () {
}

public static Boolean IsSupportedPlatform(){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Xamarin.Forms" version="1.4.3.6376" targetFramework="portable-net45+win+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10" />
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Xamarin.Forms" version="2.0.1.6505" targetFramework="portable-net45+win+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10" />
</packages>
Loading

0 comments on commit d02aa35

Please sign in to comment.