Im currently working on an integration of a secure login provider and their SDK uses a modal SFSafariView to open a login page.
The Requirements differ from what they offer as standard, where we need to have a guest button that closes the modal and links to somewhere else in the app. - as this isn't standard it cant be handled by the SDK.
Unless a user force clicks the link and chooses to open in our app the link continues to a web page in the SFSafariView. This isn't a great user experience and there is no way other to notify the user of this need besides adding a note on the web page (not very attractive).
Q - How can I get a link that appears on a html web page displayed in a SFSafariView to be sent to the same app its open in. NB - the app has associated domains and correctly set up AASA files on the site
Helpful Code
//Sets up a SFSafariVC (use this code in a button to open a local html file with your link in)
guard let path = Bundle.main.path(forResource: "", ofType: "html") else { return }
let url = URL(fileURLWithPath: path)
let config = SFSafariViewController.Configuration()
let vc = SFSafariViewController(url: url, configuration: config)
present(vc, animated: true)
Using old school deeplinks did solve my issue.
by registering a custom URL protocol
then using a link in the form appNameWebProtocol://link/destination the SFSafariViewController always passes this link to the app.
this is picked up by appDelegate method
Issues with this solution - in our specific case this link would be found on a website that can be viewed outside of the app and without it installed. if that is the case the link would not do anything, so our solution had to include custom script on the webpage to establish which link it should present in the webPage.