diff --git a/src/Uno.UWP/Storage/CachedFileManager.Interop.wasm.cs b/src/Uno.UWP/Storage/CachedFileManager.Interop.wasm.cs deleted file mode 100644 index d16ea6686a5c..000000000000 --- a/src/Uno.UWP/Storage/CachedFileManager.Interop.wasm.cs +++ /dev/null @@ -1,13 +0,0 @@ -#if NET7_0_OR_GREATER -using System.Runtime.InteropServices.JavaScript; - -namespace __Windows.Storage -{ - internal partial class CachedFileManager - { - internal static partial class NativeMethods - { - } - } -} -#endif \ No newline at end of file diff --git a/src/Uno.UWP/Storage/CachedFileManager.wasm.cs b/src/Uno.UWP/Storage/CachedFileManager.wasm.cs index a9f246703abb..a3877a9d4857 100644 --- a/src/Uno.UWP/Storage/CachedFileManager.wasm.cs +++ b/src/Uno.UWP/Storage/CachedFileManager.wasm.cs @@ -7,7 +7,7 @@ using Windows.Storage.Provider; #if NET7_0_OR_GREATER -using NativeMethods = __Windows.Storage.CachedFileManager.NativeMethods; +using NativeMethods = __Windows.Storage.Pickers.FileSavePicker.NativeMethods; #endif namespace Windows.Storage @@ -31,7 +31,11 @@ private static async Task CompleteUpdatesTaskAsync(IStorageFil try { +#if NET7_0_OR_GREATER + NativeMethods.SaveAs(file.Name, pinnedData, data.Length); +#else WebAssemblyRuntime.InvokeJS($"Windows.Storage.Pickers.FileSavePicker.SaveAs('{file.Name}', {pinnedData}, {data.Length})"); +#endif } finally { diff --git a/src/Uno.UWP/Storage/Pickers/FileSavePicker.Interop.wasm.cs b/src/Uno.UWP/Storage/Pickers/FileSavePicker.Interop.wasm.cs index 93354c5968d9..8eb1ce14eb7a 100644 --- a/src/Uno.UWP/Storage/Pickers/FileSavePicker.Interop.wasm.cs +++ b/src/Uno.UWP/Storage/Pickers/FileSavePicker.Interop.wasm.cs @@ -15,6 +15,9 @@ internal static partial class NativeMethods [JSImport($"{JsType}.nativePickSaveFileAsync")] internal static partial Task PickSaveFileAsync(bool showAll, string fileTypeMap, string suggestedFileName, string id, string startIn); + + [JSImport($"{JsType}.SaveAs")] + internal static partial void SaveAs(string fileName, nint pData, int length); } } }