diff --git a/src/FileProvider/Structs.cs b/src/FileProvider/Structs.cs new file mode 100644 index 000000000000..8dd8ec9c3a56 --- /dev/null +++ b/src/FileProvider/Structs.cs @@ -0,0 +1,25 @@ +#if MONOMAC +using System; +using System.Runtime.InteropServices; +using ObjCRuntime; + +namespace FileProvider { + + [NoiOS, NoMacCatalyst, Mac (12,0)] + [StructLayout (LayoutKind.Sequential)] + public struct NSFileProviderTypeAndCreator + { + public uint Type; + public uint Creator; + +#if !COREBUILD + public string GetTypeAsFourCC () + => Runtime.ToFourCCString (Type); + + public string GetCreatorAsFourCC() + => Runtime.ToFourCCString (Creator); +#endif + } + +} +#endif diff --git a/src/fileprovider.cs b/src/fileprovider.cs index d63d69cf3dce..b480190c484a 100644 --- a/src/fileprovider.cs +++ b/src/fileprovider.cs @@ -182,11 +182,17 @@ enum NSFileProviderError : long { OlderExtensionVersionRunning = -2003, NewerExtensionVersionFound = -2004, CannotSynchronize = -2005, -#if MONOMAC NonEvictableChildren = -2006, UnsyncedEdits = -2007, NonEvictable = -2008, -#endif + } + + [NoiOS, Mac (12,0), NoMacCatalyst] + [Native] + public enum NSFileProviderDomainRemovalMode : long { + RemoveAll = 0, + PreserveDirtyUserData = 1, + PreserveDownloadedUserData = 2, } [iOS (11,0)] @@ -203,7 +209,7 @@ interface NSFileProviderErrorKeys { [Field ("NSFileProviderErrorNonExistentItemIdentifierKey")] NSString NonExistentItemIdentifierKey { get; } - [NoiOS] + [iOS (15,0)] [Field ("NSFileProviderErrorItemKey")] NSString ItemKey { get; } } @@ -330,6 +336,10 @@ interface NSFileProviderDomain { [Notification] [Field ("NSFileProviderDomainDidChange")] NSString DidChange { get; } + + [NoWatch, NoTV, NoiOS, Mac (12, 0), NoMacCatalyst] + [NullAllowed, Export ("backingStoreIdentity")] + NSData BackingStoreIdentity { get; } } interface INSFileProviderEnumerationObserver { } @@ -542,6 +552,12 @@ interface NSFileProviderItem { [NoiOS] [NullAllowed, Export ("symlinkTargetPath")] string SymlinkTargetPath { get; } + +#if MONOMAC + [NoiOS, Mac (12, 0), NoMacCatalyst] + [Export ("typeAndCreator")] + NSFileProviderTypeAndCreator TypeAndCreator { get; } +#endif } [iOS (11,0)] @@ -716,6 +732,12 @@ interface NSFileProviderManager { [return: NullAllowed] NSDictionary GetRunTestingOperations (INSFileProviderTestingOperation[] operations, [NullAllowed] out NSError error); + [NoiOS, Mac (12,0), NoMacCatalyst] + [Async (ResultTypeName = "NSFileProviderRemoveDomainResult")] + [Static] + [Export ("removeDomain:mode:completionHandler:")] + void RemoveDomain (NSFileProviderDomain domain, NSFileProviderDomainRemovalMode mode, Action completionHandler); + } interface INSFileProviderPendingSetEnumerator { } @@ -815,6 +837,8 @@ enum NSFileProviderItemFields : ulong { ContentModificationDate = 1uL << 7, FileSystemFlags = 1uL << 8, ExtendedAttributes = 1uL << 9, + [Mac (12,0)] + TypeAndCreator = 1uL << 10, } [Mac (11,0)] @@ -826,9 +850,8 @@ enum NSFileProviderManagerDisconnectionOptions : ulong { Temporary = 1, } - [Mac (11,0)] + [iOS (15,0), Mac (11,0)] [Unavailable (PlatformName.MacCatalyst)][Advice ("This API is not available when using Catalyst on macOS.")] - [NoiOS] [Native][Flags] enum NSFileProviderFileSystemFlags : ulong { @@ -1002,9 +1025,7 @@ interface NSFileProviderDomainState { NSDictionary UserInfo { get; } } - [Advice ("This API is not available when using UIKit on macOS.")] - [Unavailable (PlatformName.MacCatalyst)] - [NoWatch, NoTV, NoiOS, Mac (11,3)] + [NoWatch, NoTV, iOS (15,0), Mac (12,0), NoMacCatalyst] [Flags] [Native] public enum NSFileProviderDomainTestingModes : ulong { @@ -1263,4 +1284,18 @@ interface NSFileProviderTestingCollisionResolution : NSFileProviderTestingOperat [Export ("renamedItem")] INSFileProviderItem RenamedItem { get; } } + + [NoWatch, NoTV, NoiOS, Mac (12,0), NoMacCatalyst] + [Protocol] + interface NSFileProviderUserInteractionSuppressing + { + [Abstract] + [Export ("setInteractionSuppressed:forIdentifier:")] + void SetInteractionSuppressed (bool suppression, string suppressionIdentifier); + + [Abstract] + [Export ("isInteractionSuppressedForIdentifier:")] + bool IsInteractionSuppressed (string suppressionIdentifier); + } + } diff --git a/src/frameworks.sources b/src/frameworks.sources index 1075fe315604..483a47f65f04 100644 --- a/src/frameworks.sources +++ b/src/frameworks.sources @@ -716,6 +716,9 @@ EXTERNALACCESSORY_API_SOURCES = \ # FileProvider +FILEPROVIDER_CORE_SOURCES = \ + FileProvider/Structs.cs \ + FILEPROVIDER_SOURCES = \ FileProvider/Compat.cs \ diff --git a/tests/xtro-sharpie/iOS-FileProvider.todo b/tests/xtro-sharpie/iOS-FileProvider.todo deleted file mode 100644 index 7c8c2c5d1fb7..000000000000 --- a/tests/xtro-sharpie/iOS-FileProvider.todo +++ /dev/null @@ -1,6 +0,0 @@ -!missing-enum! NSFileProviderDomainTestingModes not bound -!missing-enum! NSFileProviderFileSystemFlags not bound -!missing-enum-value! NSFileProviderError native value NSFileProviderErrorNonEvictable = -2008 not bound -!missing-enum-value! NSFileProviderError native value NSFileProviderErrorNonEvictableChildren = -2006 not bound -!missing-enum-value! NSFileProviderError native value NSFileProviderErrorUnsyncedEdits = -2007 not bound -!missing-field! NSFileProviderErrorItemKey not bound diff --git a/tests/xtro-sharpie/macOS-FileProvider.todo b/tests/xtro-sharpie/macOS-FileProvider.todo deleted file mode 100644 index bc1aa0bb4d48..000000000000 --- a/tests/xtro-sharpie/macOS-FileProvider.todo +++ /dev/null @@ -1,7 +0,0 @@ -## appended from unclassified file -!missing-enum! NSFileProviderDomainRemovalMode not bound -!missing-enum-value! NSFileProviderItemFields native value NSFileProviderItemTypeAndCreator = 1024 not bound -!missing-protocol! NSFileProviderUserInteractionSuppressing not bound -!missing-protocol-member! NSFileProviderItem::typeAndCreator not found -!missing-selector! +NSFileProviderManager::removeDomain:mode:completionHandler: not bound -!missing-selector! NSFileProviderDomain::backingStoreIdentity not bound