feat(scenarios): add buy me a coffee maui library
Create a .NET MAUI library for Buy Me a Coffee integration with branded button, QR code, and widget controls. Includes 8 theme presets (yellow, black, white, blue, violet, orange, red, green), customizable styling, and SkiaSharp-based rendering. Supports opening BMC pages in browser and generating QR codes for donations.
2026-03-03 23:19:45 -05:00
|
|
|
namespace BuyMeCofee.Maui.Helpers;
|
|
|
|
|
|
|
|
|
|
internal static class BmcBrandAssets
|
|
|
|
|
{
|
2026-03-04 02:37:46 -05:00
|
|
|
// Embedded PNG resource name — travels with the NuGet package assembly
|
2026-03-04 00:35:05 -05:00
|
|
|
private const string EmbeddedLogoName = "BuyMeCofee.Maui.Resources.Images.bmc_logo.png";
|
feat(scenarios): add buy me a coffee maui library
Create a .NET MAUI library for Buy Me a Coffee integration with branded button, QR code, and widget controls. Includes 8 theme presets (yellow, black, white, blue, violet, orange, red, green), customizable styling, and SkiaSharp-based rendering. Supports opening BMC pages in browser and generating QR codes for donations.
2026-03-03 23:19:45 -05:00
|
|
|
|
2026-03-04 00:35:05 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Returns the cup logo as an ImageSource for MAUI Image controls.
|
2026-03-04 02:37:46 -05:00
|
|
|
/// Loads from embedded PNG resource so it works in consuming NuGet projects.
|
2026-03-04 00:35:05 -05:00
|
|
|
/// </summary>
|
feat(scenarios): add buy me a coffee maui library
Create a .NET MAUI library for Buy Me a Coffee integration with branded button, QR code, and widget controls. Includes 8 theme presets (yellow, black, white, blue, violet, orange, red, green), customizable styling, and SkiaSharp-based rendering. Supports opening BMC pages in browser and generating QR codes for donations.
2026-03-03 23:19:45 -05:00
|
|
|
internal static ImageSource GetCupLogo()
|
|
|
|
|
{
|
2026-03-04 02:37:46 -05:00
|
|
|
return ImageSource.FromStream(() =>
|
|
|
|
|
{
|
|
|
|
|
var assembly = typeof(BmcBrandAssets).Assembly;
|
|
|
|
|
return assembly.GetManifestResourceStream(EmbeddedLogoName)!;
|
|
|
|
|
});
|
feat(scenarios): add buy me a coffee maui library
Create a .NET MAUI library for Buy Me a Coffee integration with branded button, QR code, and widget controls. Includes 8 theme presets (yellow, black, white, blue, violet, orange, red, green), customizable styling, and SkiaSharp-based rendering. Supports opening BMC pages in browser and generating QR codes for donations.
2026-03-03 23:19:45 -05:00
|
|
|
}
|
|
|
|
|
|
2026-03-04 00:35:05 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Returns the cup logo as a raw stream for SkiaSharp rendering (QR code overlay).
|
|
|
|
|
/// Falls back to embedded PNG resource.
|
|
|
|
|
/// </summary>
|
|
|
|
|
internal static Stream? GetCupLogoStream()
|
feat(scenarios): add buy me a coffee maui library
Create a .NET MAUI library for Buy Me a Coffee integration with branded button, QR code, and widget controls. Includes 8 theme presets (yellow, black, white, blue, violet, orange, red, green), customizable styling, and SkiaSharp-based rendering. Supports opening BMC pages in browser and generating QR codes for donations.
2026-03-03 23:19:45 -05:00
|
|
|
{
|
2026-03-04 00:35:05 -05:00
|
|
|
// Try embedded resource first (for QR code SkiaSharp rendering)
|
feat(scenarios): add buy me a coffee maui library
Create a .NET MAUI library for Buy Me a Coffee integration with branded button, QR code, and widget controls. Includes 8 theme presets (yellow, black, white, blue, violet, orange, red, green), customizable styling, and SkiaSharp-based rendering. Supports opening BMC pages in browser and generating QR codes for donations.
2026-03-03 23:19:45 -05:00
|
|
|
var assembly = typeof(BmcBrandAssets).Assembly;
|
2026-03-04 00:35:05 -05:00
|
|
|
var stream = assembly.GetManifestResourceStream(EmbeddedLogoName);
|
|
|
|
|
if (stream != null) return stream;
|
|
|
|
|
|
|
|
|
|
// If embedded PNG was removed, return null (QR code will render without logo)
|
|
|
|
|
return null;
|
feat(scenarios): add buy me a coffee maui library
Create a .NET MAUI library for Buy Me a Coffee integration with branded button, QR code, and widget controls. Includes 8 theme presets (yellow, black, white, blue, violet, orange, red, green), customizable styling, and SkiaSharp-based rendering. Supports opening BMC pages in browser and generating QR codes for donations.
2026-03-03 23:19:45 -05:00
|
|
|
}
|
|
|
|
|
}
|