Closed daryll-fourie closed 6 years ago
Yes, it is different on the simulator and on the real machine.
Okay, thx for the speedy response. I will make sure to test this on an actual device.
Regards, Daryll Fourie
I just tested this on an iPhone 5s and it also opens that "Share" view.
Please see the attached screenshot:
I tested this with a .jpeg and a .pdf file.
Hey, do you perhaps have any feedback regarding this?
If you want, I can create a pull request and see if I can fix the issue on my side. Let me know if I can help you out :)
I'm an Android dev actually but I don't mind working with XCode every now and then.
Regards, Daryll
This may be a mechanism issue, and can be previewed if the third-party application is open to the public.
Unfortunately I cannot share the third-party application as it is a company private in-house app.
When you say a mechanism issue, what do you mean with that?
Currently, I just have a .jpeg which is saved in the getApplicationDocumentsDirectory
, which is the default Documents directory, is that correct?
I just checked on my iOS testing device, the path where the file is stored is : /var/mobile/Containers/Data/Application/15EB2091-D8A2-42FF-8379-B3A9CC511F73/Documents/Docs/58/doge.jpeg
This is the Documents directory which only the app can access (https://flutter.io/cookbook/persistence/reading-writing-files/), is this maybe the problem? That the iOS open file app cannot access the image?
Where did you store your files on the iOS device when testing this with flutter?
@daryll-fourie I'm facing the same issue in my flutter app, did you find any workaround? Thanks in advance!
The same issue on iOS. The bottom sheet is displaying options. However, I can't open any files.
Everything working on Android.
Hi @daniel-mf & @rtoshmukhamedov , unfortunately I haven't been able to find a solution to this problem. If I do find the problem, I will update this issue as soon as possible.
May be UIDocumentInteractionController presentpreview should be used?
I think instead of using presentOpenInMenuFromRect
we should use presentPreviewAnimated
I just followed this tutorial and it works like a charm.
I'm gonna give that a try.
That's awesome @daniel-mf , well done! @crazecoder , if this works will you please merge it into your master branch?
If am not mistaken, as shown in presentPreviewAnimated
docs, the UIViewController
should extend UIDocumentInteractionControllerDelegate
and implement documentInteractionControllerViewControllerForPreview
I don't know if that's possible since UIViewController
is managed by the flutter framework.
Docs for presentPreviewAnimated
:
// Bypasses the menu and opens the full screen preview window for the item at URL. Returns NO if the item could not be previewed.
// Note that you must implement the delegate method documentInteractionControllerViewControllerForPreview: to preview the document.
I was able to make it work as expected (at least for the few tests I've done) Took as example this plugin DocumentsPickerPlugin I have only tested PDF files, working just fine!
Hi @daniel-mf , what is the latest status of you progress? I see you've made various commits to your fork, including some Android changes which you rolled back. Is the iOS part working as expected now? I will try and reference your fork locally then I can test a few other file types (other than '.pdf') from my side.
Hey @daryll-fourie, I've tested even with zip files, all working fine on iOS! You can reference my fork adding this to the dependencies section of your pubspec.yaml
open_file:
git:
url: git://github.com/daniel-mf/open_file.git
Just to note, I also changed Android code for the result to be asynchronous and removed the static Context property to avoid memory leak (Android Studio shows a warning about the leak).
@daniel-mf , thanks! I changed my reference in the pubspec.yaml and tested it successfully on Android. I do however get the following error & warning when compiling for iOS -->
@daniel-mf the above error I have might be as result of the version of my Xcode. It is Version 9.4.1 (9F2000), what is yours?
@daryll-fourie just commited a fix for that. Please upgrade localy and check if it is working.
@daniel-mf works like a charm!! Well freaking done man! :) I tested it with the following files and it worked (on my device) : pdf, jpg & png. I'm pretty sure other file types will work too as long as the OS can handle it! Whoohooo!!! Thank you so much @daniel-mf !
@crazecoder do you perhaps want to merge his branch into yours?
Thanks a lot @daniel-mf. It is working well.
@crazecoder Can you merge his changes?
yeah,no problem
I have used this package, but it does not open the file manager app for .zip files on Android. Additionally, it opens the downloaded file in full screen immediately after downloading, without showing the corresponding app on iOS.
https://github.com/user-attachments/assets/e775847c-7754-4f64-81f5-de767704c499
Hi,
First of all, great work on the plugin! It really helped me a lot with a Flutter App I'm currently busy with.
I just have a question regarding the iOS implementation: I noticed that in Android, when calling
open
, it actually opens the .jpeg/.pdf in the relevant app on the device. When callingopen
on an iOS simulator, it opens a dialog from the bottom giving me the options to "Share" the file via AirDrop, ICloud Photo Sharing and also a "Save to Files" option. Is this standard behaviour?I would expect it to just open the .jpeg/.pdf in the relevant app, just like in Android?
I haven't been able to test this on an actual iOS device yet, so it might be a simulator issue. I just wanted to confirm this behaviour. Please let me know if this is how the plugin should work or am I missing something here?
Keep up the great work!
Regards, Daryll Fourie