This repository has been archived by the owner on Aug 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Add url and send_after options #7
Open
hsamadi
wants to merge
8
commits into
joaobarbosa:master
Choose a base branch
from
soopadev:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1ff88e9
Allow retrieving device information
43e4210
added url param to payload
tworonko 2967622
Allow for attaching launch url to notiifcation
tworonko 649f9a3
added send_after option
tworonko 72cecad
added android accent color
tworonko f65a0cb
added image support to push notifications
tworonko d1195c3
Notification: additional data always sent
tworonko 2e887fc
merge
tworonko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,12 +142,14 @@ def __init__(self, app_id, mode=SEGMENTS_MODE): | |
self.contents = {'en': 'Default message.'} | ||
self.headings = {} | ||
self.subtitle = {} | ||
self.send_after = None | ||
self.url = None | ||
self.data = {} | ||
self.small_icon = None | ||
self.large_icon = None | ||
self.ios_badge_type = self.IOS_BADGE_TYPE_NONE | ||
self.ios_badge_count = 0 | ||
self.image = None | ||
|
||
def _validate_content_dict(self, value): | ||
""" | ||
|
@@ -173,9 +175,10 @@ def get_payload_for_request(self): | |
payload = { | ||
'app_id': self.app_id, | ||
# Should change when template/content_available support be done | ||
'contents': self.contents | ||
'contents': self.contents, | ||
'android_accent_color': 'FFE42D1F', | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unwanted space? 😬 |
||
# Mode related settings | ||
if self.mode == self.DEVICES_MODE: | ||
payload.update({'include_player_ids': self.include_player_ids}) | ||
|
@@ -189,6 +192,9 @@ def get_payload_for_request(self): | |
if len(self.subtitle) > 0: | ||
payload.update({'subtitle': self.subtitle}) | ||
|
||
if self.send_after: | ||
payload.update({'send_after': self.send_after}) | ||
|
||
if self.url: | ||
payload.update({'url': self.url}) | ||
|
||
|
@@ -198,6 +204,15 @@ def get_payload_for_request(self): | |
if self.large_icon: | ||
payload.update({'large_icon': self.large_icon}) | ||
|
||
if self.image: | ||
payload.update({ | ||
'mutable_content': True, | ||
'ios_attachments': { | ||
'id': self.image | ||
}, | ||
'big_picture': self.image | ||
}) | ||
|
||
if self.ios_badge_count > 0: | ||
payload.update({ | ||
'ios_badgeType': self.ios_badge_type, | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about making
android_accent_color
a property in the class?