Skip to content

Commit d7846db

Browse files
committed
Suppress sponsorship prompts on licensed installs
1 parent b116829 commit d7846db

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/NetworkOptimizer.Web/Services/SponsorshipService.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,17 @@ public SponsorshipService(IServiceProvider serviceProvider, ILogger<SponsorshipS
7979
try
8080
{
8181
using var scope = _serviceProvider.CreateScope();
82+
83+
// A licensed install has already paid for the product - never nag it
84+
// for sponsorship. Cached property, so this costs nothing per page load.
85+
// alwaysShow (the Settings preview) still works so the operator can see
86+
// what the prompts look like.
87+
var licenseState = scope.ServiceProvider.GetRequiredService<Licensing.LicenseStateService>();
88+
if (licenseState.AnyKeysActive && !alwaysShow)
89+
{
90+
return null;
91+
}
92+
8293
var settingsService = scope.ServiceProvider.GetRequiredService<ISystemSettingsService>();
8394

8495
// Sponsorship nag state is instance-wide (one operator), so it always lives in

0 commit comments

Comments
 (0)