Cloud Notification: support enhanced notification#285
Merged
ccutrer merged 1 commit intoopenhab:mainfrom Jun 28, 2024
Merged
Conversation
51d2b1f to
5662d8e
Compare
ccutrer
reviewed
Jun 28, 2024
| end | ||
|
|
||
| if email | ||
| # @!deprecated OH 4.1 |
Member
There was a problem hiding this comment.
given the 4 branches here, I'd suggest building up the args list dynamically:
args = []
if email
args.push(:send_notification, email)
else
args.push(:send_broadcast_notification)
end
args.push(msg.to_s, icon&.to_s, severity&.to_s)
if Core.version >= Core::V4_2
buttons ||= []
buttons = buttons.map { |title, action| "#{title}=#{action}" } if buttons.is_a?(Hash)
raise ArgumentError, "buttons must contain (0..3) elements." unless (0..3).cover?(buttons.size)
args.push(on_click&.to_s, attachment&.to_s, buttons[0]&.to_s, buttons[1]&.to_s, buttons[2]&.to_s)
end
NotificationAction.__send__(*args)
Contributor
Author
There was a problem hiding this comment.
So elegant! Thanks, master!
add title, on_click, attachment, and buttons Signed-off-by: Jimmy Tanagra <[email protected]>
ccutrer
approved these changes
Jun 28, 2024
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
add title, on_click, attachment, and buttons
See openhab/openhab-addons#16938