Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS Delivery Method Updates and a couple of docs enhancements #377

Merged
merged 9 commits into from
Jan 23, 2024

Conversation

phil-6
Copy link
Contributor

@phil-6 phil-6 commented Jan 23, 2024

Summary

Functionality

  • Changes format to json in lib/noticed/delivery_methods/ios.rb
  • Allows json to respond to a symbol as a method in ios.rb
  • Allows connection_pool_options to respond to symbol representing a method

Documentation

  • Add section about delivery method configuration to README.md
  • Add tip about Extracting Delivery Method Configurations to README.md
  • Update UPGRADE.md with changes to configuration methods

Description

Changes format to json in lib/noticed/delivery_methods/ios.rb

The UPGRADE.md lists one of the changes being format option for both iOS and FCM being renamed to JSON. This change had only been implemented for FCM. I'm not certain the approach I've taken here is the right one, it might be better to keep the code as-is and revert the change in the docs. It depends what the original intent was.

Allows json to respond to a symbol as a method in ios.rb

This change is lib/noticed/delivery_methods/ios.rb#L36 and adds:

method = event.send(method, apn) if method.is_a?(Symbol) && event.respond_to?(method)

Using the same method as evaluate_options() in the DeliveryMethod class. It evaluates the method if it's a symbol and event responds to that method.

Note: I think a similar change might be needed in fcm.rb, but the execution logic in send_notification(device_token) is different and I can't get it working.

Allows connection_pool_options to respond to symbol representing a method

Similar to the change above, but using the evaluate_options() method to allow extraction of values to methods

Testing

All tests pass.

Checklist

  • Code follows the project's coding standards
  • Tests have been added or updated to cover the changes
  • Documentation has been updated (if applicable)
  • All existing tests pass
  • Conforms to the contributing guidelines

Note: This is my first open source code PR. Happy to take on any and all feedback!

@phil-6 phil-6 requested a review from excid3 January 23, 2024 20:47
README.md Outdated Show resolved Hide resolved
Co-authored-by: Chris Oliver <excid3@gmail.com>
@excid3 excid3 merged commit 181f349 into excid3:main Jan 23, 2024
45 checks passed
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.

None yet

2 participants