feat(ci): add supporter verification and auto-hide functionality
Implement BmcSupporterService to verify supporters via BMC API with configurable caching. Add SupporterEmail and HideIfSupporter properties to all controls to automatically hide donation prompts for existing supporters. Replace PNG logo with SVG for crisp rendering at all scales. Add BmcOptions and BmcConfiguration for library-wide settings. Bump version to 1.1.0.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using BuyMeCofee.Maui.Services;
|
||||
using SkiaSharp.Views.Maui.Controls.Hosting;
|
||||
|
||||
namespace BuyMeCofee.Maui;
|
||||
@@ -13,4 +14,32 @@ public static class BuyMeACoffeeExtensions
|
||||
builder.UseSkiaSharp();
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers Buy Me a Coffee controls with optional supporter verification.
|
||||
/// When an AccessToken is provided, controls with HideIfSupporter=true
|
||||
/// will auto-hide for verified supporters.
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// builder.UseBuyMeACoffee(options =>
|
||||
/// {
|
||||
/// options.AccessToken = "your-bmc-api-token";
|
||||
/// options.CacheDuration = TimeSpan.FromHours(2);
|
||||
/// });
|
||||
/// </example>
|
||||
public static MauiAppBuilder UseBuyMeACoffee(this MauiAppBuilder builder, Action<BmcOptions> configure)
|
||||
{
|
||||
builder.UseSkiaSharp();
|
||||
|
||||
var options = new BmcOptions();
|
||||
configure(options);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(options.AccessToken))
|
||||
{
|
||||
BmcConfiguration.SupporterService = new BmcSupporterService(
|
||||
options.AccessToken, options.CacheDuration);
|
||||
}
|
||||
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user