Skip to content
Permalink
Browse files

refactor: Remove the weak event managers (#2276)

  • Loading branch information
glennawatson committed Dec 10, 2019
1 parent f0aefc1 commit 125387dac07bd7269d3fa50b1db9e90b7637ed98
Showing with 153 additions and 1,824 deletions.
  1. +3 −3 src/ReactiveUI.Android.Tests/Properties/AndroidManifest.xml
  2. +0 −1 src/ReactiveUI.Android.Tests/ReactiveUI.Android.Tests.csproj
  3. +4 −12 src/ReactiveUI.AndroidSupport/ReactiveAppCompatActivity.cs
  4. +4 −12 src/ReactiveUI.AndroidSupport/ReactiveDialogFragment.cs
  5. +4 −12 src/ReactiveUI.AndroidSupport/ReactiveFragment.cs
  6. +4 −12 src/ReactiveUI.AndroidSupport/ReactiveFragmentActivity.cs
  7. +4 −12 src/ReactiveUI.AndroidSupport/ReactiveRecyclerViewViewHolder.cs
  8. +4 −12 src/ReactiveUI.AndroidX/ReactiveAppCompatActivity.cs
  9. +4 −12 src/ReactiveUI.AndroidX/ReactiveDialogFragment.cs
  10. +4 −12 src/ReactiveUI.AndroidX/ReactiveFragment.cs
  11. +4 −12 src/ReactiveUI.AndroidX/ReactiveFragmentActivity.cs
  12. +4 −12 src/ReactiveUI.AndroidX/ReactiveRecyclerViewViewHolder.cs
  13. +2 −2 src/ReactiveUI.Fody.Analyzer.Test/Helpers/DiagnosticResultLocation.cs
  14. +5 −0 src/ReactiveUI.Fody.Analyzer.Test/Helpers/DiagnosticVerifier.Helper.cs
  15. +4 −3 src/ReactiveUI.Fody.Analyzer.Test/Verifiers/DiagnosticVerifier.cs
  16. +0 −856 src/ReactiveUI.Tests/API/ApiApprovalTests.ReactiveUI.approved.txt
  17. +0 −11 src/ReactiveUI.Tests/API/ApiApprovalTests.ReactiveUI.net461.approved.txt
  18. +4 −0 src/ReactiveUI.Tests/API/ApiApprovalTests.ReactiveUI.netcoreapp2.0.approved.txt
  19. +0 −11 src/ReactiveUI.Tests/API/ApiApprovalTests.ReactiveUI.netcoreapp3.0.approved.txt
  20. +0 −43 src/ReactiveUI.Tests/API/ApiApprovalTests.Testing.netcoreapp2.0.approved.txt
  21. 0 src/ReactiveUI.Tests/InteractionsTest.cs
  22. 0 src/ReactiveUI.Tests/Platforms/winforms/CommandBindingTests.cs
  23. +0 −20 src/ReactiveUI.Winforms/EventShims/PropertyChangedEventManager.cs
  24. +0 −20 src/ReactiveUI.Winforms/EventShims/PropertyChangingEventManager.cs
  25. +4 −12 src/ReactiveUI.Winforms/RoutedViewHost.cs
  26. +4 −12 src/ReactiveUI.Winforms/ViewModelViewHost.cs
  27. +0 −16 src/ReactiveUI/EventManagers/CanExecuteChangedEventManager.cs
  28. +0 −15 src/ReactiveUI/EventManagers/PropertyChangedEventManager.cs
  29. +0 −15 src/ReactiveUI/EventManagers/PropertyChangingEventManager.cs
  30. +0 −385 src/ReactiveUI/EventManagers/WeakEventManager.cs
  31. +1 −1 src/ReactiveUI/Expression/Reflection.cs
  32. 0 src/ReactiveUI/Interfaces/IHasScheduler.cs
  33. +4 −12 src/ReactiveUI/Platforms/android/ReactiveActivity.cs
  34. +4 −12 src/ReactiveUI/Platforms/android/ReactiveFragment.cs
  35. +4 −12 src/ReactiveUI/Platforms/android/ReactivePreferenceActivity.cs
  36. +4 −12 src/ReactiveUI/Platforms/android/ReactivePreferenceFragment.cs
  37. +4 −12 src/ReactiveUI/Platforms/android/ReactiveViewHost.cs
  38. +4 −12 src/ReactiveUI/Platforms/apple-common/ReactiveControl.cs
  39. +4 −12 src/ReactiveUI/Platforms/apple-common/ReactiveImageView.cs
  40. +4 −12 src/ReactiveUI/Platforms/apple-common/ReactiveSplitViewController.cs
  41. +4 −12 src/ReactiveUI/Platforms/apple-common/ReactiveView.cs
  42. +4 −12 src/ReactiveUI/Platforms/apple-common/ReactiveViewController.cs
  43. +2 −2 src/ReactiveUI/Platforms/uap/SingleWindowDispatcherScheduler.cs
  44. +4 −12 src/ReactiveUI/Platforms/uikit-common/ReactiveCollectionView.cs
  45. +4 −12 src/ReactiveUI/Platforms/uikit-common/ReactiveCollectionViewCell.cs
  46. +4 −12 src/ReactiveUI/Platforms/uikit-common/ReactiveCollectionViewController.cs
  47. +4 −12 src/ReactiveUI/Platforms/uikit-common/ReactiveCollectionViewSource.cs
  48. +4 −12 src/ReactiveUI/Platforms/uikit-common/ReactiveNavigationController.cs
  49. +4 −12 src/ReactiveUI/Platforms/uikit-common/ReactivePageViewController.cs
  50. +4 −12 src/ReactiveUI/Platforms/uikit-common/ReactiveTabBarController.cs
  51. +4 −12 src/ReactiveUI/Platforms/uikit-common/ReactiveTableView.cs
  52. +4 −12 src/ReactiveUI/Platforms/uikit-common/ReactiveTableViewCell.cs
  53. +4 −12 src/ReactiveUI/Platforms/uikit-common/ReactiveTableViewController.cs
  54. +4 −12 src/ReactiveUI/Platforms/uikit-common/ReactiveTableViewSource.cs
  55. 0 src/ReactiveUI/Platforms/windows-common/ReactiveUserControl.cs
  56. +0 −24 src/ReactiveUI/ReactiveObject/ReactiveObject.cs
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="ReactiveUI.Android.Tests" android:versionCode="1" android:versionName="1.0" android:installLocation="preferExternal">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28" />
<application android:label="Splat.Android.Tests" android:icon="@drawable/Icon"></application>
</manifest>
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28" />
<application android:label="Splat.Android.Tests" android:icon="@drawable/Icon"></application>
</manifest>
@@ -17,7 +17,6 @@
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<AndroidResgenClass>Resource</AndroidResgenClass>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v9.0</TargetFrameworkVersion>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
@@ -80,18 +80,10 @@ protected ReactiveAppCompatActivity(IntPtr handle, JniHandleOwnership ownership)
}

/// <inheritdoc/>
public event PropertyChangingEventHandler PropertyChanging
{
add => PropertyChangingEventManager.AddHandler(this, value);
remove => PropertyChangingEventManager.RemoveHandler(this, value);
}
public event PropertyChangingEventHandler PropertyChanging;

/// <inheritdoc/>
public event PropertyChangedEventHandler PropertyChanged
{
add => PropertyChangedEventManager.AddHandler(this, value);
remove => PropertyChangedEventManager.RemoveHandler(this, value);
}
public event PropertyChangedEventHandler PropertyChanged;

/// <inheritdoc/>
public IObservable<IReactivePropertyChangedEventArgs<ReactiveAppCompatActivity>> Changing => this.GetChangingObservable();
@@ -129,13 +121,13 @@ protected ReactiveAppCompatActivity(IntPtr handle, JniHandleOwnership ownership)
/// <inheritdoc/>
void IReactiveObject.RaisePropertyChanging(PropertyChangingEventArgs args)
{
PropertyChangingEventManager.DeliverEvent(this, args);
PropertyChanging?.Invoke(this, args);
}

/// <inheritdoc/>
void IReactiveObject.RaisePropertyChanged(PropertyChangedEventArgs args)
{
PropertyChangedEventManager.DeliverEvent(this, args);
PropertyChanged?.Invoke(this, args);
}

/// <inheritdoc/>
@@ -63,18 +63,10 @@ protected ReactiveDialogFragment()
}

/// <inheritdoc/>
public event PropertyChangingEventHandler PropertyChanging
{
add => PropertyChangingEventManager.AddHandler(this, value);
remove => PropertyChangingEventManager.RemoveHandler(this, value);
}
public event PropertyChangingEventHandler PropertyChanging;

/// <inheritdoc/>
public event PropertyChangedEventHandler PropertyChanged
{
add => PropertyChangedEventManager.AddHandler(this, value);
remove => PropertyChangedEventManager.RemoveHandler(this, value);
}
public event PropertyChangedEventHandler PropertyChanged;

/// <inheritdoc/>
public IObservable<Exception> ThrownExceptions => this.GetThrownExceptionsObservable();
@@ -98,13 +90,13 @@ protected ReactiveDialogFragment()
/// <inheritdoc/>
void IReactiveObject.RaisePropertyChanging(PropertyChangingEventArgs args)
{
PropertyChangingEventManager.DeliverEvent(this, args);
PropertyChanging?.Invoke(this, args);
}

/// <inheritdoc/>
void IReactiveObject.RaisePropertyChanged(PropertyChangedEventArgs args)
{
PropertyChangedEventManager.DeliverEvent(this, args);
PropertyChanged?.Invoke(this, args);
}

/// <inheritdoc />
@@ -81,18 +81,10 @@ protected ReactiveFragment()
}

/// <inheritdoc/>
public event PropertyChangingEventHandler PropertyChanging
{
add => PropertyChangingEventManager.AddHandler(this, value);
remove => PropertyChangingEventManager.RemoveHandler(this, value);
}
public event PropertyChangingEventHandler PropertyChanging;

/// <inheritdoc/>
public event PropertyChangedEventHandler PropertyChanged
{
add => PropertyChangedEventManager.AddHandler(this, value);
remove => PropertyChangedEventManager.RemoveHandler(this, value);
}
public event PropertyChangedEventHandler PropertyChanged;

/// <inheritdoc/>
public IObservable<Exception> ThrownExceptions => this.GetThrownExceptionsObservable();
@@ -116,13 +108,13 @@ protected ReactiveFragment()
/// <inheritdoc/>
void IReactiveObject.RaisePropertyChanging(PropertyChangingEventArgs args)
{
PropertyChangingEventManager.DeliverEvent(this, args);
PropertyChanging?.Invoke(this, args);
}

/// <inheritdoc/>
void IReactiveObject.RaisePropertyChanged(PropertyChangedEventArgs args)
{
PropertyChangedEventManager.DeliverEvent(this, args);
PropertyChanged?.Invoke(this, args);
}

/// <inheritdoc />
@@ -77,18 +77,10 @@ public class ReactiveFragmentActivity : FragmentActivity, IReactiveObject, IReac
private readonly Subject<(int requestCode, Result result, Intent intent)> _activityResult = new Subject<(int requestCode, Result result, Intent intent)>();

/// <inheritdoc/>
public event PropertyChangingEventHandler PropertyChanging
{
add => PropertyChangingEventManager.AddHandler(this, value);
remove => PropertyChangingEventManager.RemoveHandler(this, value);
}
public event PropertyChangingEventHandler PropertyChanging;

/// <inheritdoc/>
public event PropertyChangedEventHandler PropertyChanged
{
add => PropertyChangedEventManager.AddHandler(this, value);
remove => PropertyChangedEventManager.RemoveHandler(this, value);
}
public event PropertyChangedEventHandler PropertyChanged;

/// <inheritdoc />
public IObservable<IReactivePropertyChangedEventArgs<ReactiveFragmentActivity>> Changing => this.GetChangingObservable();
@@ -117,13 +109,13 @@ public class ReactiveFragmentActivity : FragmentActivity, IReactiveObject, IReac
/// <inheritdoc/>
void IReactiveObject.RaisePropertyChanging(PropertyChangingEventArgs args)
{
PropertyChangingEventManager.DeliverEvent(this, args);
PropertyChanging?.Invoke(this, args);
}

/// <inheritdoc/>
void IReactiveObject.RaisePropertyChanged(PropertyChangedEventArgs args)
{
PropertyChangedEventManager.DeliverEvent(this, args);
PropertyChanged?.Invoke(this, args);
}

/// <inheritdoc />
@@ -80,18 +80,10 @@ protected ReactiveRecyclerViewViewHolder(View view)
}

/// <inheritdoc/>
public event PropertyChangingEventHandler PropertyChanging
{
add => PropertyChangingEventManager.AddHandler(this, value);
remove => PropertyChangingEventManager.RemoveHandler(this, value);
}
public event PropertyChangingEventHandler PropertyChanging;

/// <inheritdoc/>
public event PropertyChangedEventHandler PropertyChanged
{
add => PropertyChangedEventManager.AddHandler(this, value);
remove => PropertyChangedEventManager.RemoveHandler(this, value);
}
public event PropertyChangedEventHandler PropertyChanged;

/// <summary>
/// Gets an observable that signals that this ViewHolder has been selected.
@@ -174,13 +166,13 @@ public bool AreChangeNotificationsEnabled()
/// <inheritdoc/>
void IReactiveObject.RaisePropertyChanging(PropertyChangingEventArgs args)
{
PropertyChangingEventManager.DeliverEvent(this, args);
PropertyChanging?.Invoke(this, args);
}

/// <inheritdoc/>
void IReactiveObject.RaisePropertyChanged(PropertyChangedEventArgs args)
{
PropertyChangedEventManager.DeliverEvent(this, args);
PropertyChanged?.Invoke(this, args);
}

[OnDeserialized]
@@ -80,18 +80,10 @@ protected ReactiveAppCompatActivity(IntPtr handle, JniHandleOwnership ownership)
}

/// <inheritdoc/>
public event PropertyChangingEventHandler PropertyChanging
{
add => PropertyChangingEventManager.AddHandler(this, value);
remove => PropertyChangingEventManager.RemoveHandler(this, value);
}
public event PropertyChangingEventHandler PropertyChanging;

/// <inheritdoc/>
public event PropertyChangedEventHandler PropertyChanged
{
add => PropertyChangedEventManager.AddHandler(this, value);
remove => PropertyChangedEventManager.RemoveHandler(this, value);
}
public event PropertyChangedEventHandler PropertyChanged;

/// <inheritdoc/>
public IObservable<IReactivePropertyChangedEventArgs<ReactiveAppCompatActivity>> Changing => this.GetChangingObservable();
@@ -129,13 +121,13 @@ protected ReactiveAppCompatActivity(IntPtr handle, JniHandleOwnership ownership)
/// <inheritdoc/>
void IReactiveObject.RaisePropertyChanging(PropertyChangingEventArgs args)
{
PropertyChangingEventManager.DeliverEvent(this, args);
PropertyChanging?.Invoke(this, args);
}

/// <inheritdoc/>
void IReactiveObject.RaisePropertyChanged(PropertyChangedEventArgs args)
{
PropertyChangedEventManager.DeliverEvent(this, args);
PropertyChanged?.Invoke(this, args);
}

/// <inheritdoc/>
@@ -63,18 +63,10 @@ protected ReactiveDialogFragment()
}

/// <inheritdoc/>
public event PropertyChangingEventHandler PropertyChanging
{
add => PropertyChangingEventManager.AddHandler(this, value);
remove => PropertyChangingEventManager.RemoveHandler(this, value);
}
public event PropertyChangingEventHandler PropertyChanging;

/// <inheritdoc/>
public event PropertyChangedEventHandler PropertyChanged
{
add => PropertyChangedEventManager.AddHandler(this, value);
remove => PropertyChangedEventManager.RemoveHandler(this, value);
}
public event PropertyChangedEventHandler PropertyChanged;

/// <inheritdoc/>
public IObservable<Exception> ThrownExceptions => this.GetThrownExceptionsObservable();
@@ -98,13 +90,13 @@ protected ReactiveDialogFragment()
/// <inheritdoc/>
void IReactiveObject.RaisePropertyChanging(PropertyChangingEventArgs args)
{
PropertyChangingEventManager.DeliverEvent(this, args);
PropertyChanging?.Invoke(this, args);
}

/// <inheritdoc/>
void IReactiveObject.RaisePropertyChanged(PropertyChangedEventArgs args)
{
PropertyChangedEventManager.DeliverEvent(this, args);
PropertyChanged?.Invoke(this, args);
}

/// <inheritdoc />
@@ -63,18 +63,10 @@ protected ReactiveFragment()
}

/// <inheritdoc/>
public event PropertyChangingEventHandler PropertyChanging
{
add => PropertyChangingEventManager.AddHandler(this, value);
remove => PropertyChangingEventManager.RemoveHandler(this, value);
}
public event PropertyChangingEventHandler PropertyChanging;

/// <inheritdoc/>
public event PropertyChangedEventHandler PropertyChanged
{
add => PropertyChangedEventManager.AddHandler(this, value);
remove => PropertyChangedEventManager.RemoveHandler(this, value);
}
public event PropertyChangedEventHandler PropertyChanged;

/// <inheritdoc/>
public IObservable<Exception> ThrownExceptions => this.GetThrownExceptionsObservable();
@@ -98,13 +90,13 @@ protected ReactiveFragment()
/// <inheritdoc/>
void IReactiveObject.RaisePropertyChanging(PropertyChangingEventArgs args)
{
PropertyChangingEventManager.DeliverEvent(this, args);
PropertyChanging?.Invoke(this, args);
}

/// <inheritdoc/>
void IReactiveObject.RaisePropertyChanged(PropertyChangedEventArgs args)
{
PropertyChangedEventManager.DeliverEvent(this, args);
PropertyChanged?.Invoke(this, args);
}

/// <inheritdoc />
@@ -62,18 +62,10 @@ public class ReactiveFragmentActivity : FragmentActivity, IReactiveObject, IReac
private readonly Subject<(int requestCode, Result result, Intent intent)> _activityResult = new Subject<(int requestCode, Result result, Intent intent)>();

/// <inheritdoc/>
public event PropertyChangingEventHandler PropertyChanging
{
add => PropertyChangingEventManager.AddHandler(this, value);
remove => PropertyChangingEventManager.RemoveHandler(this, value);
}
public event PropertyChangingEventHandler PropertyChanging;

/// <inheritdoc/>
public event PropertyChangedEventHandler PropertyChanged
{
add => PropertyChangedEventManager.AddHandler(this, value);
remove => PropertyChangedEventManager.RemoveHandler(this, value);
}
public event PropertyChangedEventHandler PropertyChanged;

/// <inheritdoc />
public IObservable<IReactivePropertyChangedEventArgs<ReactiveFragmentActivity>> Changing => this.GetChangingObservable();
@@ -102,13 +94,13 @@ public class ReactiveFragmentActivity : FragmentActivity, IReactiveObject, IReac
/// <inheritdoc/>
void IReactiveObject.RaisePropertyChanging(PropertyChangingEventArgs args)
{
PropertyChangingEventManager.DeliverEvent(this, args);
PropertyChanging?.Invoke(this, args);
}

/// <inheritdoc/>
void IReactiveObject.RaisePropertyChanged(PropertyChangedEventArgs args)
{
PropertyChangedEventManager.DeliverEvent(this, args);
PropertyChanged?.Invoke(this, args);
}

/// <inheritdoc />
@@ -80,18 +80,10 @@ protected ReactiveRecyclerViewViewHolder(View view)
}

/// <inheritdoc/>
public event PropertyChangingEventHandler PropertyChanging
{
add => PropertyChangingEventManager.AddHandler(this, value);
remove => PropertyChangingEventManager.RemoveHandler(this, value);
}
public event PropertyChangingEventHandler PropertyChanging;

/// <inheritdoc/>
public event PropertyChangedEventHandler PropertyChanged
{
add => PropertyChangedEventManager.AddHandler(this, value);
remove => PropertyChangedEventManager.RemoveHandler(this, value);
}
public event PropertyChangedEventHandler PropertyChanged;

/// <summary>
/// Gets an observable that signals that this ViewHolder has been selected.
@@ -174,13 +166,13 @@ public bool AreChangeNotificationsEnabled()
/// <inheritdoc/>
void IReactiveObject.RaisePropertyChanging(PropertyChangingEventArgs args)
{
PropertyChangingEventManager.DeliverEvent(this, args);
PropertyChanging?.Invoke(this, args);
}

/// <inheritdoc/>
void IReactiveObject.RaisePropertyChanged(PropertyChangedEventArgs args)
{
PropertyChangedEventManager.DeliverEvent(this, args);
PropertyChanged?.Invoke(this, args);
}

[OnDeserialized]

0 comments on commit 125387d

Please sign in to comment.
You can’t perform that action at this time.