Skip to content

Commit

Permalink
Renamed AsyncInject to IAsyncInject
Browse files Browse the repository at this point in the history
  • Loading branch information
altunsercan authored and Mathijs-Bakker committed Feb 24, 2021
1 parent b709601 commit 8b8b8bc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static
"You should not use Container.BindAsync for factory classes. Use Container.BindFactory instead.");

Assert.That(!bindInfo.ContractTypes.Contains(typeof(AsyncInject<TContract>)));
bindInfo.ContractTypes.Add(typeof(AsyncInject));
bindInfo.ContractTypes.Add(typeof(IAsyncInject));
bindInfo.ContractTypes.Add(typeof(AsyncInject<TContract>));

#if EXTENJECT_INCLUDE_ADDRESSABLE_BINDINGS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Zenject
{
public interface AsyncInject
public interface IAsyncInject
{
bool HasResult { get; }
bool IsCancelled { get; }
Expand All @@ -19,7 +19,7 @@ public interface AsyncInject

[ZenjectAllowDuringValidation]
[NoReflectionBaking]
public class AsyncInject<T> : AsyncInject
public class AsyncInject<T> : IAsyncInject
{
protected readonly CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
protected readonly InjectContext _context;
Expand Down Expand Up @@ -133,6 +133,6 @@ public T Result

public TaskAwaiter<T> GetAwaiter() => task.GetAwaiter();

TaskAwaiter AsyncInject.GetAwaiter() => task.ContinueWith(task => { }).GetAwaiter();
TaskAwaiter IAsyncInject.GetAwaiter() => task.ContinueWith(task => { }).GetAwaiter();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public IEnumerator TestUntypedInject()
}).AsCached();
PostInstall();

var asycFoo = Container.Resolve<AsyncInject>();
var asycFoo = Container.Resolve<IAsyncInject>();
yield return null;

Assert.NotNull(asycFoo);
Expand Down Expand Up @@ -139,13 +139,13 @@ public class Foo : IFoo
public class PreloadAsyncKernel: BaseMonoKernelDecorator
{
[Inject]
public List<AsyncInject> asyncInjects;
public List<IAsyncInject> asyncInjects;

public bool IsPreloadCompleted { get; private set; }

public async override void Initialize()
{
foreach (AsyncInject inject in asyncInjects)
foreach (IAsyncInject inject in asyncInjects)
{
if (!inject.IsCompleted)
{
Expand Down

0 comments on commit 8b8b8bc

Please sign in to comment.