Skip to content

Commit

Permalink
Merge pull request #12442 from unoplatform/Youssef1313/ResourceResolv…
Browse files Browse the repository at this point in the history
…erSingleton

fix!: Cleanup ResourceResolverSingleton
  • Loading branch information
jeromelaban authored May 28, 2023
2 parents 645238e + eec78e6 commit 4506700
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 15 deletions.
5 changes: 5 additions & 0 deletions build/PackageDiffIgnore.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1380,6 +1380,11 @@
<Member fullName="UIKit.UIView Windows.UI.Xaml.Controls.ItemsPanelTemplate.LoadContent()" reason="Api alignments" />
<Member fullName="AppKit.NSView Windows.UI.Xaml.FrameworkTemplate.LoadContent()" reason="Api alignments" />
<Member fullName="AppKit.NSView Windows.UI.Xaml.Controls.ItemsPanelTemplate.LoadContent()" reason="Api alignments" />
<Member fullName="System.Boolean Uno.UI.ResourceResolver.ResolveResourceStatic(System.Object key, System.Object&amp; value, System.Object context)" reason="Api alignments" />
<Member fullName="System.Void Uno.UI.ResourceResolver.ApplyResource(Windows.UI.Xaml.DependencyObject owner, Windows.UI.Xaml.DependencyProperty property, System.Object resourceKey, System.Boolean isThemeResourceExtension, System.Object context)" reason="Api alignments" />
<Member fullName="System.Boolean Uno.UI.ResourceResolverSingleton.ResolveResourceStatic(System.Object key, System.Object&amp; value, System.Object context)" reason="Api alignments" />
<Member fullName="System.Void Uno.UI.ResourceResolverSingleton.ApplyResource(Windows.UI.Xaml.DependencyObject owner, Windows.UI.Xaml.DependencyProperty property, System.Object resourceKey, System.Boolean isThemeResourceExtension, System.Object context)" reason="Api alignments" />


<Member fullName="System.Void Windows.UI.Xaml.Media.Animation.EasingFunctionBase..ctor()" reason="API Alignment" />
<Member fullName="System.Double Windows.UI.Xaml.Media.Animation.EasingFunctionBase.Ease(System.Double currentTime, System.Double startValue, System.Double finalValue, System.Double duration)" reason="API Alignment" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void When_LinkedResDict_ThemeUpdated()
[TestBrush] = new WeakResourceInitializer(dontcare, that =>
{
var brush = new SolidColorBrush();
ResourceResolverSingleton.Instance.ApplyResource(brush, SolidColorBrush.ColorProperty, TestThemeColor, true, parserContext);
ResourceResolverSingleton.Instance.ApplyResource(brush, SolidColorBrush.ColorProperty, TestThemeColor, true, false, parserContext);

return brush;
})
Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/Controls/TimePicker/TimePicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public partial class TimePicker : Control

public TimePicker()
{
ResourceResolver.ApplyResource(this, LightDismissOverlayBackgroundProperty, "TimePickerLightDismissOverlayBackground", isThemeResourceExtension: true);
ResourceResolver.ApplyResource(this, LightDismissOverlayBackgroundProperty, "TimePickerLightDismissOverlayBackground", isThemeResourceExtension: true, isHotReloadSupported: false);

DefaultStyleKey = typeof(TimePicker);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/Documents/Hyperlink.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public Hyperlink() : base("a")
PointerPressed += TextBlock.OnPointerPressed;
PointerReleased += TextBlock.OnPointerReleased;
PointerCaptureLost += TextBlock.OnPointerCaptureLost;
ResourceResolver.ApplyResource(this, Hyperlink.ForegroundProperty, "SystemControlHyperlinkTextBrush", isThemeResourceExtension: true);
ResourceResolver.ApplyResource(this, Hyperlink.ForegroundProperty, "SystemControlHyperlinkTextBrush", isThemeResourceExtension: true, isHotReloadSupported: false);

}

Expand Down
6 changes: 1 addition & 5 deletions src/Uno.UI/UI/Xaml/ResourceResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public static object ResolveResourceStatic(object key, Type type, object context
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public static bool ResolveResourceStatic(object key, out object value, object context = null)
internal static bool ResolveResourceStatic(object key, out object value, object context = null)
=> TryStaticRetrieval(new SpecializedResourceDictionary.ResourceKey(key), context, out value);

/// <summary>
Expand Down Expand Up @@ -233,10 +233,6 @@ internal static object ResolveTopLevelResource(SpecializedResourceDictionary.Res

return fallbackValue;
}
[EditorBrowsable(EditorBrowsableState.Never)]
// This overload is kept for backwards compatibility
public static void ApplyResource(DependencyObject owner, DependencyProperty property, object resourceKey, bool isThemeResourceExtension, object context = null)
=> ApplyResource(owner, property, resourceKey, isThemeResourceExtension, false, context);

/// <summary>
/// Apply a StaticResource or ThemeResource assignment to a DependencyProperty of a DependencyObject. The assignment will be provisionally
Expand Down
7 changes: 0 additions & 7 deletions src/Uno.UI/UI/Xaml/ResourceResolverSingleton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,12 @@ public sealed class ResourceResolverSingleton
private static ResourceResolverSingleton _instance;
public static ResourceResolverSingleton Instance => _instance ??= new ResourceResolverSingleton();

[EditorBrowsable(EditorBrowsableState.Never)]
public bool ResolveResourceStatic(object key, out object value, object context) => ResourceResolver.ResolveResourceStatic(key, out value, context);

[EditorBrowsable(EditorBrowsableState.Never)]
public object ResolveResourceStatic(object key, Type type, object context) => ResourceResolver.ResolveResourceStatic(key, type, context);

[EditorBrowsable(EditorBrowsableState.Never)]
public void ApplyResource(DependencyObject owner, DependencyProperty property, object resourceKey, bool isThemeResourceExtension, bool isHotReloadSupported, object context) => ResourceResolver.ApplyResource(owner, property, resourceKey, isThemeResourceExtension, isHotReloadSupported, context);

[EditorBrowsable(EditorBrowsableState.Never)]
// This overload is kept for backwards compatibility
public void ApplyResource(DependencyObject owner, DependencyProperty property, object resourceKey, bool isThemeResourceExtension, object context) => ResourceResolver.ApplyResource(owner, property, resourceKey, isThemeResourceExtension, context);

[EditorBrowsable(EditorBrowsableState.Never)]
public object ResolveStaticResourceAlias(string resourceKey, object parseContext) => ResourceResolver.ResolveStaticResourceAlias(resourceKey, parseContext);
}
Expand Down

0 comments on commit 4506700

Please sign in to comment.