From 361f73c94a037ee784b4f9b638dfdb1077eba17f Mon Sep 17 00:00:00 2001 From: Shimmy Weitzhandler <2716316+weitzhandler@users.noreply.github.com> Date: Tue, 9 Jul 2019 08:25:48 +0300 Subject: [PATCH 1/6] Added constructors required by Uno.UI for Android and iOS. --- .../Platforms/windows-common/ReactivePage.cs | 36 +++++++++++++++++++ .../windows-common/ReactiveUserControl.cs | 35 ++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/src/ReactiveUI/Platforms/windows-common/ReactivePage.cs b/src/ReactiveUI/Platforms/windows-common/ReactivePage.cs index ccc840c3fa..3188312fb6 100644 --- a/src/ReactiveUI/Platforms/windows-common/ReactivePage.cs +++ b/src/ReactiveUI/Platforms/windows-common/ReactivePage.cs @@ -3,6 +3,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System; using System.Diagnostics.CodeAnalysis; #if NETFX_CORE || HAS_UNO using Windows.UI.Xaml; @@ -81,6 +82,9 @@ namespace ReactiveUI /// /// The type of the view model backing the view. /// +#if __IOS__ + [global::Foundation.Register] +#endif [SuppressMessage("Design", "CA1010:Collections should implement generic interface", Justification = "Deliberate usage")] public abstract #if HAS_UNO @@ -100,6 +104,38 @@ class ReactivePage : typeof(ReactivePage), new PropertyMetadata(null)); +#if __ANDROID__ + /// + /// Initializes a new instance of the class. + /// Native constructor, do not use explicitly. + /// + /// + /// Used by the Xamarin Runtime to materialize native + /// objects that may have been collected in the managed world. + /// + /// javaReference. + /// transfer. + protected ReactivePage(IntPtr javaReference, global::Android.Runtime.JniHandleOwnership transfer) + : base(javaReference, transfer) + { + } +#endif +#if __IOS__ + /// + /// Initializes a new instance of the class. + /// Native constructor, do not use explicitly. + /// + /// handle. + /// + /// Used by the Xamarin Runtime to materialize native. + /// objects that may have been collected in the managed world. + /// + protected ReactivePage(IntPtr handle) + : base(handle) + { + } +#endif + /// /// Gets the binding root view model. /// diff --git a/src/ReactiveUI/Platforms/windows-common/ReactiveUserControl.cs b/src/ReactiveUI/Platforms/windows-common/ReactiveUserControl.cs index 24bfdb12a6..f6b0f81b0c 100755 --- a/src/ReactiveUI/Platforms/windows-common/ReactiveUserControl.cs +++ b/src/ReactiveUI/Platforms/windows-common/ReactiveUserControl.cs @@ -81,6 +81,9 @@ namespace ReactiveUI /// /// The type of the view model backing the view. /// +#if __IOS__ + [global::Foundation.Register] +#endif [SuppressMessage("Design", "CA1010:Collections should implement generic interface", Justification = "Deliberate usage")] public abstract #if HAS_UNO @@ -100,6 +103,38 @@ class ReactiveUserControl : typeof(ReactiveUserControl), new PropertyMetadata(null)); +#if __ANDROID__ + /// + /// Initializes a new instance of the class. + /// Native constructor, do not use explicitly. + /// + /// + /// Used by the Xamarin Runtime to materialize native + /// objects that may have been collected in the managed world. + /// + /// javaReference. + /// transfer. + protected ReactiveUserControl(IntPtr javaReference, global::Android.Runtime.JniHandleOwnership transfer) + : base(javaReference, transfer) + { + } +#endif +#if __IOS__ + /// + /// Initializes a new instance of the class. + /// Native constructor, do not use explicitly. + /// + /// handle. + /// + /// Used by the Xamarin Runtime to materialize native. + /// objects that may have been collected in the managed world. + /// + protected ReactiveUserControl(IntPtr handle) + : base(handle) + { + } +#endif + /// /// Gets the binding root view model. /// From d63c522b0f9a724d69ae7fe01e7558c922694142 Mon Sep 17 00:00:00 2001 From: Shimmy Weitzhandler <2716316+weitzhandler@users.noreply.github.com> Date: Tue, 9 Jul 2019 08:30:55 +0300 Subject: [PATCH 2/6] Added missing namespace --- src/ReactiveUI/Platforms/windows-common/ReactiveUserControl.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ReactiveUI/Platforms/windows-common/ReactiveUserControl.cs b/src/ReactiveUI/Platforms/windows-common/ReactiveUserControl.cs index f6b0f81b0c..a6075b38a6 100755 --- a/src/ReactiveUI/Platforms/windows-common/ReactiveUserControl.cs +++ b/src/ReactiveUI/Platforms/windows-common/ReactiveUserControl.cs @@ -3,6 +3,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System; using System.Diagnostics.CodeAnalysis; #if NETFX_CORE || HAS_UNO using Windows.UI.Xaml; From 745a367f2669d9fc8b5c37b3b490068b076fd4e1 Mon Sep 17 00:00:00 2001 From: Shimmy Weitzhandler <2716316+weitzhandler@users.noreply.github.com> Date: Tue, 9 Jul 2019 08:44:12 +0300 Subject: [PATCH 3/6] Correction of preprocessor directives --- src/ReactiveUI/Platforms/windows-common/ReactivePage.cs | 8 +++++--- .../Platforms/windows-common/ReactiveUserControl.cs | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/ReactiveUI/Platforms/windows-common/ReactivePage.cs b/src/ReactiveUI/Platforms/windows-common/ReactivePage.cs index 3188312fb6..60097c257c 100644 --- a/src/ReactiveUI/Platforms/windows-common/ReactivePage.cs +++ b/src/ReactiveUI/Platforms/windows-common/ReactivePage.cs @@ -82,7 +82,7 @@ namespace ReactiveUI /// /// The type of the view model backing the view. /// -#if __IOS__ +#if HAS_UNO && IOS [global::Foundation.Register] #endif [SuppressMessage("Design", "CA1010:Collections should implement generic interface", Justification = "Deliberate usage")] @@ -104,7 +104,8 @@ class ReactivePage : typeof(ReactivePage), new PropertyMetadata(null)); -#if __ANDROID__ +#if HAS_UNO +#if ANDROID /// /// Initializes a new instance of the class. /// Native constructor, do not use explicitly. @@ -120,7 +121,7 @@ protected ReactivePage(IntPtr javaReference, global::Android.Runtime.JniHandleOw { } #endif -#if __IOS__ +#if IOS /// /// Initializes a new instance of the class. /// Native constructor, do not use explicitly. @@ -134,6 +135,7 @@ protected ReactivePage(IntPtr handle) : base(handle) { } +#endif #endif /// diff --git a/src/ReactiveUI/Platforms/windows-common/ReactiveUserControl.cs b/src/ReactiveUI/Platforms/windows-common/ReactiveUserControl.cs index a6075b38a6..2083028819 100755 --- a/src/ReactiveUI/Platforms/windows-common/ReactiveUserControl.cs +++ b/src/ReactiveUI/Platforms/windows-common/ReactiveUserControl.cs @@ -82,7 +82,7 @@ namespace ReactiveUI /// /// The type of the view model backing the view. /// -#if __IOS__ +#if HAS_UNO && IOS [global::Foundation.Register] #endif [SuppressMessage("Design", "CA1010:Collections should implement generic interface", Justification = "Deliberate usage")] @@ -104,7 +104,8 @@ class ReactiveUserControl : typeof(ReactiveUserControl), new PropertyMetadata(null)); -#if __ANDROID__ +#if HAS_UNO +#if ANDROID /// /// Initializes a new instance of the class. /// Native constructor, do not use explicitly. @@ -120,7 +121,7 @@ protected ReactiveUserControl(IntPtr javaReference, global::Android.Runtime.JniH { } #endif -#if __IOS__ +#if IOS /// /// Initializes a new instance of the class. /// Native constructor, do not use explicitly. @@ -134,6 +135,7 @@ protected ReactiveUserControl(IntPtr handle) : base(handle) { } +#endif #endif /// From c31f7537b200751eb3f2da19f42ad05405ec6bbd Mon Sep 17 00:00:00 2001 From: Shimmy Weitzhandler <2716316+weitzhandler@users.noreply.github.com> Date: Tue, 9 Jul 2019 09:11:51 +0300 Subject: [PATCH 4/6] Not sure about UserControl changes. --- .../windows-common/ReactiveUserControl.cs | 37 ------------------- 1 file changed, 37 deletions(-) diff --git a/src/ReactiveUI/Platforms/windows-common/ReactiveUserControl.cs b/src/ReactiveUI/Platforms/windows-common/ReactiveUserControl.cs index 2083028819..896279a109 100755 --- a/src/ReactiveUI/Platforms/windows-common/ReactiveUserControl.cs +++ b/src/ReactiveUI/Platforms/windows-common/ReactiveUserControl.cs @@ -82,9 +82,6 @@ namespace ReactiveUI /// /// The type of the view model backing the view. /// -#if HAS_UNO && IOS - [global::Foundation.Register] -#endif [SuppressMessage("Design", "CA1010:Collections should implement generic interface", Justification = "Deliberate usage")] public abstract #if HAS_UNO @@ -104,40 +101,6 @@ class ReactiveUserControl : typeof(ReactiveUserControl), new PropertyMetadata(null)); -#if HAS_UNO -#if ANDROID - /// - /// Initializes a new instance of the class. - /// Native constructor, do not use explicitly. - /// - /// - /// Used by the Xamarin Runtime to materialize native - /// objects that may have been collected in the managed world. - /// - /// javaReference. - /// transfer. - protected ReactiveUserControl(IntPtr javaReference, global::Android.Runtime.JniHandleOwnership transfer) - : base(javaReference, transfer) - { - } -#endif -#if IOS - /// - /// Initializes a new instance of the class. - /// Native constructor, do not use explicitly. - /// - /// handle. - /// - /// Used by the Xamarin Runtime to materialize native. - /// objects that may have been collected in the managed world. - /// - protected ReactiveUserControl(IntPtr handle) - : base(handle) - { - } -#endif -#endif - /// /// Gets the binding root view model. /// From 6731788faebb542ef61dd9bb66cac717be1f7767 Mon Sep 17 00:00:00 2001 From: Shimmy Weitzhandler <2716316+weitzhandler@users.noreply.github.com> Date: Tue, 9 Jul 2019 09:14:38 +0300 Subject: [PATCH 5/6] Remove redundant namespace --- src/ReactiveUI/Platforms/windows-common/ReactiveUserControl.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ReactiveUI/Platforms/windows-common/ReactiveUserControl.cs b/src/ReactiveUI/Platforms/windows-common/ReactiveUserControl.cs index 896279a109..24bfdb12a6 100755 --- a/src/ReactiveUI/Platforms/windows-common/ReactiveUserControl.cs +++ b/src/ReactiveUI/Platforms/windows-common/ReactiveUserControl.cs @@ -3,7 +3,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. -using System; using System.Diagnostics.CodeAnalysis; #if NETFX_CORE || HAS_UNO using Windows.UI.Xaml; From a2b03533bc204dc4941d094912961f0c8d778237 Mon Sep 17 00:00:00 2001 From: Shimmy Weitzhandler <2716316+weitzhandler@users.noreply.github.com> Date: Tue, 9 Jul 2019 09:23:56 +0300 Subject: [PATCH 6/6] Updated params in docs --- src/ReactiveUI/Platforms/windows-common/ReactivePage.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ReactiveUI/Platforms/windows-common/ReactivePage.cs b/src/ReactiveUI/Platforms/windows-common/ReactivePage.cs index 60097c257c..c6b2151403 100644 --- a/src/ReactiveUI/Platforms/windows-common/ReactivePage.cs +++ b/src/ReactiveUI/Platforms/windows-common/ReactivePage.cs @@ -114,8 +114,8 @@ class ReactivePage : /// Used by the Xamarin Runtime to materialize native /// objects that may have been collected in the managed world. /// - /// javaReference. - /// transfer. + /// A containing a Java Native Interface (JNI) object reference. + /// A indicating how to handle handle. protected ReactivePage(IntPtr javaReference, global::Android.Runtime.JniHandleOwnership transfer) : base(javaReference, transfer) { @@ -126,7 +126,7 @@ protected ReactivePage(IntPtr javaReference, global::Android.Runtime.JniHandleOw /// Initializes a new instance of the class. /// Native constructor, do not use explicitly. /// - /// handle. + /// Handle to the native control. /// /// Used by the Xamarin Runtime to materialize native. /// objects that may have been collected in the managed world.