From a6cbd48fab0e929eb8c36118318d1dcd2d06978f Mon Sep 17 00:00:00 2001 From: Alex Soto Date: Fri, 15 Jun 2018 00:35:27 -0500 Subject: [PATCH] [IntentsUI] Update bindings to Xcode 10 Beta 1 (#4262) * [IntentsUI] Update bindings to Xcode 10 Beta 1 This commit also adds a strong dictionary version to INPlayMediaIntentResponse.WeakNowPlayingInfo. * Implement feedback --- src/Intents/INPlayMediaIntentResponse.cs | 26 +++++++++ src/frameworks.sources | 1 + src/intents.cs | 2 + src/intentsui.cs | 68 ++++++++++++++++++++++++ tests/introspection/ApiCtorInitTest.cs | 5 +- tests/xtro-sharpie/iOS-IntentsUI.todo | 10 ---- 6 files changed, 100 insertions(+), 12 deletions(-) create mode 100644 src/Intents/INPlayMediaIntentResponse.cs diff --git a/src/Intents/INPlayMediaIntentResponse.cs b/src/Intents/INPlayMediaIntentResponse.cs new file mode 100644 index 0000000000..95e9d1f05f --- /dev/null +++ b/src/Intents/INPlayMediaIntentResponse.cs @@ -0,0 +1,26 @@ +// +// INPlayMediaIntentResponse.cs +// +// Authors: +// Alex Soto +// +// Copyright 2018 Microsoft Corporation. +// + +#if XAMCORE_2_0 && !MONOMAC && !WATCH // We must remove !WATCH when MediaPlayer is enabled in watchOS +using System; +using Foundation; +using ObjCRuntime; +using MediaPlayer; + +namespace Intents { + public partial class INPlayMediaIntentResponse { + + // MPNowPlayingInfo is not a DictionaryContainer but a manual NSDictionary wrapper class. + MPNowPlayingInfo NowPlayingInfo { + get => new MPNowPlayingInfo (WeakNowPlayingInfo); + set => WeakNowPlayingInfo = value?.ToDictionary (); + } + } +} +#endif \ No newline at end of file diff --git a/src/frameworks.sources b/src/frameworks.sources index 4b81f62781..4867003fd3 100644 --- a/src/frameworks.sources +++ b/src/frameworks.sources @@ -902,6 +902,7 @@ INTENTS_SOURCES = \ Intents/INRelativeReferenceResolutionResult.cs \ Intents/INRelativeSettingResolutionResult.cs \ Intents/INRideOption.cs \ + Intents/INPlayMediaIntentResponse.cs \ Intents/INSaveProfileInCarIntent.cs \ Intents/INSearchCallHistoryIntent.cs \ Intents/INSetCarLockStatusIntent.cs \ diff --git a/src/intents.cs b/src/intents.cs index fc903b9c0f..f5efb06260 100644 --- a/src/intents.cs +++ b/src/intents.cs @@ -10,6 +10,7 @@ #if XAMCORE_2_0 // The Intents framework uses generics which is only supported in Unified using System; +using System.ComponentModel; using CoreGraphics; using Foundation; using ObjCRuntime; @@ -8818,6 +8819,7 @@ namespace Intents { [Export ("code")] INPlayMediaIntentResponseCode Code { get; } + [EditorBrowsable (EditorBrowsableState.Advanced)] [NullAllowed, Export ("nowPlayingInfo", ArgumentSemantic.Copy)] NSDictionary WeakNowPlayingInfo { get; set; } } diff --git a/src/intentsui.cs b/src/intentsui.cs index d061b21bb9..32a12150a9 100644 --- a/src/intentsui.cs +++ b/src/intentsui.cs @@ -81,6 +81,74 @@ namespace IntentsUI { [Export ("displaysPaymentTransaction")] bool DisplaysPaymentTransaction { get; } } + + [iOS (12,0)] + [BaseType (typeof (UIViewController))] + [DisableDefaultCtor] + interface INUIAddVoiceShortcutViewController { + + [Wrap ("WeakDelegate")] + [NullAllowed] + IINUIAddVoiceShortcutViewControllerDelegate Delegate { get; set; } + + [NullAllowed, Export ("delegate", ArgumentSemantic.Weak)] + NSObject WeakDelegate { get; set; } + + [Export ("initWithShortcut:")] + IntPtr Constructor (INShortcut shortcut); + } + + interface IINUIAddVoiceShortcutViewControllerDelegate { } + + [iOS (12,0)] + [Protocol, Model (AutoGeneratedName = true)] + [BaseType (typeof (NSObject))] + interface INUIAddVoiceShortcutViewControllerDelegate { + + [Abstract] + [Export ("addVoiceShortcutViewController:didFinishWithVoiceShortcut:error:")] + void DidFinish (INUIAddVoiceShortcutViewController controller, [NullAllowed] INVoiceShortcut voiceShortcut, [NullAllowed] NSError error); + + [Abstract] + [Export ("addVoiceShortcutViewControllerDidCancel:")] + void DidCancel (INUIAddVoiceShortcutViewController controller); + } + + [iOS (12,0)] + [BaseType (typeof (UIViewController))] + [DisableDefaultCtor] + interface INUIEditVoiceShortcutViewController { + + [Wrap ("WeakDelegate")] + [NullAllowed] + IINUIEditVoiceShortcutViewControllerDelegate Delegate { get; set; } + + [NullAllowed, Export ("delegate", ArgumentSemantic.Weak)] + NSObject WeakDelegate { get; set; } + + [Export ("initWithVoiceShortcut:")] + IntPtr Constructor (INVoiceShortcut voiceShortcut); + } + + interface IINUIEditVoiceShortcutViewControllerDelegate { } + + [iOS (12,0)] + [Protocol, Model (AutoGeneratedName = true)] + [BaseType (typeof (NSObject))] + interface INUIEditVoiceShortcutViewControllerDelegate { + + [Abstract] + [Export ("editVoiceShortcutViewController:didUpdateVoiceShortcut:error:")] + void DidUpdate (INUIEditVoiceShortcutViewController controller, [NullAllowed] INVoiceShortcut voiceShortcut, [NullAllowed] NSError error); + + [Abstract] + [Export ("editVoiceShortcutViewController:didDeleteVoiceShortcutWithIdentifier:")] + void DidDelete (INUIEditVoiceShortcutViewController controller, NSUuid deletedVoiceShortcutIdentifier); + + [Abstract] + [Export ("editVoiceShortcutViewControllerDidCancel:")] + void DidCancel (INUIEditVoiceShortcutViewController controller); + } } #endif diff --git a/tests/introspection/ApiCtorInitTest.cs b/tests/introspection/ApiCtorInitTest.cs index 571a3f26fb..447bffece7 100644 --- a/tests/introspection/ApiCtorInitTest.cs +++ b/tests/introspection/ApiCtorInitTest.cs @@ -418,8 +418,9 @@ namespace Introspection { case "MDLColorSwatchTexture": // they don't make sense without extra arguments return true; - case "ASCredentialProviderViewController": - // goal is to "provides a standard interface for creating a credential provider extension", not a custom one + case "ASCredentialProviderViewController": // goal is to "provides a standard interface for creating a credential provider extension", not a custom one + case "INUIAddVoiceShortcutViewController": // Doesn't make sense without INVoiceShortcut and there is no other way to set this unless you use the other only .ctor + case "INUIEditVoiceShortcutViewController": // Doesn't make sense without INVoiceShortcut and there is no other way to set this unless you use the other only .ctor if (ctor.ToString () == "Void .ctor(String, NSBundle)") return true; break; diff --git a/tests/xtro-sharpie/iOS-IntentsUI.todo b/tests/xtro-sharpie/iOS-IntentsUI.todo index c9a23e5141..e69de29bb2 100644 --- a/tests/xtro-sharpie/iOS-IntentsUI.todo +++ b/tests/xtro-sharpie/iOS-IntentsUI.todo @@ -1,10 +0,0 @@ -!missing-protocol! INUIAddVoiceShortcutViewControllerDelegate not bound -!missing-protocol! INUIEditVoiceShortcutViewControllerDelegate not bound -!missing-selector! INUIAddVoiceShortcutViewController::delegate not bound -!missing-selector! INUIAddVoiceShortcutViewController::initWithShortcut: not bound -!missing-selector! INUIAddVoiceShortcutViewController::setDelegate: not bound -!missing-selector! INUIEditVoiceShortcutViewController::delegate not bound -!missing-selector! INUIEditVoiceShortcutViewController::initWithVoiceShortcut: not bound -!missing-selector! INUIEditVoiceShortcutViewController::setDelegate: not bound -!missing-type! INUIAddVoiceShortcutViewController not bound -!missing-type! INUIEditVoiceShortcutViewController not bound