Closed fiedl closed 8 years ago
I've posted my workaround at stackoverflow in the hope that somebody knows a better solution.
Please let me know if you consider the problem resolved or if you'd consider implementing a "built-in solution" for the issue.
@fiedl I think that's a good solution and close to what we do in Basecamp. We send all URLs that Turbolinks doesn't handle through our Router
that decides how to handle them (open a native view controller, open in Safari, etc..). For files, we have a native view controller that downloads them and provides previewing/sharing options.
One note, your FilesViewController
doesn't need to have have any connection to Turbolinks, so it can be a plain UIViewController
subclass instead of inheriting from Turbolinks.VisitableViewController
. Just need to use the same processPool to share cookies if needed, as you noted in your answer.
Thanks, @zachwaugh
@zachwaugh I'm having this same issue, but our Rails app uses anchor tags with an href like /files/[id]/download
which gets redirected to an s3.amazonaws
url. The turbolinks iOS app is receiving the original url (and failing) but not the AWS one we are interested in (which comes afterward). Any advice on waiting for the redirected url and using that one instead?
When a turbolinks page links to a pdf or other file that's not handled by turbolinks, currently the link is handled as external link and will open in safari rather than the embedded
VisitableView
.Scenario
Consider a documents index. The document links refer to the actual pdfs.
The user clicks on such a link.
Observed behavior
The linked pdf is opened in safari rather than an embedded
VisitableView
. Unfortunately, safari asks for authentication, again. Furthermore, the user leaves the application.Desired behavior
The pdf is displayed within the app, preferably within a
VisitableView
of turbolinks-ios.Is this currently possible? Is this something, you would consider to implement?
Workaraounds?
I could have the link send a message to the mobile app via javascript as shown in the README:
webkit.messageHandlers.show_pdf.postMessage(pdf_url)
. But how would I tell the VisitableView to just open that url?If I use
presentVisitableForSession(session, URL: pdf_url, action: .Advance)
as shown in the demo application, it takes a while, and then the pdf is shown as raw:documents#show
page rendered by turbolinks. But unfortunately, the iframe just shows the first page of the pdf. I suspect this might be a scrolling issue.Thanks very much in advance for any hint you might have!