diff --git a/source/Lottie/Loader.cs b/source/Lottie/Loader.cs
index 86039cf1..55a636de 100644
--- a/source/Lottie/Loader.cs
+++ b/source/Lottie/Loader.cs
@@ -25,6 +25,8 @@
namespace CommunityToolkit.WinUI.Lottie
{
+#pragma warning disable SA1303 // Constants must begin with an upper case letter.
+
///
/// Handles loading a composition from a Lottie file. The result of the load
/// is a that can be used to instantiate a
@@ -32,6 +34,9 @@ namespace CommunityToolkit.WinUI.Lottie
///
abstract class Loader : IDisposable
{
+ // TODO: we do not support UAP above 14 in Lottie-Windows yet, only in LottieGen.
+ const uint c_maxContractVersion = 14u;
+
// Identifies the bound property names in SourceMetadata.
static readonly Guid s_propertyBindingNamesKey = new Guid("A115C46A-254C-43E6-A3C7-9DE516C3C3C8");
@@ -147,7 +152,13 @@ await Task.Run(() =>
{
TranslatePropertyBindings = makeColorsBindable,
GenerateColorBindings = makeColorsBindable,
+#if WINAPPSDK
+ // The WindowsAppSDK has access to the latest APIs, and should not use
+ // fallback APIs based on which OS the app is running on.
+ TargetUapVersion = c_maxContractVersion,
+#else
TargetUapVersion = GetCurrentUapVersion(),
+#endif
});
wincompDataRootVisual = translationResult.RootVisual;
@@ -211,17 +222,13 @@ static IReadOnlyList ToIssues(IEnumerable<(string Code, string Descriptio
static IReadOnlyList ToIssues(IEnumerable issues)
=> issues.Select(issue => new Issue(code: issue.Code, description: issue.Description)).ToArray();
+#if !WINAPPSDK
///
/// Gets the highest UAP version supported by the current process.
///
/// The highest UAP version supported by the current process.
static uint GetCurrentUapVersion()
{
-#if WINAPPSDK
- // The WindowsAppSDK has access to all APIs up to version 14, and should not use fallback APIs
- // based on which OS the app is running on.
- return 14;
-#else
// Start testing on version 2. We know that at least version 1 is supported because
// we are running in UAP code.
var versionToTest = 1u;
@@ -233,13 +240,12 @@ static uint GetCurrentUapVersion()
versionToTest++;
}
- // TODO: we do not support UAP above 14 in Lottie-Windows yet, only in LottieGen.
- versionToTest = Math.Min(versionToTest, 14);
+ versionToTest = Math.Min(versionToTest, c_maxContractVersion);
// Query failed on versionToTest. Return the previous version.
return versionToTest;
-#endif
}
+#endif
// Specializes the Stopwatch to do just the one thing we need of it - get the time
// elapsed since the last call then restart the Stopwatch to start measuring again.