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

Commit b630a52

Browse files
author
Christoph Wendt
committed
Merge branch 'release/v1.0-alpha.3'
2 parents df0e628 + 0e79052 commit b630a52

File tree

62 files changed

+13724
-1109
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+13724
-1109
lines changed

ApplicationInsightsXamarinSDK/ApplicationInsightsXamarin/AI.XamarinSDK.Abstractions/AI.XamarinSDK.Abstractions.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<OutputType>Library</OutputType>
99
<RootNamespace>AI.XamarinSDK.Abstractions</RootNamespace>
1010
<AssemblyName>AI.XamarinSDK.Abstractions</AssemblyName>
11-
<TargetFrameworkProfile>Profile49</TargetFrameworkProfile>
11+
<TargetFrameworkProfile>Profile78</TargetFrameworkProfile>
1212
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1313
</PropertyGroup>
1414
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -37,16 +37,16 @@
3737
<Compile Include="Utils.cs" />
3838
</ItemGroup>
3939
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
40-
<Import Project="..\..\packages\Xamarin.Forms.1.4.3.6374\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.1.4.3.6374\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
40+
<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')" />
4141
<ItemGroup>
4242
<Reference Include="Xamarin.Forms.Core">
43-
<HintPath>..\..\packages\Xamarin.Forms.1.4.3.6374\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Core.dll</HintPath>
43+
<HintPath>..\..\packages\Xamarin.Forms.2.0.1.6505\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Core.dll</HintPath>
4444
</Reference>
4545
<Reference Include="Xamarin.Forms.Xaml">
46-
<HintPath>..\..\packages\Xamarin.Forms.1.4.3.6374\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Xaml.dll</HintPath>
46+
<HintPath>..\..\packages\Xamarin.Forms.2.0.1.6505\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Xaml.dll</HintPath>
4747
</Reference>
4848
<Reference Include="Xamarin.Forms.Platform">
49-
<HintPath>..\..\packages\Xamarin.Forms.1.4.3.6374\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Platform.dll</HintPath>
49+
<HintPath>..\..\packages\Xamarin.Forms.2.0.1.6505\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Platform.dll</HintPath>
5050
</Reference>
5151
</ItemGroup>
5252
<ItemGroup>

ApplicationInsightsXamarinSDK/ApplicationInsightsXamarin/AI.XamarinSDK.Abstractions/ApplicationInsights.cs

Lines changed: 33 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
using System;
2+
using System.Collections.Generic;
23
using Xamarin.Forms;
34

4-
namespace AI.XamarinSDK.Abstractions
5-
{
5+
namespace AI.XamarinSDK.Abstractions {
6+
67
/// <summary>
78
/// 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.
89
/// </summary>
9-
public class ApplicationInsights
10-
{
10+
public class ApplicationInsights {
1111

1212
private static readonly IApplicationInsights target = GetTarget();
1313

@@ -17,8 +17,7 @@ private ApplicationInsights() {}
1717
/// Setup the SDK with the instrumentation key of your app.
1818
/// </summary>
1919
/// <param name="instrumentationKey">The instrumentation key of your app.</param>
20-
public static void Setup (string instrumentationKey)
21-
{
20+
public static void Setup (string instrumentationKey) {
2221
if (Utils.IsSupportedPlatform ()) {
2322
target.Setup (instrumentationKey);
2423
}
@@ -27,8 +26,7 @@ public static void Setup (string instrumentationKey)
2726
/// <summary>
2827
/// Starts the SDK. This should be called after setup().
2928
/// </summary>
30-
public static void Start ()
31-
{
29+
public static void Start () {
3230
if (Utils.IsSupportedPlatform()) {
3331
target.Start ();
3432
}
@@ -38,8 +36,7 @@ public static void Start ()
3836
/// Gets the server URL
3937
/// </summary>
4038
/// <returns>The server URL.</returns>
41-
public static string GetServerUrl ()
42-
{
39+
public static string GetServerUrl () {
4340
if (Utils.IsSupportedPlatform()) {
4441
return target.GetServerUrl ();
4542
}
@@ -50,30 +47,17 @@ public static string GetServerUrl ()
5047
/// Sets the server URL.
5148
/// </summary>
5249
/// <param name="serverUrl">Server URL.</param>
53-
public static void SetServerUrl (string serverUrl)
54-
{
50+
public static void SetServerUrl (string serverUrl) {
5551
if (Utils.IsSupportedPlatform()) {
5652
target.SetServerUrl (serverUrl);
5753
}
5854
}
5955

60-
/// <summary>
61-
/// Configures the auto collection of app crashes. This method should be called in between setup() and start()
62-
/// </summary>
63-
/// <param name="crashManagerDisabled">If set to <c>true</c> the crash manager will be disabled. Default is <c>false</c>.</param>
64-
public static void SetCrashManagerDisabled (bool crashManagerDisabled)
65-
{
66-
if (Utils.IsSupportedPlatform()) {
67-
target.SetCrashManagerDisabled (crashManagerDisabled);
68-
}
69-
}
70-
7156
/// <summary>
7257
/// Configures the tracking of custom events. This method should be called in between setup() and start()
7358
/// </summary>
7459
/// <param name="telemetryManagerDisabled">If set to <c>true</c> the telemetry manager disabled. Default is <c>false</c>.</param>
75-
public static void SetTelemetryManagerDisabled (bool telemetryManagerDisabled)
76-
{
60+
public static void SetTelemetryManagerDisabled (bool telemetryManagerDisabled) {
7761
if (Utils.IsSupportedPlatform()) {
7862
target.SetTelemetryManagerDisabled (telemetryManagerDisabled);
7963
}
@@ -83,38 +67,46 @@ public static void SetTelemetryManagerDisabled (bool telemetryManagerDisabled)
8367
/// Configures the auto collection of page views. This method should be called in between setup() and start()
8468
/// </summary>
8569
/// <param name="autoPageViewTrackingDisabled">If set to <c>true</c> auto page view tracking will be disabled. Default is <c>false</c>.</param>
86-
public static void SetAutoPageViewTrackingDisabled (bool autoPageViewTrackingDisabled)
87-
{
88-
target.SetAutoPageViewTrackingDisabled (autoPageViewTrackingDisabled);
70+
public static void SetAutoPageViewTrackingDisabled (bool autoPageViewTrackingDisabled) {
71+
if (Utils.IsSupportedPlatform()) {
72+
target.SetAutoPageViewTrackingDisabled (autoPageViewTrackingDisabled);
73+
}
8974
}
9075

9176
/// <summary>
9277
/// Configures the auto session management. This method should be called in between setup() and start()
9378
/// </summary>
9479
/// <param name="autoSessionManagementDisabled">If set to <c>true</c> the auto session management will be disabled. Default is <c>false</c>.</param>
95-
public static void SetAutoSessionManagementDisabled (bool autoSessionManagementDisabled)
96-
{
80+
public static void SetAutoSessionManagementDisabled (bool autoSessionManagementDisabled) {
9781
if (Utils.IsSupportedPlatform()) {
9882
target.SetAutoSessionManagementDisabled (autoSessionManagementDisabled);
9983
}
10084
}
10185

10286
/// <summary>
103-
/// Sets a custom user identifier.
87+
/// Sets the Id of the azhenticated user.
88+
/// </summary>
89+
/// <param name="authUserId">Authenticated user identifier.</param>
90+
public static void SetAuthUserId (string authUserId) {
91+
if (Utils.IsSupportedPlatform()) {
92+
target.SetAuthUserId (authUserId);
93+
}
94+
}
95+
96+
/// <summary>
97+
/// Sets common properties that are added to all telemetry items.
10498
/// </summary>
105-
/// <param name="userId">User identifier.</param>
106-
public static void SetUserId (string userId)
107-
{
99+
/// <param name="properties">A dictionary with .</param>
100+
public static void SetCommonProperties(Dictionary<string, string> properties) {
108101
if (Utils.IsSupportedPlatform()) {
109-
target.SetUserId (userId);
102+
target.SetCommonProperties (properties);
110103
}
111104
}
112105

113106
/// <summary>
114107
/// Forces the SDK to start a new session.
115108
/// </summary>
116-
public static void StartNewSession ()
117-
{
109+
public static void StartNewSession () {
118110
if (Utils.IsSupportedPlatform()) {
119111
target.StartNewSession ();
120112
}
@@ -124,8 +116,7 @@ public static void StartNewSession ()
124116
/// 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
125117
/// </summary>
126118
/// <param name="appBackgroundTime">The interval at which sessions are renewed.</param>
127-
public static void SetSessionExpirationTime (int appBackgroundTime)
128-
{
119+
public static void SetSessionExpirationTime (int appBackgroundTime) {
129120
if (Utils.IsSupportedPlatform()) {
130121
target.SetSessionExpirationTime (appBackgroundTime);
131122
}
@@ -135,8 +126,7 @@ public static void SetSessionExpirationTime (int appBackgroundTime)
135126
/// Manually renews the session with a custom identifier.
136127
/// </summary>
137128
/// <param name="sessionId">Custom session identifier.</param>
138-
public static void RenewSessionWithId (string sessionId)
139-
{
129+
public static void RenewSessionWithId (string sessionId) {
140130
if (Utils.IsSupportedPlatform()) {
141131
target.RenewSessionWithId (sessionId);
142132
}
@@ -146,8 +136,7 @@ public static void RenewSessionWithId (string sessionId)
146136
/// Gets the debug log enabled.
147137
/// </summary>
148138
/// <returns><c>true</c>, if debug log is enabled, <c>false</c> otherwise.</returns>
149-
public static bool GetDebugLogEnabled()
150-
{
139+
public static bool GetDebugLogEnabled() {
151140
if (Utils.IsSupportedPlatform()) {
152141
return target.GetDebugLogEnabled ();
153142
}
@@ -158,8 +147,7 @@ public static bool GetDebugLogEnabled()
158147
/// Sets the debug log enabled.
159148
/// </summary>
160149
/// <param name="debugLogEnabled">If set to <c>true</c> debug log is enabled.</param>
161-
public static void SetDebugLogEnabled(bool debugLogEnabled)
162-
{
150+
public static void SetDebugLogEnabled(bool debugLogEnabled) {
163151
if (Utils.IsSupportedPlatform()) {
164152
target.SetDebugLogEnabled (debugLogEnabled);
165153
}

ApplicationInsightsXamarinSDK/ApplicationInsightsXamarin/AI.XamarinSDK.Abstractions/IApplicationInsights.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23

34
namespace AI.XamarinSDK.Abstractions
45
{
@@ -12,15 +13,15 @@ public interface IApplicationInsights
1213

1314
void SetServerUrl (string serverUrl);
1415

15-
void SetCrashManagerDisabled (bool crashManagerDisabled);
16-
1716
void SetTelemetryManagerDisabled (bool telemetryManagerDisabled);
1817

1918
void SetAutoPageViewTrackingDisabled (bool autoPageViewTrackingDisabled);
2019

2120
void SetAutoSessionManagementDisabled (bool autoSessionManagementDisabled);
2221

23-
void SetUserId (string userId);
22+
void SetAuthUserId (string authUserId);
23+
24+
void SetCommonProperties (Dictionary<string, string> properties);
2425

2526
void StartNewSession ();
2627

ApplicationInsightsXamarinSDK/ApplicationInsightsXamarin/AI.XamarinSDK.Abstractions/ITelemetryManager.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,5 @@ public interface ITelemetryManager
2222
void TrackPageView (string pageName, int duration);
2323

2424
void TrackPageView (string pageName, int duration, Dictionary<string, string> properties);
25-
26-
void TrackManagedException (Exception exception, bool handled);
2725
}
2826
}
Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
using System;
2-
using Xamarin.Forms;
32
using System.Collections.Generic;
3+
using Xamarin.Forms;
4+
5+
namespace AI.XamarinSDK.Abstractions {
46

5-
namespace AI.XamarinSDK.Abstractions
6-
{
77
/// <summary>
88
/// This class exposes functions to track differnt types of telemetry data. Tracked data will be created, persisted, and sent to the server.
99
/// </summary>
10-
public class TelemetryManager
11-
{
10+
public class TelemetryManager {
1211
public TelemetryManager(){}
1312

1413
/// <summary>
1514
/// Tracks a custom event object
1615
/// </summary>
1716
/// <param name="eventName">The name of the custom event.</param>
18-
public static void TrackEvent (string eventName)
19-
{
17+
public static void TrackEvent (string eventName) {
2018
if (Utils.IsSupportedPlatform ()) {
2119
DependencyService.Get<ITelemetryManager>().TrackEvent(eventName);
2220
}
@@ -27,8 +25,7 @@ public static void TrackEvent (string eventName)
2725
/// </summary>
2826
/// <param name="eventName">The name of the custom event.</param>
2927
/// <param name="properties">Custom properties that should be added to this event.</param>
30-
public static void TrackEvent (string eventName, Dictionary<string, string> properties)
31-
{
28+
public static void TrackEvent (string eventName, Dictionary<string, string> properties) {
3229
if (Utils.IsSupportedPlatform ()) {
3330
DependencyService.Get<ITelemetryManager>().TrackEvent(eventName, properties);
3431
}
@@ -38,8 +35,7 @@ public static void TrackEvent (string eventName, Dictionary<string, string> prop
3835
/// Tracks a custom message
3936
/// </summary>
4037
/// <param name="message">The message to be tracked.</param>
41-
public static void TrackTrace (string message)
42-
{
38+
public static void TrackTrace (string message) {
4339
if (Utils.IsSupportedPlatform ()) {
4440
DependencyService.Get<ITelemetryManager>().TrackTrace(message);
4541
}
@@ -50,8 +46,7 @@ public static void TrackTrace (string message)
5046
/// </summary>
5147
/// <param name="message">The message to be tracked.</param>
5248
/// <param name="properties">Custom properties that should be added to this message.</param>
53-
public static void TrackTrace (string message, Dictionary<string, string> properties)
54-
{
49+
public static void TrackTrace (string message, Dictionary<string, string> properties){
5550
if (Utils.IsSupportedPlatform ()) {
5651
DependencyService.Get<ITelemetryManager>().TrackTrace(message, properties);
5752
}
@@ -62,8 +57,7 @@ public static void TrackTrace (string message, Dictionary<string, string> proper
6257
/// </summary>
6358
/// <param name="metricName">The name of the metric.</param>
6459
/// <param name="value">The numeric metric value.</param>
65-
public static void TrackMetric (string metricName, double value)
66-
{
60+
public static void TrackMetric (string metricName, double value){
6761
if (Utils.IsSupportedPlatform ()) {
6862
DependencyService.Get<ITelemetryManager>().TrackMetric(metricName, value);
6963
}
@@ -75,8 +69,7 @@ public static void TrackMetric (string metricName, double value)
7569
/// <param name="metricName">The name of the metric.</param>
7670
/// <param name="value">The numeric metric value.</param>
7771
/// <param name="properties">Custom properties that should be added to this metric.</param>
78-
public static void TrackMetric (string metricName, double value, Dictionary<string, string> properties)
79-
{
72+
public static void TrackMetric (string metricName, double value, Dictionary<string, string> properties){
8073
if (Utils.IsSupportedPlatform ()) {
8174
DependencyService.Get<ITelemetryManager>().TrackMetric(metricName, value, properties);
8275
}
@@ -86,8 +79,7 @@ public static void TrackMetric (string metricName, double value, Dictionary<stri
8679
/// Tracks a page view.
8780
/// </summary>
8881
/// <param name="pageName">The name of the page.</param>
89-
public static void TrackPageView (string pageName)
90-
{
82+
public static void TrackPageView (string pageName) {
9183
if (Utils.IsSupportedPlatform ()) {
9284
DependencyService.Get<ITelemetryManager>().TrackPageView(pageName);
9385
}
@@ -98,8 +90,7 @@ public static void TrackPageView (string pageName)
9890
/// </summary>
9991
/// <param name="pageName">The name of the page.</param>
10092
/// <param name="duration">The time the page was visible to the user</param>
101-
public static void TrackPageView (string pageName, int duration)
102-
{
93+
public static void TrackPageView (string pageName, int duration) {
10394
if (Utils.IsSupportedPlatform ()) {
10495
DependencyService.Get<ITelemetryManager>().TrackPageView(pageName, duration);
10596
}
@@ -111,23 +102,10 @@ public static void TrackPageView (string pageName, int duration)
111102
/// <param name="pageName">The name of the page.</param>
112103
/// <param name="duration">The time the page was visible to the user</param>
113104
/// <param name="properties">Custom properties that should be added to this page view object.</param>
114-
public static void TrackPageView (string pageName, int duration, Dictionary<string, string> properties)
115-
{
105+
public static void TrackPageView (string pageName, int duration, Dictionary<string, string> properties) {
116106
if (Utils.IsSupportedPlatform ()) {
117107
DependencyService.Get<ITelemetryManager>().TrackPageView(pageName, duration, properties);
118108
}
119109
}
120-
121-
/// <summary>
122-
/// Tracks a managed handled/unhandled exception
123-
/// </summary>
124-
/// <param name="exception">The exception object that should be tracked</param>
125-
/// <param name="handled">If set to <c>true</c> the exception has been handled by the developer.</param>
126-
public static void TrackManagedException (Exception exception, bool handled)
127-
{
128-
if (Utils.IsSupportedPlatform ()) {
129-
DependencyService.Get<ITelemetryManager>().TrackManagedException(exception, handled);
130-
}
131-
}
132110
}
133111
}

ApplicationInsightsXamarinSDK/ApplicationInsightsXamarin/AI.XamarinSDK.Abstractions/Utils.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
using System;
22
using Xamarin.Forms;
33

4-
namespace AI.XamarinSDK.Abstractions
5-
{
6-
public class Utils
7-
{
8-
public Utils ()
9-
{
4+
namespace AI.XamarinSDK.Abstractions {
5+
public class Utils {
6+
public Utils () {
107
}
118

129
public static Boolean IsSupportedPlatform(){
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Xamarin.Forms" version="1.4.3.6374" targetFramework="portable-net45+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10" />
3+
<package id="Xamarin.Forms" version="2.0.1.6505" targetFramework="portable-net45+win+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10" />
44
</packages>

0 commit comments

Comments
 (0)