-
Notifications
You must be signed in to change notification settings - Fork 3
/
PlatformInfoProvider.cs
65 lines (54 loc) · 1.71 KB
/
PlatformInfoProvider.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using System;
using System.IO.IsolatedStorage;
using System.Windows;
using System.Drawing;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace GoogleAnalytics
{
public sealed class PlatformInfoProvider
{
const string Key_AnonymousClientId = "GoogleAnaltyics.AnonymousClientId";
public event EventHandler ViewPortResolutionChanged;
public event EventHandler ScreenResolutionChanged;
public string AnonymousClientId
{
get
{
if (NSUserDefaults.StandardUserDefaults.ValueForKey(new NSString(Key_AnonymousClientId)) == null)
{
var result = Guid.NewGuid().ToString();
NSUserDefaults.StandardUserDefaults.SetString(result, Key_AnonymousClientId);
return result;
}
else
{
return NSUserDefaults.StandardUserDefaults.StringForKey(Key_AnonymousClientId);
}
}
}
public Size? ScreenResolution
{
get { return new Size((int)UIScreen.MainScreen.Bounds.Width, (int) UIScreen.MainScreen.Bounds.Height); }
}
public Size? ViewPortResolution
{
get { return new Size((int)UIScreen.MainScreen.Bounds.Width, (int)UIScreen.MainScreen.Bounds.Height); }
}
public string UserLanguage
{
get { return NSLocale.PreferredLanguages[0]; }
}
public int? ScreenColorDepthBits
{
get { return null; }
}
public string DocumentEncoding
{
get { return null; }
}
public void OnTracking()
{
}
}
}