Changes after review
This commit is contained in:
@@ -81,14 +81,14 @@ A "contributor" is any person that distributes its contribution under this licen
|
|||||||
|
|
||||||
https://github.com/wayland-project/wayland-protocols
|
https://github.com/wayland-project/wayland-protocols
|
||||||
|
|
||||||
Copyright © 2008-2013 Kristian Høgsberg
|
Copyright © 2008-2013 Kristian Høgsberg
|
||||||
Copyright © 2010-2013 Intel Corporation
|
Copyright © 2010-2013 Intel Corporation
|
||||||
Copyright © 2013 Rafael Antognolli
|
Copyright © 2013 Rafael Antognolli
|
||||||
Copyright © 2013 Jasper St. Pierre
|
Copyright © 2013 Jasper St. Pierre
|
||||||
Copyright © 2014 Jonas Ådahl
|
Copyright © 2014 Jonas Ådahl
|
||||||
Copyright © 2014 Jason Ekstrand
|
Copyright © 2014 Jason Ekstrand
|
||||||
Copyright © 2014-2015 Collabora, Ltd.
|
Copyright © 2014-2015 Collabora, Ltd.
|
||||||
Copyright © 2015 Red Hat Inc.
|
Copyright © 2015 Red Hat Inc.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -140,7 +140,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
https://github.com/toptensoftware/RichTextKit
|
https://github.com/toptensoftware/RichTextKit
|
||||||
|
|
||||||
Copyright © 2019 Topten Software. All Rights Reserved.
|
Copyright © 2019 Topten Software. All Rights Reserved.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License"); you may
|
Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
not use this product except in compliance with the License. You may obtain
|
not use this product except in compliance with the License. You may obtain
|
||||||
@@ -334,3 +334,31 @@ https://github.com/flutter/flutter
|
|||||||
//ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
//ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
//(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
//(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
# Reactive Extensions
|
||||||
|
|
||||||
|
https://github.com/dotnet/reactive
|
||||||
|
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) .NET Foundation and Contributors
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ namespace Avalonia.Data.Core
|
|||||||
public ExpressionObserver(
|
public ExpressionObserver(
|
||||||
Func<object?> rootGetter,
|
Func<object?> rootGetter,
|
||||||
ExpressionNode node,
|
ExpressionNode node,
|
||||||
IObservable<object> update,
|
IObservable<ValueTuple> update,
|
||||||
string? description)
|
string? description)
|
||||||
{
|
{
|
||||||
Description = description;
|
Description = description;
|
||||||
@@ -171,7 +171,7 @@ namespace Avalonia.Data.Core
|
|||||||
public static ExpressionObserver Create<T, U>(
|
public static ExpressionObserver Create<T, U>(
|
||||||
Func<T> rootGetter,
|
Func<T> rootGetter,
|
||||||
Expression<Func<T, U>> expression,
|
Expression<Func<T, U>> expression,
|
||||||
IObservable<object> update,
|
IObservable<ValueTuple> update,
|
||||||
bool enableDataValidation = false,
|
bool enableDataValidation = false,
|
||||||
string? description = null)
|
string? description = null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ using System.Threading;
|
|||||||
|
|
||||||
namespace Avalonia.Reactive.Operators;
|
namespace Avalonia.Reactive.Operators;
|
||||||
|
|
||||||
|
// Code based on https://github.com/dotnet/reactive/blob/main/Rx.NET/Source/src/System.Reactive/Internal/Sink.cs
|
||||||
|
|
||||||
internal abstract class Sink<TTarget> : IDisposable
|
internal abstract class Sink<TTarget> : IDisposable
|
||||||
{
|
{
|
||||||
private IDisposable? _upstream;
|
private IDisposable? _upstream;
|
||||||
|
|||||||
@@ -252,9 +252,8 @@ namespace Avalonia.Data
|
|||||||
}).Switch();
|
}).Switch();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class UpdateSignal : SingleSubscriberObservableBase<object>
|
private class UpdateSignal : SingleSubscriberObservableBase<ValueTuple>
|
||||||
{
|
{
|
||||||
private static readonly object s_val = new();
|
|
||||||
private readonly AvaloniaObject _target;
|
private readonly AvaloniaObject _target;
|
||||||
private readonly AvaloniaProperty _property;
|
private readonly AvaloniaProperty _property;
|
||||||
|
|
||||||
@@ -278,7 +277,7 @@ namespace Avalonia.Data
|
|||||||
{
|
{
|
||||||
if (e.Property == _property)
|
if (e.Property == _property)
|
||||||
{
|
{
|
||||||
PublishNext(s_val);
|
PublishNext(default);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ namespace Avalonia.Markup.Parsers
|
|||||||
public static ExpressionObserver Build(
|
public static ExpressionObserver Build(
|
||||||
Func<object> rootGetter,
|
Func<object> rootGetter,
|
||||||
string expression,
|
string expression,
|
||||||
IObservable<object> update,
|
IObservable<ValueTuple> update,
|
||||||
bool enableDataValidation = false,
|
bool enableDataValidation = false,
|
||||||
string? description = null,
|
string? description = null,
|
||||||
Func<string, string, Type>? typeResolver = null)
|
Func<string, string, Type>? typeResolver = null)
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace Avalonia.Base.UnitTests.Data.Core
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void Should_Complete_When_Update_Observable_Completes()
|
public void Should_Complete_When_Update_Observable_Completes()
|
||||||
{
|
{
|
||||||
var update = new Subject<object>();
|
var update = new Subject<ValueTuple>();
|
||||||
var target = ExpressionObserver.Create(() => 1, o => o, update);
|
var target = ExpressionObserver.Create(() => 1, o => o, update);
|
||||||
var completed = false;
|
var completed = false;
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ namespace Avalonia.Base.UnitTests.Data.Core
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void Should_Complete_When_Update_Observable_Errors()
|
public void Should_Complete_When_Update_Observable_Errors()
|
||||||
{
|
{
|
||||||
var update = new Subject<object>();
|
var update = new Subject<ValueTuple>();
|
||||||
var target = ExpressionObserver.Create(() => 1, o => o, update);
|
var target = ExpressionObserver.Create(() => 1, o => o, update);
|
||||||
var completed = false;
|
var completed = false;
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ namespace Avalonia.Base.UnitTests.Data.Core
|
|||||||
public void Should_Unsubscribe_From_Update_Observable()
|
public void Should_Unsubscribe_From_Update_Observable()
|
||||||
{
|
{
|
||||||
var scheduler = new TestScheduler();
|
var scheduler = new TestScheduler();
|
||||||
var update = scheduler.CreateColdObservable<object>();
|
var update = scheduler.CreateColdObservable<ValueTuple>();
|
||||||
var data = new { Foo = "foo" };
|
var data = new { Foo = "foo" };
|
||||||
var target = ExpressionObserver.Create(() => data, o => o.Foo, update);
|
var target = ExpressionObserver.Create(() => data, o => o.Foo, update);
|
||||||
var result = new List<object>();
|
var result = new List<object>();
|
||||||
|
|||||||
@@ -359,14 +359,14 @@ namespace Avalonia.Base.UnitTests.Data.Core
|
|||||||
public void Empty_Expression_Should_Track_Root()
|
public void Empty_Expression_Should_Track_Root()
|
||||||
{
|
{
|
||||||
var data = new Class1 { Foo = "foo" };
|
var data = new Class1 { Foo = "foo" };
|
||||||
var update = new Subject<object>();
|
var update = new Subject<ValueTuple>();
|
||||||
var target = ExpressionObserver.Create(() => data.Foo, o => o, update);
|
var target = ExpressionObserver.Create(() => data.Foo, o => o, update);
|
||||||
var result = new List<object>();
|
var result = new List<object>();
|
||||||
|
|
||||||
target.Subscribe(x => result.Add(x));
|
target.Subscribe(x => result.Add(x));
|
||||||
|
|
||||||
data.Foo = "bar";
|
data.Foo = "bar";
|
||||||
update.OnNext(Unit.Default);
|
update.OnNext(default);
|
||||||
|
|
||||||
Assert.Equal(new[] { "foo", "bar" }, result);
|
Assert.Equal(new[] { "foo", "bar" }, result);
|
||||||
|
|
||||||
@@ -533,15 +533,15 @@ namespace Avalonia.Base.UnitTests.Data.Core
|
|||||||
var first = new Class1 { Foo = "foo" };
|
var first = new Class1 { Foo = "foo" };
|
||||||
var second = new Class1 { Foo = "bar" };
|
var second = new Class1 { Foo = "bar" };
|
||||||
var root = first;
|
var root = first;
|
||||||
var update = new Subject<object>();
|
var update = new Subject<ValueTuple>();
|
||||||
var target = ExpressionObserver.Create(() => root, o => o.Foo, update);
|
var target = ExpressionObserver.Create(() => root, o => o.Foo, update);
|
||||||
var result = new List<object>();
|
var result = new List<object>();
|
||||||
var sub = target.Subscribe(x => result.Add(x));
|
var sub = target.Subscribe(x => result.Add(x));
|
||||||
|
|
||||||
root = second;
|
root = second;
|
||||||
update.OnNext(Unit.Default);
|
update.OnNext(default);
|
||||||
root = null;
|
root = null;
|
||||||
update.OnNext(Unit.Default);
|
update.OnNext(default);
|
||||||
|
|
||||||
Assert.Equal(
|
Assert.Equal(
|
||||||
new object[]
|
new object[]
|
||||||
@@ -640,7 +640,7 @@ namespace Avalonia.Base.UnitTests.Data.Core
|
|||||||
public void RootGetter_Is_Reevaluated_On_Subscribe()
|
public void RootGetter_Is_Reevaluated_On_Subscribe()
|
||||||
{
|
{
|
||||||
var data = "foo";
|
var data = "foo";
|
||||||
var target = new ExpressionObserver(() => data, new EmptyExpressionNode(), new Subject<object>(), null);
|
var target = new ExpressionObserver(() => data, new EmptyExpressionNode(), new Subject<ValueTuple>(), null);
|
||||||
var result = new List<object>();
|
var result = new List<object>();
|
||||||
var sub = target.Subscribe(x => result.Add(x));
|
var sub = target.Subscribe(x => result.Add(x));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user