Closed aleksilahis closed 3 years ago
Steps to Reproduce Call showOpenWithDialog for different files one after the other.
How does that work? Are you doing
showOpenWithDialog(...)
showOpenWithDialog(...)
showOpenWithDialog(...)
showOpenWithDialog(...)
showOpenWithDialog(...)
Before waiting for the previous calls to be done?
Steps to Reproduce Call showOpenWithDialog for different files one after the other.
How does that work? Are you doing
showOpenWithDialog(...)
showOpenWithDialog(...)
showOpenWithDialog(...)
showOpenWithDialog(...)
showOpenWithDialog(...)
Before waiting for the previous calls to be done?
I'm calling showOpenWithDialog inside observables. Those are executed sequentially, so they should wait for showOpenWithDialog to be resolved. I will double-check my code and clarify reproduction steps once I'm back at the office and can use my Mac for further investigation. Just to mention, on Android the same code works fine and action for each file can be selected one by one.
I have now investigated this a little bit more and added sample code for reproduction.
Found a solution for this. Shortly: I added documentInteractionControllerDidDismissOpenInMenu
function to UiDocumentInteractionControllerDelegate and moved the return clause from line 119 into the callback function in this file https://github.com/pwlin/cordova-plugin-file-opener2/blob/master/src/ios/FileOpener2.m. May I create a pull request?
Hi @aleksilahis thank you very much for your work. I have merged this and pushed a new version 3.0.5
to npm. Can you please test if everything is ok?
@pwlin thank you! The functionality has been verified with a real device and simulators, so closing this issue.
Expected Behaviour
If showOpenWithDialog is called multiple times, the native "open in" menu is displayed for each files.
Actual Behaviour
The menu is displayed only for the first file. The following error is displayed in console:
2020-08-13 16:08:40.107951+0300 App[14160:747672] Warning: Attempt to present <_UIDICActivityViewController: 0x7faaaa92d800> on <Capacitor.CAPBridgeViewController: 0x7faaa960be90> which is already presenting <_UIDICActivityViewController: 0x7faaa98c7600>
So it doesn't wait until the menu is closed before attempting to open it for the next file(s).
Reproduce Scenario (including but not limited to)
Steps to Reproduce
Call showOpenWithDialog for different files one after the other.
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
iPad Pro (iOS 12.2) iPhone SE (2nd gen) simulator (iOS 13.6)
Cordova CLI info
Using this plugin with Capacitor (https://github.com/ionic-team/capacitor).
Versions:
@capacitor/cli: 2.4.0 @capacitor/core: 2.4.0 @capacitor/ios: 2.4.0
Plugin version
Here is the output:
"cordova-plugin-file-opener2": 3.0.4
Sample Code that illustrates the problem
Logs taken while reproducing problem