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

Tapping on iOS 12 doesn't work properly with multiple line labels #106

Closed
dbard opened this issue Jun 17, 2020 · 17 comments · Fixed by #105
Closed

Tapping on iOS 12 doesn't work properly with multiple line labels #106

dbard opened this issue Jun 17, 2020 · 17 comments · Fixed by #105

Comments

@dbard
Copy link

dbard commented Jun 17, 2020

If the user taps on a link appearing after the first line of a multiple line label, the link doesn't open. I was able to reproduce this using the test project with the Nuget.

I've put up a pull request with what I think is a good solution. #105

And... thank you for your work on this Nuget!!

@IeuanWalker
Copy link
Contributor

@matteobortolazzo is this fixed? I have a bug in our app that neds fixing today, if there is a fix any chance of a beta or preview release today?

@matteobortolazzo
Copy link
Owner

@IeuanWalker I cannot test it so I trust @dbard PR
Now 4.1.3 is releasing

@IeuanWalker
Copy link
Contributor

@matteobortolazzo thanks for releasing it so quickly. Unfortunately version 4.1.3 still doesn't work for me. I'm using a iOS 13.5 emulator.

@matteobortolazzo
Copy link
Owner

I am sorry to head that!

Unfortunately I cannot work on that right now.

Can you please try version 5 (alpha) then?

@IeuanWalker
Copy link
Contributor

@matteobortolazzo i can confirm link and phone numbers are working, but email link isn't.
Also seams to have an issue with scrolling.

The control is wrapped in a scrollview, but is only scrollable when the view is refreshed with hot reload. Wasnt an issue on older versions

@matteobortolazzo
Copy link
Owner

Got it, can add those issues as comments in pr #104 please?

@IeuanWalker
Copy link
Contributor

@matteobortolazzo done. As i need this fixed my self are you ok with me messing around with that PR? cant promise anything though.

@matteobortolazzo
Copy link
Owner

Sure, help is always welcome :) thanks

@dbard
Copy link
Author

dbard commented Jun 24, 2020

Note that the code I provided was meant to address that there was some unnecessary math being performed to determine total characters which wasn't necessary. It only addressed where on the screen a tap occurred, nothing to do with what happens within the library after the tap was correctly observed.

@matteobortolazzo
Copy link
Owner

@dbard sure, don't worry, your update is still valid! Thanks again

@IeuanWalker
Copy link
Contributor

@matteobortolazzo @dbard
The scroll issue seams to happen if the html is set after the the page is loaded.
In my project I have a markdown file embedded in the project, and in the OnAppearing of the page i read the file, and convert it too html, then set the text on HtmlLabel. I've replicated the issue here - https://github.com/IeuanWalker/HtmlLabelPlugin/tree/Bug/Scrollview

The scrollview works just text is cut off

And this is the error that I'm getting when clicking the email link (also replicated in the above repo)

2020-06-24 18:02:29.112257+0100 HtmlLabel.Forms.Plugin.Tests.App.iOS[62636:1277100] -canOpenURL: failed for URL: "mailto:" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
[0:] Specified method is not supported.:             ERROR: 
2020-06-24 18:02:29.121559+0100 HtmlLabel.Forms.Plugin.Tests.App.iOS[62636:1277258] [default] Failed to open URL mailto:github@github.com?subject=Awesome&body=Awesome%20plugin: Error Domain=NSOSStatusErrorDomain Code=-10814 "(null)" UserInfo={_LSLine=247, _LSFunction=-[_LSDOpenClient openURL:options:completionHandler:]}

@IeuanWalker
Copy link
Contributor

IeuanWalker commented Jun 25, 2020

@matteobortolazzo Update

I think the scrolling issue is do to this issue - xamarin/Xamarin.Forms#1332
For now I've moved the method call from the OnAppearing to the page constructor before the InitializeComponent(); call and all seams fine. Only reason it was in the OnAppearing was because it was using async methods to handle error messages + PopAsync. But I've updated it so it catches the error in the constructor and in the OnAppearing if the text is null then it show the error message and pops the page.

So only issue I have now is around email links, but its not going to stop us releasing with it not working. So ill stick to v5 alpha for now,

@matteobortolazzo
Copy link
Owner

matteobortolazzo commented Jun 25, 2020

Got it, glad to hear. About emails, it looks like it is a Xamarin.Essentials issue, do you need to whitelist emails in the Info.plist maybe?

EDIT: I think public static bool IsEmail(this Uri uri) => uri.MatchSchema("mailto") is not returning True, do you mind debug it please?

EDIT 2: Maybe I should have added Unit Tests for those extension methods.

@IeuanWalker
Copy link
Contributor

@matteobortolazzo Ye sure ill give it a test in a bit

@IeuanWalker
Copy link
Contributor

IeuanWalker commented Jun 25, 2020

@matteobortolazzo

I use a simulator 90%, but turns out the Xamarin.Essentials email isn't supported on iOS simulators.
From the docs - 'To use the Email API on iOS you must run it on a physical device, else an exception will be thrown.'
https://docs.microsoft.com/en-us/xamarin/essentials/email?tabs=ios

Tested my project on a physical device and I'm getting a 'NullReferenceException' when clicking on an email link. I've imported the HtmlLabel project into mine (so I don't have to create provisioning profile to test on a physical device) and its throwing the error here -
image

Updating the code to this fixes it -
image
Do you reckon you could do a another Alpha release with this fix today?

@IeuanWalker
Copy link
Contributor

@matteobortolazzo PR created - #108

@matteobortolazzo
Copy link
Owner

v5 Released

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 a pull request may close this issue.

3 participants