Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gui): Conditionally hide the Landscape Config page based on registry #835

Merged
merged 7 commits into from
Jul 15, 2024

Conversation

CarlosNihelton
Copy link
Contributor

(Opening this PR on top of #834 because otherwise CI won't go green ;) )

This implements a "Settings" feature on top of the Windows registry via which we can enable Landscape configuration and MS Store purchase (previously configured via an environment variable), which are both currently disabled by default.
We make sure to not depend on the Windows registry for integration testing, i.e. everything is tested as if all features are enabled.

For smaller test cases we test with both features enabled and disabled to ensure correctness.

This PR keeps the dependency on the Settings on the highest level, only propagating the decision to the implementation of the related pages.

While this is a simpler design, it has a drawback of not reacting to changes in the underlying data source (the Windows registry).

Adding a listener for registry changes is more complex and not worth in my opinion.


UDENG-3360

Copy link

codecov bot commented Jul 11, 2024

Codecov Report

Attention: Patch coverage is 90.47619% with 4 lines in your changes missing coverage. Please review.

Project coverage is 88.35%. Comparing base (1e0f4fd) to head (1882839).

Files Patch % Lines
gui/packages/ubuntupro/lib/core/settings.dart 81.81% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #835      +/-   ##
==========================================
+ Coverage   88.25%   88.35%   +0.10%     
==========================================
  Files         104      105       +1     
  Lines        6733     6758      +25     
==========================================
+ Hits         5942     5971      +29     
+ Misses        616      613       -3     
+ Partials      175      174       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Base automatically changed from upgrade-go-1.22.5 to main July 12, 2024 12:07
@CarlosNihelton CarlosNihelton force-pushed the hide-landscape-reg branch 2 times, most recently from b6e8fc2 to 441b931 Compare July 12, 2024 14:22
For reading keys from registry
Or preloaded values for integration testing.
By default false.
Affects the canConfigureLandscape getter.
Simplify the sealed-hierarchy, removing unneeded parameters from derived classes constructors:
- keep info about whether Landscape configuration is allowed in the base class.

Adds test cases to assert that getter is false
when Landscape is globally disabled no matter the config source.
The page itself doesn't change.
But we need to pass a boolean flag from the app to the model.
Here we use the Wizard route userdata param.
More tests are added, to assert that the
"Configure Landscape" button is not shown when globally disabled.
And propagate through the wizard:
1. The Landscape page is excluded from the Wizard if the feature is disabled.
2. SubscriptionStatus route userdata holds the flag, informing the respective page the situation of the Landscape feature.
Disabled by default
Enabled via settings/registry
Enabled on integration testing.
Pass a bool flag to the SubscribeNowModel
In the wizard composition, via the route userdata.
No longer reading env vars.
Updates tests.
That's affecting integration tests due render overflows.
@CarlosNihelton
Copy link
Contributor Author

There is a modest coverage on the lines reported as uncovered, because we don't report coverage of Flutter tests run on Windows (to avoid more complexity in CI installing tools to install tools on Windows to be able to parse and report coverage output).

@CarlosNihelton CarlosNihelton marked this pull request as ready for review July 12, 2024 16:44
@CarlosNihelton CarlosNihelton requested a review from a team as a code owner July 12, 2024 16:44
Copy link
Collaborator

@didrocks didrocks left a comment

Choose a reason for hiding this comment

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

I did review the Dart/Flutter side as best of my knowledge. I agree it doesn’t worth checking and monitoring the registry for this and this is the best outcome I can think of.

Nice work!

@CarlosNihelton CarlosNihelton merged commit a3ceb98 into main Jul 15, 2024
35 checks passed
@CarlosNihelton CarlosNihelton deleted the hide-landscape-reg branch July 15, 2024 12:25
CarlosNihelton added a commit that referenced this pull request Aug 6, 2024
... for developers and contributors.

We don't show Landscape config page nor the subscribe button by default.
Those willing to test those features by hand need to enable them
explicitly via the Windows registry.
CarlosNihelton added a commit that referenced this pull request Aug 6, 2024
... for developers and contributors.

We don't show Landscape config page nor the subscribe button by default.
Those willing to test those features by hand need to enable them
explicitly via the Windows registry.
CarlosNihelton added a commit that referenced this pull request Aug 7, 2024
…859)

We don't show Landscape config page nor the subscribe button by default.
Those willing to test those features by hand need to enable them
explicitly via the Windows registry, since #835 .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants