Skip to content

Commit 88a213f

Browse files
committed
Fix AcrylicBrush AV
1 parent bd5fca6 commit 88a213f

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

‎Telegram/Common/ApiInfo.cs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ public static class ApiInfo
4545
private static bool? _canCreateRectangleClip;
4646
public static bool CanCreateRectangleClip => _canCreateRectangleClip ??= ApiInformation.IsMethodPresent("Windows.UI.Composition.Compositor", "CreateRectangleClip");
4747

48+
private static bool? _canSetTintLuminosityOpacity;
49+
public static bool CanSetTintLuminosityOpacity => _canSetTintLuminosityOpacity ??= ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 10);
50+
4851
// We only enable shadows on Windows 11 for three reasons:
4952
// First: they look terrible on Windows 10
5053
// Second: they are way more optimized on Windows 11 (they use a nine-grid instead of dynamically casted shadows)

‎Telegram/Common/Theme.cs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,14 @@ Color GetShade(AccentShade shade)
409409
{
410410
update.TintColor = tintColor;
411411
update.TintOpacity = tintOpacity;
412-
update.TintLuminosityOpacity = tintLuminosityOpacity;
412+
if (ApiInfo.CanSetTintLuminosityOpacity)
413+
{
414+
update.TintLuminosityOpacity = tintLuminosityOpacity;
415+
}
416+
else
417+
{
418+
update.SetValue(AcrylicBrush.TintLuminosityOpacityProperty, tintLuminosityOpacity);
419+
}
413420
update.FallbackColor = fallbackColor;
414421
update.AlwaysUseFallback = !PowerSavingPolicy.AreMaterialsEnabled;
415422
});

0 commit comments

Comments
 (0)