From 36cdb26c8ed6945059cdba4cc0cbd40b2066995a Mon Sep 17 00:00:00 2001 From: Vincent Dondain Date: Mon, 14 Aug 2017 18:01:07 -0400 Subject: [PATCH] [homekit] Update for Xcode 9 beta 5 --- src/HomeKit/HMEnums.cs | 33 +++++++------- src/HomeKit/HMMutablePresenceEvent.cs | 17 -------- src/HomeKit/HMPresenceEvent.cs | 17 -------- src/frameworks.sources | 2 - src/homekit.cs | 38 +++++----------- .../HomeKit/HMMutablePresenceEventTest.cs | 43 ------------------- .../HomeKit/HMPresenceEventTest.cs | 41 ------------------ tests/monotouch-test/monotouch-test.csproj | 2 - 8 files changed, 25 insertions(+), 168 deletions(-) delete mode 100644 src/HomeKit/HMMutablePresenceEvent.cs delete mode 100644 src/HomeKit/HMPresenceEvent.cs delete mode 100644 tests/monotouch-test/HomeKit/HMMutablePresenceEventTest.cs delete mode 100644 tests/monotouch-test/HomeKit/HMPresenceEventTest.cs diff --git a/src/HomeKit/HMEnums.cs b/src/HomeKit/HMEnums.cs index a70cb7757199..9849944e27c8 100644 --- a/src/HomeKit/HMEnums.cs +++ b/src/HomeKit/HMEnums.cs @@ -1271,24 +1271,21 @@ public enum HMHomeHubState : nuint { } [Watch (4,0), TV (11,0), iOS (11,0)] - public enum HMPresenceType { - - [Field ("HMPresenceTypeCurrentUserAtHome")] - CurrentUserAtHome, - - [Field ("HMPresenceTypeCurrentUserNotAtHome")] - CurrentUserNotAtHome, - - [Field ("HMPresenceTypeAnyUserAtHome")] - AnyUserAtHome, - - [Field ("HMPresenceTypeNoUserAtHome")] - NoUserAtHome, - - [Field ("HMPresenceTypeUsersAtHome")] - UsersAtHome, + [Native] + public enum HMPresenceEventType : nuint { + EveryEntry = 1, + EveryExit = 2, + FirstEntry = 3, + LastExit = 4, + AtHome = FirstEntry, + NotAtHome = LastExit, + } - [Field ("HMPresenceTypeUsersNotAtHome")] - UsersNotAtHome, + [Watch (4,0), TV (11,0), iOS (11,0)] + [Native] + public enum HMPresenceEventUserType : nuint { + CurrentUser = 1, + HomeUsers = 2, + CustomUsers = 3, } } diff --git a/src/HomeKit/HMMutablePresenceEvent.cs b/src/HomeKit/HMMutablePresenceEvent.cs deleted file mode 100644 index 9d44be336917..000000000000 --- a/src/HomeKit/HMMutablePresenceEvent.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using XamCore.ObjCRuntime; - -namespace XamCore.HomeKit { - - partial class HMMutablePresenceEvent { - - public virtual HMPresenceType PresenceType { - get { - return (HMPresenceType) (HMPresenceTypeExtensions.GetValue (_PresenceType)); - } - set { - _PresenceType = HMPresenceTypeExtensions.GetConstant (value); - } - } - } -} diff --git a/src/HomeKit/HMPresenceEvent.cs b/src/HomeKit/HMPresenceEvent.cs deleted file mode 100644 index 106463123626..000000000000 --- a/src/HomeKit/HMPresenceEvent.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using XamCore.ObjCRuntime; - -namespace XamCore.HomeKit { - - partial class HMPresenceEvent { - - public virtual HMPresenceType PresenceType { - get { - return (HMPresenceType) (HMPresenceTypeExtensions.GetValue (_PresenceType)); - } - set { - _PresenceType = HMPresenceTypeExtensions.GetConstant (value); - } - } - } -} diff --git a/src/frameworks.sources b/src/frameworks.sources index 263c2c723613..7586384f83e4 100644 --- a/src/frameworks.sources +++ b/src/frameworks.sources @@ -816,9 +816,7 @@ HOMEKIT_SOURCES = \ HomeKit/HMCharacteristicProperties.cs \ HomeKit/HMEventTrigger.cs \ HomeKit/HMHome.cs \ - HomeKit/HMPresenceEvent.cs \ HomeKit/HMSignificantTimeEvent.cs \ - HomeKit/HMMutablePresenceEvent.cs \ HomeKit/HMMutableSignificantTimeEvent.cs \ HomeKit/HMService.cs \ diff --git a/src/homekit.cs b/src/homekit.cs index 342af02d3e2a..26c8bb17e6db 100644 --- a/src/homekit.cs +++ b/src/homekit.cs @@ -1207,7 +1207,6 @@ interface HMEventTrigger { [NoWatch] [iOS (11,0)] [Export ("initWithName:events:endEvents:recurrences:predicate:")] - [DesignatedInitializer] IntPtr Constructor (string name, HMEvent[] events, [NullAllowed] HMEvent[] endEvents, [NullAllowed] NSDateComponents[] recurrences, [NullAllowed] NSPredicate predicate); [Export ("events", ArgumentSemantic.Copy)] @@ -1675,20 +1674,14 @@ interface HMNumberRange { [DisableDefaultCtor] interface HMPresenceEvent : NSMutableCopying { - [Internal] - [Export ("initWithPresenceType:")] - IntPtr Constructor (NSString presenceType); - - [Wrap ("this (HMPresenceTypeExtensions.GetConstant (presenceType))")] - IntPtr Constructor (HMPresenceType presenceType); + [Export ("initWithPresenceEventType:presenceUserType:")] + IntPtr Constructor (HMPresenceEventType presenceEventType, HMPresenceEventUserType presenceUserType); - [Internal] - [Export ("presenceType")] - NSString _PresenceType { get; [NotImplemented] set; } + [Export ("presenceEventType")] + HMPresenceEventType PresenceEventType { get; [NotImplemented] set; } - // FIXME: Bug https://bugzilla.xamarin.com/show_bug.cgi?id=57870 - // [Wrap ("HMPresenceTypeExtensions.GetValue (_PresenceType)")] - // HMPresenceType PresenceType { get; [NotImplemented] set; } + [Export ("presenceUserType")] + HMPresenceEventUserType PresenceUserType { get; [NotImplemented] set; } [Field ("HMPresenceKeyPath")] NSString KeyPath { get; } @@ -1699,22 +1692,11 @@ interface HMPresenceEvent : NSMutableCopying { [DisableDefaultCtor] interface HMMutablePresenceEvent { - [Internal] - [Export ("initWithPresenceType:")] - IntPtr Constructor (NSString presenceType); - - [Wrap ("this (HMPresenceTypeExtensions.GetConstant (presenceType))")] - IntPtr Constructor (HMPresenceType presenceType); - - [Internal] - [Override] - [Export ("presenceType")] - NSString _PresenceType { get; set; } + [Export ("presenceEventType", ArgumentSemantic.Assign)] + HMPresenceEventType PresenceEventType { get; /* Radar 33883958: https://trello.com/c/TIlzWzrL*/ [NotImplemented] set; } - // FIXME: Bug https://bugzilla.xamarin.com/show_bug.cgi?id=57870 - // [Override] - // [Wrap ("HMPresenceTypeExtensions.GetValue (_PresenceType)")] - // HMPresenceType PresenceType { get; set; } + [Export ("presenceUserType", ArgumentSemantic.Assign)] + HMPresenceEventUserType PresenceUserType { get; /* Radar 33883958: https://trello.com/c/TIlzWzrL*/ [NotImplemented] set; } } [Watch (4,0), TV (11,0), iOS (11,0)] diff --git a/tests/monotouch-test/HomeKit/HMMutablePresenceEventTest.cs b/tests/monotouch-test/HomeKit/HMMutablePresenceEventTest.cs deleted file mode 100644 index dea30d55dad6..000000000000 --- a/tests/monotouch-test/HomeKit/HMMutablePresenceEventTest.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -// Unit tests for HMMutablePresenceEventTest -// -// Authors: -// Vincent Dondain -// -// -// Copyright 2017 Microsoft. All rights reserved. -// - -#if !MONOMAC - -using System; -using NUnit.Framework; - -using Foundation; -using HomeKit; - -namespace MonoTouchFixtures.HomeKit -{ - [TestFixture] - [Preserve (AllMembers = true)] - public class HMMutablePresenceEventTest - { - [SetUp] - public void Setup () - { - TestRuntime.AssertXcodeVersion (9, 0); - } - - [Test] - public void PresenceTypePropertyTest () - { - using (var obj = new HMMutablePresenceEvent (HMPresenceType.AnyUserAtHome)) { - Assert.AreEqual (HMPresenceType.AnyUserAtHome, obj.PresenceType, "1 PresenceType Getter"); - obj.PresenceType = HMPresenceType.CurrentUserAtHome; - Assert.AreEqual (HMPresenceType.CurrentUserAtHome, obj.PresenceType, "2 PresenceType Setter"); - } - } - } -} - -#endif \ No newline at end of file diff --git a/tests/monotouch-test/HomeKit/HMPresenceEventTest.cs b/tests/monotouch-test/HomeKit/HMPresenceEventTest.cs deleted file mode 100644 index ad7a255cad62..000000000000 --- a/tests/monotouch-test/HomeKit/HMPresenceEventTest.cs +++ /dev/null @@ -1,41 +0,0 @@ -// -// Unit tests for HMPresenceEventTest -// -// Authors: -// Vincent Dondain -// -// -// Copyright 2017 Microsoft. All rights reserved. -// - -#if !MONOMAC - -using System; -using NUnit.Framework; - -using Foundation; -using HomeKit; - -namespace MonoTouchFixtures.HomeKit -{ - [TestFixture] - [Preserve (AllMembers = true)] - public class HMPresenceEventTest - { - [SetUp] - public void Setup () - { - TestRuntime.AssertXcodeVersion (9, 0); - } - - [Test] - public void PresenceTypePropertyTest () - { - using (var obj = new HMPresenceEvent (HMPresenceType.AnyUserAtHome)) { - Assert.AreEqual (HMPresenceType.AnyUserAtHome, obj.PresenceType, "1 PresenceType Getter"); - } - } - } -} - -#endif \ No newline at end of file diff --git a/tests/monotouch-test/monotouch-test.csproj b/tests/monotouch-test/monotouch-test.csproj index 180a408d0781..f152a0c822ac 100644 --- a/tests/monotouch-test/monotouch-test.csproj +++ b/tests/monotouch-test/monotouch-test.csproj @@ -652,9 +652,7 @@ - -