HomeiOS Developmentios - Complicated queries in common hyperlinks: AND vs. OR within the...

ios – Complicated queries in common hyperlinks: AND vs. OR within the AASA (apple-app-site-association) file


Within the app I am engaged on I would like common hyperlinks with fairly a number of completely different doable question phrases (eight to be particular). And any mixture of these eight question phrases can be utilized.

For instance, the next are all legitimate:

https://instance.com/path/?term1=foo

https://instance.com/path/?term1=foo&term2=bar

https://instance.com/path/?term1=foo&term2=bar&term3=baz

It has been a little bit of a wrestle, however my conclusion is that the AASA file, for those who use question keys (“?”) within the elements dictionaries solely successfully permits “AND” situations inside a particular elements dictionary. To realize an “OR” you must give a number of elements dictionary entries. So, for instance, the next elements dictionary is an implicit “AND” situation indicating that every of the question phrases have to be provided:

{
    "/": "/path/*",
    "?": {
        "term1": "?*",
        "term2": "?*",
        "term3": "?*"
    }
}

So, the next hyperlink:

https://instance.com/path/?term1=foo&term2=bar&term3=baz

would match, however these different wouldn’t match:

https://instance.com/path/?term1=foo

https://instance.com/path/?term1=foo&term2=bar

And the next elements dictionaries collectively permit only a single of the question phrases for use (successfully an “OR” situation):

{
    "/": "/path/*",
    "?": {
        "term1": "?*",
    }
},
{
    "/": "/path/*",
    "?": {
        "term2": "?*"
    }
},
{
    "/": "/path/*",
    "?": {
        "term2": "?*",
    }
}

So, for instance the next would match:

https://instance.com/path/?term1=foo

However this one wouldn’t match:

https://instance.com/path/?term1=foo&term2=bar

If I’ve eight question phrases, and want to permit all doable combos of these phrases, and need to use the question format in an AASA file I would have to provide 2^8 combos (elements dictionaries) within the AASA file.

Alternatively, in fact, I may simply use a elements entry of:

{ “/”: “/path/*" }

and in my app prohibit the doable question phrases.

I’ve discovered no definitive Apple documentation on this. However, the next is suggestive

From WWDC 2019 Session 717 “What’s New in Common Hyperlinks”:

“For a elements dictionary to match a candidate URL, all of the
specified elements should match”

This implies that a number of question parameters in a elements
dictionary use AND logic.

Supply: WWDC 2019 Session 717 – What’s New in Common
Hyperlinks
.

I am scripting this as an SO query to see if others produce other info that may assist this or that would disconfirm this.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments