Skip to content

Commit

Permalink
[FileProvider] Add support for Xcode13 beta 4. (#12300)
Browse files Browse the repository at this point in the history
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
  • Loading branch information
mandel-macaque and rolfbjarne committed Aug 2, 2021
1 parent d506a13 commit 0f15240
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 21 deletions.
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
{
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.

1 comment on commit 0f15240

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Tests failed catastrophically on Build (no summary found). 🔥

Result file $(TEST_SUMMARY_PATH) not found.

Pipeline on Agent
[FileProvider] Add support for Xcode13 beta 4. (#12300)

Please sign in to comment.