2012-01-25 03:09:49 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using DeskMetrics;
|
|
|
|
|
using Ninject;
|
|
|
|
|
using NzbDrone.Common;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Providers
|
|
|
|
|
{
|
|
|
|
|
public class AnalyticsProvider
|
|
|
|
|
{
|
|
|
|
|
private readonly IDeskMetricsClient _deskMetricsClient;
|
2012-01-26 01:52:47 +00:00
|
|
|
|
public const string DESKMETRICS_TEST_ID = "4ea8d347a14ad71442000002";
|
|
|
|
|
public const string DESKMETRICS_PRODUCTION_ID = "4f20b01ea14ad729b2000000";
|
2012-01-25 03:09:49 +00:00
|
|
|
|
|
|
|
|
|
[Inject]
|
|
|
|
|
public AnalyticsProvider(IDeskMetricsClient deskMetricsClient)
|
|
|
|
|
{
|
|
|
|
|
_deskMetricsClient = deskMetricsClient;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public AnalyticsProvider()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void Checkpoint()
|
|
|
|
|
{
|
|
|
|
|
if (EnviromentProvider.IsNewInstall)
|
|
|
|
|
{
|
|
|
|
|
_deskMetricsClient.RegisterInstall();
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-26 01:29:55 +00:00
|
|
|
|
if (_deskMetricsClient.Started)
|
|
|
|
|
{
|
|
|
|
|
_deskMetricsClient.Stop();
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-25 03:09:49 +00:00
|
|
|
|
_deskMetricsClient.Start();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|