Skip to content

Commit

Permalink
Merge pull request #90 from Jorl17/master
Browse files Browse the repository at this point in the history
Fix some parameters only being sent if message_body is not None
  • Loading branch information
olucurious authored Nov 16, 2016
2 parents 30e1114 + e92d81a commit 7c414fb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
7 changes: 7 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,10 @@ v1.1.4 (11-11-2016)
- added body_loc_key support and notify single device single response

.. _Emmanuel Olucurious: https://github.com/olucurious

v1.1.5 (16-11-2016)
-------------------

- Fix some message components not being sent if message_body is None (click_action, badge, sound, etc)

.. _João Ricardo Lourenço: https://github.com/Jorl17
26 changes: 13 additions & 13 deletions pyfcm/baseapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,6 @@ def parse_payload(self,
'title': message_title,
'icon': message_icon
}
if click_action:
fcm_payload['notification']['click_action'] = click_action
if badge:
fcm_payload['notification']['badge'] = badge
if color:
fcm_payload['notification']['color'] = color
if tag:
fcm_payload['notification']['tag'] = tag
# only add the 'sound' key if sound is not None
# otherwise a default sound will play -- even with empty string args.
if sound:
fcm_payload['notification']['sound'] = sound

else:
fcm_payload['notification'] = {'icon': message_icon}
if body_loc_key:
Expand All @@ -163,6 +150,19 @@ def parse_payload(self,
if title_loc_args:
fcm_payload['notification']['title_loc_args'] = title_loc_args

if click_action:
fcm_payload['notification']['click_action'] = click_action
if badge:
fcm_payload['notification']['badge'] = badge
if color:
fcm_payload['notification']['color'] = color
if tag:
fcm_payload['notification']['tag'] = tag
# only add the 'sound' key if sound is not None
# otherwise a default sound will play -- even with empty string args.
if sound:
fcm_payload['notification']['sound'] = sound

if extra_kwargs:
fcm_payload.update(extra_kwargs)

Expand Down

0 comments on commit 7c414fb

Please sign in to comment.