-
Notifications
You must be signed in to change notification settings - Fork 751
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
Feat/filesavepicker #3380
Conversation
…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.
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 |
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.
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 |
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.
public class OnActivityResultArgs | |
public class ActivityResultArgs |
Also make this class internal
namespace Windows.Storage.Pickers | ||
{ | ||
[Activity(ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize)] | ||
class AsyncFileSaveActivity : AsyncActivity |
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.
class AsyncFileSaveActivity : AsyncActivity | |
internal class AsyncFileSaveActivity : AsyncActivity |
src/Uno.UWP/Uno.csproj
Outdated
@@ -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" /> |
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.
This is not needed
You can use logic for SettingsIdentifier from #2896. |
…wnload via cache manager
buffer[i] = Module.getValue(dataPtr + i, "i8"); | ||
} | ||
|
||
var a = window.document.createElement('a'); |
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.
Codacy found an issue: Identifier 'a' is never reassigned; use 'const' instead of 'var'.
export class FileSavePicker { | ||
public static SaveAs(fileName: string, dataPtr: any, size: number): void { | ||
|
||
var buffer = new Uint8Array(size); |
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.
Codacy found an issue: Identifier 'buffer' is never reassigned; use 'const' instead of 'var'.
} | ||
|
||
var a = window.document.createElement('a'); | ||
var blob = new Blob([buffer]); |
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.
Codacy found an issue: Identifier 'blob' is never reassigned; use 'const' instead of 'var'.
private async static Task<FileUpdateStatus> DownloadFile(IStorageFile file) | ||
{ | ||
var stream = await file.OpenStreamForReadAsync(); | ||
var data = new byte[(int)stream.Length]; |
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.
Codacy found an issue: Remove this useless assignment to local variable 'data'.
@@ -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__ |
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.
You'll need to rebase on latest, this has changed significantly
var temporaryFolder = new StorageFolder(LocalCachePath); | ||
if (!Directory.Exists(LocalCachePath)) | ||
{ | ||
temporaryFolder.MakePersistent(); |
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.
Why do you need this ? The existing folders from Windows.Storage.ApplicationData.Current
may already be used to store information like this.
<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> | ||
|
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.
You can remove
GitHub Issue (If applicable): #
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Enhancement - new feature
Issue #3215
PR Checklist
Please check if your PR fulfills the following requirements:
Screenshots Compare Test Run
results.Other information
Internal Issue (If applicable):
#3215