From 2f3c2309c82874aa10c78a6ccf42c201af0b357a Mon Sep 17 00:00:00 2001 From: Ryan Romanchuk Date: Sat, 17 Feb 2024 09:15:13 -0600 Subject: [PATCH 1/4] Minor sig fix in docs (#405) * Update README.md Minor sig changes * Update README.md --------- Co-authored-by: Chris Oliver --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 397855b..06bdc5e 100644 --- a/README.md +++ b/README.md @@ -348,7 +348,7 @@ module IosNotifier config.key_id = Rails.application.credentials.dig(:ios, :key_id) config.team_id = Rails.application.credentials.dig(:ios, :team_id) config.apns_key = Rails.application.credentials.dig(:ios, :apns_key) - config.if = ->(recipient) { recipient.ios_notifications? } + config.if = -> { recipient.ios_notifications? } end end end From 52c5736bf919793dc99563555dfab5b079b4db55 Mon Sep 17 00:00:00 2001 From: Cory Diamand Date: Mon, 19 Feb 2024 10:09:31 -0500 Subject: [PATCH 2/4] Fix small typo in README.md (#411) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 06bdc5e..602278d 100644 --- a/README.md +++ b/README.md @@ -387,7 +387,7 @@ This invocation will create a single `Noticed::Event` record and a `Noticed::Not ### Custom Noticed Model Methods -In order to extend the Noticed models you'll need to use a concern an a to_prepare block: +In order to extend the Noticed models you'll need to use a concern and a to_prepare block: ```ruby # config/initializers/noticed.rb From 9873532d48d99020aa10d3a3bb94620126c69fc6 Mon Sep 17 00:00:00 2001 From: Marcelo Kanzaki Date: Mon, 19 Feb 2024 17:47:19 -0300 Subject: [PATCH 3/4] Update typo on README.md (#413) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 602278d..0f3fbdc 100644 --- a/README.md +++ b/README.md @@ -395,7 +395,7 @@ module NotificationExtensions extend ActiveSupport::Concern included do - belongs_to :organisation + belongs_to :organization scope :filter_by_type, ->(type) { where(type:) } scope :exclude_type, ->(type) { where.not(type:) } @@ -766,7 +766,7 @@ class CreateNoticedTables < ActiveRecord::Migration[7.1] t.jsonb :params # Custom Fields - t.string :organisation_id, type: :uuid, as: "((params ->> 'organisation_id')::uuid)", stored: true + t.string :organization_id, type: :uuid, as: "((params ->> 'organization_id')::uuid)", stored: true t.virtual :action_type, type: :string, as: "((params ->> 'action_type'))", stored: true t.virtual :url, type: :string, as: "((params ->> 'url'))", stored: true From 294679f6d74f2db706360ec57f32bfac112f1fae Mon Sep 17 00:00:00 2001 From: Chris Oliver Date: Tue, 20 Feb 2024 09:13:00 -0600 Subject: [PATCH 4/4] Pass notification and APN object to ios format if symbol. #406 --- CHANGELOG.md | 10 ++++++++++ lib/noticed/delivery_methods/ios.rb | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eaf01f7..4ef9c97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ ### Unreleased +* Fix iOS `format` option with Symbols. This now passes the `notification` and `apn` objects instead of just the `apn`. + +```ruby +config.format = :ios_format + +# ... +def ios_format(notification, apn) +end +``` + ### 2.1.3 * Stringify keys for Twilio Messaging json diff --git a/lib/noticed/delivery_methods/ios.rb b/lib/noticed/delivery_methods/ios.rb index 41cf11a..551d342 100644 --- a/lib/noticed/delivery_methods/ios.rb +++ b/lib/noticed/delivery_methods/ios.rb @@ -35,7 +35,7 @@ def format_notification(apn) method = config[:format] # Call method on Notifier if defined if method&.is_a?(Symbol) && event.respond_to?(method) - event.send(method, apn) + event.send(method, notification, apn) # If Proc, evaluate it on the Notification elsif method&.respond_to?(:call) notification.instance_exec(apn, &method)