-
Notifications
You must be signed in to change notification settings - Fork 405
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
Add FileSaverResult
and FolderPickerResult
, Fix Initial folder on Android
#1009
Conversation
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.
@VladislavAntonyuk I've a couple of requests and suggestions (:
src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.android.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.android.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.android.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/Essentials/FileSaver/IFileSaver.shared.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/Essentials/FileSaver/IFileSaver.shared.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/Essentials/FolderPicker/FolderPickerImplementation.android.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/Essentials/FolderPicker/IFolderPicker.shared.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/Essentials/FolderPicker/IFolderPicker.shared.cs
Outdated
Show resolved
Hide resolved
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 Vlad! Just a thought about adding an .EnsureSuccess()
method, similar to HttpResponseMethod.EnsureSuccessStatusCode()
src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverResult.shared.cs
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverResult.shared.cs
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/Essentials/FolderPicker/FolderPickerResult.shared.cs
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/Essentials/FolderPicker/FolderPickerImplementation.android.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Maui.Core/Essentials/FileSaver/FileSaverImplementation.android.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com>
Hey Vlad! After giving this some thought, let's re-write the existing I know it's a breaking change, but having one API that returns Plus, we have to bump our major version for our next release anyways because of a breaking change we've already merged in a different PR. Here's what I'm thinking:
Does that make sense? For example, public Task<FileSaverResult> SaveAsync(string fileName, Stream stream, CancellationToken cancellationToken)
{
try
{
cancellationToken.ThrowIfCancellationRequested();
// existing SaveAsync logic here
return new FileSaverResult(path, null);
}
catch (Exception e)
{
return new FileSaverResult(null, e);
}
} |
Hey Vlad! What do you think about making changing
I think it might be confusing to devs to see both We'd also have to remove the example from the sample app that demonstrates |
@brminnick those are |
@pictos Good point 💯 |
FileSaverResult
and FolderPickerResult
, Fix Initial folder on Android
…olkit/Maui into dialogs-safe-methods
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 Vlad!!
@bijington Are you able to help update the docs for this PR? I've added
do not merge
We modified the return Type of Modified APIspublic interface IFileSaver
{
Task<FileSaverResult> SaveAsync(string initialPath, string fileName, Stream stream, CancellationToken cancellationToken);
Task<FileSaverResult> SaveAsync(string fileName, Stream stream, CancellationToken cancellationToken);
}
public class FileSaver
{
Task<FolderPickerResult> PickAsync(string initialPath, CancellationToken cancellationToken);
Task<FolderPickerResult> PickAsync(CancellationToken cancellationToken);
}
^@jfversluis FYI - these are breaking changes that we'll need to note in our release notes for v5.0.0 |
@brminnick , @bijington updated docs MicrosoftDocs/CommunityToolkit#234 |
Description of Change
Add new safe methods that return result instead of throwing exception.
A;so fixes initial path on Android
PR Checklist
approved
(bug) orChampioned
(feature/proposal)main
at time of PRAdditional information