Skip to content

Commit

Permalink
Returning the result of the symbol evaluation for ios format (#390)
Browse files Browse the repository at this point in the history
* Returning the result of the symbol evaluation for ios format

* Refactor

* Update ios.rb

* Update lib/noticed/delivery_methods/ios.rb

---------

Co-authored-by: Chris Oliver <excid3@gmail.com>
  • Loading branch information
avanrielly and excid3 authored Jan 27, 2024
1 parent 82e3fc0 commit 8a85d5b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/noticed/delivery_methods/ios.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ def deliver
def format_notification(apn)
apn.topic = evaluate_option(:bundle_identifier)

if (method = config[:format])
method = event.send(method, apn) if method.is_a?(Symbol) && event.respond_to?(method)
method = config[:format]
# Call method on Notifier if defined
if method&.is_a?(Symbol) && event.respond_to?(method)
event.send(method, apn)
# If Proc, evaluate it on the Notification
elsif method&.respond_to?(:call)
notification.instance_exec(apn, &method)
elsif notification.params.try(:has_key?, :message)
apn.alert = notification.params[:message]
Expand Down

0 comments on commit 8a85d5b

Please sign in to comment.