From 2668374424c1e8a1967da7f6d0f2d20c0e103745 Mon Sep 17 00:00:00 2001 From: Alex Soto Date: Mon, 14 Nov 2016 23:23:30 -0600 Subject: [PATCH] [Intents] Update to Xcode 8.2 Beta 1 --- src/Intents/INSaveProfileInCarIntent.cs | 30 +++ src/Intents/INSetProfileInCarIntent.cs | 11 ++ src/frameworks.sources | 1 + src/intents.cs | 231 ++++++++++++++++++++++-- tests/introspection/ApiSelectorTest.cs | 5 + tests/introspection/ApiTypoTest.cs | 4 + 6 files changed, 269 insertions(+), 13 deletions(-) create mode 100644 src/Intents/INSaveProfileInCarIntent.cs diff --git a/src/Intents/INSaveProfileInCarIntent.cs b/src/Intents/INSaveProfileInCarIntent.cs new file mode 100644 index 000000000000..4cb4d0372f41 --- /dev/null +++ b/src/Intents/INSaveProfileInCarIntent.cs @@ -0,0 +1,30 @@ +// +// INSaveProfileInCarIntent Extensions +// +// Authors: +// Alex Soto +// +// Copyright 2016 Xamarin Inc. All rights reserved. +// + +#if XAMCORE_2_0 && IOS + +using XamCore.Foundation; +using XamCore.Intents; +using XamCore.ObjCRuntime; +using XamCore.UIKit; + +namespace XamCore.Intents { + public partial class INSaveProfileInCarIntent { + + public INSaveProfileInCarIntent (NSNumber profileNumber, string profileLabel) + { + // Apple created this change in 10,2 + if (UIDevice.CurrentDevice.CheckSystemVersion (10, 2)) + InitializeHandle (InitWithProfileNumberName (profileNumber, profileLabel)); + else + InitializeHandle (InitWithProfileNumberLabel (profileNumber, profileLabel)); + } + } +} +#endif diff --git a/src/Intents/INSetProfileInCarIntent.cs b/src/Intents/INSetProfileInCarIntent.cs index 179c2329162a..5817e2e5a51d 100644 --- a/src/Intents/INSetProfileInCarIntent.cs +++ b/src/Intents/INSetProfileInCarIntent.cs @@ -3,16 +3,27 @@ using XamCore.Foundation; using XamCore.Intents; using XamCore.ObjCRuntime; +using XamCore.UIKit; namespace XamCore.Intents { public partial class INSetProfileInCarIntent { + [DesignatedInitializer] public INSetProfileInCarIntent (NSNumber profileNumber, string profileLabel, bool? defaultProfile) : this (profileNumber, profileLabel, defaultProfile.HasValue ? new NSNumber (defaultProfile.Value) : null) { } + protected INSetProfileInCarIntent (NSNumber profileNumber, string profileLabel, NSNumber defaultProfile) + { + // Apple created this change in 10,2 + if (UIDevice.CurrentDevice.CheckSystemVersion (10, 2)) + InitializeHandle (InitWithProfileNumberName (profileNumber, profileLabel, defaultProfile)); + else + InitializeHandle (InitWithProfileNumberLabel (profileNumber, profileLabel, defaultProfile)); + } + // if/when we update the generator to allow this pattern we can move this back // into bindings and making them virtual (not a breaking change) diff --git a/src/frameworks.sources b/src/frameworks.sources index 138e919e261b..5232611deec6 100644 --- a/src/frameworks.sources +++ b/src/frameworks.sources @@ -827,6 +827,7 @@ INTENTS_SOURCES = \ Intents/INSetProfileInCarIntent.cs \ Intents/INSetSeatSettingsInCarIntent.cs \ Intents/INStartWorkoutIntent.cs \ + Intents/INSaveProfileInCarIntent.cs \ # JavaScriptCore diff --git a/src/intents.cs b/src/intents.cs index cb4402862750..7ce61146510f 100644 --- a/src/intents.cs +++ b/src/intents.cs @@ -450,7 +450,10 @@ public enum INSearchCallHistoryIntentResponseCode : nint { Ready, ContinueInApp, Failure, - FailureRequiringAppLaunch + FailureRequiringAppLaunch, + [Introduced (PlatformName.iOS, 10, 2)] + [Introduced (PlatformName.MacOSX, 10, 12, 2, PlatformArchitecture.Arch64)] + FailureAppConfigurationRequired, } [Introduced (PlatformName.iOS, 10, 0)] @@ -474,7 +477,10 @@ public enum INSearchForPhotosIntentResponseCode : nint { Ready, ContinueInApp, Failure, - FailureRequiringAppLaunch + FailureRequiringAppLaunch, + [Introduced (PlatformName.iOS, 10, 2)] + [Introduced (PlatformName.MacOSX, 10, 12, 2, PlatformArchitecture.Arch64)] + FailureAppConfigurationRequired, } [Introduced (PlatformName.iOS, 10, 0)] @@ -613,7 +619,13 @@ public enum INStartAudioCallIntentResponseCode : nint { Ready, ContinueInApp, Failure, - FailureRequiringAppLaunch + FailureRequiringAppLaunch, + [Introduced (PlatformName.iOS, 10, 2)] + [Introduced (PlatformName.MacOSX, 10, 12, 2, PlatformArchitecture.Arch64)] + FailureAppConfigurationRequired, + [Introduced (PlatformName.iOS, 10, 2)] + [Introduced (PlatformName.MacOSX, 10, 12, 2, PlatformArchitecture.Arch64)] + FailureCallingServiceNotAvailable, } [Introduced (PlatformName.iOS, 10, 0)] @@ -624,7 +636,9 @@ public enum INStartPhotoPlaybackIntentResponseCode : nint { Ready, ContinueInApp, Failure, - FailureRequiringAppLaunch + FailureRequiringAppLaunch, + [Introduced (PlatformName.iOS, 10, 2)] + FailureAppConfigurationRequired, } [Introduced (PlatformName.iOS, 10, 0)] @@ -635,7 +649,13 @@ public enum INStartVideoCallIntentResponseCode : nint { Ready, ContinueInApp, Failure, - FailureRequiringAppLaunch + FailureRequiringAppLaunch, + [Introduced (PlatformName.iOS, 10, 2)] + [Introduced (PlatformName.MacOSX, 10, 12, 2, PlatformArchitecture.Arch64)] + FailureAppConfigurationRequired, + [Introduced (PlatformName.iOS, 10, 2)] + [Introduced (PlatformName.MacOSX, 10, 12, 2, PlatformArchitecture.Arch64)] + FailureCallingServiceNotAvailable, } [Introduced (PlatformName.iOS, 10, 0)] @@ -802,6 +822,135 @@ public enum INIntentIdentifier { GetRideStatus } + [Introduced (PlatformName.iOS, 10, 2)] + [Introduced (PlatformName.MacOSX, 10, 12, 2, PlatformArchitecture.Arch64)] + enum INPersonHandleLabel { + [Field (null)] + None, + + [Field ("INPersonHandleLabelHome")] + Home, + + [Field ("INPersonHandleLabelWork")] + Work, + + [Field ("INPersonHandleLabeliPhone")] + iPhone, + + [Field ("INPersonHandleLabelMobile")] + Mobile, + + [Field ("INPersonHandleLabelMain")] + Main, + + [Field ("INPersonHandleLabelHomeFax")] + HomeFax, + + [Field ("INPersonHandleLabelWorkFax")] + WorkFax, + + [Field ("INPersonHandleLabelPager")] + Pager, + + [Field ("INPersonHandleLabelOther")] + Other, + } + + [Introduced (PlatformName.iOS, 10, 2)] + [Introduced (PlatformName.MacOSX, 10, 12, 2, PlatformArchitecture.Arch64)] + enum INPersonRelationship { + [Field ("INPersonRelationshipFather")] + Father, + + [Field ("INPersonRelationshipMother")] + Mother, + + [Field ("INPersonRelationshipParent")] + Parent, + + [Field ("INPersonRelationshipBrother")] + Brother, + + [Field ("INPersonRelationshipSister")] + Sister, + + [Field ("INPersonRelationshipChild")] + Child, + + [Field ("INPersonRelationshipFriend")] + Friend, + + [Field ("INPersonRelationshipSpouse")] + Spouse, + + [Field ("INPersonRelationshipPartner")] + Partner, + + [Field ("INPersonRelationshipAssistant")] + Assistant, + + [Field ("INPersonRelationshipManager")] + Manager, + } + + [Introduced (PlatformName.iOS, 10, 2)] + [Unavailable (PlatformName.MacOSX)] + enum INWorkoutNameIdentifier { + [Field ("INWorkoutNameIdentifierRun")] + Run, + + [Field ("INWorkoutNameIdentifierSit")] + Sit, + + [Field ("INWorkoutNameIdentifierSteps")] + Steps, + + [Field ("INWorkoutNameIdentifierStand")] + Stand, + + [Field ("INWorkoutNameIdentifierMove")] + Move, + + [Field ("INWorkoutNameIdentifierWalk")] + Walk, + + [Field ("INWorkoutNameIdentifierYoga")] + Yoga, + + [Field ("INWorkoutNameIdentifierDance")] + Dance, + + [Field ("INWorkoutNameIdentifierCrosstraining")] + Crosstraining, + + [Field ("INWorkoutNameIdentifierElliptical")] + Elliptical, + + [Field ("INWorkoutNameIdentifierRower")] + Rower, + + [Field ("INWorkoutNameIdentifierCycle")] + Cycle, + + [Field ("INWorkoutNameIdentifierStairs")] + Stairs, + + [Field ("INWorkoutNameIdentifierOther")] + Other, + + [Field ("INWorkoutNameIdentifierIndoorrun")] + Indoorrun, + + [Field ("INWorkoutNameIdentifierIndoorcycle")] + Indoorcycle, + + [Field ("INWorkoutNameIdentifierIndoorwalk")] + Indoorwalk, + + [Field ("INWorkoutNameIdentifierExercise")] + Exercise, + } + // End of enums [Introduced (PlatformName.iOS, 10, 0)] @@ -2157,6 +2306,28 @@ interface INPersonHandle : NSCopying, NSSecureCoding { [Export ("type")] INPersonHandleType Type { get; } + [Introduced (PlatformName.iOS, 10, 2)] + [Introduced (PlatformName.MacOSX, 10, 12, 2, PlatformArchitecture.Arch64)] + [Export ("label"), NullAllowed, Protected] + NSString WeakLabel { get; } + + [Introduced (PlatformName.iOS, 10, 2)] + [Introduced (PlatformName.MacOSX, 10, 12, 2, PlatformArchitecture.Arch64)] + [Wrap ("INPersonHandleLabelExtensions.GetValue (WeakLabel)")] + INPersonHandleLabel Label { get; } + + [Introduced (PlatformName.iOS, 10, 2)] + [Introduced (PlatformName.MacOSX, 10, 12, 2, PlatformArchitecture.Arch64)] + [Wrap ("this (value, type, label.GetConstant ())")] + [DesignatedInitializer] + IntPtr Constructor (string value, INPersonHandleType type, INPersonHandleLabel label); + + [Introduced (PlatformName.iOS, 10, 2)] + [Introduced (PlatformName.MacOSX, 10, 12, 2, PlatformArchitecture.Arch64)] + [Export ("initWithValue:type:label:"), Protected] + [DesignatedInitializer] + IntPtr Constructor (string value, INPersonHandleType type, [NullAllowed] NSString stringLabel); + [Export ("initWithValue:type:")] [DesignatedInitializer] IntPtr Constructor (string value, INPersonHandleType type); @@ -2840,9 +3011,14 @@ interface INRideCompletionStatus : NSCopying, NSSecureCoding { interface INRideDriver : NSCopying, NSSecureCoding { [Export ("initWithPersonHandle:nameComponents:displayName:image:rating:phoneNumber:")] - [DesignatedInitializer] + [Deprecated (PlatformName.iOS, 10,2, message:"Use the overload signature instead")] IntPtr Constructor (INPersonHandle personHandle, [NullAllowed] NSPersonNameComponents nameComponents, [NullAllowed] string displayName, [NullAllowed] INImage image, [NullAllowed] string rating, [NullAllowed] string phoneNumber); + [Export ("initWithPhoneNumber:nameComponents:displayName:image:rating:")] + [Introduced (PlatformName.iOS, 10,2)] + [DesignatedInitializer] + IntPtr Constructor (string phoneNumber, [NullAllowed] NSPersonNameComponents nameComponents, [NullAllowed] string displayName, [NullAllowed] INImage image, [NullAllowed] string rating); + [NullAllowed, Export ("rating")] string Rating { get; } @@ -3015,15 +3191,24 @@ interface INRideVehicle : NSCopying, NSSecureCoding { [BaseType (typeof (INIntent))] interface INSaveProfileInCarIntent { - [Export ("initWithProfileNumber:profileLabel:")] - [DesignatedInitializer] - IntPtr Constructor ([NullAllowed] NSNumber profileNumber, [NullAllowed] string profileLabel); + [Deprecated (PlatformName.iOS, 10, 2)] + [Export ("initWithProfileNumber:profileLabel:"), Internal] + IntPtr InitWithProfileNumberLabel ([NullAllowed] NSNumber profileNumber, [NullAllowed] string profileLabel); + + [Introduced (PlatformName.iOS, 10, 2)] + [Export ("initWithProfileNumber:profileName:"), Internal] + IntPtr InitWithProfileNumberName ([NullAllowed] NSNumber profileNumber, [NullAllowed] string profileName); [NullAllowed, Export ("profileNumber", ArgumentSemantic.Copy)] NSNumber ProfileNumber { get; } + [Deprecated (PlatformName.iOS, 10,2, message:"Use ProfileName instead")] [NullAllowed, Export ("profileLabel")] string ProfileLabel { get; } + + [Introduced (PlatformName.iOS, 10, 2)] + [NullAllowed, Export ("profileName")] + string ProfileName { get; } } [Introduced (PlatformName.iOS, 10, 0)] @@ -3040,6 +3225,10 @@ interface INSaveProfileInCarIntentHandling { [Export ("resolveProfileNumberForSaveProfileInCar:withCompletion:")] void ResolveProfileNumber (INSaveProfileInCarIntent intent, Action completion); + + [Introduced (PlatformName.iOS, 10, 2)] + [Export ("resolveProfileNameForSaveProfileInCar:withCompletion:")] + void ResolveProfileName (INSaveProfileInCarIntent intent, Action completion); } [Introduced (PlatformName.iOS, 10, 0)] @@ -3672,17 +3861,25 @@ interface INSetMessageAttributeIntentResponse { [BaseType (typeof (INIntent))] interface INSetProfileInCarIntent { - [Protected] - [Export ("initWithProfileNumber:profileLabel:defaultProfile:")] - [DesignatedInitializer] - IntPtr Constructor ([NullAllowed] NSNumber profileNumber, [NullAllowed] string profileLabel, [NullAllowed] NSNumber defaultProfile); + [Deprecated (PlatformName.iOS, 10, 2)] + [Export ("initWithProfileNumber:profileLabel:defaultProfile:"), Internal] + IntPtr InitWithProfileNumberLabel ([NullAllowed] NSNumber profileNumber, [NullAllowed] string profileLabel, [NullAllowed] NSNumber defaultProfile); + + [Introduced (PlatformName.iOS, 10, 2)] + [Export ("initWithProfileNumber:profileName:defaultProfile:"), Internal] + IntPtr InitWithProfileNumberName ([NullAllowed] NSNumber profileNumber, [NullAllowed] string profileName, [NullAllowed] NSNumber defaultProfile); [NullAllowed, Export ("profileNumber", ArgumentSemantic.Copy)] NSNumber ProfileNumber { get; } + [Deprecated (PlatformName.iOS, 10, 2, message: "Use ProfileName instead")] [NullAllowed, Export ("profileLabel")] string ProfileLabel { get; } + [Introduced (PlatformName.iOS, 10, 2)] + [NullAllowed, Export ("profileName")] + string ProfileName { get; } + [Internal] [NullAllowed, Export ("defaultProfile", ArgumentSemantic.Copy)] NSNumber _DefaultProfile { get; } @@ -3705,6 +3902,10 @@ interface INSetProfileInCarIntentHandling { [Export ("resolveDefaultProfileForSetProfileInCar:withCompletion:")] void ResolveDefaultProfile (INSetProfileInCarIntent intent, Action completion); + + [Introduced (PlatformName.iOS, 10, 2)] + [Export ("resolveProfileNameForSetProfileInCar:withCompletion:")] + void ResolveProfileName (INSetProfileInCarIntent intent, Action completion); } [Introduced (PlatformName.iOS, 10, 0)] @@ -3892,6 +4093,10 @@ interface INSpeakableString : INSpeakable { [Export ("initWithIdentifier:spokenPhrase:pronunciationHint:")] [DesignatedInitializer] IntPtr Constructor (string identifier, string spokenPhrase, [NullAllowed] string pronunciationHint); + + [Introduced (PlatformName.iOS, 10, 2)] + [Export ("initWithSpokenPhrase:")] + IntPtr Constructor (string spokenPhrase); } [Introduced (PlatformName.iOS, 10, 0)] diff --git a/tests/introspection/ApiSelectorTest.cs b/tests/introspection/ApiSelectorTest.cs index 9c13c9b16745..09ef6a1b7f98 100644 --- a/tests/introspection/ApiSelectorTest.cs +++ b/tests/introspection/ApiSelectorTest.cs @@ -514,6 +514,11 @@ protected virtual bool SkipInit (string selector, MethodBase m) case "initWithLeaderboardIdentifier:": // MCSession case "initWithPeer:securityIdentity:encryptionPreference:": + // INSetProfileInCarIntent and INSaveProfileInCarIntent + case "initWithProfileNumber:profileName:defaultProfile:": + case "initWithProfileNumber:profileLabel:defaultProfile:": + case "initWithProfileNumber:profileName:": + case "initWithProfileNumber:profileLabel:": // UISegmentedControl case "initWithItems:": var mi = m as MethodInfo; diff --git a/tests/introspection/ApiTypoTest.cs b/tests/introspection/ApiTypoTest.cs index d963bb939ed9..1b766e19d16c 100644 --- a/tests/introspection/ApiTypoTest.cs +++ b/tests/introspection/ApiTypoTest.cs @@ -115,6 +115,7 @@ public virtual bool Skip (MemberInfo methodName, string typo) { "Connnect", "Counterclock", "Craete", + "Crosstraining", "Cubemap", "Cmyk", // acronym: Cyan, magenta, yellow and key "Daap", @@ -190,6 +191,9 @@ public virtual bool Skip (MemberInfo methodName, string typo) { "Imap", "Imaps", "Img", + "Indoorrun", + "Indoorcycle", + "Indoorwalk", "Inser", "Interac", "Interframe",