Skip to content

Commit e86f5c9

Browse files
authored
Added app center tracking on startup (#7607)
1 parent 0bade49 commit e86f5c9

21 files changed

+186
-97
lines changed

src/Files/App.xaml.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,13 @@ private static async Task StartAppCenter()
157157

158158
private static async Task InitializeAppComponentsAsync()
159159
{
160+
var userSettingsService = Ioc.Default.GetRequiredService<IUserSettingsService>();
161+
160162
// Start off a list of tasks we need to run before we can continue startup
161163
await Task.Run(async () =>
162164
{
165+
userSettingsService.ReportToAppCenter();
166+
163167
await Task.WhenAll(
164168
StartAppCenter(),
165169
DrivesManager.EnumerateDrivesAsync(),

src/Files/Files.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@
247247
<Compile Include="Models\JsonSettings\Implementation\DefaultSettingsSerializer.cs" />
248248
<Compile Include="Models\JsonSettings\ISettingsSerializer.cs" />
249249
<Compile Include="Services\IAppearanceSettingsService.cs" />
250+
<Compile Include="Services\IBaseSettingsService.cs" />
250251
<Compile Include="Services\IBundlesSettingsService.cs" />
251252
<Compile Include="Services\IFileTagsSettingsService.cs" />
252253
<Compile Include="Services\ILayoutSettingsService.cs" />

src/Files/Services/IAppearanceSettingsService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Files.Services
44
{
5-
public interface IAppearanceSettingsService : INotifyPropertyChanged
5+
public interface IAppearanceSettingsService : IBaseSettingsService, INotifyPropertyChanged
66
{
77
/// <summary>
88
/// Gets or sets a value indicating whether or not to move overflow menu items into a sub menu.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace Files.Services
2+
{
3+
public interface IBaseSettingsService
4+
{
5+
void ReportToAppCenter();
6+
}
7+
}

src/Files/Services/IBundlesSettingsService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Files.Services
55
{
6-
public interface IBundlesSettingsService
6+
public interface IBundlesSettingsService : IBaseSettingsService
77
{
88
event EventHandler OnSettingImportedEvent;
99

src/Files/Services/IFileTagsSettingsService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Files.Services
66
{
7-
public interface IFileTagsSettingsService
7+
public interface IFileTagsSettingsService : IBaseSettingsService
88
{
99
event EventHandler OnSettingImportedEvent;
1010

src/Files/Services/ILayoutSettingsService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Files.Services
55
{
6-
public interface ILayoutSettingsService : INotifyPropertyChanged
6+
public interface ILayoutSettingsService : IBaseSettingsService, INotifyPropertyChanged
77
{
88
/// <summary>
99
/// Gets or sets a value indicating whether or not the date column should be visible.

src/Files/Services/IMultitaskingSettingsService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Files.Services
44
{
5-
public interface IMultitaskingSettingsService : INotifyPropertyChanged
5+
public interface IMultitaskingSettingsService : IBaseSettingsService, INotifyPropertyChanged
66
{
77
/// <summary>
88
/// Gets or sets a value indicating whether or not to enable the vertical tab flyout.

src/Files/Services/IPreferencesSettingsService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Files.Services
55
{
6-
public interface IPreferencesSettingsService : INotifyPropertyChanged
6+
public interface IPreferencesSettingsService : IBaseSettingsService, INotifyPropertyChanged
77
{
88
/// <summary>
99
/// Gets or sets a value indicating whether or not to show the delete confirmation dialog when deleting items.

src/Files/Services/IPreviewPaneSettingsService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Files.Services
44
{
5-
public interface IPreviewPaneSettingsService : INotifyPropertyChanged
5+
public interface IPreviewPaneSettingsService : IBaseSettingsService, INotifyPropertyChanged
66
{
77
/// <summary>
88
/// Gets or sets a value indicating the default volume on media preview.

src/Files/Services/IUserSettingsService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Files.Services
66
{
7-
public interface IUserSettingsService
7+
public interface IUserSettingsService : IBaseSettingsService
88
{
99
event EventHandler<SettingChangedEventArgs> OnSettingChangedEvent;
1010

src/Files/Services/IWidgetsSettingsService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Files.Services
44
{
5-
public interface IWidgetsSettingsService : INotifyPropertyChanged
5+
public interface IWidgetsSettingsService : IBaseSettingsService, INotifyPropertyChanged
66
{
77
/// <summary>
88
/// Gets or sets a value indicating whether or not the library cards widget should be visible.

src/Files/Services/Implementation/AppearanceSettingsService.cs

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Files.Models.JsonSettings;
2+
using Microsoft.AppCenter.Analytics;
23
using System;
34

45
namespace Files.Services.Implementation
@@ -11,24 +12,6 @@ public AppearanceSettingsService(ISettingsSharingContext settingsSharingContext)
1112
this.RegisterSettingsContext(settingsSharingContext);
1213
}
1314

14-
public override void RaiseOnSettingChangedEvent(object sender, EventArguments.SettingChangedEventArgs e)
15-
{
16-
switch (e.settingName)
17-
{
18-
case nameof(MoveOverflowMenuItemsToSubMenu):
19-
case nameof(ShowFavoritesSection):
20-
case nameof(ShowLibrarySection):
21-
case nameof(ShowCloudDrivesSection):
22-
case nameof(ShowNetworkDrivesSection):
23-
case nameof(ShowWslSection):
24-
case nameof(PinRecycleBinToSidebar):
25-
Microsoft.AppCenter.Analytics.Analytics.TrackEvent($"{e.settingName} {e.newValue}");
26-
break;
27-
}
28-
29-
base.RaiseOnSettingChangedEvent(sender, e);
30-
}
31-
3215
#region Internal Settings
3316

3417
public double SidebarWidth
@@ -92,5 +75,34 @@ public bool MoveOverflowMenuItemsToSubMenu
9275
get => Get(true);
9376
set => Set(value);
9477
}
78+
79+
public override void RaiseOnSettingChangedEvent(object sender, EventArguments.SettingChangedEventArgs e)
80+
{
81+
switch (e.settingName)
82+
{
83+
case nameof(MoveOverflowMenuItemsToSubMenu):
84+
case nameof(ShowFavoritesSection):
85+
case nameof(ShowLibrarySection):
86+
case nameof(ShowCloudDrivesSection):
87+
case nameof(ShowNetworkDrivesSection):
88+
case nameof(ShowWslSection):
89+
case nameof(PinRecycleBinToSidebar):
90+
Analytics.TrackEvent($"{e.settingName} {e.newValue}");
91+
break;
92+
}
93+
94+
base.RaiseOnSettingChangedEvent(sender, e);
95+
}
96+
97+
public void ReportToAppCenter()
98+
{
99+
Analytics.TrackEvent($"{nameof(MoveOverflowMenuItemsToSubMenu)}, {MoveOverflowMenuItemsToSubMenu}");
100+
Analytics.TrackEvent($"{nameof(ShowFavoritesSection)}, {ShowFavoritesSection}");
101+
Analytics.TrackEvent($"{nameof(ShowLibrarySection)}, {ShowLibrarySection}");
102+
Analytics.TrackEvent($"{nameof(ShowCloudDrivesSection)}, {ShowCloudDrivesSection}");
103+
Analytics.TrackEvent($"{nameof(ShowNetworkDrivesSection)}, {ShowNetworkDrivesSection}");
104+
Analytics.TrackEvent($"{nameof(ShowWslSection)}, {ShowWslSection}");
105+
Analytics.TrackEvent($"{nameof(PinRecycleBinToSidebar)}, {PinRecycleBinToSidebar}");
106+
}
95107
}
96108
}

src/Files/Services/Implementation/BundlesSettingsService.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,9 @@ public override object ExportSettings()
4747
// Return string in Json format
4848
return jsonSettingsSerializer.SerializeToJson(SavedBundles);
4949
}
50+
51+
public void ReportToAppCenter()
52+
{
53+
}
5054
}
5155
}

src/Files/Services/Implementation/FileTagsSettingsService.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,9 @@ public override object ExportSettings()
8282
// Return string in Json format
8383
return jsonSettingsSerializer.SerializeToJson(FileTagList);
8484
}
85+
86+
public void ReportToAppCenter()
87+
{
88+
}
8589
}
8690
}

src/Files/Services/Implementation/LayoutSettingsService.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,9 @@ public GroupOption DefaultDirectoryGroupOption
7070
get => (GroupOption)Get((long)GroupOption.None);
7171
set => Set((long)value);
7272
}
73+
74+
public void ReportToAppCenter()
75+
{
76+
}
7377
}
7478
}
Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Files.Models.JsonSettings;
2+
using Microsoft.AppCenter.Analytics;
23

34
namespace Files.Services.Implementation
45
{
@@ -10,20 +11,6 @@ public MultitaskingSettingsService(ISettingsSharingContext settingsSharingContex
1011
this.RegisterSettingsContext(settingsSharingContext);
1112
}
1213

13-
public override void RaiseOnSettingChangedEvent(object sender, EventArguments.SettingChangedEventArgs e)
14-
{
15-
switch (e.settingName)
16-
{
17-
case nameof(IsVerticalTabFlyoutEnabled):
18-
case nameof(IsDualPaneEnabled):
19-
case nameof(AlwaysOpenDualPaneInNewTab):
20-
Microsoft.AppCenter.Analytics.Analytics.TrackEvent($"{e.settingName} {e.newValue}");
21-
break;
22-
}
23-
24-
base.RaiseOnSettingChangedEvent(sender, e);
25-
}
26-
2714
public bool IsVerticalTabFlyoutEnabled
2815
{
2916
get => Get(true);
@@ -41,5 +28,26 @@ public bool AlwaysOpenDualPaneInNewTab
4128
get => Get(false);
4229
set => Set(value);
4330
}
31+
32+
public override void RaiseOnSettingChangedEvent(object sender, EventArguments.SettingChangedEventArgs e)
33+
{
34+
switch (e.settingName)
35+
{
36+
case nameof(IsVerticalTabFlyoutEnabled):
37+
case nameof(IsDualPaneEnabled):
38+
case nameof(AlwaysOpenDualPaneInNewTab):
39+
Analytics.TrackEvent($"{e.settingName} {e.newValue}");
40+
break;
41+
}
42+
43+
base.RaiseOnSettingChangedEvent(sender, e);
44+
}
45+
46+
public void ReportToAppCenter()
47+
{
48+
Analytics.TrackEvent($"{nameof(IsVerticalTabFlyoutEnabled)}, {IsVerticalTabFlyoutEnabled}");
49+
Analytics.TrackEvent($"{nameof(IsDualPaneEnabled)}, {IsDualPaneEnabled}");
50+
Analytics.TrackEvent($"{nameof(AlwaysOpenDualPaneInNewTab)}, {AlwaysOpenDualPaneInNewTab}");
51+
}
4452
}
4553
}

src/Files/Services/Implementation/PreferencesSettingsService.cs

Lines changed: 50 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Files.Models.JsonSettings;
2+
using Microsoft.AppCenter.Analytics;
23
using System.Collections.Generic;
34

45
namespace Files.Services.Implementation
@@ -11,34 +12,6 @@ public PreferencesSettingsService(ISettingsSharingContext settingsSharingContext
1112
this.RegisterSettingsContext(settingsSharingContext);
1213
}
1314

14-
public override void RaiseOnSettingChangedEvent(object sender, EventArguments.SettingChangedEventArgs e)
15-
{
16-
switch (e.settingName)
17-
{
18-
case nameof(ShowConfirmDeleteDialog):
19-
case nameof(OpenFoldersInNewTab):
20-
case nameof(ShowFileExtensions):
21-
case nameof(AreHiddenItemsVisible):
22-
case nameof(AreSystemItemsHidden):
23-
case nameof(ListAndSortDirectoriesAlongsideFiles):
24-
case nameof(OpenFilesWithOneClick):
25-
case nameof(OpenFoldersWithOneClick):
26-
case nameof(SearchUnindexedItems):
27-
case nameof(AreLayoutPreferencesPerFolder):
28-
case nameof(AdaptiveLayoutEnabled):
29-
case nameof(AreFileTagsEnabled):
30-
case nameof(ShowFolderSize):
31-
case nameof(OpenSpecificPageOnStartup):
32-
case nameof(ContinueLastSessionOnStartUp):
33-
case nameof(OpenNewTabOnStartup):
34-
case nameof(AlwaysOpenNewInstance):
35-
Microsoft.AppCenter.Analytics.Analytics.TrackEvent($"{e.settingName} {e.newValue}");
36-
break;
37-
}
38-
39-
base.RaiseOnSettingChangedEvent(sender, e);
40-
}
41-
4215
public bool ShowConfirmDeleteDialog
4316
{
4417
get => Get(true);
@@ -158,5 +131,54 @@ public List<string> LastSessionTabList
158131
get => Get<List<string>>(null);
159132
set => Set(value);
160133
}
134+
135+
public override void RaiseOnSettingChangedEvent(object sender, EventArguments.SettingChangedEventArgs e)
136+
{
137+
switch (e.settingName)
138+
{
139+
case nameof(ShowConfirmDeleteDialog):
140+
case nameof(OpenFoldersInNewTab):
141+
case nameof(ShowFileExtensions):
142+
case nameof(AreHiddenItemsVisible):
143+
case nameof(AreSystemItemsHidden):
144+
case nameof(ListAndSortDirectoriesAlongsideFiles):
145+
case nameof(OpenFilesWithOneClick):
146+
case nameof(OpenFoldersWithOneClick):
147+
case nameof(SearchUnindexedItems):
148+
case nameof(AreLayoutPreferencesPerFolder):
149+
case nameof(AdaptiveLayoutEnabled):
150+
case nameof(AreFileTagsEnabled):
151+
case nameof(ShowFolderSize):
152+
case nameof(OpenSpecificPageOnStartup):
153+
case nameof(ContinueLastSessionOnStartUp):
154+
case nameof(OpenNewTabOnStartup):
155+
case nameof(AlwaysOpenNewInstance):
156+
Analytics.TrackEvent($"{e.settingName} {e.newValue}");
157+
break;
158+
}
159+
160+
base.RaiseOnSettingChangedEvent(sender, e);
161+
}
162+
163+
public void ReportToAppCenter()
164+
{
165+
Analytics.TrackEvent($"{nameof(ShowConfirmDeleteDialog)}, {ShowConfirmDeleteDialog}");
166+
Analytics.TrackEvent($"{nameof(OpenFoldersInNewTab)}, {OpenFoldersInNewTab}");
167+
Analytics.TrackEvent($"{nameof(ShowFileExtensions)}, {ShowFileExtensions}");
168+
Analytics.TrackEvent($"{nameof(AreHiddenItemsVisible)}, {AreHiddenItemsVisible}");
169+
Analytics.TrackEvent($"{nameof(AreSystemItemsHidden)}, {AreSystemItemsHidden}");
170+
Analytics.TrackEvent($"{nameof(ListAndSortDirectoriesAlongsideFiles)}, {ListAndSortDirectoriesAlongsideFiles}");
171+
Analytics.TrackEvent($"{nameof(OpenFilesWithOneClick)}, {OpenFilesWithOneClick}");
172+
Analytics.TrackEvent($"{nameof(OpenFoldersWithOneClick)}, {OpenFoldersWithOneClick}");
173+
Analytics.TrackEvent($"{nameof(SearchUnindexedItems)}, {SearchUnindexedItems}");
174+
Analytics.TrackEvent($"{nameof(AreLayoutPreferencesPerFolder)}, {AreLayoutPreferencesPerFolder}");
175+
Analytics.TrackEvent($"{nameof(AdaptiveLayoutEnabled)}, {AdaptiveLayoutEnabled}");
176+
Analytics.TrackEvent($"{nameof(AreFileTagsEnabled)}, {AreFileTagsEnabled}");
177+
Analytics.TrackEvent($"{nameof(ShowFolderSize)}, {ShowFolderSize}");
178+
Analytics.TrackEvent($"{nameof(OpenSpecificPageOnStartup)}, {OpenSpecificPageOnStartup}");
179+
Analytics.TrackEvent($"{nameof(ContinueLastSessionOnStartUp)}, {ContinueLastSessionOnStartUp}");
180+
Analytics.TrackEvent($"{nameof(OpenNewTabOnStartup)}, {OpenNewTabOnStartup}");
181+
Analytics.TrackEvent($"{nameof(AlwaysOpenNewInstance)}, {AlwaysOpenNewInstance}");
182+
}
161183
}
162184
}

0 commit comments

Comments
 (0)