-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Files opened by "Copy to" on iOS are not re-openable #3
Conversation
If the destination is not a security-scoped resource then "unable to access" will not be true
Now this PR fixes #4 as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, looks good, just two small things.. see my inline comments and let me know what you think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, lgtm 👍️
Thanks for merging. But somehow I don't see it in the master branch. |
oops sorry.. no idea how that happened.. i think i've did one force push too many.. |
On iOS, files can be opened from other apps in two ways:
application(_:open:options:)
as an "open in place" security-scoped resourceoptions
map containsUIApplicationOpenURLOptionsOpenInPlaceKey: true
application(_:open:options:)
as a regular (non-security-scoped) file URIoptions
map containsUIApplicationOpenURLOptionsOpenInPlaceKey: false
in my observation (could hypothetically havenil
or the key might be absent)Previously, I thought that with correct setup (proper keys in Info.plist), all apps would be able to "Open In", but it turns out that some, in particular Google Drive, can never "Open In" but only offer "Copy To", regardless of the target application and its capabilities.
file_picker_writable currently handles receiving "Copy To" files OK: it ignores the failure to obtain a security scope in
_prepareUrlForReading
:file_picker_writable/ios/Classes/SwiftFilePickerWritablePlugin.swift
Lines 188 to 198 in 72470d0
But when trying to reopen a bookmark obtained from such a file, it fails due to strict checking in
readFile
:file_picker_writable/ios/Classes/SwiftFilePickerWritablePlugin.swift
Lines 104 to 106 in 72470d0