Skip to content

[homekit] Update for Xcode 9 beta 1 & 2#2276

Merged
VincentDondain merged 4 commits into
dotnet:xcode9from
VincentDondain:homekit-b2
Jul 5, 2017
Merged

[homekit] Update for Xcode 9 beta 1 & 2#2276
VincentDondain merged 4 commits into
dotnet:xcode9from
VincentDondain:homekit-b2

Conversation

@VincentDondain

Copy link
Copy Markdown
Contributor

Reviewed iOS/watchOS/tvOS API diffs for beta 1 & 2.

Comment thread src/HomeKit/HMMutablePresenceEvent.cs Outdated

partial class HMMutablePresenceEvent {

public HMPresenceType PresenceType {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make it virtual so we can replace this with normal bindings (once support is added to the generator)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmh sure but I don't follow the logic. Why is virtual needed? Wound't we just remove the manual bindings?

@dalexsoto dalexsoto Jun 30, 2017

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because BindAs will generate a virtual member so making it virtual will be a breaking change, also we will need to use the same property name too so it is also not a breaking change

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right to avoid a breaking change, fair enough. However that is in the eventuality the generator fix doesn't make it before our release of the Xcode 9 APIs right? We can break before that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup we can break before it becomes stable, but we can keep the binary compat since now :)


partial class HMMutableSignificantTimeEvent {

public HMSignificantEvent SignificantEvent {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment thread src/homekit.cs Outdated
[BaseType (typeof (HMEvent))]
[DisableDefaultCtor]
interface HMLocationEvent : NSMutableCopying {
interface HMLocationEvent : NSCopying, NSMutableCopying {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unneeded since NSMutableCopying subclass NSCopying

Comment thread src/homekit.cs Outdated
[Watch (4,0), TV (11,0), iOS (11,0)]
[BaseType (typeof(HMTimeEvent))]
[DisableDefaultCtor]
interface HMCalendarEvent : NSCopying, NSMutableCopying {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same NSCopying not needed

Comment thread src/homekit.cs
IntPtr Constructor (NSDateComponents fireDateComponents);

[Export ("fireDateComponents", ArgumentSemantic.Strong)]
NSDateComponents FireDateComponents { get; set; }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't you get warnings from this ? c# does not allow overriding properties that don't match (no setter vs setter)

the non-mutable version should have both a getter and a setter, the later should be decorated with [NotImplemented]. That solves the issue and makes the code work like expected.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok sounds good, but no I did not get any warning (make all in /src).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the lack of warning due to the fact that we generate: public virtual NSDateComponents FireDateComponents for HMMutableCalendarEvent.g.cs? No override.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird, double check (with a simple test case) with csc (since pmcs is still mcs based)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spouliot this is because @VincentDondain is missing [Override] in the property of the mutable objects, he needs

[Export ("fireDateComponents", ArgumentSemantic.Strong)]
[Override]
NSDateComponents FireDateComponents { get; set; }

@VincentDondain VincentDondain Jun 30, 2017

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like it could be indeed, I did not know of this attribute, never had to use it. Seemed weird to me that the generated code did not have override.

Comment thread src/homekit.cs Outdated
[Watch (4,0), TV (11,0), iOS (11,0)]
[BaseType (typeof(HMTimeEvent))]
[DisableDefaultCtor]
interface HMDurationEvent : NSCopying, NSMutableCopying {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment thread src/homekit.cs
IntPtr Constructor (double duration);

[Export ("duration")]
double Duration { get; set; }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same (lack of setter on non-mutable property)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also needs [Override]

Comment thread src/homekit.cs

// FIXME: Bug https://bugzilla.xamarin.com/show_bug.cgi?id=57870
// [Wrap ("HMPresenceTypeExtensions.GetValue (_PresenceType)")]
// HMPresenceType PresenceType { get; set; }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same (non mutable should expose both)

Comment thread src/homekit.cs Outdated
[BaseType (typeof(HMSignificantTimeEvent))]
interface HMMutableSignificantTimeEvent {

[Internal]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure it should be internal, it might be needed in some cases (some NSString are user extensible).

Maybe just [Advanced] to hide it (by default) from intelligence ?

Comment thread src/homekit.cs

// FIXME: Bug https://bugzilla.xamarin.com/show_bug.cgi?id=57870
// [Wrap ("HMSignificantEventExtensions.GetValue (_SignificantEvent)")]
// HMSignificantEvent SignificantEvent { get; set; }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, non mutable version should match signature

@monojenkins

Copy link
Copy Markdown
Contributor

Build failure

@monojenkins

Copy link
Copy Markdown
Contributor

Build failure

1 similar comment
@monojenkins

Copy link
Copy Markdown
Contributor

Build failure

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VincentDondain please verify you have [Override] in your mutable properties

Comment thread src/homekit.cs Outdated

[Watch (4,0), TV (11,0), iOS (11,0)]
[Export ("homeDidUpdateAccessControlForCurrentUser:")]
void DidUpdateAccessControl (HMHome home);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmm this is kinda not making sense in my head if home type parameter is ok then let's keep DidUpdateAccessControlForCurrentUser since CurrentUser ctx is lost

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you're right, I understood it as the "Home" is the user or represents the user if I give it a bit more thoughts I don't think it's actually the case.

@brief Informs the delegate when the access control for current user has been updated.

Comment thread src/homekit.cs
IntPtr Constructor (NSDateComponents fireDateComponents);

[Export ("fireDateComponents", ArgumentSemantic.Strong)]
NSDateComponents FireDateComponents { get; set; }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spouliot this is because @VincentDondain is missing [Override] in the property of the mutable objects, he needs

[Export ("fireDateComponents", ArgumentSemantic.Strong)]
[Override]
NSDateComponents FireDateComponents { get; set; }

Comment thread src/homekit.cs
IntPtr Constructor (double duration);

[Export ("duration")]
double Duration { get; set; }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also needs [Override]

@monojenkins

Copy link
Copy Markdown
Contributor

Build failure

@VincentDondain

Copy link
Copy Markdown
Contributor Author

Unrelated test failure: https://bugzilla.xamarin.com/show_bug.cgi?id=57762

@VincentDondain VincentDondain merged commit 9866d3a into dotnet:xcode9 Jul 5, 2017
@VincentDondain VincentDondain deleted the homekit-b2 branch July 5, 2017 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants