Skip to content

Commit

Permalink
Stop putting selectors on subclasses of command params structs. (#24543)
Browse files Browse the repository at this point in the history
That violates assumptions about being able to cast between the old and
new names.

Fixes #24542
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Sep 5, 2023
1 parent f1f1404 commit 1389971
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ NS_ASSUME_NONNULL_BEGIN
{{#*inline "oldNameImpl"}}

@implementation MTR{{cluster}}Cluster{{command}}Params
{{#zcl_command_arguments}}
{{#if (hasOldName (asUpperCamelCase parent.parent.name preserveAcronyms=true) command=(asUpperCamelCase parent.name preserveAcronyms=true) commandField=(asStructPropertyName label))}}

{{> renamed_struct_field_impl cluster=parent.parent.name type=type newName=label oldName=(oldName (asUpperCamelCase parent.parent.name preserveAcronyms=true) command=(asUpperCamelCase parent.name preserveAcronyms=true) commandField=(asStructPropertyName label))}}
{{/if}}
{{/zcl_command_arguments}}
@end
{{/inline}}
{{#if (not (wasRemoved (asUpperCamelCase parent.name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true)))}}
Expand All @@ -74,7 +68,8 @@ NS_ASSUME_NONNULL_BEGIN
(not (isStrEqual (asUpperCamelCase name preserveAcronyms=true) (compatCommandNameRemapping parent.name name))))}}
{{> oldNameImpl cluster=(compatClusterNameRemapping parent.name)
command=(compatCommandNameRemapping parent.name name)}}
{{else if (hasRenamedFields (asUpperCamelCase parent.name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true))}}
{{/if}}
{{#if (hasRenamedFields (asUpperCamelCase parent.name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true))}}
{{#*inline "deprecatedImpl"}}

@implementation MTR{{cluster}}Cluster{{command}}Params (Deprecated)
Expand Down
12 changes: 2 additions & 10 deletions src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,6 @@ NS_ASSUME_NONNULL_BEGIN

{{availability cluster command=command deprecationMessage=(concat "Please use MTR" (asUpperCamelCase parent.name preserveAcronyms=true) "Cluster" (asUpperCamelCase name preserveAcronyms=true) "Params")}}
@interface MTR{{cluster}}Cluster{{command}}Params : MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name}}Params
{{#zcl_command_arguments}}
{{#*inline "oldNameFieldDecl"}}

{{> struct_field_decl cluster=parent.parent.name type=type label=commandField}} {{availability ../cluster command=../command commandField=commandField deprecationMessage=(concat "Please use " (asStructPropertyName label))}};
{{/inline}}
{{#if (hasOldName (asUpperCamelCase parent.parent.name preserveAcronyms=true) command=(asUpperCamelCase parent.name preserveAcronyms=true) commandField=(asStructPropertyName label))}}
{{> oldNameFieldDecl commandField=(oldName (asUpperCamelCase parent.parent.name preserveAcronyms=true) command=(asUpperCamelCase parent.name preserveAcronyms=true) commandField=(asStructPropertyName label))}}
{{/if}}
{{/zcl_command_arguments}}
@end

{{/inline}}
Expand All @@ -86,7 +77,8 @@ NS_ASSUME_NONNULL_BEGIN
(not (isStrEqual (asUpperCamelCase name preserveAcronyms=true) (compatCommandNameRemapping parent.name name))))}}
{{> oldNameDecl cluster=(compatClusterNameRemapping parent.name)
command=(compatCommandNameRemapping parent.name name)}}
{{else if (hasRenamedFields (asUpperCamelCase parent.name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true))}}
{{/if}}
{{#if (hasRenamedFields (asUpperCamelCase parent.name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true))}}
{{#*inline "deprecatedDecl"}}

@interface MTR{{cluster}}Cluster{{command}}Params (Deprecated)
Expand Down
14 changes: 14 additions & 0 deletions src/darwin/Framework/CHIP/templates/availability.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4954,6 +4954,9 @@
- location
- requestorCanConsent
- metadataForProvider
# Next two were introduced and deprecated at the same time, effectively
- vendorId
- productId
QueryImageResponse:
- status
- delayedActionTime
Expand All @@ -4979,6 +4982,9 @@
- announcementReason
- metadataForNode
- endpoint
# Next two were introduced and deprecated at the same time, effectively
- providerNodeId
- vendorId
ClientMonitoring:
RegisterClientMonitoring:
- clientNodeId
Expand Down Expand Up @@ -5647,6 +5653,14 @@
ColorControl:
MoveToColorTemperature:
- colorTemperature
OTASoftwareUpdateProvider:
QueryImage:
- vendorId
- productId
OTASoftwareUpdateRequestor:
AnnounceOTAProvider:
- providerNodeId
- vendorId
structs:
Descriptor:
- DeviceType
Expand Down
18 changes: 10 additions & 8 deletions src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1389971

Please sign in to comment.