From 73aa889ac0d0c733c7681b0aae4d438bf3bb25ae Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Fri, 9 Jun 2017 12:48:51 +0200 Subject: [PATCH 1/6] Updated spotlight bindings for xcode 9. --- src/corespotlight.cs | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/corespotlight.cs b/src/corespotlight.cs index 2302c8b58ca9..304495a70058 100644 --- a/src/corespotlight.cs +++ b/src/corespotlight.cs @@ -124,6 +124,16 @@ interface CSSearchableIndexDelegate { [Export ("searchableIndexDidFinishThrottle:")] void DidFinishThrottle (CSSearchableIndex searchableIndex); + + [iOS (11,0), NoTV, Mac (10,11)] + [Export ("dataForSearchableIndex:itemIdentifier:typeIdentifier:error:")] + [return: NullAllowed] + NSData GetData (CSSearchableIndex searchableIndex, string itemIdentifier, string typeIdentifier, out NSError outError); + + [iOS (11,0), NoTV, Mac (10,11)] + [Export ("fileURLForSearchableIndex:itemIdentifier:typeIdentifier:inPlace:error:")] + [return: NullAllowed] + NSUrl GetFileUrl (CSSearchableIndex searchableIndex, string itemIdentifier, string typeIdentifier, bool inPlace, out NSError outError); } [NoTV] // CS_TVOS_UNAVAILABLE @@ -979,6 +989,38 @@ interface CSSearchableItemAttributeSet : NSCopying, NSSecureCoding { [Export ("valueForCustomKey:")] [return: NullAllowed] INSSecureCoding ValueForCustomKey (CSCustomAttributeKey key); + + // CSSearchableItemAttributeSet_CSGeneral + + [iOS (11,0), NoTV, Mac (10, 11)] + [NullAllowed, Export ("userCreated", ArgumentSemantic.Strong)] + NSNumber IsUserCreated { [Bind ("isUserCreated")] get; set; } + + [iOS (11, 0), NoTV, Mac (10, 11)] + [NullAllowed, Export ("userOwned", ArgumentSemantic.Strong)] + NSNumber IsUserOwned { [Bind ("isUserOwned")] get; set; } + + [iOS (11, 0), NoTV, Mac (10, 11)] + [NullAllowed, Export ("userCurated", ArgumentSemantic.Strong)] + NSNumber IsUserCurated { [Bind ("isUserCurated")] get; set; } + + [iOS (11, 0), NoTV, Mac (10, 11)] + [NullAllowed, Export ("rankingHint", ArgumentSemantic.Strong)] + NSNumber RankingHint { get; set; } + + // CSSearchableItemAttributeSet_CSItemProvider + + [NoTV, Mac (10, 11)] + [NullAllowed, Export ("providerDataTypeIdentifiers", ArgumentSemantic.Copy)] + string[] ProviderDataTypeIdentifiers { get; set; } + + [NoTV, Mac (10, 11)] + [NullAllowed, Export ("providerFileTypeIdentifiers", ArgumentSemantic.Copy)] + string[] ProviderFileTypeIdentifiers { get; set; } + + [NoTV, Mac (10, 11)] + [NullAllowed, Export ("providerInPlaceFileTypeIdentifiers", ArgumentSemantic.Copy)] + string[] ProviderInPlaceFileTypeIdentifiers { get; set; } } [NoTV][iOS (10,0)] From 8b7d9a8222a3128c07598ad49f4c7ae0efee6a0d Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Fri, 9 Jun 2017 17:47:58 +0200 Subject: [PATCH 2/6] Fixed new bindings as per review: * Added BindAs for those properties that are NSNumber -> bool * Added BindAs for those properties that are NSNumber -> int * Added missing iOS attr. --- src/corespotlight.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/corespotlight.cs b/src/corespotlight.cs index 304495a70058..d6093e989670 100644 --- a/src/corespotlight.cs +++ b/src/corespotlight.cs @@ -994,31 +994,35 @@ interface CSSearchableItemAttributeSet : NSCopying, NSSecureCoding { [iOS (11,0), NoTV, Mac (10, 11)] [NullAllowed, Export ("userCreated", ArgumentSemantic.Strong)] + [return: BindAs (typeof (bool?))] NSNumber IsUserCreated { [Bind ("isUserCreated")] get; set; } [iOS (11, 0), NoTV, Mac (10, 11)] [NullAllowed, Export ("userOwned", ArgumentSemantic.Strong)] + [return: BindAs (typeof (bool?))] NSNumber IsUserOwned { [Bind ("isUserOwned")] get; set; } [iOS (11, 0), NoTV, Mac (10, 11)] [NullAllowed, Export ("userCurated", ArgumentSemantic.Strong)] + [return: BindAs (typeof (bool?))] NSNumber IsUserCurated { [Bind ("isUserCurated")] get; set; } [iOS (11, 0), NoTV, Mac (10, 11)] [NullAllowed, Export ("rankingHint", ArgumentSemantic.Strong)] + [return: BindAs (typeof (int?))] NSNumber RankingHint { get; set; } // CSSearchableItemAttributeSet_CSItemProvider - [NoTV, Mac (10, 11)] + [iOS (11, 0), NoTV, Mac (10, 11)] [NullAllowed, Export ("providerDataTypeIdentifiers", ArgumentSemantic.Copy)] string[] ProviderDataTypeIdentifiers { get; set; } - [NoTV, Mac (10, 11)] + [iOS (11, 0), NoTV, Mac (10, 11)] [NullAllowed, Export ("providerFileTypeIdentifiers", ArgumentSemantic.Copy)] string[] ProviderFileTypeIdentifiers { get; set; } - [NoTV, Mac (10, 11)] + [iOS (11, 0), NoTV, Mac (10, 11)] [NullAllowed, Export ("providerInPlaceFileTypeIdentifiers", ArgumentSemantic.Copy)] string[] ProviderInPlaceFileTypeIdentifiers { get; set; } } From b0db7ea375836d4025e7f69de5b6d6280812b4f8 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Fri, 9 Jun 2017 17:59:13 +0200 Subject: [PATCH 3/6] Remove return: from properties. --- src/corespotlight.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corespotlight.cs b/src/corespotlight.cs index d6093e989670..509d2e2706d6 100644 --- a/src/corespotlight.cs +++ b/src/corespotlight.cs @@ -994,22 +994,22 @@ interface CSSearchableItemAttributeSet : NSCopying, NSSecureCoding { [iOS (11,0), NoTV, Mac (10, 11)] [NullAllowed, Export ("userCreated", ArgumentSemantic.Strong)] - [return: BindAs (typeof (bool?))] + [BindAs (typeof (bool?))] NSNumber IsUserCreated { [Bind ("isUserCreated")] get; set; } [iOS (11, 0), NoTV, Mac (10, 11)] [NullAllowed, Export ("userOwned", ArgumentSemantic.Strong)] - [return: BindAs (typeof (bool?))] + [BindAs (typeof (bool?))] NSNumber IsUserOwned { [Bind ("isUserOwned")] get; set; } [iOS (11, 0), NoTV, Mac (10, 11)] [NullAllowed, Export ("userCurated", ArgumentSemantic.Strong)] - [return: BindAs (typeof (bool?))] + [BindAs (typeof (bool?))] NSNumber IsUserCurated { [Bind ("isUserCurated")] get; set; } [iOS (11, 0), NoTV, Mac (10, 11)] [NullAllowed, Export ("rankingHint", ArgumentSemantic.Strong)] - [return: BindAs (typeof (int?))] + [BindAs (typeof (int?))] NSNumber RankingHint { get; set; } // CSSearchableItemAttributeSet_CSItemProvider From 7f74046d58c91e280f4045eb072da2e485ad2353 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Sun, 11 Jun 2017 18:33:39 +0200 Subject: [PATCH 4/6] Use the correct version for the attributes in the new methods in CSSearchableIndexDelegate. --- src/corespotlight.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corespotlight.cs b/src/corespotlight.cs index 509d2e2706d6..17a3738a6fa5 100644 --- a/src/corespotlight.cs +++ b/src/corespotlight.cs @@ -125,12 +125,12 @@ interface CSSearchableIndexDelegate { [Export ("searchableIndexDidFinishThrottle:")] void DidFinishThrottle (CSSearchableIndex searchableIndex); - [iOS (11,0), NoTV, Mac (10,11)] + [iOS (11,0), NoTV, Mac (10,13)] [Export ("dataForSearchableIndex:itemIdentifier:typeIdentifier:error:")] [return: NullAllowed] NSData GetData (CSSearchableIndex searchableIndex, string itemIdentifier, string typeIdentifier, out NSError outError); - [iOS (11,0), NoTV, Mac (10,11)] + [iOS (11,0), NoTV, Mac (10,13)] [Export ("fileURLForSearchableIndex:itemIdentifier:typeIdentifier:inPlace:error:")] [return: NullAllowed] NSUrl GetFileUrl (CSSearchableIndex searchableIndex, string itemIdentifier, string typeIdentifier, bool inPlace, out NSError outError); From 2b219453b56268f0116edf15961e5b6eef80c9ba Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Wed, 19 Jul 2017 13:07:36 +0200 Subject: [PATCH 5/6] Remove the BindAs attrs so that we can land the updated bindings. --- .../CSSearchableItemAttributeSet.cs | 29 +++++++++++++++++++ src/corespotlight.cs | 13 ++++----- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/CoreSpotlight/CSSearchableItemAttributeSet.cs b/src/CoreSpotlight/CSSearchableItemAttributeSet.cs index f761e94e0c2a..87ade03a64c1 100644 --- a/src/CoreSpotlight/CSSearchableItemAttributeSet.cs +++ b/src/CoreSpotlight/CSSearchableItemAttributeSet.cs @@ -4,6 +4,7 @@ using System; using XamCore.Foundation; +using XamCore.ObjCRuntime; namespace XamCore.CoreSpotlight { @@ -17,6 +18,34 @@ public INSSecureCoding this [CSCustomAttributeKey key] { SetValue (value, key); } } + + // Manually deal with these properties until we get BindAs working + [iOS (11,0), NoTV, Mac (10, 11)] + bool? IsUserCreated { + get { + return _IsUserCreated?.BoolValue; + } set { + _IsUserCreated = value.HasValue ? new NSNumber (value.Value) : null; + } + } + + [iOS (11, 0), NoTV, Mac (10, 11)] + bool? IsUserOwned { + get { + return _IsUserOwned?.BoolValue; + } set { + _IsUserOwned = value.HasValue ? new NSNumber (value.Value) : null; + } + } + + [iOS (11, 0), NoTV, Mac (10, 11)] + bool? IsUserCurated { + get { + return _IsUserCurated?.BoolValue; + } set { + _IsUserCurated = value.HasValue ? new NSNumber (value.Value) : null; + } + } } } diff --git a/src/corespotlight.cs b/src/corespotlight.cs index 17a3738a6fa5..7d3eb13be7cf 100644 --- a/src/corespotlight.cs +++ b/src/corespotlight.cs @@ -994,22 +994,21 @@ interface CSSearchableItemAttributeSet : NSCopying, NSSecureCoding { [iOS (11,0), NoTV, Mac (10, 11)] [NullAllowed, Export ("userCreated", ArgumentSemantic.Strong)] - [BindAs (typeof (bool?))] - NSNumber IsUserCreated { [Bind ("isUserCreated")] get; set; } + [Protected] // We would like to use [BindAs (typeof (bool?))] + NSNumber _IsUserCreated { [Bind ("isUserCreated")] get; set; } [iOS (11, 0), NoTV, Mac (10, 11)] [NullAllowed, Export ("userOwned", ArgumentSemantic.Strong)] - [BindAs (typeof (bool?))] - NSNumber IsUserOwned { [Bind ("isUserOwned")] get; set; } + [Protected] // We would like to use[BindAs (typeof (bool?))] + NSNumber _IsUserOwned { [Bind ("isUserOwned")] get; set; } [iOS (11, 0), NoTV, Mac (10, 11)] [NullAllowed, Export ("userCurated", ArgumentSemantic.Strong)] - [BindAs (typeof (bool?))] - NSNumber IsUserCurated { [Bind ("isUserCurated")] get; set; } + [Protected] // We would like to use [BindAs (typeof (bool?))] + NSNumber _IsUserCurated { [Bind ("isUserCurated")] get; set; } [iOS (11, 0), NoTV, Mac (10, 11)] [NullAllowed, Export ("rankingHint", ArgumentSemantic.Strong)] - [BindAs (typeof (int?))] NSNumber RankingHint { get; set; } // CSSearchableItemAttributeSet_CSItemProvider From d209303b4c2dc187bb46019d901c1d9028431754 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Wed, 19 Jul 2017 18:08:54 +0200 Subject: [PATCH 6/6] Set Protected properties internal and make the correct ones public. --- src/CoreSpotlight/CSSearchableItemAttributeSet.cs | 6 +++--- src/corespotlight.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/CoreSpotlight/CSSearchableItemAttributeSet.cs b/src/CoreSpotlight/CSSearchableItemAttributeSet.cs index 87ade03a64c1..807861c077ea 100644 --- a/src/CoreSpotlight/CSSearchableItemAttributeSet.cs +++ b/src/CoreSpotlight/CSSearchableItemAttributeSet.cs @@ -21,7 +21,7 @@ public INSSecureCoding this [CSCustomAttributeKey key] { // Manually deal with these properties until we get BindAs working [iOS (11,0), NoTV, Mac (10, 11)] - bool? IsUserCreated { + public bool? IsUserCreated { get { return _IsUserCreated?.BoolValue; } set { @@ -30,7 +30,7 @@ public INSSecureCoding this [CSCustomAttributeKey key] { } [iOS (11, 0), NoTV, Mac (10, 11)] - bool? IsUserOwned { + public bool? IsUserOwned { get { return _IsUserOwned?.BoolValue; } set { @@ -39,7 +39,7 @@ public INSSecureCoding this [CSCustomAttributeKey key] { } [iOS (11, 0), NoTV, Mac (10, 11)] - bool? IsUserCurated { + public bool? IsUserCurated { get { return _IsUserCurated?.BoolValue; } set { diff --git a/src/corespotlight.cs b/src/corespotlight.cs index 7d3eb13be7cf..08236e41cc06 100644 --- a/src/corespotlight.cs +++ b/src/corespotlight.cs @@ -994,17 +994,17 @@ interface CSSearchableItemAttributeSet : NSCopying, NSSecureCoding { [iOS (11,0), NoTV, Mac (10, 11)] [NullAllowed, Export ("userCreated", ArgumentSemantic.Strong)] - [Protected] // We would like to use [BindAs (typeof (bool?))] + [Internal] // We would like to use [BindAs (typeof (bool?))] NSNumber _IsUserCreated { [Bind ("isUserCreated")] get; set; } [iOS (11, 0), NoTV, Mac (10, 11)] [NullAllowed, Export ("userOwned", ArgumentSemantic.Strong)] - [Protected] // We would like to use[BindAs (typeof (bool?))] + [Internal] // We would like to use[BindAs (typeof (bool?))] NSNumber _IsUserOwned { [Bind ("isUserOwned")] get; set; } [iOS (11, 0), NoTV, Mac (10, 11)] [NullAllowed, Export ("userCurated", ArgumentSemantic.Strong)] - [Protected] // We would like to use [BindAs (typeof (bool?))] + [Internal] // We would like to use [BindAs (typeof (bool?))] NSNumber _IsUserCurated { [Bind ("isUserCurated")] get; set; } [iOS (11, 0), NoTV, Mac (10, 11)]