Skip to content

Commit

Permalink
merge data/target fields after action is autofilled
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerwyn committed Jan 28, 2024
1 parent a545e7a commit b090c7b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
4 changes: 2 additions & 2 deletions dist/android-tv-card.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "android-tv-card",
"version": "3.2.8",
"version": "3.2.9",
"description": "Android TV Remote Card",
"main": "./dist/android-tv-card.js",
"scripts": {
Expand Down
27 changes: 14 additions & 13 deletions src/android-tv-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,19 +193,6 @@ class AndroidTVCard extends LitElement {
const action = customAction[
actionType as keyof IActions
] as IAction;
if (['call-service', 'more-info'].includes(action.action)) {
// Merge service_data, target, and data fields
action.data = {
...action.data,
...(
action as unknown as Record<
string,
IData | undefined
>
).service_data,
...action.target,
};
}

// Populate action field
if (!('action' in action)) {
Expand All @@ -228,6 +215,20 @@ class AndroidTVCard extends LitElement {
(action as IAction).action = 'none';
}
}

// Merge service_data, target, and data fields
if (['call-service', 'more-info'].includes(action.action)) {
action.data = {
...action.data,
...(
action as unknown as Record<
string,
IData | undefined
>
).service_data,
...action.target,
};
}
}
}
}
Expand Down

0 comments on commit b090c7b

Please sign in to comment.