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

[macos10.13-beta1] FinderSync and MediaLibrary bindings #2219

Merged
merged 15 commits into from
Jun 28, 2017
40 changes: 39 additions & 1 deletion src/findersync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

#if XAMCORE_2_0
namespace XamCore.FinderSync {
delegate void GetValuesCompletionHandler (NSDictionary<NSString, NSObject> values, NSError error);

[Mac (10, 10, onlyOn64: true)]
[BaseType (typeof(NSExtensionContext))]
interface FIFinderSyncController : NSSecureCoding, NSCopying
Expand All @@ -27,6 +29,24 @@ interface FIFinderSyncController : NSSecureCoding, NSCopying

[NullAllowed, Export ("selectedItemURLs")]
NSUrl[] SelectedItemURLs { get; }

[Mac (10,13, onlyOn64 : true)]
[Export ("lastUsedDateForItemWithURL:")]
[return: NullAllowed]
NSDate GetLastUsedDate (NSUrl itemUrl);

[Mac (10,13, onlyOn64 : true)]
[Async, Export ("setLastUsedDate:forItemWithURL:completion:")]
void SetLastUsedDate (NSDate lastUsedDate, NSUrl itemUrl, Action<NSError> completion);

[Mac (10,13, onlyOn64 : true)]
[Export ("tagDataForItemWithURL:")]
[return: NullAllowed]
NSData GetTagData (NSUrl itemUrl);

[Async, Mac (10,13, onlyOn64 : true)]
[Export ("setTagData:forItemWithURL:completion:")]
void SetTagData ([NullAllowed] NSData tagData, NSUrl itemUrl, Action<NSError> completion);
}

[Mac (10, 10, onlyOn64: true)]
Expand Down Expand Up @@ -54,7 +74,25 @@ interface FIFinderSyncProtocol

[Export ("toolbarItemToolTip")]
string ToolbarItemToolTip { get; }
}

[Mac (10,13, onlyOn64 : true)]
[Export ("exportedObjectForMessageInterface:itemURL:error:")]
NSObject GetExportedObject (NSFileProviderMessageInterface messageInterface, NSUrl itemUrl, [NullAllowed] out NSError error);

[Mac (10,13, onlyOn64 : true)]
[Export ("supportedServiceNamesForItemWithURL:")]
string[] SupportedServiceNames (NSUrl itemUrl);

#if FALSE // TODO: Activate after 10.13 foundation APIs have been merged. Bug 57800
[Mac (10,13, onlyOn64 : true)]
[Export ("makeListenerEndpointForServiceName:andReturnError:")]
[return: NullAllowed]
NSXpcListenerEndpoint MakeListenerEndpoint (string serviceName, [NullAllowed] out NSError error);
#endif
[Mac (10,13, onlyOn64 : true)]
[Async, Export ("valuesForAttributes:forItemWithURL:completion:")]
void GetValues (string[] attributes, NSUrl itemUrl, GetValuesCompletionHandler completion);
}

[Mac (10, 10, onlyOn64: true)]
[BaseType (typeof(NSObject))]
Expand Down
7 changes: 7 additions & 0 deletions src/foundation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14227,4 +14227,11 @@ interface NSMeasurementFormatter : NSSecureCoding {
string ToString (NSUnit unit);
}

[NoWatch, NoTV, Mac (10,13), iOS (11,0)]
[BaseType (typeof(NSObject))]
interface NSFileProviderMessageInterface : NSSecureCoding
{
[Export ("name")]
string Name { get; }
}
}
12 changes: 12 additions & 0 deletions src/medialibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,18 @@ interface MediaLibraryTypeIdentifierKey {
[Field ("MLPhotosFrontCameraGroupTypeIdentifier")]
NSString PhotosFrontCameraGroupTypeIdentifier { get; }

[Mac (10,13, onlyOn64 : true)]
[Field ("MLPhotosLivePhotosGroupTypeIdentifier")]
NSString PhotosLivePhotosGroupTypeIdentifier { get; }

[Mac (10,13, onlyOn64 : true)]
[Field ("MLPhotosLongExposureGroupTypeIdentifier")]
NSString PhotosLongExposureGroupTypeIdentifier { get; }

[Mac (10,13, onlyOn64 : true)]
[Field ("MLPhotosAnimatedGroupTypeIdentifier")]
NSString PhotosAnimatedGroupTypeIdentifier { get; }

[Mac (10,10, onlyOn64 : true)]
[Field ("MLPhotosPanoramasGroupTypeIdentifier")]
NSString PhotosPanoramasGroupTypeIdentifier { get; }
Expand Down
2 changes: 1 addition & 1 deletion tests/xtro-sharpie/Runner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ModuleExclusionList {
"IOBluetooth", "IOBluetoothUI", "PubSub", "CryptoTokenKit", "DiscRecording", "DiscRecordingUI", "ImageCaptureCore", "OSAKit", "AudioVideoBridging", "Automator", "ImageCapture",

// Maybe?
"ICADevices", "OpenDirectory", "IMServicePlugIn", "PreferencePanes", "ScreenSaver",
"ICADevices", "OpenDirectory", "IMServicePlugIn", "PreferencePanes", "ScreenSaver", "CoreMediaIO", "SecurityInterface",

// Nope
"InstallerPlugins", "JavaVM", "ExceptionHandling", "JavaFrameEmbedding",
Expand Down