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

Feat/filesavepicker #3380

Closed
wants to merge 9 commits into from
Closed

Feat/filesavepicker #3380

wants to merge 9 commits into from

Conversation

alextrepa
Copy link
Contributor

GitHub Issue (If applicable): #

PR Type

What kind of change does this PR introduce?

  • Feature
  • Documentation content changes

What is the current behavior?

Enhancement - new feature
Issue #3215

PR Checklist

Please check if your PR fulfills the following requirements:

Other information

Internal Issue (If applicable):
#3215

Alex added 4 commits May 22, 2020 15:42
…on and return a URI

Still WIP, the StorageFile returned is useless and cannot be written to.  It's due to the way Android used Uri instead of file path to handle files.
@gitpod-io
Copy link

gitpod-io bot commented Jun 16, 2020

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Alex seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

{

[Activity(ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize)]
public class AsyncActivity : Activity
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be internal

/// <param name="ct">CancellationToken</param>
/// <param name="intent">The Intent you want to send</param>
/// <param name="requestCode">A specific Response code, this is useful if you send more than one type of request in parallel</param>
public class OnActivityResultArgs
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public class OnActivityResultArgs
public class ActivityResultArgs

Also make this class internal

namespace Windows.Storage.Pickers
{
[Activity(ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize)]
class AsyncFileSaveActivity : AsyncActivity
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
class AsyncFileSaveActivity : AsyncActivity
internal class AsyncFileSaveActivity : AsyncActivity

@@ -44,17 +44,18 @@
<PackageReference Include="Uno.SourceGenerationTasks" />
<PackageReference Include="Uno.Core" />
<PackageReference Include="Uno.MonoAnalyzers" />
<PackageReference Include="Xamarin.Forms" Version="4.6.0.800" />
Copy link
Member

Choose a reason for hiding this comment

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

This is not needed

@pkar70
Copy link
Contributor

pkar70 commented Jun 17, 2020

You can use logic for SettingsIdentifier from #2896.

buffer[i] = Module.getValue(dataPtr + i, "i8");
}

var a = window.document.createElement('a');
Copy link
Contributor

Choose a reason for hiding this comment

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

export class FileSavePicker {
public static SaveAs(fileName: string, dataPtr: any, size: number): void {

var buffer = new Uint8Array(size);
Copy link
Contributor

Choose a reason for hiding this comment

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

}

var a = window.document.createElement('a');
var blob = new Blob([buffer]);
Copy link
Contributor

Choose a reason for hiding this comment

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

private async static Task<FileUpdateStatus> DownloadFile(IStorageFile file)
{
var stream = await file.OpenStreamForReadAsync();
var data = new byte[(int)stream.Length];
Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -2,12 +2,12 @@
#pragma warning disable 114 // new keyword hiding
namespace Windows.Storage.Pickers
{
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __MACOS__
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __MACOS__
Copy link
Member

Choose a reason for hiding this comment

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

You'll need to rebase on latest, this has changed significantly

var temporaryFolder = new StorageFolder(LocalCachePath);
if (!Directory.Exists(LocalCachePath))
{
temporaryFolder.MakePersistent();
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need this ? The existing folders from Windows.Storage.ApplicationData.Current may already be used to store information like this.

Comment on lines +42 to +52
<ItemGroup>
<None Remove="Storage\CachedFileManager.wasm.cs" />
<None Remove="Storage\Pickers\FileSavePicker.wasm.cs" />
</ItemGroup>

<ItemGroup>
<UpToDateCheckInput Remove="ActivityResultArgs.Android.cs" />
<UpToDateCheckInput Remove="Storage\CachedFileManager.wasm.cs" />
<UpToDateCheckInput Remove="Storage\Pickers\FileSavePicker.wasm.cs" />
</ItemGroup>

Copy link
Member

Choose a reason for hiding this comment

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

You can remove

@alextrepa alextrepa closed this Jul 27, 2020
@alextrepa alextrepa deleted the feat/filesavepicker branch August 21, 2020 16:34
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.

5 participants