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

Pro/76 white label #273

Merged
merged 4 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions src/dymaptic.GeoBlazor.Core/Components/Views/MapView.razor
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,24 @@
<div class="map-container" id="@($"map-container-{Id}")">
@ChildContent
</div>
<div class="dymaptic-branding">
<a href="https://www.geoblazor.com">
<img height="12" src="_content/dymaptic.GeoBlazor.Core/images/Blazor-API-60px.png" /> GeoBlazor
</a>
by
<a href="https://www.dymaptic.com">
<img height="12" src="_content/dymaptic.GeoBlazor.Core/images/dymaptic-logo-circle-icon.png" /> dymaptic
</a>
</div>
@if (WhiteLabel is null || !IsPro())
{
<div class="dymaptic-branding">
<a href="https://www.geoblazor.com">
<img height="12" src="_content/dymaptic.GeoBlazor.Core/images/Blazor-API-60px.png" /> GeoBlazor
</a>
by
<a href="https://www.dymaptic.com">
<img height="12" src="_content/dymaptic.GeoBlazor.Core/images/dymaptic-logo-circle-icon.png" /> dymaptic
</a>
</div>
}
else
{
<div class="white-label">
@((MarkupString)WhiteLabel)
</div>
}
</div>
</CascadingValue>
</CascadingValue>
Expand Down
26 changes: 26 additions & 0 deletions src/dymaptic.GeoBlazor.Core/Components/Views/MapView.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ public Point? Center
/// </summary>
[Parameter]
public bool? PromptForOAuthLogin { get; set; }

[Parameter]
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
public string? WhiteLabel { get; set; }
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member

#endregion

Expand Down Expand Up @@ -2371,5 +2376,26 @@ protected List<string> GetActiveEventHandlers()
return activeHandlers;
}

private bool IsPro()
{
if (_isPro is null)
{
try
{
Assembly _ = Assembly.Load("dymaptic.GeoBlazor.Pro");

_isPro = true;
}
catch
{
_isPro = false;
}
}

return _isPro.Value;
}

private bool? _isPro;

#endregion
}
2 changes: 1 addition & 1 deletion src/dymaptic.GeoBlazor.Core/dymaptic.GeoBlazor.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
<Exec Command="pwsh ./assetCopy.ps1" />
</Target>

<Target Name="Copy Assets Release" AfterTargets="PreBuildEvent" Condition="$(Configuration) == 'RELEASE' AND $(TargetFrameworks.StartsWith($(TargetFramework)))">
<Target Name="Copy Assets Release" AfterTargets="PreBuildEvent" Condition="$(Configuration) == 'RELEASE' AND $(TargetFrameworks.StartsWith($(TargetFramework))) AND '$(UpdateTemplates)' == 'true'">
<Message Importance="high" Text="Update Template Versions" />
<Exec Command="pwsh ./updateTemplates.ps1 $(CoreVersion)" />
</Target>
Expand Down