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
[TIMOB-24086] iOS: Label doesn't fire link event correctly #8568
Conversation
Can one of the admins verify this patch? |
ok to test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments. Please also provide the test-case from the video in the JIRA.
Please check this leaks as well:
EDIT: Proposal for fixing the leaks (untested so far): https://gist.github.com/hansemannn/eb81b09926a64b208268741da4cf3711
NSString *url = nil; | ||
NSRange theRange = NSMakeRange(0, 0); | ||
NSString *url = nil; | ||
NSString *url2 = nil; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, sorry, typo.
url, @"url", | ||
[NSArray arrayWithObjects:NUMUINTEGER(theRange.location), NUMUINTEGER(theRange.length),nil],@"range", | ||
nil]; | ||
[[self proxy] fireEvent:@"link" withObject:eventDict propagate:NO reportSuccess:NO errorCode:0 message:nil]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a check to see if the event-listener is added, e.g. [[self proxy] _hasListeners:@"link"]
. It may be checked even before to prevent unnecessary memory usage. Maybe in the method call inside recognizedTap:
.
And finally, I noticed the method returns a bool but it's callee does not use the return-value. I never worked on that API before, can you think of we that was done?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll see that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hansemannn Is already checked on the first line of recognizedTap
:
BOOL testLink = (label != nil) &&([(TiViewProxy*)[self proxy] _hasListeners:@"link" checkParent:NO]);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hansemannn Yes, its boolean value is never used (NOW).
But I think that we should keep the method signature as a bool just... because we can.
textContainer.lineFragmentPadding = 0; | ||
textContainer.maximumNumberOfLines = (NSUInteger)self.label.numberOfLines; | ||
textContainer.lineBreakMode = self.label.lineBreakMode; | ||
return textContainer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still will probably leak, did you run the Analyser already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Analyser?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kopiro Let me know when you applied the changes, the FT works fine! |
cbd97fc
to
a92be49
Compare
@hansemannn Implemented but there was a Implemented as a Tested. |
Ohh, nice! PR approved 🚀 |
JIRA: https://jira.appcelerator.org/browse/TIMOB-24086