Skip to content

[CoreSpotlight] Implement Xcode 16.0 beta 1-6 changes. #20866

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

Merged
merged 3 commits into from
Sep 5, 2024
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
9 changes: 9 additions & 0 deletions src/CoreSpotlight/CSEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public enum CSIndexErrorCode : long {
RemoteConnectionError = -1003,
QuotaExceeded = -1004,
IndexingUnsupported = -1005,
MismatchedClientState = -1006,
}

/// <summary>Enumerates errors that can occur while running a Core Spotlight query with <see cref="M:CoreSpotlight.CSSearchQuery.Start" />.</summary>
Expand All @@ -53,4 +54,12 @@ public enum CSFileProtection {
CompleteUnlessOpen,
CompleteUntilFirstUserAuthentication,
}

[NoTV, Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
[Native]
public enum CSUserInteraction : long {
Select,
Default = Select,
Focus,
}
}
44 changes: 44 additions & 0 deletions src/corespotlight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ interface CSSearchableIndex {
/// <summary>Completion handler used in <see cref="M:CoreSpotlight.CSSearchableIndex_CSOptionalBatchingExtension.FetchLastClientState(CoreSpotlight.CSSearchableIndex,CoreSpotlight.CSSearchableIndexFetchHandler)" />.</summary>
delegate void CSSearchableIndexFetchHandler (NSData clientState, NSError error);

delegate void CSSearchableIndexEndIndexHandler ([NullAllowed] NSError error);

/// <summary>Extension methods for <format type="text/html"><a href="https://docs.microsoft.com/en-us/search/index?search=T:CoreServices.CSSearchableIndex&amp;scope=Xamarin" title="T:CoreServices.CSSearchableIndex">T:CoreServices.CSSearchableIndex</a></format>.</summary>
[NoTV] // CS_TVOS_UNAVAILABLE
[MacCatalyst (13, 1)]
Expand All @@ -141,6 +143,10 @@ interface CSSearchableIndex_CSOptionalBatchingExtension {

[Export ("fetchLastClientStateWithCompletionHandler:")]
void FetchLastClientState (CSSearchableIndexFetchHandler completionHandler);

[NoTV, Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
[Export ("endIndexBatchWithExpectedClientState:newClientState:completionHandler:")]
void EndIndexBatch ([NullAllowed] NSData expectedClientState, NSData newClientState, [NullAllowed] CSSearchableIndexEndIndexHandler completionHandler);
}

/// <summary>Interface representing the required methods (if any) of the protocol <see cref="T:CoreSpotlight.CSSearchableIndexDelegate" />.</summary>
Expand Down Expand Up @@ -229,6 +235,10 @@ interface CSSearchableItem : NSSecureCoding, NSCopying {
[NoTV, iOS (16, 0), MacCatalyst (16, 0), Mac (13, 0), NoWatch]
[Export ("compareByRank:")]
NSComparisonResult CompareByRank (CSSearchableItem other);

[NoTV, NoWatch]
[Export ("isUpdate", ArgumentSemantic.Assign)]
bool IsUpdate { get; set; }
}

/// <summary>Represents a string-like object that returns a locale-specific version of a string.</summary>
Expand Down Expand Up @@ -1133,6 +1143,9 @@ interface CSSearchableItemAttributeSet : NSCopying, NSSecureCoding {
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface CSSearchQuery {
[Deprecated (PlatformName.iOS, 16, 0, message: "Use the constructor that takes a 'CSSearchQueryContext' parameter instead.")]
[Deprecated (PlatformName.MacCatalyst, 18, 0, message: "Use the constructor that takes a 'CSSearchQueryContext' parameter instead.")]
[Deprecated (PlatformName.MacOSX, 13, 0, message: "Use the constructor that takes a 'CSSearchQueryContext' parameter instead.")]
[Export ("initWithQueryString:attributes:")]
NativeHandle Constructor (string queryString, [NullAllowed] string [] attributes);

Expand Down Expand Up @@ -1190,6 +1203,29 @@ interface CSUserQuery {

[Export ("cancel")]
void Cancel ();

[Static]
[Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
[Export ("prepare")]
void Prepare ();

[Static]
[Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
[Export ("prepareProtectionClasses:")]
void Prepare (NSString [] protectionClasses);

[Static]
[Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
[Wrap ("Prepare (protectionClasses.ToConstantArray ()!)")]
void Prepare (NSFileProtectionType [] protectionClasses);

[Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
[Export ("userEngagedWithItem:visibleItems:userInteractionType:")]
void UserEngaged (CSSearchableItem item, CSSearchableItem [] visibleItems, CSUserInteraction userInteractionType);

[Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
[Export ("userEngagedWithSuggestion:visibleSuggestions:userInteractionType:")]
void UserEngaged (CSSuggestion suggestion, CSSuggestion [] visibleSuggestions, CSUserInteraction userInteractionType);
}

[NoTV, Mac (13, 0), iOS (16, 0), MacCatalyst (16, 0)]
Expand All @@ -1212,6 +1248,14 @@ interface CSUserQueryContext {

[Export ("maxResultCount")]
nint MaxResultCount { get; set; }

[Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
[Export ("disableSemanticSearch")]
bool DisableSemanticSearch { get; set; }

[Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
[Export ("maxRankedResultCount")]
nint MaxRankedResultCount { get; set; }
}


Expand Down
15 changes: 15 additions & 0 deletions tests/cecil-tests/Documentation.KnownFailures.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7855,6 +7855,7 @@ F:CoreSpotlight.CSIndexErrorCode.IndexingUnsupported
F:CoreSpotlight.CSIndexErrorCode.IndexUnavailableError
F:CoreSpotlight.CSIndexErrorCode.InvalidClientStateError
F:CoreSpotlight.CSIndexErrorCode.InvalidItemError
F:CoreSpotlight.CSIndexErrorCode.MismatchedClientState
F:CoreSpotlight.CSIndexErrorCode.QuotaExceeded
F:CoreSpotlight.CSIndexErrorCode.RemoteConnectionError
F:CoreSpotlight.CSIndexErrorCode.UnknownError
Expand All @@ -7867,6 +7868,9 @@ F:CoreSpotlight.CSSearchQuerySourceOptions.Default
F:CoreSpotlight.CSSuggestionKind.Custom
F:CoreSpotlight.CSSuggestionKind.Default
F:CoreSpotlight.CSSuggestionKind.None
F:CoreSpotlight.CSUserInteraction.Default
F:CoreSpotlight.CSUserInteraction.Focus
F:CoreSpotlight.CSUserInteraction.Select
F:CoreTelephony.CTCellularDataRestrictedState.NotRestricted
F:CoreTelephony.CTCellularDataRestrictedState.Restricted
F:CoreTelephony.CTCellularDataRestrictedState.Unknown
Expand Down Expand Up @@ -33162,6 +33166,7 @@ M:CoreSpotlight.CSPerson.#ctor(System.String,System.String[],Foundation.NSString
M:CoreSpotlight.CSPerson.Copy(Foundation.NSZone)
M:CoreSpotlight.CSPerson.EncodeTo(Foundation.NSCoder)
M:CoreSpotlight.CSSearchableIndex_CSOptionalBatchingExtension.BeginIndexBatch(CoreSpotlight.CSSearchableIndex)
M:CoreSpotlight.CSSearchableIndex_CSOptionalBatchingExtension.EndIndexBatch(CoreSpotlight.CSSearchableIndex,Foundation.NSData,Foundation.NSData,CoreSpotlight.CSSearchableIndexEndIndexHandler)
M:CoreSpotlight.CSSearchableIndex_CSOptionalBatchingExtension.EndIndexBatch(CoreSpotlight.CSSearchableIndex,Foundation.NSData,System.Action{Foundation.NSError})
M:CoreSpotlight.CSSearchableIndex_CSOptionalBatchingExtension.FetchLastClientState(CoreSpotlight.CSSearchableIndex,CoreSpotlight.CSSearchableIndexFetchHandler)
M:CoreSpotlight.CSSearchableIndex.#ctor(System.String,CoreSpotlight.CSFileProtection)
Expand Down Expand Up @@ -33213,7 +33218,12 @@ M:CoreSpotlight.CSSuggestion.Copy(Foundation.NSZone)
M:CoreSpotlight.CSSuggestion.EncodeTo(Foundation.NSCoder)
M:CoreSpotlight.CSUserQuery.#ctor(System.String,CoreSpotlight.CSUserQueryContext)
M:CoreSpotlight.CSUserQuery.Cancel
M:CoreSpotlight.CSUserQuery.Prepare
M:CoreSpotlight.CSUserQuery.Prepare(Foundation.NSFileProtectionType[])
M:CoreSpotlight.CSUserQuery.Prepare(Foundation.NSString[])
M:CoreSpotlight.CSUserQuery.Start
M:CoreSpotlight.CSUserQuery.UserEngaged(CoreSpotlight.CSSearchableItem,CoreSpotlight.CSSearchableItem[],CoreSpotlight.CSUserInteraction)
M:CoreSpotlight.CSUserQuery.UserEngaged(CoreSpotlight.CSSuggestion,CoreSpotlight.CSSuggestion[],CoreSpotlight.CSUserInteraction)
M:CoreSpotlight.CSUserQueryContext.Create(CoreSpotlight.CSSuggestion)
M:CoreSpotlight.ICSSearchableIndexDelegate.DidFinishThrottle(CoreSpotlight.CSSearchableIndex)
M:CoreSpotlight.ICSSearchableIndexDelegate.DidThrottle(CoreSpotlight.CSSearchableIndex)
Expand Down Expand Up @@ -64119,6 +64129,7 @@ P:CoreSpotlight.CSSearchableItem.AttributeSet
P:CoreSpotlight.CSSearchableItem.ContinuationActionType
P:CoreSpotlight.CSSearchableItem.DomainIdentifier
P:CoreSpotlight.CSSearchableItem.ExpirationDate
P:CoreSpotlight.CSSearchableItem.IsUpdate
P:CoreSpotlight.CSSearchableItem.QueryString
P:CoreSpotlight.CSSearchableItem.UniqueIdentifier
P:CoreSpotlight.CSSearchableItemAttributeSet.AccountHandles
Expand Down Expand Up @@ -64326,7 +64337,9 @@ P:CoreSpotlight.CSSuggestion.SuggestionDataSources
P:CoreSpotlight.CSSuggestion.SuggestionKind
P:CoreSpotlight.CSUserQuery.FoundSuggestionCount
P:CoreSpotlight.CSUserQuery.FoundSuggestionsHandler
P:CoreSpotlight.CSUserQueryContext.DisableSemanticSearch
P:CoreSpotlight.CSUserQueryContext.EnableRankedResults
P:CoreSpotlight.CSUserQueryContext.MaxRankedResultCount
P:CoreSpotlight.CSUserQueryContext.MaxResultCount
P:CoreSpotlight.CSUserQueryContext.MaxSuggestionCount
P:CoreSpotlight.CSUserQueryContext.UserQueryContext
Expand Down Expand Up @@ -80822,10 +80835,12 @@ T:CoreServices.LSRoles
T:CoreSpotlight.CSImportExtension
T:CoreSpotlight.CSMailboxKey
T:CoreSpotlight.CSSearchableIndexBundleDataResult
T:CoreSpotlight.CSSearchableIndexEndIndexHandler
T:CoreSpotlight.CSSearchQueryContext
T:CoreSpotlight.CSSearchQuerySourceOptions
T:CoreSpotlight.CSSuggestion
T:CoreSpotlight.CSSuggestionKind
T:CoreSpotlight.CSUserInteraction
T:CoreSpotlight.CSUserQuery
T:CoreSpotlight.CSUserQueryContext
T:CoreTelephony.CTCellularPlanProvisioning
Expand Down

This file was deleted.

14 changes: 0 additions & 14 deletions tests/xtro-sharpie/api-annotations-dotnet/iOS-CoreSpotlight.todo

This file was deleted.

14 changes: 0 additions & 14 deletions tests/xtro-sharpie/api-annotations-dotnet/macOS-CoreSpotlight.todo

This file was deleted.

14 changes: 0 additions & 14 deletions tests/xtro-sharpie/iOS-CoreSpotlight.todo

This file was deleted.

14 changes: 0 additions & 14 deletions tests/xtro-sharpie/macOS-CoreSpotlight.todo

This file was deleted.

Loading