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

Fix touch gestures not working on MAUI iOS once packaged #1704

Merged
merged 6 commits into from
Dec 21, 2024

Conversation

albyrock87
Copy link
Contributor

Fixes #1684

  • Added Directory.Build.props to propagate properties to all project
    • I've added only MauiVersion because it was one of the issue, but I suggest to bring here also Author and other common properties (LangVersion?)..
  • Added global.json file in order to use the proper .NET + workloads when debugging and packing
  • Refactored MacCatalyst/iOS ChartBehaviour to avoid taking a (now) useless reference to the virtual view
    • Now keeps hard references to callbacks
  • Moved event registration logic to MAUI handlers to avoid memory leaks and provide proper platform-level disconnection logic
    • Now requires .UseLiveCharts() in MAUI program
  • Fixes display info not reacting to orientation / density changes on Android
  • Removed <DebugType>embedded</DebugType> as it makes impossible to place breakpoints while debugging

I don't have a windows machine so I cannot try/verify I haven't broke anything there.

Please merge this as soon as possible because we're stuck due to #1684.
If you have questions I'm also available on Discord (same username).

Thanks

@beto-rodriguez
Copy link
Owner

Thanks for the PR!

I will review and merge this asap!

@beto-rodriguez beto-rodriguez changed the base branch from master to dev November 18, 2024 17:54
@albyrock87
Copy link
Contributor Author

Hey @beto-rodriguez, I see you rebased the PR and a few conflicts appeared.

Are you gonna fix the conflicts with dev brach or should I do it?

@beto-rodriguez
Copy link
Owner

@albyrock87 I changed the base to dev, I'll try to fix conflicts with the dev branch

@albyrock87
Copy link
Contributor Author

@beto-rodriguez do you have any news on this one?

Now that NET9 automatically disconnects MAUI handlers when leaving the page we get a crash which this PR would prevent and also handle the disconnection properly.

image

@beto-rodriguez
Copy link
Owner

@albyrock87 I've been working on #1705, that should be almost ready, it is an important change in the library that will improve drastically the flexibility of the library to create custom drawn elements.

I should be able to review this in the next days.

@beto-rodriguez beto-rodriguez merged commit 2fb3685 into beto-rodriguez:dev Dec 21, 2024
3 of 5 checks passed
@beto-rodriguez
Copy link
Owner

Thanks again again for the PR! I tested on all platforms, and it works!

@@ -0,0 +1,6 @@
{
"sdk": {
"version": "8.0.401",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular reason to use this version?

Maybe upgrading the version to 9.x is a good idea, just want to confirm, if there is a particular reason, I can make this commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recently asked Microsoft what we should use as library authors regarding broad compatibility.

I think that for now you can stick with 8.0.100 with roll forward latest feature, but make sure you target net8.0-ios17.0 in the TargetFramework and not just net8.0-ios because that implicitly targets only the latest native version released with the latest workload (right now is 18.2).

This ensures compatibility with MAUI8 and MAUI9.

Take into consideration that many developers (like me) are still on .NET8 considering that MAUI9 is still a bit "unstable", or simply because they didn't have enough time to upgrade.


using LiveChartsCore.SkiaSharpView.Maui;

namespace Microsoft.Maui.Hosting;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here, can I change the namespace to LiveChartsCore.SkiaSharpView.Maui?

is there a particular reason for using that ns?

Copy link
Contributor Author

@albyrock87 albyrock87 Dec 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I've used this namespace is for dev-experience.

In MauiProgram.cs you already have this namespace imported, so the intellisense will automatically suggest the extension method.

This is a common pattern used by Microsoft.Extensions.* packages.

If you don't like it, do what you want: it's not a big deal :)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @albyrock87, I will consider both comments!

@albyrock87
Copy link
Contributor Author

albyrock87 commented Jan 16, 2025

@beto-rodriguez the only thing I'm sad about, which was my only ask, is that I needed this to be compatible with net8 but the library now requires net9.
Was there a specific reason?

I'll have to fork this and go back to net8 for broader compatibility.

Anyway, thanks for releasing the new version!

@beto-rodriguez
Copy link
Owner

beto-rodriguez commented Jan 16, 2025

net8 but the library now requires net9

@albyrock87 That should be a mistake on my side, I can see that net 8 should be supported, what is the error you are getting?

@beto-rodriguez
Copy link
Owner

Actually, the sample in this repo uses net 8, I am confused now 🤯

@albyrock87
Copy link
Contributor Author

@beto-rodriguez I'm sorry, it has been a busy day and I haven't actually tried out the library, I just checked the global.json and got tricked by that.

My mistake, I apologize!

@albyrock87 albyrock87 deleted the maui-refactor-and-fixes branch January 16, 2025 19:16
@albyrock87
Copy link
Contributor Author

I've installed the new version and I can confirm everything works well, thank you for your effort of keeping compatibility with .net8, I appreciate a lot!

@beto-rodriguez
Copy link
Owner

Amazing! glad to read that!

Thanks for confirming that it works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Touch gestures not working on iOS
2 participants