Skip to content

Commit

Permalink
Remove CommunityToolkit.Maui.Core dependency from `CommunityToolkit…
Browse files Browse the repository at this point in the history
….Maui.Camera` (#1941)

* Add `CommunityToolkit.Maui.Camera.IAsynchronousHandler`

* `dotnet format`
  • Loading branch information
brminnick authored Jun 17, 2024
1 parent 16bc0a7 commit ae711ba
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,4 @@
<None Include="..\CommunityToolkit.Maui.Camera.Analyzers.CodeFixes\bin\$(Configuration)\netstandard2.0\CommunityToolkit.Maui.Camera.Analyzers.CodeFixes.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\CommunityToolkit.Maui.Core\CommunityToolkit.Maui.Core.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace CommunityToolkit.Maui.Camera;

/// <summary>
/// Interface that allows asynchronous completion of .NET MAUI Handlers
/// </summary>
public interface IAsynchronousHandler
{
/// <summary>
/// A <see cref="TaskCompletionSource"/> to provide Handlers an asynchronous way to complete
/// </summary>
TaskCompletionSource HandlerCompleteTCS { get; }
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using CommunityToolkit.Maui.Core.Primitives;
using CommunityToolkit.Maui.Camera;
using CommunityToolkit.Maui.Core.Primitives;

namespace CommunityToolkit.Maui.Core;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.ComponentModel;
using System.Runtime.Versioning;
using System.Windows.Input;
using CommunityToolkit.Maui.Camera;
using CommunityToolkit.Maui.Core;
using CommunityToolkit.Maui.Core.Primitives;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private protected static bool IsValidTargetType<TTarget>(in Type targetType, boo

static bool IsConvertingToString(in Type targetType) => targetType == typeof(string);
static bool CanBeConvertedToString() => typeof(TTarget).GetMethods().Any(x => x.Name is nameof(ToString) && x.ReturnType == typeof(string));

static bool IsValidNullableValueType(Type targetType)
{
if (!IsNullable(targetType))
Expand All @@ -61,7 +61,7 @@ private protected static void ValidateTargetType<TTarget>(Type targetType, bool
// Ensure TTo can be assigned to the given Target Type
if (!typeof(TTarget).IsAssignableFrom(targetType) // Ensure TTarget can be assigned from targetType. Eg TTarget is IEnumerable and targetType is IList
&& !IsValidTargetType<TTarget>(targetType, shouldAllowNullableValueTypes) // Ensure targetType be converted to TTarget? Eg `Convert.ChangeType()` returns a non-null value
)
)
{
throw new ArgumentException($"targetType needs to be assignable from {typeof(TTarget)}.", nameof(targetType));
}
Expand Down

0 comments on commit ae711ba

Please sign in to comment.