Skip to content

Comments

Use Copy instead of Move in FileSaver UI on iOS#2981

Merged
TheCodeTraveler merged 26 commits intoCommunityToolkit:mainfrom
matt-goldman:fix-macios-filepicker
Jan 8, 2026
Merged

Use Copy instead of Move in FileSaver UI on iOS#2981
TheCodeTraveler merged 26 commits intoCommunityToolkit:mainfrom
matt-goldman:fix-macios-filepicker

Conversation

@matt-goldman
Copy link
Contributor

@matt-goldman matt-goldman commented Dec 1, 2025

Description of Change

Updates the FileSaver maciOS implementation to use the new asCopy argument in the UIDocumentPickerViewController to tell the OS that you're saving a new file (not copying) when moving the temp file out of the sandobx to the users' desired location.

Linked Issues

PR Checklist

  • Has a linked Issue, and the Issue has been approved(bug) or Championed (feature/proposal)
  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard
  • Documentation created or updated: https://github.com/MicrosoftDocs/CommunityToolkit/pulls

Additional information

Only affects macOS and iOS. Screenshots show the resultant change on a physical iOS device:

IMG_3596 IMG_3598

Copilot AI review requested due to automatic review settings December 1, 2025 19:55
bijington
bijington previously approved these changes Dec 1, 2025
Copy link
Contributor

@bijington bijington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Matt. LGTM!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug in the FileSaver implementation for macOS and iOS by correctly configuring the UIDocumentPickerViewController to treat the operation as saving a new file rather than copying an existing one.

  • Updates the UIDocumentPickerViewController constructor call to include the asCopy: true parameter
  • Ensures the OS properly handles moving temporary files to user-selected locations during save operations

Ensures temporary directory used by the file picker is
always removed after the file selection is made, regardless
of success or failure. Also improves error handling when
a view controller cannot be retrieved.

Fixes CommunityToolkit#2460
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

TheCodeTraveler and others added 2 commits December 4, 2025 11:56
Ensures temporary directory used by the file picker is correctly removed on iOS.

Moves the directory removal to the completion handler of the view controller presentation, ensuring it's executed after the picker is dismissed.

Handles exceptions during file removal by re-throwing them after attempting to remove the temporary directory.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

…mplementation.macios.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings December 6, 2025 20:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings December 8, 2025 20:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

Copilot AI review requested due to automatic review settings January 6, 2026 08:55
@VladislavAntonyuk VladislavAntonyuk enabled auto-merge (squash) January 6, 2026 08:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

@TheCodeTraveler TheCodeTraveler changed the title Fix macios filepicker Use Copy instead of Move in FileSaver UI on iOS Jan 8, 2026
@TheCodeTraveler TheCodeTraveler added the breaking change This label is used for PRs that include a breaking change label Jan 8, 2026
TheCodeTraveler
TheCodeTraveler previously approved these changes Jan 8, 2026
Copy link
Collaborator

@TheCodeTraveler TheCodeTraveler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @matt-goldman!

Copilot AI review requested due to automatic review settings January 8, 2026 19:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@TheCodeTraveler TheCodeTraveler merged commit cab2374 into CommunityToolkit:main Jan 8, 2026
9 of 10 checks passed
@matt-goldman matt-goldman deleted the fix-macios-filepicker branch January 9, 2026 02:40
@github-actions github-actions bot locked and limited conversation to collaborators Jan 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

breaking change This label is used for PRs that include a breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] FileSaver iOS displays 'Move' instead of 'Save'

5 participants