From f32e27e4bc4ecf1119272f87693372e686bc571d Mon Sep 17 00:00:00 2001 From: Felix <56034317+KrakenWagen@users.noreply.github.com> Date: Thu, 16 May 2024 10:44:07 +0300 Subject: [PATCH] Do not set android->notification unless explicit Do not set android->notification in the request body unless explicitly states as this would otherwise cause data messages to not get processed when the app is running in the background. --- lib/rpush/client/active_model/fcm/notification.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/rpush/client/active_model/fcm/notification.rb b/lib/rpush/client/active_model/fcm/notification.rb index c2d0b7b65..dc16ef894 100644 --- a/lib/rpush/client/active_model/fcm/notification.rb +++ b/lib/rpush/client/active_model/fcm/notification.rb @@ -66,9 +66,8 @@ def as_json(options = nil) # rubocop:disable Metrics/PerceivedComplexity end def android_config - json = { - 'notification' => android_notification, - } + json = {} + json['notification'] = android_notification if notification json['collapse_key'] = collapse_key if collapse_key json['priority'] = priority_str if priority json['ttl'] = "#{expiry}s" if expiry