Skip to content

Commit

Permalink
NR: remove AppCenter support as this service will be discontinued by …
Browse files Browse the repository at this point in the history
…Microsoft
  • Loading branch information
jbe2277 committed Mar 29, 2024
1 parent 8854707 commit a4702b9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.AppCenter.Crashes;
using System.Waf.Applications;
using System.Waf.Applications;
using System.Windows.Input;
using Waf.NewsReader.Applications.Properties;
using Waf.NewsReader.Applications.Services;
Expand Down
7 changes: 3 additions & 4 deletions src/NewsReader/NewsReader.Applications/LogExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.AppCenter.Crashes;
using NLog;
using NLog;

namespace Waf.NewsReader; // Use here the root namespace - as this should be available in all upper layers.

Expand All @@ -8,12 +7,12 @@ public static class LogExtensions
public static void TrackError(this Logger log, Exception ex, [Localizable(false)] string message)
{
log.Error(ex, message);
Crashes.TrackError(ex);
// Idea: track error via telemetry
}

public static void TrackError(this Logger log, Exception ex, [Localizable(false)] string format, params object?[] arguments)
{
log.Error(ex, format, arguments);
Crashes.TrackError(ex);
// Idea: track error via telemetry
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@

<ItemGroup>
<PackageReference Include="Autofac" Version="8.0.0" />
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="5.0.3" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="5.0.3" />
<!-- TODO: Workaround for an iOS Simulator issue because of AppCenter. Update the referenced SQLite packages to a fixed version. See: https://github.com/microsoft/appcenter-sdk-dotnet/issues/1755 -->
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.7" />
</ItemGroup>

<ItemGroup>
Expand Down
22 changes: 1 addition & 21 deletions src/NewsReader/NewsReader.Presentation/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using Microsoft.AppCenter.Analytics;
using Microsoft.AppCenter.Crashes;
using Microsoft.AppCenter;
using System.Globalization;
using System.Globalization;
using System.Waf.Applications.Services;
using Waf.NewsReader.Applications.Controllers;
using Waf.NewsReader.Applications.Properties;
Expand All @@ -14,17 +11,6 @@

namespace Waf.NewsReader.Presentation;

// Telemetry data collection with https://appcenter.ms
// Provide the secrets via separate file 'App.xaml.keys.cs' which is excluded from GIT:
//
//public partial class App
//{
// static partial void GetAppCenterSecret(ref string? appSecret)
// {
// appSecret = "android={secret};windowsdesktop={secret};ios={secret}";
// }
//}

public partial class App : Application
{
private static readonly (string loggerNamePattern, LogLevel minLevel)[] logSettings =
Expand Down Expand Up @@ -79,10 +65,6 @@ private void OnCreated()

Log.Default.Info("App started {0}, {1} on {2}", appInfoService.AppName, appInfoService.VersionString, DateTime.Now.ToString("yyyy'-'MM'-'dd' 'HH':'mm':'ssK", CultureInfo.InvariantCulture));
Log.Default.Info("Device: {0} {1} {2}; Platform: {3} {4}", DeviceInfo.Idiom, DeviceInfo.Manufacturer, DeviceInfo.Model, DeviceInfo.Platform, DeviceInfo.Version);
string? appSecret = null;
GetAppCenterSecret(ref appSecret);
if (appSecret != null) AppCenter.Start(appSecret, typeof(Analytics), typeof(Crashes));
Analytics.TrackEvent("App started");
appController.Start();
}

Expand Down Expand Up @@ -159,6 +141,4 @@ private static void InitializeCultures(AppSettings appSettings)
CultureInfo.CurrentCulture = CultureInfo.DefaultThreadCurrentCulture = culture;
}
}

static partial void GetAppCenterSecret(ref string? appSecret);
}

0 comments on commit a4702b9

Please sign in to comment.