diff --git a/src/sharedwithyoucore.cs b/src/sharedwithyoucore.cs new file mode 100644 index 000000000000..72ccb1a0291f --- /dev/null +++ b/src/sharedwithyoucore.cs @@ -0,0 +1,271 @@ +// +// SharedWithYouCore C# bindings +// +// Authors: +// Manuel de la Pena Saenz +// +// Copyright 2022 Microsoft Corporation All rights reserved. +// + +using System; + +using AVFoundation; +using CoreFoundation; +using Foundation; +using ObjCRuntime; + +#if !NET +using NativeHandle = System.IntPtr; +#endif + +namespace SharedWithYouCore { + + [NoWatch, TV (16,0), Mac (13,0), iOS (16,0), MacCatalyst (16,0)] + [BaseType (typeof (NSObject))] + interface SWAction : NSCopying, NSSecureCoding + { + [Export ("uuid")] + NSUuid Uuid { get; } + + [Export ("complete")] + bool Complete { [Bind ("isComplete")] get; } + + [Export ("fulfill")] + void Fulfill (); + + [Export ("fail")] + void Fail (); + } + + interface ISWCollaborationActionHandler {} + + [NoWatch, TV (16,0), Mac (13,0), iOS (16,0), MacCatalyst (16,0)] + [Protocol] + [BaseType (typeof (NSObject))] + interface SWCollaborationActionHandler + { + [Abstract] + [Export ("collaborationCoordinator:handleStartCollaborationAction:")] + void HandleStartCollaborationAction (SWCollaborationCoordinator coordinator, SWStartCollaborationAction action); + + [Abstract] + [Export ("collaborationCoordinator:handleUpdateCollaborationParticipantsAction:")] + void HandleUpdateCollaborationParticipantsAction (SWCollaborationCoordinator coordinator, SWUpdateCollaborationParticipantsAction action); + } + + [NoWatch, TV (16,0), Mac (13,0), iOS (16,0), MacCatalyst (16,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface SWCollaborationCoordinator + { + [Static] + [Export ("sharedCoordinator", ArgumentSemantic.Strong)] + SWCollaborationCoordinator SharedCoordinator { get; } + + [NullAllowed, Export ("actionHandler", ArgumentSemantic.Weak)] + ISWCollaborationActionHandler ActionHandler { get; set; } + } + + [NoWatch, TV (16,0), Mac (13,0), iOS (16,0), MacCatalyst (16,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface SWCollaborationOption : NSCopying, NSSecureCoding + { + [Export ("title")] + string Title { get; set; } + + [Export ("identifier")] + string Identifier { get; } + + [Export ("subtitle")] + string Subtitle { get; set; } + + [Export ("selected")] + bool Selected { [Bind ("isSelected")] get; set; } + + [Export ("requiredOptionsIdentifiers", ArgumentSemantic.Copy)] + string[] RequiredOptionsIdentifiers { get; set; } + + [Export ("initWithTitle:identifier:")] + [DesignatedInitializer] + NativeHandle Constructor (string title, string identifier); + + [Export ("initWithCoder:")] + NativeHandle Constructor (NSCoder coder); + + [Static] + [Export ("optionWithTitle:identifier:")] + SWCollaborationOption Create (string title, string identifier); + } + + [NoWatch, TV (16,0), Mac (13,0), iOS (16,0), MacCatalyst (16,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface SWCollaborationOptionsGroup : NSCopying, NSSecureCoding + { + [Export ("title")] + string Title { get; set; } + + [Export ("identifier")] + string Identifier { get; } + + [Export ("footer")] + string Footer { get; set; } + + [Export ("options", ArgumentSemantic.Copy)] + SWCollaborationOption[] Options { get; set; } + + [Export ("initWithIdentifier:options:")] + [DesignatedInitializer] + NativeHandle Constructor (string identifier, SWCollaborationOption[] options); + + [Static] + [Export ("optionsGroupWithIdentifier:options:")] + SWCollaborationOptionsGroup Create (string identifier, SWCollaborationOption[] options); + } + + [NoWatch, TV (16,0), Mac (13,0), iOS (16,0), MacCatalyst (16,0)] + [BaseType (typeof (SWCollaborationOptionsGroup))] + interface SWCollaborationOptionsPickerGroup + { + [Export ("selectedOptionIdentifier", ArgumentSemantic.Strong)] + string SelectedOptionIdentifier { get; set; } + } + + [NoWatch, TV (16,0), Mac (13,0), iOS (16,0), MacCatalyst (16,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface SWCollaborationShareOptions : NSCopying, NSSecureCoding + { + [Export ("optionsGroups", ArgumentSemantic.Copy)] + SWCollaborationOptionsGroup[] OptionsGroups { get; set; } + + [Export ("summary")] + string Summary { get; set; } + + [Export ("initWithOptionsGroups:summary:")] + [DesignatedInitializer] + NativeHandle Constructor (SWCollaborationOptionsGroup[] optionsGroups, string summary); + + [Export ("initWithOptionsGroups:")] + NativeHandle Constructor (SWCollaborationOptionsGroup[] optionsGroups); + + [Static] + [Export ("shareOptionsWithOptionsGroups:summary:")] + SWCollaborationShareOptions Create (SWCollaborationOptionsGroup[] optionsGroups, string summary); + + [Static] + [Export ("shareOptionsWithOptionsGroups:")] + SWCollaborationShareOptions Create (SWCollaborationOptionsGroup[] optionsGroups); + + [Export ("initWithCoder:")] + [DesignatedInitializer] + NativeHandle Constructor (NSCoder coder); + } + + [NoWatch, TV (16,0), Mac (13,0), iOS (16,0), MacCatalyst (16,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface SWCollaborationMetadata : NSSecureCoding, NSCopying, NSMutableCopying + { + [Export ("collaborationIdentifier")] + string CollaborationIdentifier { get; } + + [Export ("localIdentifier")] + string LocalIdentifier { get; } + + [NullAllowed, Export ("title")] + string Title { get; set; } + + [NullAllowed, Export ("defaultShareOptions", ArgumentSemantic.Copy)] + SWCollaborationShareOptions DefaultShareOptions { get; set; } + + [NullAllowed, Export ("userSelectedShareOptions", ArgumentSemantic.Copy)] + SWCollaborationShareOptions UserSelectedShareOptions { get; set; } + + [NullAllowed, Export ("initiatorHandle")] + string InitiatorHandle { get; set; } + + [NullAllowed, Export ("initiatorNameComponents", ArgumentSemantic.Strong)] + NSPersonNameComponents InitiatorNameComponents { get; set; } + + [Export ("initWithLocalIdentifier:")] + NativeHandle Constructor (string localIdentifier); + } + + [NoWatch, TV (16,0), Mac (13,0), iOS (16,0), MacCatalyst (16,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface SWPerson : NSSecureCoding + { + [Export ("initWithHandle:identity:displayName:thumbnailImageData:")] + NativeHandle Constructor ([NullAllowed] string handle, [NullAllowed] SWPersonIdentity identity, string displayName, [NullAllowed] NSData thumbnailImageData); + } + + [NoWatch, TV (16,0), Mac (13,0), iOS (16,0), MacCatalyst (16,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface SWPersonIdentity : NSSecureCoding, NSCopying + { + [Export ("rootHash", ArgumentSemantic.Copy)] + NSData RootHash { get; } + + [Export ("initWithRootHash:")] + NativeHandle Constructor (NSData rootHash); + } + + [NoWatch, TV (16,0), Mac (13,0), iOS (16,0), MacCatalyst (16,0)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface SWPersonIdentityProof : NSSecureCoding, NSCopying + { + [Export ("inclusionHashes", ArgumentSemantic.Copy)] + NSData[] InclusionHashes { get; } + + [Export ("publicKey", ArgumentSemantic.Copy)] + NSData PublicKey { get; } + + [Export ("publicKeyIndex")] + nuint PublicKeyIndex { get; } + } + + [NoWatch, TV (16,0), Mac (13,0), iOS (16,0)] + [BaseType (typeof (SWPersonIdentityProof))] + interface SWSignedPersonIdentityProof + { + [Export ("initWithPersonIdentityProof:signatureData:")] + NativeHandle Constructor (SWPersonIdentityProof personIdentityProof, NSData data); + + [Export ("signatureData", ArgumentSemantic.Copy)] + NSData SignatureData { get; } + } + + [NoWatch, TV (16,0), Mac (13,0), iOS (16,0), MacCatalyst (16,0)] + [BaseType (typeof(SWAction))] + [DisableDefaultCtor] + interface SWStartCollaborationAction : NSSecureCoding, NSCopying + { + [Export ("collaborationMetadata")] + SWCollaborationMetadata CollaborationMetadata { get; } + + [Export ("fulfillUsingURL:collaborationIdentifier:")] + void FulfillUsingUrl (NSUrl url, string collaborationIdentifier); + } + + [NoWatch, TV (16,0), Mac (13,0), iOS (16,0)] + [BaseType (typeof (SWAction))] + [DisableDefaultCtor] + interface SWUpdateCollaborationParticipantsAction : NSSecureCoding, NSCopying + { + [Export ("collaborationMetadata")] + SWCollaborationMetadata CollaborationMetadata { get; } + + [Export ("addedIdentities")] + SWPersonIdentity[] AddedIdentities { get; } + + [Export ("removedIdentities")] + SWPersonIdentity[] RemovedIdentities { get; } + } + +} + diff --git a/tests/mtouch/RegistrarTest.cs b/tests/mtouch/RegistrarTest.cs index 2febd4cfefbe..12c9802fecd7 100644 --- a/tests/mtouch/RegistrarTest.cs +++ b/tests/mtouch/RegistrarTest.cs @@ -349,6 +349,7 @@ public void MT4134 () new { Framework = "CoreLocationUI", Version = "15.0" }, new { Framework = "Chip", Version = "15.0" }, new { Framework = "ThreadNetwork", Version = "15.0" }, + new { Framework = "SharedWithYouCore", Version = "16.0" }, }; foreach (var framework in invalidFrameworks) mtouch.AssertError (4134, $"Your application is using the '{framework.Framework}' framework, which isn't included in the iOS SDK you're using to build your app (this framework was introduced in iOS {framework.Version}, while you're building with the iOS {mtouch.Sdk} SDK.) Please select a newer SDK in your app's iOS Build options."); diff --git a/tools/common/Frameworks.cs b/tools/common/Frameworks.cs index b94b26d82014..f498a8282154 100644 --- a/tools/common/Frameworks.cs +++ b/tools/common/Frameworks.cs @@ -275,6 +275,8 @@ public static Frameworks MacFrameworks { { "ShazamKit", "ShazamKit", 12,0 }, { "ScreenCaptureKit", "ScreenCaptureKit", 12,3 }, + + { "SharedWithYouCore", "SharedWithYouCore", 13, 0 }, }; } return mac_frameworks; @@ -445,6 +447,8 @@ public static Frameworks CreateiOSFrameworks (bool is_simulator_build) { "ShazamKit", "ShazamKit", new Version (15,0), NotAvailableInSimulator}, { "ThreadNetwork", "ThreadNetwork", new Version (15,0), NotAvailableInSimulator}, + { "SharedWithYouCore", "SharedWithYouCore", 16, 0 }, + // the above MUST be kept in sync with simlauncher // see tools/mtouch/Makefile // please also keep it sorted to ease comparison @@ -615,6 +619,8 @@ public static Frameworks TVOSFrameworks { #endif { "OSLog", "OSLog", 15,0 }, { "ShazamKit", "ShazamKit", new Version (15, 0), NotAvailableInSimulator}, + + { "SharedWithYouCore", "SharedWithYouCore", 16, 0 }, }; } return tvos_frameworks; diff --git a/tools/mtouch/Makefile b/tools/mtouch/Makefile index d23a1435ec0e..e8cde33a0f0a 100644 --- a/tools/mtouch/Makefile +++ b/tools/mtouch/Makefile @@ -172,6 +172,8 @@ SIMLAUNCHER_FRAMEWORKS = \ \ -weak_framework CoreLocationUI \ -weak_framework OSLog \ + \ + -weak_framework SharedWithYouCore \ SIMLAUNCHER64_FRAMEWORKS = \ -framework GameKit \