Skip to content
Browse files

Fixed back button handling for initial Analytics (first time 7Pass is…

… started).

Used installation ID instead of device ID to avoid identification of user's device.
  • Loading branch information...
1 parent 30354db commit 4f9414cc029aba8cc374e7163b242ae7a80ac218 @7Pass committed
View
3 KeePass/Analytics/TrackingEvent.cs
@@ -42,8 +42,9 @@ public string ToJson()
values.AddOrSet("mp_source", _source);
values.AddOrSet("token", TrackInfo.TOKEN);
+ var settings = AppSettings.Instance;
values.AddOrSet("distinct_id",
- DeviceData.GetDeviceId());
+ settings.InstanceID);
var properties = values.Select(x =>
new JProperty(x.Key, x.Value))
View
4 KeePass/AnalyticsSettings.xaml
@@ -26,12 +26,12 @@
7Pass collects usage information in order to continuously enhance user experience.<LineBreak />
<LineBreak />
The collection information will never have your database information, or any information that can directly identify you. However:<LineBreak />
- - 7Pass does collect your device ID to link information sent from your device together.<LineBreak />
+ - 7Pass does collect your installation ID to link information sent from your device together. This changes everytime 7Pass is installed.<LineBreak />
- Usage collection uses very little network traffic, but the cost to your bill may add up if you're on a capped plan.<LineBreak />
<LineBreak />
The collected information will be very useful for development of 7Pass.<LineBreak />
<LineBreak />
- Your device ID that will be collected is:
+ Your installation ID that will be collected is:
</TextBlock>
<TextBlock Name="lblDevice" />
</StackPanel>
View
16 KeePass/AnalyticsSettings.xaml.cs
@@ -12,13 +12,26 @@ public AnalyticsSettings()
InitializeComponent();
}
+ protected override void OnBackKeyPress(
+ System.ComponentModel.CancelEventArgs e)
+ {
+ var settings = AppSettings.Instance;
+ var justInstalled = settings.AllowAnalytics == null;
+
+ if (justInstalled)
+ this.ClearBackStack();
+
+ base.OnBackKeyPress(e);
+ }
+
protected override void OnNavigatedTo(
bool cancelled, NavigationEventArgs e)
{
if (cancelled)
return;
- lblDevice.Text = DeviceData.GetDeviceId();
+ var settings = AppSettings.Instance;
+ lblDevice.Text = settings.InstanceID;
}
private void cmdAllow_Click(object sender, EventArgs e)
@@ -26,7 +39,6 @@ private void cmdAllow_Click(object sender, EventArgs e)
var settings = AppSettings.Instance;
var justInstalled = settings.AllowAnalytics == null;
-
settings.AllowAnalytics = true;
AnalyticsTracker.Collect();
View
1 KeePass/KeePass.csproj
@@ -332,7 +332,6 @@
<Compile Include="Storage\VerifyResultTypes.cs" />
<Compile Include="Utils\AppSettings.cs" />
<Compile Include="Utils\BackTargets.cs" />
- <Compile Include="Utils\DeviceData.cs" />
<Compile Include="Utils\EaseEffect.cs" />
<Compile Include="Utils\ErrorReport.cs" />
<Compile Include="Utils\ExtensionMethods.cs" />
View
26 KeePass/Utils/AppSettings.cs
@@ -1,4 +1,5 @@
using System;
+using System.Globalization;
using System.IO.IsolatedStorage;
namespace KeePass.Utils
@@ -7,12 +8,14 @@ internal class AppSettings
{
private const string KEY_ANALYTICS = "Analytics";
private const string KEY_HIDE_BIN = "HideRecycleBin";
+ private const string KEY_INSTANCE_ID = "InstanceId";
private const string KEY_PASSWORD = "Password";
private const string KEY_TOAST_SHOWNS = "ToastShowns";
private const string KEY_USE_INT_BROWSER = "UseIntegratedBrowser";
private static AppSettings _instance;
private readonly GlobalPassHandler _globalPass;
+ private readonly string _instanceId;
private readonly IsolatedStorageSettings _settings;
/// <summary>
@@ -85,6 +88,14 @@ public static AppSettings Instance
}
}
+ /// <summary>
+ /// Gets the 7Pass installation ID.
+ /// </summary>
+ public string InstanceID
+ {
+ get { return _instanceId; }
+ }
+
public string this[string key]
{
get
@@ -140,7 +151,11 @@ public int ToastShowns
return value == null
? 0 : int.Parse(value);
}
- set { this[KEY_TOAST_SHOWNS] = value.ToString(); }
+ set
+ {
+ this[KEY_TOAST_SHOWNS] = value.ToString(
+ CultureInfo.InvariantCulture);
+ }
}
/// <summary>
@@ -168,6 +183,15 @@ public AppSettings(IsolatedStorageSettings settings)
_settings = settings;
_globalPass = new GlobalPassHandler(this);
+
+ if (!_settings.Contains(KEY_INSTANCE_ID))
+ {
+ _instanceId = Guid.NewGuid().ToString("N");
+ _settings[KEY_INSTANCE_ID] = _instanceId;
+ _settings.Save();
+ }
+ else
+ _instanceId = (string)_settings[KEY_INSTANCE_ID];
}
}
}
View
15 KeePass/Utils/DeviceData.cs
@@ -1,15 +0,0 @@
-using System;
-using Microsoft.Phone.Info;
-
-namespace KeePass.Utils
-{
- internal static class DeviceData
- {
- public static string GetDeviceId()
- {
- return Convert.ToBase64String(
- (byte[])DeviceExtendedProperties
- .GetValue("DeviceUniqueId"));
- }
- }
-}
View
4 KeePass/Utils/ErrorReport.cs
@@ -50,8 +50,8 @@ private static void AddDeviceInfo(StringBuilder sb)
sb.AppendLine((string)DeviceExtendedProperties
.GetValue("DeviceName"));
- sb.Append("Device ID: ");
- sb.AppendLine(DeviceData.GetDeviceId());
+ sb.Append("Instance ID: ");
+ sb.AppendLine(AppSettings.Instance.InstanceID);
sb.Append("Firmware: ");
sb.AppendLine((string)DeviceExtendedProperties

0 comments on commit 4f9414c

Please sign in to comment.
Something went wrong with that request. Please try again.