Skip to content
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

[FileProvider] Add support for Xcode13 beta 4. #12300

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/FileProvider/Structs.cs
Original file line number Diff line number Diff line change
@@ -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
rolfbjarne marked this conversation as resolved.
Show resolved Hide resolved
{
public uint Type;
public uint Creator;

#if !COREBUILD
public string GetTypeAsFourCC ()
=> Runtime.ToFourCCString (Type);

public string GetCreatorAsFourCC()
=> Runtime.ToFourCCString (Creator);
#endif
}

}
#endif
51 changes: 43 additions & 8 deletions src/fileprovider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -203,7 +209,7 @@ interface NSFileProviderErrorKeys {
[Field ("NSFileProviderErrorNonExistentItemIdentifierKey")]
NSString NonExistentItemIdentifierKey { get; }

[NoiOS]
[iOS (15,0)]
[Field ("NSFileProviderErrorItemKey")]
NSString ItemKey { get; }
}
Expand Down Expand Up @@ -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 { }
Expand Down Expand Up @@ -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)]
Expand Down Expand Up @@ -716,6 +732,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 +837,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 +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
{
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}

}
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.