From acaa7b6d098afbd992990353eb8681d7e450831e Mon Sep 17 00:00:00 2001 From: Martin Zikmund Date: Thu, 18 Mar 2021 01:27:45 +0100 Subject: [PATCH] feat: Extension to allow for FileSavePicker implementation --- .../3.0.0.0/Windows.Storage.Pickers/FileSavePicker.cs | 6 +++--- src/Uno.UWP/Storage/Pickers/FileSavePicker.cs | 2 +- .../{FileSavePicker.skia.cs => FileSavePicker.skiaiOS.cs} | 6 ++++-- ...xtension.skia.cs => IFileSavePickerExtension.skiaiOS.cs} | 6 ++++-- 4 files changed, 12 insertions(+), 8 deletions(-) rename src/Uno.UWP/Storage/Pickers/{FileSavePicker.skia.cs => FileSavePicker.skiaiOS.cs} (81%) rename src/Uno.UWP/Storage/Pickers/{Internal/IFileSavePickerExtension.skia.cs => IFileSavePickerExtension.skiaiOS.cs} (67%) diff --git a/src/Uno.UWP/Generated/3.0.0.0/Windows.Storage.Pickers/FileSavePicker.cs b/src/Uno.UWP/Generated/3.0.0.0/Windows.Storage.Pickers/FileSavePicker.cs index 9c678150809b..dea5bd19faba 100644 --- a/src/Uno.UWP/Generated/3.0.0.0/Windows.Storage.Pickers/FileSavePicker.cs +++ b/src/Uno.UWP/Generated/3.0.0.0/Windows.Storage.Pickers/FileSavePicker.cs @@ -2,7 +2,7 @@ #pragma warning disable 114 // new keyword hiding namespace Windows.Storage.Pickers { -#if false || __IOS__ || NET461 || false || false || __NETSTD_REFERENCE__ || false +#if false || false || NET461 || false || false || __NETSTD_REFERENCE__ || false [global::Uno.NotImplemented] #endif public partial class FileSavePicker @@ -140,7 +140,7 @@ public string EnterpriseId } #endif -#if false || __IOS__ || NET461 || false || false || __NETSTD_REFERENCE__ || false +#if false || false || NET461 || false || false || __NETSTD_REFERENCE__ || false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public FileSavePicker() { @@ -173,7 +173,7 @@ public void PickSaveFileAndContinue() // Forced skipping of method Windows.Storage.Pickers.FileSavePicker.SuggestedFileName.get // Forced skipping of method Windows.Storage.Pickers.FileSavePicker.SuggestedFileName.set -#if false || __IOS__ || NET461 || false || false || __NETSTD_REFERENCE__ || false +#if false || false || NET461 || false || false || __NETSTD_REFERENCE__ || false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public global::Windows.Foundation.IAsyncOperation PickSaveFileAsync() { diff --git a/src/Uno.UWP/Storage/Pickers/FileSavePicker.cs b/src/Uno.UWP/Storage/Pickers/FileSavePicker.cs index a0ac48ba529a..7e0118725e71 100644 --- a/src/Uno.UWP/Storage/Pickers/FileSavePicker.cs +++ b/src/Uno.UWP/Storage/Pickers/FileSavePicker.cs @@ -57,7 +57,7 @@ public string CommitButtonText set => _commitButtonText = value ?? throw new ArgumentNullException(nameof(value)); } -#if __SKIA__ || __MACOS__ || __WASM__ || __ANDROID__ +#if __SKIA__ || __MACOS__ || __WASM__ || __ANDROID__ || __IOS__ public FileSavePicker() { InitializePlatform(); diff --git a/src/Uno.UWP/Storage/Pickers/FileSavePicker.skia.cs b/src/Uno.UWP/Storage/Pickers/FileSavePicker.skiaiOS.cs similarity index 81% rename from src/Uno.UWP/Storage/Pickers/FileSavePicker.skia.cs rename to src/Uno.UWP/Storage/Pickers/FileSavePicker.skiaiOS.cs index 3981cb047dcd..61bf7ec4a063 100644 --- a/src/Uno.UWP/Storage/Pickers/FileSavePicker.skia.cs +++ b/src/Uno.UWP/Storage/Pickers/FileSavePicker.skiaiOS.cs @@ -1,4 +1,5 @@ -#nullable enable +#if __IOS__ || __SKIA__ +#nullable enable using System; using System.Threading; @@ -18,10 +19,11 @@ public partial class FileSavePicker { if (_fileSavePickerExtension == null) { - throw new NotSupportedException("FileOpenPicker is not supported on this target."); + throw new NotSupportedException("FileSavePicker extension is not registered."); } return await _fileSavePickerExtension.PickSaveFileAsync(token); } } } +#endif diff --git a/src/Uno.UWP/Storage/Pickers/Internal/IFileSavePickerExtension.skia.cs b/src/Uno.UWP/Storage/Pickers/IFileSavePickerExtension.skiaiOS.cs similarity index 67% rename from src/Uno.UWP/Storage/Pickers/Internal/IFileSavePickerExtension.skia.cs rename to src/Uno.UWP/Storage/Pickers/IFileSavePickerExtension.skiaiOS.cs index 7741006f2f55..f92d0d9bf482 100644 --- a/src/Uno.UWP/Storage/Pickers/Internal/IFileSavePickerExtension.skia.cs +++ b/src/Uno.UWP/Storage/Pickers/IFileSavePickerExtension.skiaiOS.cs @@ -1,4 +1,5 @@ -#nullable enable +#if __SKIA__ || __IOS__ +#nullable enable using System.Threading.Tasks; using System.Threading; @@ -6,8 +7,9 @@ namespace Uno.Extensions.Storage.Pickers { - internal interface IFileSavePickerExtension + public interface IFileSavePickerExtension { Task PickSaveFileAsync(CancellationToken token); } } +#endif