Skip to content

Commit 48293a4

Browse files
Israel Sotomandel-macaque
andauthored
[HomeKit] Added support to Xcode 14.1 b1-b3 (#16069)
* Matter properties are still missing Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
1 parent bac36c5 commit 48293a4

9 files changed

Lines changed: 135 additions & 118 deletions

File tree

src/HomeKit/HMCompat.cs

Lines changed: 108 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class HMChipServiceRequestHandler : NSObject, INSExtensionRequestHandling
4747

4848
} /* class HMChipServiceRequestHandler */
4949

50-
[Obsolete ("This class is removed, use 'HMMatterTopology' instead.")]
50+
[Obsolete ("This class is removed.")]
5151
[Register ("HMCHIPServiceTopology", SkipRegistration = true)]
5252
public class HMChipServiceTopology : NSObject, INSCoding, INSCopying, INSSecureCoding {
5353

@@ -82,7 +82,7 @@ public class HMChipServiceRoom : NSObject, INSCoding, INSCopying, INSSecureCodin
8282

8383
} /* class HMChipServiceRoom */
8484

85-
[Obsolete ("This class is removed, use 'HMMatterHome' instead.")]
85+
[Obsolete ("This class is removed.")]
8686
[Register("HMCHIPServiceHome", SkipRegistration = true)]
8787
public partial class HMChipServiceHome : NSObject, INSCoding, INSCopying, INSSecureCoding {
8888

@@ -131,6 +131,112 @@ public unsafe partial class HMAccessorySetupManager : NSObject {
131131
public virtual void PerformMatterEcosystemAccessorySetup (HMAccessorySetupRequest request, HMMatterTopology topology, Action<NSError> completion) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
132132
public virtual Task PerformMatterEcosystemAccessorySetupAsync (HMAccessorySetupRequest request, HMMatterTopology topology) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
133133
}
134+
135+
#endif
136+
137+
#if !NET
138+
[Obsolete ("This class is removed.")]
139+
#else
140+
[UnsupportedOSPlatform ("ios16.1")]
141+
[UnsupportedOSPlatform ("tvos16.1")]
142+
[UnsupportedOSPlatform ("maccatalyst16.1")]
143+
[UnsupportedOSPlatform ("macos13.0")]
134144
#endif
145+
[Register ("HMMatterRoom", SkipRegistration = true)]
146+
public partial class HMMatterRoom : NSObject, INSCoding, INSCopying, INSSecureCoding {
147+
public override NativeHandle ClassHandle => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
148+
protected HMMatterRoom (NativeHandle handle) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
149+
public HMMatterRoom (NSCoder coder) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
150+
protected HMMatterRoom (NSObjectFlag t) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
151+
public HMMatterRoom (NSUuid uuid, string name) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
152+
153+
public virtual string Name => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
154+
public virtual NSUuid Uuid => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
155+
156+
public virtual NSObject Copy (NSZone? zone)=> throw new InvalidOperationException (Constants.RemovedFromHomeKit);
157+
public virtual void EncodeTo (NSCoder encoder) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
158+
159+
}
160+
161+
#if !NET
162+
[Obsolete ("This class is removed.")]
163+
#else
164+
[UnsupportedOSPlatform ("ios16.1")]
165+
[UnsupportedOSPlatform ("tvos16.1")]
166+
[UnsupportedOSPlatform ("maccatalyst16.1")]
167+
[UnsupportedOSPlatform ("macos13.0")]
168+
#endif
169+
[Register("HMMatterHome", SkipRegistration = true)]
170+
public partial class HMMatterHome : NSObject, INSCoding, INSCopying, INSSecureCoding {
171+
172+
public override NativeHandle ClassHandle => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
173+
174+
protected HMMatterHome (NativeHandle handle) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
175+
public HMMatterHome (NSCoder coder) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
176+
protected HMMatterHome (NSObjectFlag t) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
177+
178+
public HMMatterHome (NSUuid uuid, string name) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
179+
public virtual NSObject Copy (NSZone? zone) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
180+
181+
public virtual void EncodeTo (NSCoder encoder) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
182+
public virtual string Name => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
183+
public virtual NSUuid Uuid => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
184+
185+
}
186+
187+
#if !NET
188+
[Obsolete ("This class is removed.")]
189+
#else
190+
[UnsupportedOSPlatform ("ios16.1")]
191+
[UnsupportedOSPlatform ("tvos16.1")]
192+
[UnsupportedOSPlatform ("maccatalyst16.1")]
193+
[UnsupportedOSPlatform ("macos13.0")]
194+
#endif
195+
[Register("HMMatterTopology", SkipRegistration = true)]
196+
public partial class HMMatterTopology : NSObject, INSCoding, INSCopying, INSSecureCoding {
197+
198+
public override NativeHandle ClassHandle => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
199+
200+
protected HMMatterTopology (NativeHandle handle) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
201+
public HMMatterTopology (NSCoder coder) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
202+
protected HMMatterTopology (NSObjectFlag t) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
203+
204+
public HMMatterTopology (HMMatterHome [] homes) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
205+
206+
public virtual HMMatterHome [] Homes => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
207+
public virtual NSObject Copy (NSZone? zone)=> throw new InvalidOperationException (Constants.RemovedFromHomeKit);
208+
public virtual void EncodeTo (NSCoder encoder) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
209+
}
210+
211+
public delegate void HMFetchRoomHandler (HMMatterRoom [] rooms, NSError error);
212+
213+
#if !NET
214+
[Obsolete ("This class is removed.")]
215+
#else
216+
[UnsupportedOSPlatform ("ios16.1")]
217+
[UnsupportedOSPlatform ("tvos16.1")]
218+
[UnsupportedOSPlatform ("maccatalyst16.1")]
219+
[UnsupportedOSPlatform ("macos13.0")]
220+
#endif
221+
[Register("HMMatterRequestHandler", SkipRegistration = true)]
222+
public partial class HMMatterRequestHandler : NSObject, INSExtensionRequestHandling {
223+
public override NativeHandle ClassHandle => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
224+
225+
public HMMatterRequestHandler () => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
226+
protected HMMatterRequestHandler (NativeHandle handle) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
227+
protected HMMatterRequestHandler (NSObjectFlag t) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
228+
229+
public virtual void FetchRooms (HMMatterHome home, HMFetchRoomHandler completion) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
230+
public virtual Task<HMMatterRoom[]> FetchRoomsAsync (HMMatterHome home) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
231+
232+
public virtual void PairAccessory (HMMatterHome home, string onboardingPayload, Action<NSError> completion) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
233+
public virtual Task PairAccessoryAsync (HMMatterHome home, string onboardingPayload) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
234+
235+
public virtual void ConfigureAccessory (string accessoryName, HMMatterRoom accessoryRoom, Action<NSError> completion) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
236+
public virtual Task ConfigureAccessoryAsync (string accessoryName, HMMatterRoom accessoryRoom) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
237+
238+
public virtual void BeginRequestWithExtensionContext (NSExtensionContext context) => throw new InvalidOperationException (Constants.RemovedFromHomeKit);
239+
}
240+
135241
#endif
136242
}

src/homekit.cs

Lines changed: 22 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ partial interface HMHomeManager {
3939
[Protocolize]
4040
HMHomeManagerDelegate Delegate { get; set; }
4141

42+
[Deprecated (PlatformName.MacOSX, 13,0, message: "No longer supported.")]
43+
[Deprecated (PlatformName.iOS, 16,1, message: "No longer supported.")]
44+
[Deprecated (PlatformName.MacCatalyst, 16,1, message: "No longer supported.")]
45+
[Deprecated (PlatformName.WatchOS, 9,1, message: "No longer supported.")]
46+
[Deprecated (PlatformName.TvOS, 16,1, message: "No longer supported.")]
4247
[NullAllowed, Export ("primaryHome", ArgumentSemantic.Retain)]
4348
HMHome PrimaryHome { get; }
4449

@@ -47,6 +52,9 @@ partial interface HMHomeManager {
4752

4853
[NoTV]
4954
[NoWatch]
55+
[Deprecated (PlatformName.MacOSX, 13, 0, message: "No longer supported.")]
56+
[Deprecated (PlatformName.iOS, 16,1, message: "No longer supported.")]
57+
[Deprecated (PlatformName.MacCatalyst, 16,1, message: "No longer supported.")]
5058
[Async]
5159
[Export ("updatePrimaryHome:completionHandler:")]
5260
void UpdatePrimaryHome (HMHome home, Action<NSError> completion);
@@ -166,6 +174,11 @@ partial interface HMAccessory {
166174
[NullAllowed, Export ("firmwareVersion")]
167175
string FirmwareVersion { get; }
168176

177+
[NullAllowed]
178+
[Mac (13,0), iOS (16,1), MacCatalyst (16,1), Watch (9,1), TV (16,1)]
179+
[Export ("matterNodeID", ArgumentSemantic.Copy)]
180+
NSNumber MatterNodeId { get; }
181+
169182
[NoTV]
170183
[NoWatch]
171184
[Async]
@@ -537,7 +550,6 @@ partial interface HMCharacteristicWriteAction {
537550

538551
[NoTV]
539552
[NoWatch]
540-
[DesignatedInitializer]
541553
[Export ("initWithCharacteristic:targetValue:")]
542554
#if XAMCORE_3_0
543555
NativeHandle Constructor (HMCharacteristic characteristic, INSCopying targetValue);
@@ -774,6 +786,15 @@ partial interface HMHome {
774786
[Export ("homeAccessControlForUser:")]
775787
HMHomeAccessControl GetHomeAccessControl (HMUser user);
776788

789+
// @interface Matter (HMHome)
790+
[TV (16,1), iOS (16, 1), MacCatalyst (16,1), Watch (9,1)]
791+
[Export ("matterControllerID")]
792+
string MatterControllerId { get; }
793+
794+
[TV (16,1), iOS (16, 1), MacCatalyst (16,1), Watch (9,1)]
795+
[Export ("matterControllerXPCConnectBlock", ArgumentSemantic.Strong)]
796+
Func<NSXpcConnection> MatterControllerXPCConnectBlock { get; }
797+
777798
// constants
778799

779800
[MacCatalyst (14,0)]
@@ -1921,77 +1942,6 @@ interface HMAccessControl {
19211942

19221943
}
19231944

1924-
[iOS (15,2), Watch (8,3), TV (15,2), MacCatalyst (15,2)]
1925-
[BaseType (typeof (NSObject))]
1926-
[DisableDefaultCtor]
1927-
interface HMMatterHome : NSCopying, NSSecureCoding
1928-
{
1929-
[Wrap ("true ? throw new InvalidOperationException (Constants.RemovedFromHomeKit) : false", IsVirtual = true)]
1930-
[Export ("uuid", ArgumentSemantic.Strong)]
1931-
NSUuid Uuid { get; }
1932-
1933-
[Wrap ("true ? throw new InvalidOperationException (Constants.RemovedFromHomeKit) : false", IsVirtual = true)]
1934-
[Export ("name", ArgumentSemantic.Strong)]
1935-
string Name { get; }
1936-
1937-
[Wrap ("true ? throw new InvalidOperationException (Constants.RemovedFromHomeKit) : false", IsVirtual = true)]
1938-
[Export ("initWithUUID:name:")]
1939-
[DesignatedInitializer]
1940-
NativeHandle Constructor (NSUuid uuid, string name);
1941-
}
1942-
1943-
delegate void HMFetchRoomHandler (HMMatterRoom [] rooms, NSError error);
1944-
1945-
[iOS (15,2), Watch (8,3), TV (15,2), MacCatalyst (15,2)]
1946-
[BaseType (typeof (NSObject))]
1947-
interface HMMatterRequestHandler : NSExtensionRequestHandling
1948-
{
1949-
[Async]
1950-
[Export ("fetchRoomsInHome:completion:")]
1951-
void FetchRooms (HMMatterHome home, HMFetchRoomHandler completion);
1952-
1953-
[Async]
1954-
[Export ("pairAccessoryInHome:onboardingPayload:completion:")]
1955-
void PairAccessory (HMMatterHome home, string onboardingPayload, Action<NSError> completion);
1956-
1957-
[Async]
1958-
[Export ("configureAccessoryWithName:room:completion:")]
1959-
void ConfigureAccessory (string accessoryName, HMMatterRoom accessoryRoom, Action<NSError> completion);
1960-
}
1961-
1962-
[iOS (15,2), Watch (8,3), TV (15,2), MacCatalyst (15,2)]
1963-
[BaseType (typeof (NSObject))]
1964-
[DisableDefaultCtor]
1965-
interface HMMatterRoom : NSCopying, NSSecureCoding
1966-
{
1967-
[Wrap ("true ? throw new InvalidOperationException (Constants.RemovedFromHomeKit) : false", IsVirtual = true)]
1968-
[Export ("uuid", ArgumentSemantic.Strong)]
1969-
NSUuid Uuid { get; }
1970-
1971-
[Wrap ("true ? throw new InvalidOperationException (Constants.RemovedFromHomeKit) : false", IsVirtual = true)]
1972-
[Export ("name", ArgumentSemantic.Strong)]
1973-
string Name { get; }
1974-
1975-
[Wrap ("true ? throw new InvalidOperationException (Constants.RemovedFromHomeKit) : false", IsVirtual = true)]
1976-
[Export ("initWithUUID:name:")]
1977-
[DesignatedInitializer]
1978-
NativeHandle Constructor (NSUuid uuid, string name);
1979-
}
1980-
1981-
[iOS (15,2), Watch (8,3), TV (15,2), MacCatalyst (15,2)]
1982-
[BaseType (typeof (NSObject))]
1983-
[DisableDefaultCtor]
1984-
interface HMMatterTopology : NSCopying, NSSecureCoding
1985-
{
1986-
[Wrap ("true ? throw new InvalidOperationException (Constants.RemovedFromHomeKit) : false", IsVirtual = true)]
1987-
[Export ("initWithHomes:")]
1988-
NativeHandle Constructor (HMMatterHome [] homes);
1989-
1990-
[Wrap ("true ? throw new InvalidOperationException (Constants.RemovedFromHomeKit) : false", IsVirtual = true)]
1991-
[Export ("homes", ArgumentSemantic.Copy)]
1992-
HMMatterHome [] Homes { get; }
1993-
}
1994-
19951945
[NoWatch, NoTV, NoMacCatalyst, NoMac, iOS (15,4)]
19961946
[BaseType (typeof (NSObject))]
19971947
interface HMAccessorySetupRequest : NSCopying {

tests/introspection/ApiCtorInitTest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ protected virtual bool Skip (Type type)
132132
// Causes a crash later. Filed as radar://18440271.
133133
// Apple said they won't fix this ('init' isn't a designated initializer)
134134
return true;
135+
case "HMMatterRequestHandler": // got removed and the current API throws an exception at run time.
136+
return true;
135137
}
136138

137139
#if !NET

tests/introspection/ApiProtocolTest.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ protected virtual bool Skip (Type type)
5656
case "CLKComplicationWidgetMigrator":
5757
// Not present in the simulator, is a migration class
5858
return true;
59+
// was removed by apple and is a compat class.
60+
case "HMMatterRequestHandler":
61+
return true;
5962
default:
6063
return SkipDueToAttribute (type);
6164
}

tests/xtro-sharpie/api-annotations-dotnet/iOS-HomeKit.todo

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/xtro-sharpie/api-annotations-dotnet/tvOS-HomeKit.todo

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/xtro-sharpie/iOS-HomeKit.todo

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/xtro-sharpie/tvOS-HomeKit.todo

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/xtro-sharpie/watchOS-HomeKit.todo

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)