React Native opening a local file from webview - webview

After downloading a PDF or any other type of file, I'm having trouble opening it from a webview. Basically, I would like to be able to display a href pointed to the local file, e.g. - and then prompt the user to open it in an external application. Currently it seems to hang / not recognize the downloaded file.
The data in this file is currently base64 encoded. Can I send this binary data to an external app?

I needed to intercept the url using onShouldStartLoadWithRequest and use the Linking native module provided by react-native. More info here: https://facebook.github.io/react-native/docs/linking.html#opening-external-links

Related

iOS cannot preview RTF from React PWA

We have a React PWA where we initially download RTF-Documents and save them to an indexDB. We use createObjectURL and an a with a.click() to simulate a download when the file is requested by the User.
The mimetype is set to application/rtf in the createObjectURL call.
However, on iOS (with Safari) the default "view" operation shows the following:
This file cannot be previewed
It might be corrupted or of an unknown file format.
The same file works from our "normal" webapp (i.e. file is served from a backend server). I tried to set the headers exactly like our backend server does, but it either doesn't show the "view" Button at all or it shows the error.
Any ideas how to set up the calls, so iOS will show the RTF correctly?

Universal Links query string removed/lost while generating share link, IOS, ReactNative Share

Project workspace
Mobile Project: ReactNative 0.64.3 / Expo with Managed Workflow / IOS 14.6 / NPM
Sharing Library: ReactNative's default Share library.
Website/Domain: Statically hosted via S3, single page app built with TS/Gatsby. Caching handled with CloudFront.
Synopsis: I'm using universal links and query params to allow my users to share tickets. The Universal links are being stripped of all route params and query strings when the link is shared by the native sharing dialog. Using the COPY/PASTE function in the native sharing dialog always copies a complete link, which can be pasted anywhere and used successfully to open the app. The EMAIL option also works, opening Mail with the correct url string and autofilled as expected. The problem arrises when I try to share the link via iMessage. I'm running the project on an iPhone as a fully deployed Apple Testflight standalone app.
The app does download the AASA file on app install, which is statically hosted via an S3 bucket. I have verified its availability via postman and the online AASA validator here https://branch.io/resources/aasa-validator/
The app always opens when opening a valid universal link, such as when I manually type it into iMessage or other sharing medium -- email, etc. Because of this, I'm inclined to believe I have a problem with where the link string is being generated rather than the AASA system.
const ticketShare = (ticket: Ticket) => {
const link = Linking.createURL("www.sample.com/share_ticket", { //Expo Linking library
scheme: "https",
queryParams: {
...ticket
}
}).replaceAll("%25", "%"); //double encoding problem I have yet to properly fix.
console.log("link: ", link); //always the correct url here.
Share.share({ url: link }); // request to open the native sharing dialog activity. ('url' for ios)
};
Correct url is something like:
https://www.sample.com/share_ticket?my=query&params=here
Stripped url is something like:
https://www.sample.com/
sharing dialog image.
https://www.sketchappsources.com/resources/source-image/simple-share-actionsheet-ios-13-hugo.png
"COPY" actions always copy the correct url, "MAIL" works as well.
Using "MESSAGE" or any of the "recent" actions in the top row fails, sharing the base url only.
The title and website abbreviation at the top of the action sheet do render properly, pulling metadata/images from the website.
To make it more complicated, the share function does yield the correct url directly after a fresh install, but then never again. Console.logs always log the correct url.
I have tried react-native-share's library with the same results. (Wraps the same native bridge code?)
I have checked the react-native github page for issues related to this with no result. I have combed StackOverflow for a few days without results. Usually that means its something simple.. here's to hoping.
Anyone out there run into this issue? Thanks!

webview loaded pdf file from remotly then how to send this pdf file via mail and all that? (SWIFT 4)

I am a new developer in swift, so please help me.
I am open a pdf file from remote server through Alamofire, then i needed to send this opened pdf file in webview so how it can be possible to send via mail,whatsapp,etc.from my app.

Display flash file with URL in UIWebView: Obj C/swift

I have game URL-
https://nogs-gl.nyxinteractive.eu/game/?nogsgameid=70090&nogsoperatorid=268&nogscurrency=eur&nogslang=en_us&nogsmode=demo
URL is running well in my web browser.
I want to display this in my iOS app. Currently, I am doing that so by using native UIWebView but it's displaying the message as
What am I supposed to do for opening the given URL in my application?
iOS does not support Flash. It never has, and it never will. You cannot run flash content on iOS.

How to open a local file in Office on iOS

I've saved a file locally and want to open it in Word if installed. For example my file's URL is:
file:///var/mobile/Containers/Data/Application/{guid}/Library/Caches/MyFile.docx
My Office URL is:
ms-word:ofe|u|file:///var/mobile/Containers/Data/Application/{guid}/Library/Caches/MyFile.docx|p|my-protocol
When Word launches it says:
The link you clicked on is invalid and the document cannot be opened
However if I feed the original URL to a UIDocumentInteractionController it opens correctly.
Any ideas?
If you pass the URL to Word directly you are attempting to violate your Application Sandbox - Word doesn't have access to your App's directory, so it can't read the file.
You have to use the UIDocumentInteractionController to prompt the user to open the document in Word or you need to store the document somewhere that Word can read it (this would be external to your device - on a cloud store somewhere)

Resources