This commit is contained in:
Max Katz 2023-01-08 00:17:53 -05:00
Родитель 4ca0dbac6e
Коммит a78b0edd42
7 изменённых файлов: 53 добавлений и 24 удалений

Просмотреть файл

@ -81,14 +81,14 @@ A "contributor" is any person that distributes its contribution under this licen
https://github.com/wayland-project/wayland-protocols
Copyright © 2008-2013 Kristian Høgsberg
Copyright © 2010-2013 Intel Corporation
Copyright © 2013 Rafael Antognolli
Copyright © 2013 Jasper St. Pierre
Copyright © 2014 Jonas Ådahl
Copyright © 2014 Jason Ekstrand
Copyright © 2014-2015 Collabora, Ltd.
Copyright © 2015 Red Hat Inc.
Copyright © 2008-2013 Kristian Høgsberg
Copyright © 2010-2013 Intel Corporation
Copyright © 2013 Rafael Antognolli
Copyright © 2013 Jasper St. Pierre
Copyright © 2014 Jonas Ådahl
Copyright © 2014 Jason Ekstrand
Copyright © 2014-2015 Collabora, Ltd.
Copyright © 2015 Red Hat Inc.
Permission is hereby granted, free of charge, to any person obtaining a
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
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
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
//(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
//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(
Func<object?> rootGetter,
ExpressionNode node,
IObservable<object> update,
IObservable<ValueTuple> update,
string? description)
{
Description = description;
@ -171,7 +171,7 @@ namespace Avalonia.Data.Core
public static ExpressionObserver Create<T, U>(
Func<T> rootGetter,
Expression<Func<T, U>> expression,
IObservable<object> update,
IObservable<ValueTuple> update,
bool enableDataValidation = false,
string? description = null)
{

Просмотреть файл

@ -3,6 +3,8 @@ using System.Threading;
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
{
private IDisposable? _upstream;

Просмотреть файл

@ -252,9 +252,8 @@ namespace Avalonia.Data
}).Switch();
}
private class UpdateSignal : SingleSubscriberObservableBase<object>
private class UpdateSignal : SingleSubscriberObservableBase<ValueTuple>
{
private static readonly object s_val = new();
private readonly AvaloniaObject _target;
private readonly AvaloniaProperty _property;
@ -278,7 +277,7 @@ namespace Avalonia.Data
{
if (e.Property == _property)
{
PublishNext(s_val);
PublishNext(default);
}
}
}

Просмотреть файл

@ -63,7 +63,7 @@ namespace Avalonia.Markup.Parsers
public static ExpressionObserver Build(
Func<object> rootGetter,
string expression,
IObservable<object> update,
IObservable<ValueTuple> update,
bool enableDataValidation = false,
string? description = null,
Func<string, string, Type>? typeResolver = null)

Просмотреть файл

@ -41,7 +41,7 @@ namespace Avalonia.Base.UnitTests.Data.Core
[Fact]
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 completed = false;
@ -54,7 +54,7 @@ namespace Avalonia.Base.UnitTests.Data.Core
[Fact]
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 completed = false;
@ -87,7 +87,7 @@ namespace Avalonia.Base.UnitTests.Data.Core
public void Should_Unsubscribe_From_Update_Observable()
{
var scheduler = new TestScheduler();
var update = scheduler.CreateColdObservable<object>();
var update = scheduler.CreateColdObservable<ValueTuple>();
var data = new { Foo = "foo" };
var target = ExpressionObserver.Create(() => data, o => o.Foo, update);
var result = new List<object>();

Просмотреть файл

@ -359,14 +359,14 @@ namespace Avalonia.Base.UnitTests.Data.Core
public void Empty_Expression_Should_Track_Root()
{
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 result = new List<object>();
target.Subscribe(x => result.Add(x));
data.Foo = "bar";
update.OnNext(Unit.Default);
update.OnNext(default);
Assert.Equal(new[] { "foo", "bar" }, result);
@ -533,15 +533,15 @@ namespace Avalonia.Base.UnitTests.Data.Core
var first = new Class1 { Foo = "foo" };
var second = new Class1 { Foo = "bar" };
var root = first;
var update = new Subject<object>();
var update = new Subject<ValueTuple>();
var target = ExpressionObserver.Create(() => root, o => o.Foo, update);
var result = new List<object>();
var sub = target.Subscribe(x => result.Add(x));
root = second;
update.OnNext(Unit.Default);
update.OnNext(default);
root = null;
update.OnNext(Unit.Default);
update.OnNext(default);
Assert.Equal(
new object[]
@ -640,7 +640,7 @@ namespace Avalonia.Base.UnitTests.Data.Core
public void RootGetter_Is_Reevaluated_On_Subscribe()
{
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 sub = target.Subscribe(x => result.Add(x));