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

[TIMOB-23988] iOS: Add click event to "callout" bubble to return infoWindow (Parity) #159

Closed
wants to merge 4 commits into from

Conversation

darknos
Copy link
Contributor

@darknos darknos commented Apr 22, 2016

@@ -30,6 +30,9 @@
NSMutableArray *polygonProxies;
NSMutableArray *circleProxies;
NSMutableArray *polylineProxies;

//selected annotation
MKAnnotationView<TiMapAnnotation> * selectedAnnotation;
Copy link
Contributor

Choose a reason for hiding this comment

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

Make sure to also deallocate it during dealloc by using RELEASE_TO_NIL(selectedAnnotation).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is just a pointer - I don't do alloc so I don't need to dealloc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

selectedAnnotation = nil; in destructor should be enough

Copy link
Contributor

Choose a reason for hiding this comment

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

When you assign it with selectedAnnotation = ann;, it can be deallocated, since it's not using ARC. That's why you need to retain and release it.

@hansemannn
Copy link
Contributor

Left some review comments, thanks!

@hansemannn
Copy link
Contributor

@darknos, ping! 🚀

@darknos
Copy link
Contributor Author

darknos commented Jun 7, 2016

Notice, there is a mix of tabs and spaces in this file. I use 4 spaces but github shows one tab as 8 spaces so it looks like indentation issue in diff views.

@darknos
Copy link
Contributor Author

darknos commented Jun 21, 2016

@hansemannn, ping!

@hansemannn
Copy link
Contributor

@darknos I requested changes a few months ago, can we still expect those or should I close this?

//add tap recogniser to this view
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleCalloutTap:)];
[node addGestureRecognizer:tap];
}else{
Copy link
Contributor

Choose a reason for hiding this comment

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

Change to } else {

@@ -34,7 +34,7 @@ -(void)dealloc
CFRelease(mapObjects2View);
mapObjects2View = nil;
}

selectedAnnotation = nil;
RELEASE_TO_NIL(locationManager);
RELEASE_TO_NIL(polygonProxies);
RELEASE_TO_NIL(polylineProxies);
Copy link
Contributor

Choose a reason for hiding this comment

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

While you're on it, this proxies have an incorrect indentation as well.

@hansemannn
Copy link
Contributor

@darknos Will you still update the issues in this PR and file a JIRA ticket? Would like to have the changes in, but we can't accept it at this point.

@darknos
Copy link
Contributor Author

darknos commented Dec 19, 2016

I already reported the issue in JIRA
https://jira.appcelerator.org/browse/TIMOB-23988

but no info since September. What do you need more to merge this PR?

@hansemannn hansemannn changed the title Add click event to "callout" bubble and return clicksource==infoWindow like Android [TIMOB-23988] iOS: Add click event to "callout" bubble and return clicksource==infoWindow like Android Dec 19, 2016
//if canShowCallout == true we will try to find calloutView to hadleTap on callout
if ([ann canShowCallout]) {
//run after delay because we have to wait for animation finish
[self performSelector:@selector(findCalloutView:) withObject:ann afterDelay:0.2];
Copy link
Contributor

Choose a reason for hiding this comment

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

Ok one thing here. I'd like to use GCD instead of the delayed performSelector method. It's recommended to migrate all of those to common async-patterns. Can you do that? 😊

Copy link
Contributor Author

@darknos darknos Dec 28, 2016

Choose a reason for hiding this comment

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

do you meant something like this?

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^(void){
    [self findCalloutView: ann];
});

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, but if you dispatch it async, wouldn't the event fire before the callout view has been found? Or why exactly do you need 0.2 seconds? Maybe it should be block-based or synced instead.

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 guess the callout contents created after wrapper animation finished (callout pop}, if delay less then 0.2 it is not found.

Copy link
Contributor

Choose a reason for hiding this comment

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

But if the click was made on the callout, the callout should already be visible. We should avoid hardcoded delays in any case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From Apple SDK we have an event "click on pin" but don't have an event "callout showed and all subviews in it are already created".

So we wait 200ms of animation after "click on pin" event and then try to find subview which class is "_MKSmallCalloutPassthroughButton" recursively in callout views hierarchy.

It is not a "SDK way" - it is a "hack".

Do you have any idea how to do it more "nice" without fixed timeouts? I don't know :( and didn't find any ideas in the net too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

-(void)refreshAfterDelay
{
	[self performSelector:@selector(refreshIfNeeded) withObject:nil afterDelay:0.1];
}

I hope this hardcoded delays is not a problem in TiMapAnnotationProxy.m ? :) :) :) :) why 0.1? :)

Copy link
Contributor

@hansemannn hansemannn left a comment

Choose a reason for hiding this comment

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

Left some final comments. If we can resolve those early, I will merge it for the next release! :-) Great PR btw.

@hansemannn hansemannn changed the title [TIMOB-23988] iOS: Add click event to "callout" bubble and return clicksource==infoWindow like Android [TIMOB-23988] iOS: Add click event to "callout" bubble to return infoWindow (Parity) Dec 28, 2016
@darknos
Copy link
Contributor Author

darknos commented Dec 29, 2016

I'm not sure that I understand word "contribution" as it should be.

I pay $90 monthly for SDK. I need this functionality. a lot of guys like me need this SDK parity. I got an idea. I proposed a solution. I made a PR. If you need it, please, fix indentations, avoid hardcoded delays, make it "legacy way", etc. I signed all required agreements to allow you it.

I already created custom version of this module for myself, I already finished a project where it was required and got money from a customer. Is $90 monthly not enough for such "contribution"?

Am I bad guy? No. I'm quite busy guy who tried to "contribute" something. Please, don't stop me and don't make this "contribution" the last one.

@hansemannn
Copy link
Contributor

hansemannn commented Dec 29, 2016

@darknos Yes, you understand the term "contribution" incorrect. It has nothing to do with your subscription or other people using this patch. Is has to be integrated properly, so thousands of developers can use it the correct way. I don't like the way this discussion is going, only because I like to discuss different approaches.

I am reviewing this PR in my spare time, suggesting best practices. If that's too much for you, I am sorry, but then we cannot accept this PR. That's how it's done in the main titanium_mobile repo and all other module repositories. People adhere to that conventions and the quality improves.

And for the refreshAfterDelay method, it's an old implementation from 2012 that should be replaced the same way. Only because something is there doesn't mean it's the way to go.

Sorry again for being so direct, but that's my personal opinion from doing a lot of work in open source communities.

@darknos
Copy link
Contributor Author

darknos commented Dec 29, 2016

ok. I don't know better solution then 0.2s delay. close PR?

@darknos
Copy link
Contributor Author

darknos commented Dec 29, 2016

and I don't know which kind of indentation is legacy. what to do? kill myself?

@hansemannn
Copy link
Contributor

Closing in favor of #193

@hansemannn hansemannn closed this Dec 29, 2016
@hansemannn
Copy link
Contributor

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.

None yet

2 participants