Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Conversation

@shana
Copy link
Contributor

@shana shana commented Feb 24, 2016

This PR adds a settings service and options page to handle user settings. Also adds one setting: anonymous usage data collection opt-out.

Also add a setting for opting out of usage data
@shana
Copy link
Contributor Author

shana commented Feb 24, 2016

@haacked I've added the options page to save the user settings, with a CollectMetrics property (grab the IPackageSettings export anywhere with either ServiceProvider.GetExportedValue or Services.DefaultExportProvider.GetExportedValue if there's no available IServiceProvider available in the local context)

@haacked
Copy link
Contributor

haacked commented Feb 24, 2016

Why don't we split this PR into two. Add the options whether we're collecting data or not. Then a separate PR for the metrics. Thoughts?

<DockPanel>
<WrapPanel DockPanel.Dock="Top">
<CheckBox x:Name="chkMetrics" VerticalAlignment="Center" />
<Label Content="{x:Static prop:Resources.Options_MetricsLabel}" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably add a hyperlink here that points to https://visualstudio.github.com/samples/. That page shows examples of the type of data we collect.

Here's the Desktop example. Obviously we'll need to add that page to the Visual Studio website, but lets add the link now. 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent idea!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out that we already have a samples page! But it looked terrible. I fixed it up with some placeholder content. Please add a link to https://visualstudio.github.com/samples.html

Thanks!

@haacked
Copy link
Contributor

haacked commented Feb 24, 2016

@shana a few code review comments for you. I'll look into the other checkboxes.

@shana
Copy link
Contributor Author

shana commented Feb 24, 2016

Why don't we split this PR into two. Add the options whether we're collecting data or not. Then a separate PR for the metrics. Thoughts?

Sounds reasonable. Should I add an issue to track these tasks instead so we don't lose the overall picture?

@haacked
Copy link
Contributor

haacked commented Feb 24, 2016

Sounds reasonable. Should I add an issue to track these tasks instead so we don't lose the overall picture?

Seems legit to me.

@shana
Copy link
Contributor Author

shana commented Feb 24, 2016

Part 1 and 2 of #229

@shana
Copy link
Contributor Author

shana commented Feb 25, 2016

So instead of all this manual checking to make sure things are synchronized, I've switched the code to automatically generate the interface and the implementation of the settings class based on a json file that lists the settings we want with their types and default values. This way we only have to change things in the json file. VS regenerates the files on build if the json file is changed.

@shana
Copy link
Contributor Author

shana commented Feb 25, 2016

I also moved some other settings files that were spread around (colors, constants, etc) to Settings folder along with this stuff, to make things easier to find.

@shana shana assigned haacked and unassigned shana Feb 25, 2016
@shana
Copy link
Contributor Author

shana commented Feb 25, 2016

@shana shana mentioned this pull request Feb 25, 2016
4 tasks
<#
foreach (var j in json["settings"].Children()) {
#>
<#= j["type"] #> <#= j["name"] #> { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fucking love this approach! Great use of text transformation templates!

I love it so much, I'm going to nitpick here and suggest that should be indented four spaces not eight. 😛

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But but but but... then the properties will be indented at the level of the interface definition!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't worry about it. 😄 Trying to get generated code formatted correctly with TT is a time sink.

@haacked haacked assigned shana and unassigned haacked Feb 25, 2016
@haacked
Copy link
Contributor

haacked commented Feb 25, 2016

This is great! Had some nitpicky comments about spacing which aren't really important. The main question is whether we need to commit the generated files or not.

@shana
Copy link
Contributor Author

shana commented Feb 25, 2016

I just validated the build on a fresh clone, things are generated correctly and it only rebuilds if files are changed, so 👍

@shana shana assigned haacked and unassigned shana Feb 25, 2016
@haacked
Copy link
Contributor

haacked commented Feb 25, 2016

We should probably add the generated files to .gitignore by either ignoring that directory or creating a new generated subdirectory to put the generated files in.

Sorry if I'm being nitpicky, but I want this to be a template for how I do this in more places. 😄

@haacked haacked assigned shana and unassigned haacked Feb 25, 2016
@shana shana assigned haacked and unassigned shana Feb 25, 2016
@haacked
Copy link
Contributor

haacked commented Feb 25, 2016

Wonderful!

haacked added a commit that referenced this pull request Feb 25, 2016
@haacked haacked merged commit 57bf0f7 into master Feb 25, 2016
@haacked haacked deleted the feature/metrics branch February 25, 2016 19:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants