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

WIP: internal router #61

Closed
wants to merge 3 commits into from
Closed

WIP: internal router #61

wants to merge 3 commits into from

Conversation

alcarvalho
Copy link

This is the very first take into trying to extract an internal router as said in #60

I feel the code is a bit cluttered, I don't know. I specially don't like to pass pointers of pointers to anything other then NSError.

Any suggestions on how to improve this?

DPLRouteHandlerBlock routeHandlerBlock = handler;
routeHandlerBlock(deepLink);

- (DPLDeepLink *)deepLinkForUrl:(NSURL *)url handler:(id *)handler {
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that an inout parameter isn't ideal here. Maybe this method could return a dictionary? Or we could even create a lightweight class that had deepLink and handler properties.

Copy link
Author

Choose a reason for hiding this comment

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

I almost created that lightweight class. IMO is the best option since we don't have tuples in Objective C. :)

@getaaron
Copy link
Contributor

getaaron commented Jul 7, 2015

I like this approach - left a few stylistic suggestions. Didn't get a chance to test it out (on the road right now) but looks good.

return NO;
}
}

else if ([handler isKindOfClass:NSClassFromString(@"NSBlock")]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This might cause a problem in the future if the private class name changes. Can we just create a throwaway DPLRouteHandlerBlock and compare its class to handler's?

Copy link
Author

Choose a reason for hiding this comment

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

We could certainly do that. That line is actually a copy from what was already in place on the code. I just had to move it to extract things from the methods.

But from what I've seen, we can have two kinds of blocks, with and without a DPLDeepLink argument. So maybe that's why it was this way in the first place?

@chrismaddern
Copy link
Contributor

Excited to see a P/R on this!

I started this Wiki page to begin to collect a shared set of requirements for using this for internal routing. I think that this is something that is both non-trivial and represents an opportunity to share an opinion on how people should architect and construct their apps.

Please do add to it: https://github.com/usebutton/DeepLinkKit/wiki/Internal-DeepLink-Routing

@alcarvalho
Copy link
Author

That's really nice, @chrismaddern 😁

Since we don't have a way of commenting on that wiki, I will ask it here:

... delegating responsibility to handlers for fetching and processing data and ViewControllers for presenting the resources we request.

I have never thought that fetching data could belong to the route handler. Do you think that's a good idea? For instance, how could we present any feedback (progress, connection error) to the user, if you don't have a UI to do it in the handler?

I either don't get it or are you planning deeper modifications to the route handler?

My intention on this PR is to have direct access to the view controller that will be presented, so we can set some data that wouldn't fit inside the DPLDeepLink, like prefetched data that is already available on the calling View Controller somehow. Or even for customizing the transition animation.

I am open for suggestions on this too. 😉

@wessmith
Copy link
Member

wessmith commented Jul 8, 2015

I moved the wiki to an issue #62 to make it easier to discuss.

@alcarvalho alcarvalho mentioned this pull request Jul 10, 2015
@alcarvalho
Copy link
Author

What more do you think I can do to so this PR can be considered done? Does this depend on the discussion of the internal router as a whole?

@chrismaddern
Copy link
Contributor

@alcarvalho A good point - I don't think it has to, but I definitely don't want to have to totally change directions in the spirit of keeping non-major updates API-additive vs. breaking.

Would adding the deeplink to the viewController creation method solve the problem?

@alcarvalho
Copy link
Author

@chrismaddern I am sorry, but I don't follow you. Adding the deeplink to the viewController would solve what problem?

@alcarvalho
Copy link
Author

So, could we consider merging the PR? Are there any changes required or suggested before we're able to do it? /cc @chrismaddern @wessmith

@wessmith wessmith added this to the 2.0.0 milestone Dec 17, 2015
@wessmith wessmith self-requested a review March 31, 2017 15:09
@wessmith wessmith self-assigned this Mar 31, 2017
@wessmith
Copy link
Member

triage: needs review

@jmcgill jmcgill closed this May 31, 2019
@jmcgill jmcgill reopened this May 31, 2019
@wessmith wessmith closed this Jan 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

5 participants