exclude a url in universal links iOS - ios

I have implemented universal links and working fine but now I need to exclude few url types from opening app so i tried following ways with apple-app-site-association file.
{
"applinks": {
"apps": [],
"details": [{
"appID": "abc",
"paths": ["NOT /test_url_1/", "NOT /test_url_2/"]
}]
}
}
"paths":["NOT /test_url_1/", "NOT /test_url_2/"] - will ignore ALL urls, no redirection to the mobile app
{
"applinks": {
"apps": [],
"details": [{
"appID": "abc",
"paths": ["NOT /test_url_1/", "/test_url_2/"]
}]
}
}
"paths":["NOT /test_url_1/", "/test_url_2/"] - will ignore /test_url_1/ url, allow /test_url_2/ and ignore other urls
{
"applinks": {
"apps": [],
"details": [{
"appID": "abc",
"paths": ["NOT /test_url_1/", "NOT /test_url_2/", "*"]
}]
}
}
"paths":["NOT /test_url_1/", "NOT /test_url_2/", "*"] - will open ALL urls in the mobile app
I just need to ignore test_url_1and test_url_2 and open mobile app for other urls. Is there anyway to do this? am I missing something here?

Your third example should be correct, and matches both the specifications and examples I've seen in working practice before. We'd probably need to see non-anonymized data and actual links to debug any further.
You could possibly also try this:
{
"applinks": {
"apps": [],
"details": [{
"appID": "abc",
"paths": ["NOT /test_url_1/*", "NOT /test_url_2/*", "*", "/"]
}]
}
}

You have to check it by casting each of your url to string and look for the ur that you don't want to be in your new url path like so
let url = URL(string: "/test_url_1/somepoints/")!
let urlString = url.absoluteString
var newURL:URL!
if !urlString.contains("test_url") {
newURL = URL(string: urlString)
// use the new url now
}
for a big list of urls you have to make this test inside a for loop and generate the urls that you want

Related

Redirect only if a URL query matches

How to config apple-app-site-association to open/redirect only link with specific url query?
For example I would like to open only links like this https://www.example.com/?modal=CreatePassword
This is my current config an it opens all links even without the url query (modal=CreatePassword)
"applinks": {
"details": [
{
"appIDs": [
"com.app"
],
"components": [
{
"?": {
"modal": "CreatePassword"
}
}
]
}
]
}
I found that iOS keeps/downloads old file even after reinstallation of the app(delete -> install). This video was very helpful: https://youtu.be/xxyEq_ySoO4
I downloaded sysdiagnose file from my iPhone and checked swcutil_show.txt, and found that it keeps old version of the apple-app-site-association file.
The correct config for me:
{
"applinks": {
"details": [
{
"appIDs": [ "com.app" ],
"components": [{
"?":{"modal":"CreatePassword"},
"/":"/"
}
]
}
]
}
}

Universal Link, AASA file component syntax wrong

I correctly have created Universal Link on iOS side and also successfully upload it to the domain.
Apple Validate service shows me that all work fine but I can't open specific links because the syntax of the component wrong
My file:
{
"applinks": {
"details": [
{
"appIDs": [ "K6789HNH.com.example-app" ],
"components": [
{
"/": "/#/market/lettings"
},
{
"/": "/#/market/lettings/*"
},
{
"/": "/#/market/acquisitions"
},
{
"/": "/#/market/acquisitions/*"
}
]
}
]
},
"webcredentials": {
"apps": [ "K6789HNH.com.example-app" ]
}
}
Example of links:
https://example.com/#/market/lettings/49830?view=grid
https://example.com/#/market/acquisitions/50134
I follow the Apple example of components https://developer.apple.com/videos/play/wwdc2019/717/ , time code 7:23 - 9:00
Image from example above
What is my syntax problem with components?
The problem was in the symbol "#", it's a fragment, a little info about URL
I change components to :
"#": "*market/lettings*"
and
"#": "*market/acquisitions*"
And all work well, symbol * used for handling all value between # and market/. Example: www.example.com/#.......market/lettings, instead of ... can be any of the symbols like www.example.com/#/market/lettings/123

How Can I make Apple App Clip Smart Banner show?

I recently developed an App Clip and published it on the App Store. I've created the default app clip experience and put the apple-app-site-association file in the .well-known directory. The JSON looks like this.
{
"applinks": {
"details": [
{
"apps": ["T3Y3F3XXXX.it.company.my-app"],
"components": []
}
]
},
"appclips": {
"apps": ["T3Y3F3XXXX.it.company.my-app.Clip"]
}
}
This is what I've done on App Store Connect:
My meta looks like this:
<meta name="ARShades" content="app-id=1586660000, app-clip-bundle-id=it.company.my-app.Clip, app-clip-display=card">
The problem is the Smart App Banner won't show. I think I've met all of the Apple stated requirements here: https://developer.apple.com/documentation/app_clips/supporting_invocations_from_your_website_and_the_messages_app
Try using the below JSON in apple-app-site-association file :
{ "applinks": {
"details": [
{
"appIDs": [ "T3Y3F3XXXX.it.company.my-app" ],
"components": [
{
"#": "no_universal_links",
"exclude": true,
"comment": "Matches any URL whose fragment equals no_universal_links and instructs the system not to open it as a universal link"
}
]
}
] },
"appclips": {
"apps": ["T3Y3F3XXXX.it.company.my-app.Clip"]
}
}

How to build query with "sourcedoc" which is present in "SharePoint file" shared URL. I want to search file in OneDrive using Microsoft Graph API

I am using below URL to search files in Onedrive. How to add the query string as "Sourcecode"?
https://graph.microsoft.com/beta/search/query
Request parameters:
{
"requests": [
{
"entityTypes": [
"driveItem"
],
"query": {
// "queryString": "Presentation.pptx"
//"queryString": "contoso filetype:pdf OR filetype:docx"
//"queryString": "contoso
path:\"https://contoso.sharepoint.com/sites/Team Site/Documents/\\""
}
}
]
}
The sourcedoc value should be the same as id of the listItem which represents an item in a SharePoint list.
Try to specify the sourcedoc value in queryString.
Example:
{
"requests": [
{
"entityTypes": [
"listItem"
],
"query": {
"queryString": "C2CB147F-1B73-4307-990E-37F7CBE090C6"
}
}
]
}
It will search across the metadata including id.

Renaming type for FSharp.Data JsonProvider

I have a JSON that looks something like this:
{
...
"names": [
{
"value": "Name",
"language": "en"
}
],
"descriptions": [
{
"value": "Sample description",
"language" "en"
}
],
...
}
When using JsonProvider from the FSharp.Data library, it maps both fields as the same type MyJsonProvider.Name. This is a little confusing when working with the code. Is there any way how to rename the type to MyJsonProvider.NameOrDescription? I have read that this is possible for the CsvProvider, but typing
JsonProvider<"./Resources/sample.json", Schema="Name->NameOrDescription">
results in an error.
Also, is it possible to define that the Description field is actually an Option<MyJsonProvider.NameOrDescription>? Or do I just have to define the JSON twice, once with all possible values and the second time just with mandatory values?
[
{
...
"names": [
{
"value": "Name",
"language": "en"
}
],
"descriptions": [
{
"value": "Sample description",
"language" "en"
}
],
...
},
{
...
"names": [
{
"value": "Name",
"language": "en"
}
],
...
}
]
To answer your first question, I do not think there is a way of specifying such renaming. It would be quite reasonable option, but the JSON provider could also be more clever when generating names here (it knows that the type can represent Name or Description, so it could generate a name with Or based on those).
As a hack, you could add an unusued field with the right name:
type A = JsonProvider<"""{
"do not use": { "value_with_langauge": {"value":"A", "language":"A"} },
"names": [ {"value":"A", "language":"A"} ],
"descriptions": [ {"value":"A", "language":"A"} ]
}""">
To answer your second question - your names and descriptions fields are already arrays, i.e. ValueWithLanguge[]. For this, you do not need an optional value. If they are not present, the provider will simply give you an empty array.

Resources