Skip to content
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

fix(dialog): do not create file copy for save file picker on iOS #2548

Open
wants to merge 2 commits into
base: v2
Choose a base branch
from

Conversation

nashaofu
Copy link
Contributor

@nashaofu nashaofu commented Mar 18, 2025

On iOS the file picker returns a security scoped resource file path on the save() file picker: https://developer.apple.com/documentation/uikit/uidocumentpickerviewcontroller?language=objc#Work-with-external-documents

this means we can't directly access it without calling startAccessingSecurityScopedResource

this PR changes the plugin to not access the save file early, leaving that to the user and returning its actual path

fix #2089

@nashaofu nashaofu requested a review from a team as a code owner March 18, 2025 01:15
Copy link
Contributor

github-actions bot commented Mar 18, 2025

Package Changes Through b4cfd60

There are 6 changes which include http with patch, http-js with patch, deep-link with patch, deep-link-js with patch, fs with patch, fs-js with patch

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
api-example 2.0.23 2.0.24
api-example-js 2.0.19 2.0.20
deep-link-example-js 2.2.0 2.2.1
deep-link 2.2.0 2.2.1
deep-link-js 2.2.0 2.2.1
fs 2.2.0 2.2.1
fs-js 2.2.0 2.2.1
dialog 2.2.0 2.2.1
dialog-js 2.2.0 2.2.1
http 2.4.2 2.4.3
http-js 2.4.2 2.4.3
persisted-scope 2.2.0 2.2.1
single-instance 2.2.2 2.2.3

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@amrbashir amrbashir requested a review from lucasfernog March 18, 2025 07:49
On iOS the file picker returns a security scoped resource file path on the save() file picker: https://developer.apple.com/documentation/uikit/uidocumentpickerviewcontroller?language=objc#Work-with-external-documents

this means we can't directly access it without calling [startAccessingSecurityScopedResource](https://developer.apple.com/documentation/foundation/nsurl/1417051-startaccessingsecurityscopedreso?language=objc)

this PR changes the plugin to not access the save file early, leaving that to the user and returning its actual path
@lucasfernog lucasfernog changed the title fix: fix the issue of inconsistency between selected files and return… fix(dialog): do not create file copy for save file picker on iOS Mar 18, 2025
@lucasfernog
Copy link
Member

nice catch. I think we still need some improvements here, for instance now I couldn't access the file without https://developer.apple.com/documentation/foundation/nsurl/1417051-startaccessingsecurityscopedreso?language=objc

I think we should add that to the FS plugin too

@nashaofu
Copy link
Contributor Author

Add two methods to fs startAccessingScopedResource and stopAccessingScopedResource? Or I hope to automatically add these two methods before and after the fs call

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] Using plugin-dialog and plugin-fs to write file on iOS is ineffective.
2 participants