Skip to content

Commit

Permalink
Merge pull request #11 from reactiveui/master
Browse files Browse the repository at this point in the history
feature: Added Uno support (reactiveui#2067)
  • Loading branch information
arda-a authored Jul 5, 2019
2 parents cb28c9c + ebd58cb commit b61d262
Show file tree
Hide file tree
Showing 118 changed files with 1,882 additions and 425 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,17 +298,11 @@ ReactiveUI is part of the [.NET Foundation](https://www.dotnetfoundation.org/).
<table>
<tbody>
<tr>
<td align="center" valign="top">
<img width="100" height="100" src="https://github.com/ghuntley.png?s=150">
<br>
<a href="https://github.com/ghuntley">Geoffrey Huntley</a>
<p>Sydney, Australia</p>
</td>
<td align="center" valign="top">
<img width="100" height="100" src="https://github.com/glennawatson.png?s=150">
<br>
<a href="https://github.com/glennawatson">Glenn Watson</a>
<p>Washington, USA</p>
<p>Melbourne, Australia</p>
</td>
<td align="center" valign="top">
<img width="100" height="100" src="https://github.com/rlittlesii.png?s=150">
Expand Down Expand Up @@ -339,6 +333,12 @@ The following have been core team members in the past.
<table>
<tbody>
<tr>
<td align="center" valign="top">
<img width="100" height="100" src="https://github.com/ghuntley.png?s=150">
<br>
<a href="https://github.com/ghuntley">Geoffrey Huntley</a>
<p>Sydney, Australia</p>
</td>
<td align="center" valign="top">
<img width="100" height="100" src="https://github.com/kentcb.png?s=150">
<br>
Expand Down
1 change: 1 addition & 0 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var packageWhitelist = new List<FilePath>
MakeAbsolute(File("./src/ReactiveUI.Fody.Helpers/ReactiveUI.Fody.Helpers.csproj")),
MakeAbsolute(File("./src/ReactiveUI.AndroidSupport/ReactiveUI.AndroidSupport.csproj")),
MakeAbsolute(File("./src/ReactiveUI.XamForms/ReactiveUI.XamForms.csproj")),
MakeAbsolute(File("./src/ReactiveUI.Uno/ReactiveUI.Uno.csproj")),
};

if (IsRunningOnWindows())
Expand Down
8 changes: 4 additions & 4 deletions src/Directory.build.props
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,22 @@
</PropertyGroup>

<ItemGroup Condition="$(IsTestProject)">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.console" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="Xunit.StaFact" Version="0.3.18" />
<PackageReference Include="Shouldly" Version="4.0.0-beta0002" />
<PackageReference Include="Microsoft.Reactive.Testing" Version="4.1.5" />
<PackageReference Include="PublicApiGenerator" Version="9.0.0" />
<PackageReference Include="PublicApiGenerator" Version="9.1.0" />
</ItemGroup>

<ItemGroup Condition="$(IsTestProject)">
<Compile Include="$(MSBuildThisFileDirectory)ApiGeneratorGlobalSuppressions.cs" />
</ItemGroup>

<ItemGroup Condition="'$(IsTestProject)' != 'true' and '$(SourceLinkEnabled)' != 'false'">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-19270-01" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-19351-01" PrivateAssets="All" />
</ItemGroup>

<PropertyGroup>
Expand All @@ -74,7 +74,7 @@
<ItemGroup>
<PackageReference Include="stylecop.analyzers" Version="1.1.118" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.3" PrivateAssets="all" />
<PackageReference Include="Roslynator.Analyzers" Version="2.1.0-rc" PrivateAssets="All" />
<PackageReference Include="Roslynator.Analyzers" Version="2.1.0" PrivateAssets="All" />
<PackageReference Condition="'$(OS)' == 'Windows_NT'" Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.3" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
Expand Down
5 changes: 5 additions & 0 deletions src/ReactiveUI.AndroidSupport/ControlFetcherMixin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ public static class ControlFetcherMixin
/// <param name="resolveMembers">The resolve members.</param>
public static void WireUpControls(this Fragment fragment, View inflatedView, ResolveStrategy resolveMembers = ResolveStrategy.Implicit)
{
if (fragment == null)
{
throw new ArgumentNullException(nameof(fragment));
}

var members = fragment.GetWireUpMembers(resolveMembers);

foreach (var member in members)
Expand Down
18 changes: 16 additions & 2 deletions src/ReactiveUI.AndroidSupport/ReactivePagerAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,23 @@ public override Object InstantiateItem(ViewGroup container, int position)
}

/// <inheritdoc/>
public override void DestroyItem(ViewGroup container, int position, Object @object)
public override void DestroyItem(ViewGroup container, int position, Object item)
{
var view = (View)@object;
if (container == null)
{
throw new ArgumentNullException(nameof(container));
}

if (item == null)
{
throw new ArgumentNullException(nameof(item));
}

if (!(item is View view))
{
throw new ArgumentException("Item must be of type View", nameof(item));
}

container.RemoveView(view);
}

Expand Down
12 changes: 11 additions & 1 deletion src/ReactiveUI.AndroidSupport/ReactiveRecyclerViewAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,17 @@ public virtual int GetItemViewType(int position, TViewModel viewModel)
/// <inheritdoc/>
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
{
((IViewFor)holder).ViewModel = GetViewModelByPosition(position);
if (holder == null)
{
throw new ArgumentNullException(nameof(holder));
}

if (!(holder is IViewFor viewForHolder))
{
throw new ArgumentException("Holder must be derived from IViewFor", nameof(holder));
}

viewForHolder.ViewModel = GetViewModelByPosition(position);
}

/// <inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFrameworks>MonoAndroid81</TargetFrameworks>
<Description>ReactiveUI extensions for the Android Support Library</Description>
<PackageId>ReactiveUI.AndroidSupport</PackageId>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
25 changes: 17 additions & 8 deletions src/ReactiveUI.Blend/FollowObservableStateBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,26 @@ public FrameworkElement TargetObject
/// <param name="e">The <see cref="DependencyPropertyChangedEventArgs"/> instance containing the event data.</param>
protected static void OnStateObservableChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
var @this = (FollowObservableStateBehavior)sender;
if (@this._watcher != null)
if (e == null)
{
@this._watcher.Dispose();
@this._watcher = null;
throw new ArgumentNullException(nameof(e));
}

@this._watcher = ((IObservable<string>)e.NewValue).ObserveOn(RxApp.MainThreadScheduler).Subscribe(
if (!(sender is FollowObservableStateBehavior item))
{
throw new ArgumentException("Sender must be of type " + nameof(FollowObservableStateBehavior), nameof(sender));
}

if (item._watcher != null)
{
item._watcher.Dispose();
item._watcher = null;
}

item._watcher = ((IObservable<string>)e.NewValue).ObserveOn(RxApp.MainThreadScheduler).Subscribe(
x =>
{
var target = @this.TargetObject ?? @this.AssociatedObject;
var target = item.TargetObject ?? item.AssociatedObject;
#if NETFX_CORE
VisualStateManager.GoToState(target, x, true);
#else
Expand All @@ -115,12 +124,12 @@ protected static void OnStateObservableChanged(DependencyObject sender, Dependen
},
ex =>
{
if (!@this.AutoResubscribeOnError)
if (!item.AutoResubscribeOnError)
{
return;
}
OnStateObservableChanged(@this, e);
OnStateObservableChanged(item, e);
});
}

Expand Down
6 changes: 5 additions & 1 deletion src/ReactiveUI.Blend/Platforms/net461/ObservableTrigger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ public IObservable<object> Observable
/// <param name="e">The <see cref="DependencyPropertyChangedEventArgs"/> instance containing the event data.</param>
protected static void OnObservableChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
ObservableTrigger triggerItem = (ObservableTrigger)sender;
if (!(sender is ObservableTrigger triggerItem))
{
throw new ArgumentException("Sender must be of type " + nameof(ObservableTrigger), nameof(sender));
}

if (triggerItem._watcher != null)
{
triggerItem._watcher.Dispose();
Expand Down
1 change: 1 addition & 0 deletions src/ReactiveUI.Blend/ReactiveUI.Blend.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<RootNamespace>ReactiveUI.Blend</RootNamespace>
<Description>Blend behaviors for ReactiveUI</Description>
<PackageId>ReactiveUI.Blend</PackageId>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
16 changes: 13 additions & 3 deletions src/ReactiveUI.Fody.Helpers/ObservableAsPropertyExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static class ObservableAsPropertyExtensions
/// </summary>
/// <typeparam name="TObj">The type of the object.</typeparam>
/// <typeparam name="TRet">The type of the ret.</typeparam>
/// <param name="this">The this.</param>
/// <param name="item">The observable with the return value.</param>
/// <param name="source">The source.</param>
/// <param name="property">The property.</param>
/// <param name="initialValue">The initial value.</param>
Expand All @@ -32,10 +32,20 @@ public static class ObservableAsPropertyExtensions
/// or
/// Backing field not found for " + propertyInfo.
/// </exception>
public static ObservableAsPropertyHelper<TRet> ToPropertyEx<TObj, TRet>(this IObservable<TRet> @this, TObj source, Expression<Func<TObj, TRet>> property, TRet initialValue = default(TRet), bool deferSubscription = false, IScheduler scheduler = null)
public static ObservableAsPropertyHelper<TRet> ToPropertyEx<TObj, TRet>(this IObservable<TRet> item, TObj source, Expression<Func<TObj, TRet>> property, TRet initialValue = default, bool deferSubscription = false, IScheduler scheduler = null)
where TObj : ReactiveObject
{
var result = @this.ToProperty(source, property, initialValue, deferSubscription, scheduler);
if (item == null)
{
throw new ArgumentNullException(nameof(item));
}

if (property == null)
{
throw new ArgumentNullException(nameof(property));
}

var result = item.ToProperty(source, property, initialValue, deferSubscription, scheduler);

// Now assign the field via reflection.
var propertyInfo = property.GetPropertyInfo();
Expand Down
5 changes: 3 additions & 2 deletions src/ReactiveUI.Fody.Helpers/ReactiveUI.Fody.Helpers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@

<!-- Due to fody insisting on having .net 4 classes, we can't pack on non-windows -->
<IsPackable Condition=" '$(OS)' != 'Windows_NT' ">false</IsPackable>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Fody" Version="5.1.0" PrivateAssets="None" />
<PackageReference Include="FodyPackaging" Version="5.1.0" PrivateAssets="All" />
<PackageReference Include="Fody" Version="5.1.1" PrivateAssets="None" />
<PackageReference Include="FodyPackaging" Version="5.1.1" PrivateAssets="All" />
<PackageReference Include="System.Reactive" Version="4.1.5" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace ReactiveUI.Fody.Helpers
}
public class static ObservableAsPropertyExtensions
{
public static ReactiveUI.ObservableAsPropertyHelper<TRet> ToPropertyEx<TObj, TRet>(this System.IObservable<TRet> @this, TObj source, System.Linq.Expressions.Expression<System.Func<TObj, TRet>> property, TRet initialValue = null, bool deferSubscription = False, System.Reactive.Concurrency.IScheduler scheduler = null)
public static ReactiveUI.ObservableAsPropertyHelper<TRet> ToPropertyEx<TObj, TRet>(this System.IObservable<TRet> item, TObj source, System.Linq.Expressions.Expression<System.Func<TObj, TRet>> property, TRet initialValue = null, bool deferSubscription = False, System.Reactive.Concurrency.IScheduler scheduler = null)
where TObj : ReactiveUI.ReactiveObject { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Property | System.AttributeTargets.All)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace ReactiveUI.Fody.Helpers
}
public class static ObservableAsPropertyExtensions
{
public static ReactiveUI.ObservableAsPropertyHelper<TRet> ToPropertyEx<TObj, TRet>(this System.IObservable<TRet> @this, TObj source, System.Linq.Expressions.Expression<System.Func<TObj, TRet>> property, TRet initialValue = null, bool deferSubscription = False, System.Reactive.Concurrency.IScheduler scheduler = null)
public static ReactiveUI.ObservableAsPropertyHelper<TRet> ToPropertyEx<TObj, TRet>(this System.IObservable<TRet> item, TObj source, System.Linq.Expressions.Expression<System.Func<TObj, TRet>> property, TRet initialValue = null, bool deferSubscription = False, System.Reactive.Concurrency.IScheduler scheduler = null)
where TObj : ReactiveUI.ReactiveObject { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Property | System.AttributeTargets.All)]
Expand Down
1 change: 1 addition & 0 deletions src/ReactiveUI.Fody.Tests/ReactiveUI.Fody.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">$(TargetFrameworks);net461</TargetFrameworks>
<FodyTargetFramework>netstandard2.0</FodyTargetFramework>
<FodyTargetFramework Condition=" $(TargetFramework.StartsWith('net4')) ">$(TargetFramework)</FodyTargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit b61d262

Please sign in to comment.