Replace MAUI asset pipeline logo loading with embedded resource stream to fix logo not appearing in consuming NuGet projects. Add CustomLogoSource property to Button and Widget controls for custom branding. Update logo to higher resolution PNG. Bump version to 1.1.2.
36 lines
1.3 KiB
C#
36 lines
1.3 KiB
C#
namespace BuyMeCofee.Maui.Helpers;
|
|
|
|
internal static class BmcBrandAssets
|
|
{
|
|
// Embedded PNG resource name — travels with the NuGet package assembly
|
|
private const string EmbeddedLogoName = "BuyMeCofee.Maui.Resources.Images.bmc_logo.png";
|
|
|
|
/// <summary>
|
|
/// Returns the cup logo as an ImageSource for MAUI Image controls.
|
|
/// Loads from embedded PNG resource so it works in consuming NuGet projects.
|
|
/// </summary>
|
|
internal static ImageSource GetCupLogo()
|
|
{
|
|
return ImageSource.FromStream(() =>
|
|
{
|
|
var assembly = typeof(BmcBrandAssets).Assembly;
|
|
return assembly.GetManifestResourceStream(EmbeddedLogoName)!;
|
|
});
|
|
}
|
|
|
|
/// <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()
|
|
{
|
|
// Try embedded resource first (for QR code SkiaSharp rendering)
|
|
var assembly = typeof(BmcBrandAssets).Assembly;
|
|
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;
|
|
}
|
|
}
|