Skip to content

Commit 39a2159

Browse files
authored
Deprecate Microsoft.AppCenter (#1422)
* Deprecate Microsoft.AppCenter Deprecate Microsoft.AppCenter since it is scheduled for retirement on March 31, 2025 * Update PRIVACY.md
1 parent ed3c874 commit 39a2159

26 files changed

+135
-128
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,7 @@ jobs:
282282
/p:AppxBundlePlatforms=$env:APPX_BUNDLE_PLATFORMS `
283283
/p:AppxPackageDir=$env:ARTIFACTS_DIR `
284284
/p:PackageCertificateKeyFile=$env:PACKAGE_CERTIFICATE_KEYFILE `
285-
/p:PackageCertificatePassword=$env:PACKAGE_CERTIFICATE_PASSWORD `
286-
/p:AppCenterSecret=$env:APP_CENTER_SECRET
285+
/p:PackageCertificatePassword=$env:PACKAGE_CERTIFICATE_PASSWORD
287286
env:
288287
PLATFORM: x64
289288
UAP_APPX_PACKAGE_BUILD_MODE: StoreUpload

PRIVACY.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ If you choose to use this app, then you agree to the collection and use of infor
88

99
### Information Collection and Use
1010
For a better experience while using this app, certain usage data and errors are collected for identifying issues or improving the user experience of the app. *[Visual Studio AppCenter](https://visualstudio.microsoft.com/app-center/)* analytics service is used in this app to collect basic usage data plus some minimum telemetry to help debug runtime errors. See thread [#334](https://github.com/0x7c13/Notepads/issues/334) for more details.
11-
The app does NOT use third party services that may collect information used to identify you.
11+
The app does NOT use third party services that may collect information used to identify you.
12+
13+
Note: Visual Studio App Center is scheduled for retirement on March 31, 2025. Notepads v1.5.6.0+ starts to use Microsoft Store Services SDK to log non-privacy usage data and errors.
1214

1315
### Data Security
1416
We value your trust in providing us your Personal Information, thus we are striving to use commercially acceptable means of protecting it. But remember that no method of transmission over the internet, or method of electronic storage is 100% secure and reliable, and we cannot guarantee its absolute security.

src/Notepads.Controls/Notepads.Controls.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@
290290
<Version>7.1.3</Version>
291291
</PackageReference>
292292
<PackageReference Include="Win2D.uwp">
293-
<Version>1.27.1</Version>
293+
<Version>1.28.2</Version>
294294
</PackageReference>
295295
</ItemGroup>
296296
<ItemGroup>

src/Notepads/App.xaml.cs

Lines changed: 9 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ namespace Notepads
1010
using System.Linq;
1111
using System.Threading;
1212
using System.Threading.Tasks;
13-
using Microsoft.AppCenter;
14-
using Microsoft.AppCenter.Analytics;
15-
using Microsoft.AppCenter.Crashes;
1613
using Microsoft.Toolkit.Uwp.Helpers;
1714
using Notepads.Services;
1815
using Notepads.Settings;
@@ -100,19 +97,6 @@ private async Task ActivateAsync(IActivatedEventArgs e)
10097
Window.Current.Content = rootFrame;
10198
rootFrameCreated = true;
10299

103-
try
104-
{
105-
if (!string.IsNullOrEmpty(AppCenterSecret))
106-
{
107-
var services = new Type[] { typeof(Crashes), typeof(Analytics) };
108-
AppCenter.Start(AppCenterSecret, services);
109-
}
110-
}
111-
catch (Exception ex)
112-
{
113-
LoggingService.LogError($"[{nameof(App)}] Failed to start AppCenter: {ex.Message}");
114-
}
115-
116100
ThemeSettingsService.Initialize();
117101
AppSettingsService.Initialize();
118102
}
@@ -136,7 +120,7 @@ private async Task ActivateAsync(IActivatedEventArgs e)
136120
};
137121

138122
LoggingService.LogInfo($"[{nameof(App)}] Launch settings: \n{string.Join("\n", appLaunchSettings.Select(x => x.Key + "=" + x.Value).ToArray())}.");
139-
Analytics.TrackEvent("AppLaunch_Settings", appLaunchSettings);
123+
AnalyticsService.TrackEvent("AppLaunch_Settings", appLaunchSettings);
140124

141125
var appLaunchEditorSettings = new Dictionary<string, string>()
142126
{
@@ -154,7 +138,7 @@ private async Task ActivateAsync(IActivatedEventArgs e)
154138
};
155139

156140
LoggingService.LogInfo($"[{nameof(App)}] Editor settings: \n{string.Join("\n", appLaunchEditorSettings.Select(x => x.Key + "=" + x.Value).ToArray())}.");
157-
Analytics.TrackEvent("AppLaunch_Editor_Settings", appLaunchEditorSettings);
141+
AnalyticsService.TrackEvent("AppLaunch_Editor_Settings", appLaunchEditorSettings);
158142

159143
try
160144
{
@@ -167,8 +151,8 @@ private async Task ActivateAsync(IActivatedEventArgs e)
167151
{ "Message", ex?.Message },
168152
{ "Exception", ex?.ToString() },
169153
};
170-
Analytics.TrackEvent("AppFailedToActivate", diagnosticInfo);
171-
Crashes.TrackError(ex, diagnosticInfo);
154+
AnalyticsService.TrackEvent("AppFailedToActivate", diagnosticInfo);
155+
AnalyticsService.TrackError(ex, diagnosticInfo);
172156
throw;
173157
}
174158

@@ -224,7 +208,7 @@ void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
224208
{
225209
var exception = new Exception($"[{nameof(App)}] Failed to load Page: {e.SourcePageType.FullName} Exception: {e.Exception.Message}");
226210
LoggingService.LogException(exception);
227-
Analytics.TrackEvent("FailedToLoadPage", new Dictionary<string, string>()
211+
AnalyticsService.TrackEvent("FailedToLoadPage", new Dictionary<string, string>()
228212
{
229213
{ "Page", e.SourcePageType.FullName },
230214
{ "Exception", e.Exception.Message }
@@ -277,15 +261,8 @@ private static void OnUnhandledException(object sender, Windows.UI.Xaml.Unhandle
277261
{ "IsGameBarWidget", IsGameBarWidget.ToString() }
278262
};
279263

280-
var attachment = ErrorAttachmentLog.AttachmentWithText(
281-
$"Exception: {e.Exception}, " +
282-
$"Message: {e.Message}, " +
283-
$"InnerException: {e.Exception?.InnerException}, " +
284-
$"InnerExceptionMessage: {e.Exception?.InnerException?.Message}",
285-
"UnhandledException");
286-
287-
Analytics.TrackEvent("OnUnhandledException", diagnosticInfo);
288-
Crashes.TrackError(e.Exception, diagnosticInfo, attachment);
264+
AnalyticsService.TrackEvent("OnUnhandledException", diagnosticInfo);
265+
AnalyticsService.TrackError(e.Exception, diagnosticInfo);
289266

290267
// suppress and handle it manually.
291268
e.Handled = true;
@@ -305,15 +282,8 @@ private static void OnUnobservedException(object sender, UnobservedTaskException
305282
{ "InnerExceptionMessage", e.Exception?.InnerException?.Message }
306283
};
307284

308-
var attachment = ErrorAttachmentLog.AttachmentWithText(
309-
$"Exception: {e.Exception}, " +
310-
$"Message: {e.Exception?.Message}, " +
311-
$"InnerException: {e.Exception?.InnerException}, " +
312-
$"InnerExceptionMessage: {e.Exception?.InnerException?.Message}",
313-
"UnobservedException");
314-
315-
Analytics.TrackEvent("OnUnobservedException", diagnosticInfo);
316-
Crashes.TrackError(e.Exception, diagnosticInfo, attachment);
285+
AnalyticsService.TrackEvent("OnUnobservedException", diagnosticInfo);
286+
AnalyticsService.TrackError(e.Exception, diagnosticInfo);
317287

318288
// suppress and handle it manually.
319289
e.SetObserved();

src/Notepads/AppCenterSecret.cs

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/Notepads/Brushes/HostBackdropAcrylicBrush.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ namespace Notepads.Brushes
2222
using Windows.UI.ViewManagement;
2323
using Windows.UI.Xaml;
2424
using Windows.UI.Xaml.Media;
25-
using Microsoft.AppCenter.Analytics;
2625
using Microsoft.Graphics.Canvas;
2726
using Microsoft.Graphics.Canvas.Effects;
2827
using Microsoft.Graphics.Canvas.UI.Composition;
2928
using Controls.Helpers;
29+
using Notepads.Services;
3030

3131
public sealed class HostBackdropAcrylicBrush : XamlCompositionBrushBase, IDisposable
3232
{
@@ -281,7 +281,7 @@ private async Task<CompositionBrush> BuildHostBackdropAcrylicBrushInternalAsync(
281281
}
282282
catch (Exception ex)
283283
{
284-
Analytics.TrackEvent("FailedToBuildAcrylicBrushInternal",
284+
AnalyticsService.TrackEvent("FailedToBuildAcrylicBrushInternal",
285285
new Dictionary<string, string>
286286
{
287287
{ "Exception", ex.ToString() },
@@ -329,7 +329,7 @@ private static async Task<CompositionSurfaceBrush> LoadImageBrushAsync(Uri textu
329329
}
330330
catch (Exception ex)
331331
{
332-
Analytics.TrackEvent("FailedToLoadImageBrush", new Dictionary<string, string> { { "Exception", ex.ToString() } });
332+
AnalyticsService.TrackEvent("FailedToLoadImageBrush", new Dictionary<string, string> { { "Exception", ex.ToString() } });
333333
return null;
334334
}
335335
}

src/Notepads/Controls/Dialog/FileRenameDialog.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ namespace Notepads.Controls.Dialog
1414
using Windows.UI.Xaml.Media;
1515
using Notepads.Services;
1616
using Notepads.Utilities;
17-
using Microsoft.AppCenter.Analytics;
1817

1918
public sealed class FileRenameDialog : NotepadsDialog
2019
{
@@ -68,7 +67,7 @@ public FileRenameDialog(string filename, bool fileExists, Action<string> confirm
6867

6968
PrimaryButtonClick += (sender, args) => TryRename();
7069

71-
Analytics.TrackEvent("FileRenameDialogOpened", new Dictionary<string, string>()
70+
AnalyticsService.TrackEvent("FileRenameDialogOpened", new Dictionary<string, string>()
7271
{
7372
{ "FileExists", fileExists.ToString() },
7473
});

src/Notepads/Controls/TextEditor/TextEditor.xaml.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System.Text;
66
using System.Threading;
77
using System.Threading.Tasks;
8-
using Microsoft.AppCenter.Analytics;
98
using Notepads.Commands;
109
using Notepads.Controls.FindAndReplace;
1110
using Notepads.Controls.GoTo;
@@ -503,7 +502,7 @@ public async Task ReloadFromEditingFileAsync(Encoding encoding = null)
503502
CloseSideBySideDiffViewer();
504503
HideGoToControl();
505504
FileReloaded?.Invoke(this, EventArgs.Empty);
506-
Analytics.TrackEvent(encoding == null ? "OnFileReloaded" : "OnFileReopenedWithEncoding");
505+
AnalyticsService.TrackEvent(encoding == null ? "OnFileReloaded" : "OnFileReopenedWithEncoding");
507506
}
508507
}
509508

@@ -596,7 +595,7 @@ private void OpenSplitView(IContentPreviewExtension extension)
596595
SplitPanelColumnDefinition.MinWidth = 100.0f;
597596
SplitPanel.Visibility = Visibility.Visible;
598597
GridSplitter.Visibility = Visibility.Visible;
599-
Analytics.TrackEvent("MarkdownContentPreview_Opened");
598+
AnalyticsService.TrackEvent("MarkdownContentPreview_Opened");
600599
_isContentPreviewPanelOpened = true;
601600
}
602601

@@ -646,7 +645,7 @@ public void OpenSideBySideDiffViewer()
646645
SideBySideDiffViewer.Visibility = Visibility.Visible;
647646
SideBySideDiffViewer.RenderDiff(LastSavedSnapshot.Content, TextEditorCore.GetText(), ThemeSettingsService.ThemeMode);
648647
SideBySideDiffViewer.Focus();
649-
Analytics.TrackEvent("SideBySideDiffViewer_Opened");
648+
AnalyticsService.TrackEvent("SideBySideDiffViewer_Opened");
650649
}
651650

652651
public void CloseSideBySideDiffViewer()

src/Notepads/Controls/TextEditor/TextEditorCore.DuplicateText.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ namespace Notepads.Controls.TextEditor
88
using System;
99
using System.Collections.Generic;
1010
using Windows.UI.Text;
11-
using Microsoft.AppCenter.Analytics;
1211
using Notepads.Services;
1312

1413
public partial class TextEditorCore
@@ -69,7 +68,7 @@ private void DuplicateText()
6968
catch (Exception ex)
7069
{
7170
LoggingService.LogError($"[{nameof(TextEditorCore)}] Failed to duplicate text: {ex}");
72-
Analytics.TrackEvent("TextEditorCore_FailedToDuplicateText",
71+
AnalyticsService.TrackEvent("TextEditorCore_FailedToDuplicateText",
7372
new Dictionary<string, string> { { "Exception", ex.ToString() } });
7473
}
7574
}

src/Notepads/Controls/TextEditor/TextEditorCore.JoinText.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ namespace Notepads.Controls.TextEditor
88
using System;
99
using System.Collections.Generic;
1010
using Windows.UI.Text;
11-
using Microsoft.AppCenter.Analytics;
1211
using Notepads.Services;
1312

1413
public partial class TextEditorCore
@@ -61,7 +60,7 @@ private void JoinText()
6160
catch (Exception ex)
6261
{
6362
LoggingService.LogError($"[{nameof(TextEditorCore)}] Failed to join text: {ex}");
64-
Analytics.TrackEvent("TextEditorCore_FailedToJoinText",
63+
AnalyticsService.TrackEvent("TextEditorCore_FailedToJoinText",
6564
new Dictionary<string, string> { { "Exception", ex.ToString() } });
6665
}
6766
}

0 commit comments

Comments
 (0)