Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Uno Support #3495

Closed

Conversation

nickrandolph
Copy link
Contributor

✨ What kind of change does this PR introduce? (Bug fix, feature, docs update...)

Feature - Adds support for Uno

⤵️ What is the current behavior?

No support for Uno

🆕 What is the new behavior (if this is a feature change)?

Additional libraries MvvmCross.Uno and MvvmCross.Uno.Plugins to support Uno

💥 Does this PR introduce a breaking change?

No

🐛 Recommendations for testing

Run the sample Uno projects

📝 Links to relevant issues/docs

🤔 Checklist before submitting

  • [ X ] All projects build
  • [ X ] Follows style guide lines (code style guide)
  • Relevant documentation was updated (docs style guide)
  • [ X ] Rebased onto current develop

@nickrandolph
Copy link
Contributor Author

@Cheesebaron can you let me know what I need to do in order to generate nuget packages for MvvmCross.Uno and MvvmCross.Uno.Plugins?

@MartinZikmund
Copy link
Contributor

Hi, what is the status of this PR? Anything I could help with to get it done 🙂 ?

@nickrandolph
Copy link
Contributor Author

@MartinZikmund I just rebased the branch. I need to test it again to make sure it's all working and I need some guidance from @Cheesebaron as to what we need to do to generate nuget packages.

@Cheesebaron
Copy link
Member

To generate NuGet packages, the only thing that should be necessary is to use MSBuild.Sdk.Extras for the project file.

<Project Sdk="MSBuild.Sdk.Extras">

Additionally it needs to fulfill these conditions:

<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' and '$(IsTestProject)' != 'true'">true</GeneratePackageOnBuild>

So built in Release mode and not have "Test" in the project name.

@MartinZikmund
Copy link
Contributor

Hi, is this close to release 😊 ? I had several people asking about MvvmCross support 😉 . I am happy to help if something is missing/not working yet

@Cheesebaron
Copy link
Member

@MartinZikmund Except for it not building, then I guess it is not far from it.

I will be working on MvvmCross this week. So I'll give this one a spin and perhaps fix it up so we can get it out with 7.0.0

@Cheesebaron Cheesebaron added this to the 7.0.0 milestone Mar 22, 2020
@MartinZikmund
Copy link
Contributor

Thanks a ton 👌👌👌

@MartinZikmund
Copy link
Contributor

MartinZikmund commented Mar 23, 2020

Update

Nevermind, after a looooong debugging session I uncovered the bug is in Uno and is in fact cause by using await in OnLaunched, so does not happen in general (unoplatform/uno#2872).

Original post

I am trying out the current version with Uno and found an unusual inconsistency with x:Bind. Consider the following code-behind:

    public MainView()
    {
        this.InitializeComponent();
        DataContextChanged += MainPage_DataContextChanged;
    }

    private void MainPage_DataContextChanged(DependencyObject sender, DataContextChangedEventArgs args)
    {
        Text = "In data context changed";
    }

    protected override void OnNavigatedTo(NavigationEventArgs e)
    {            
        base.OnNavigatedTo(e);            
        DataContext = "test";
    }

    public string Text { get; set; }

And following XAML:

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
	<TextBlock Text="{x:Bind Text}" Margin="20" FontSize="30" />
</Grid>

In UWP this properly shows "In data context changed", but on Uno platforms it does not. It seems like the bind occurs before the DataContextChanged is processed or something similar. Weirdly enough, this does work with a plain Uno Platform project, only happens when the page derives from MvxWindowsPage.

Not entirely sure if this is a problem on Uno side or MvvmCross side

@Cheesebaron
Copy link
Member

@nickrandolph I've tried to get Android to build today. I can't seem to get it to work, since it generates some code behind looking like this:

#if __ANDROID__
		/// <summary>
		/// Native constructor, do not use explicitly.
		/// </summary>
		/// <remarks>
		/// Used by the Xamarin Runtime to materialize native 
		/// objects that may have been collected in the managed world.
		/// </remarks>
		public SplitMasterView(IntPtr javaReference, global::Android.Runtime.JniHandleOwnership transfer) : base (javaReference, transfer) { }
#endif

The base class is MvxWindowsPage, it which inherits from Windows.UI.Xaml.Controls.Page, this type doesn't have that ctor.

The only thing I did was to bump uno to latest stable 2.4.0 and use Uno.Wasm.Bootstrap.DevServer instead of the CLI tool in the Wasm project, as it was throwing build errors.

@Cheesebaron
Copy link
Member

Wasm seems to work OK.

@Cheesebaron
Copy link
Member

Can't seem to get UWP running either.

4>"C:\git\MvvmCross\Projects\Playground\Playground.Uno\Playground.Uno.UWP\Playground.Uno.UWP.csproj" (Build;BuiltProjectOutputGroup;BuiltProjectOutputGroupDependencies;DebugSymbolsProjectOutputGroup;DebugSymbolsProjectOutputGroupDependencies;DocumentationProjectOutputGroup;DocumentationProjectOutputGroupDependencies;SatelliteDllsProjectOutputGroup;SatelliteDllsProjectOutputGroupDependencies;SGenFilesOutputGroup;SGenFilesOutputGroupDependencies target) (1) ->
4>(MarkupCompilePass1 target) -> 
4>  C:\git\MvvmCross\Projects\Playground\Playground.Uno\Playground.Uno.Shared\Views\SecondChildView.xaml : Xaml Internal Error error WMC9999: Type universe cannot resolve assembly: Uno.UI, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null.
4>  C:\git\MvvmCross\Projects\Playground\Playground.Uno\Playground.Uno.Shared\Views\SplitMasterView.xaml : Xaml Internal Error error WMC9999: Type universe cannot resolve assembly: Uno.UI, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null.
4>  C:\git\MvvmCross\Projects\Playground\Playground.Uno\Playground.Uno.Shared\Views\SplitRootView.xaml : Xaml Internal Error error WMC9999: Type universe cannot resolve assembly: Uno.UI, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null.

* Add missing package references

* Change base types

MvvmCross.DroidX.AppCompat -> MvvmCross.Platforms.Android.Views
MvxAppCompatActivity -> MvxActivity

* RecyclerView has changed namespace too

* Add back MvxActionBarDrawerToggle

* Fix namespaces

* Fix null reference
Hackmodford and others added 25 commits July 27, 2020 10:01
…-keyboard-fix

Factor in bottom safe area when showing keyboard
Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.4.2 to 2.4.3.
- [Release notes](https://github.com/xunit/visualstudio.xunit/releases)
- [Commits](xunit/visualstudio.xunit@v2.4.2...v2.4.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Hint for confusing multiple App classes in Forms.Wpf sample documentation
…ross#3864)

Bumps [Microsoft.CodeAnalysis.FxCopAnalyzers](https://github.com/dotnet/roslyn-analyzers) from 3.0.0 to 3.3.0.
- [Release notes](https://github.com/dotnet/roslyn-analyzers/releases)
- [Changelog](https://github.com/dotnet/roslyn-analyzers/blob/master/PostReleaseActivities.md)
- [Commits](dotnet/roslyn-analyzers@v3.0.0...v3.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Tomasz Cielecki <tci@trackman.com>
Bumps [Microsoft.CodeAnalysis](https://github.com/dotnet/roslyn) from 3.6.0 to 3.7.0.
- [Release notes](https://github.com/dotnet/roslyn/releases)
- [Changelog](https://github.com/dotnet/roslyn/blob/master/docs/Breaking%20API%20Changes.md)
- [Commits](https://github.com/dotnet/roslyn/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 16.6.1 to 16.7.0.
- [Release notes](https://github.com/microsoft/vstest/releases)
- [Commits](microsoft/vstest@v16.6.1...v16.7.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Updated uno version
Fixed issue with referencing CSharp library with dynamic types
Fixing iOS sample Uno project
Update playground to show issue with x:Bind in Android view
@MartinZikmund MartinZikmund mentioned this pull request Aug 31, 2020
8 tasks
@nickrandolph
Copy link
Contributor Author

Closing this PR and raising a new one that's got a clean commit history

@nickrandolph nickrandolph mentioned this pull request Sep 2, 2020
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet