-
Notifications
You must be signed in to change notification settings - Fork 280
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
Issue-89 - Add support for arrays in query parameters #98
Conversation
Removes array literal ('[]') from the string | ||
@return String without array literal ('[]') | ||
*/ | ||
- (NSString *)DPL_removeArrayLiteral; |
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.
Convention would indicate:
DPL_stringByRemovingArrayLiteral
or something similar
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.
Thanks for noticing, will correct it shortly.
On Thursday, April 7, 2016, Chris Maddern [email protected] wrote:
In DeepLinkKit/Categories/NSString+DPLQuery.h
#98 (comment):+- (BOOL)DPL_containsArrayLiteral;
+
+
+/**
- Checks if string contains key with array literal
- @return YES if string contains key with '[]' attached (e.g. "key[]"),
NO otherwise (e.g. "key")
- /
+- (BOOL)DPL_containsArrayLiteralWithKey:(NSString *)key;
+
+
+/*- Removes array literal ('[]') from the string
- @return String without array literal ('[]')
- */
+- (NSString *)DPL_removeArrayLiteral;Convention would indicate:
DPL_stringByRemovingArrayLiteral or something similar—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
https://github.com/button/DeepLinkKit/pull/98/files/7cebc8717560a0a64fb675df53f041ef2e2d7acb#r58930895
Best regards,
Pavel Pantus
That's really cool test failure: (Different ordering in NSDictionary) Test passes on my machine though :) |
@@ -74,4 +75,14 @@ - (DPLDemoAction *)logHelloWorldAction { | |||
return action; | |||
} | |||
|
|||
|
|||
- (DPLDemoAction *)logShoppingList { | |||
DPLMutableDeepLink *link = [[DPLMutableDeepLink alloc] initWithString:@"dpl://shoppinglist?list%5B%5D%3DBread&list%5B%5D%3DCandies&list%5B%5D%3DWine&list%5B%5D%3DBeer"]; |
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 was wondering if here should be easier way to initialize deep link with URLs of such kind?
@wessmith @chrismaddern Hey guys, wanted to ask for your feedback. |
Hi @pantuspavel this is looking good 😄 but I haven't had a chance to fully go through it. |
NSString *queryStringToMatch; | ||
NSString *queryStringPartBeers = @"beers[]=stout&beers[]=ale"; | ||
NSString *queryStringPartLiquors = @"liquors[]=vodka&liquors[]=whiskey"; | ||
if ([[params allKeys][0] isEqualToString:@"beers"]) { |
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 think we should probably have a suitable default here such as ordered ascending that way we can expect a consistent result.
Similarly, when parsing a url, I would expect to have the parameter order preserved so re-serialization mirrors the original url though that can't really happen in the category (#15) without more information.
For example:
NSURL *url = [NSURL URLWithString:@"dpl://something/?liquors[]=vodka&liquors[]=whiskey&beers[]=stout&beers[]=ale"];
DPLDeepLink *link = [[DPLDeepLink alloc] initWithURL:url];
link.URL.query // should serialize as => @"liquors[]=vodka&liquors[]=whiskey&beers[]=stout&beers[]=ale"
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.
@wessmith Just making sure I understand that correctly: you are talking here about DPLMutableDeepLink
not DPLDeepLink
right? (DPLDeepLink
returns previously set URL without any serialization work).
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.
You're right. Yeah.
Hey @wessmith, |
@pantuspavel If you want to tackle #15 I'd love to hear your thoughts on how you would approach it before you get too far into it :) |
@wessmith sure, [NSString DPL_queryStringWithParameters:(NSDictionary *)parameters]; This way we always get the same order in the output string. |
That works. Then we can tackle #15 later. |
What do you think of using some kind of ordered dictionary(e.g. M13OrderedDictionary - not sure about this one though. Last commit - Oct. 2015) |
We don't want to add any dependencies. Perhaps we pass in an |
Yeah, that was my second thought -- dependencies. On Friday, April 8, 2016, Wes Smith [email protected] wrote:
Best regards, |
Hey guys, any plan to merge this? |
@wessmith @pantuspavel what's the action here? Would love to get this merged! |
@pantuspavel can you have a look at this and make sure its up to date and all comments are resolved |
Possible solution if I got the meaning right.