Skip to content

Commit

Permalink
[FileProvider] Add support for Xcode13 beta 4.
Browse files Browse the repository at this point in the history
  • Loading branch information
mandel-macaque committed Jul 29, 2021
1 parent 448cc6e commit 72c9e22
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 20 deletions.
18 changes: 18 additions & 0 deletions src/FileProvider/Structs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#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;
}

}
#endif
54 changes: 47 additions & 7 deletions src/fileprovider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,18 @@ enum NSFileProviderError : long {
OlderExtensionVersionRunning = -2003,
NewerExtensionVersionFound = -2004,
CannotSynchronize = -2005,
#if MONOMAC
NonEvictableChildren = -2006,
UnsyncedEdits = -2007,
NonEvictable = -2008,
#endif
}

[Unavailable (PlatformName.MacCatalyst)]
[NoiOS, Mac (12,0), NoMacCatalyst]
[Native, Advice ("This API is not available when using UIKit on macOS.")]
public enum NSFileProviderDomainRemovalMode : long {
RemoveAll = 0,
PreserveDirtyUserData = 1,
PreserveDownloadedUserData = 2,
}

[iOS (11,0)]
Expand All @@ -203,7 +210,7 @@ interface NSFileProviderErrorKeys {
[Field ("NSFileProviderErrorNonExistentItemIdentifierKey")]
NSString NonExistentItemIdentifierKey { get; }

[NoiOS]
[iOS (15,0)]
[Field ("NSFileProviderErrorItemKey")]
NSString ItemKey { get; }
}
Expand Down Expand Up @@ -330,6 +337,11 @@ interface NSFileProviderDomain {
[Notification]
[Field ("NSFileProviderDomainDidChange")]
NSString DidChange { get; }

[NoWatch, NoTV, NoiOS, Mac (12, 0), NoMacCatalyst]
[Advice ("This API is not available when using UIKit on macOS.")]
[NullAllowed, Export ("backingStoreIdentity")]
NSData BackingStoreIdentity { get; }
}

interface INSFileProviderEnumerationObserver { }
Expand Down Expand Up @@ -542,6 +554,13 @@ interface NSFileProviderItem {
[NoiOS]
[NullAllowed, Export ("symlinkTargetPath")]
string SymlinkTargetPath { get; }

#if MONOMAC
[NoiOS, Mac (12, 0), NoMacCatalyst]
[Advice ("This API is not available when using UIKit on macOS.")]
[Export ("typeAndCreator")]
NSFileProviderTypeAndCreator TypeAndCreator { get; }
#endif
}

[iOS (11,0)]
Expand Down Expand Up @@ -716,6 +735,12 @@ interface NSFileProviderManager {
[return: NullAllowed]
NSDictionary<INSFileProviderTestingOperation, NSError> 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<NSUrl, NSError> completionHandler);

}

interface INSFileProviderPendingSetEnumerator { }
Expand Down Expand Up @@ -815,6 +840,8 @@ enum NSFileProviderItemFields : ulong {
ContentModificationDate = 1uL << 7,
FileSystemFlags = 1uL << 8,
ExtendedAttributes = 1uL << 9,
[Mac (12,0)
TypeAndCreator = 1uL << 10,
}

[Mac (11,0)]
Expand All @@ -826,9 +853,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
{
Expand Down Expand Up @@ -1003,8 +1029,7 @@ interface NSFileProviderDomainState {
}

[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 {
Expand Down Expand Up @@ -1263,4 +1288,19 @@ interface NSFileProviderTestingCollisionResolution : NSFileProviderTestingOperat
[Export ("renamedItem")]
INSFileProviderItem RenamedItem { get; }
}

[NoWatch, NoTV, NoiOS, Mac (12,0), NoMacCatalyst]
[Protocol, Advice ("This API is not available when using UIKit on macOS.")]
[BaseType (typeof (NSObject))]
interface NSFileProviderUserInteractionSuppressing
{
[Abstract]
[Export ("setInteractionSuppressed:forIdentifier:")]
void SetInteractionSuppressed (bool suppression, string suppressionIdentifier);

[Abstract]
[Export ("isInteractionSuppressedForIdentifier:")]
bool IsInteractionSuppressed (string suppressionIdentifier);
}

}
3 changes: 3 additions & 0 deletions src/frameworks.sources
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,9 @@ EXTERNALACCESSORY_API_SOURCES = \

# FileProvider

FILEPROVIDER_CORE_SOURCES = \
FileProvider/Structs.cs \

FILEPROVIDER_SOURCES = \
FileProvider/Compat.cs \

Expand Down
6 changes: 0 additions & 6 deletions tests/xtro-sharpie/iOS-FileProvider.todo

This file was deleted.

7 changes: 0 additions & 7 deletions tests/xtro-sharpie/macOS-FileProvider.todo

This file was deleted.

0 comments on commit 72c9e22

Please sign in to comment.