-
Notifications
You must be signed in to change notification settings - Fork 333
add analytics_label in FcmOptions #303
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
Closed
Closed
Changes from all commits
Commits
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 hidden or 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 |
---|---|---|
|
@@ -36,19 +36,21 @@ class Message(object): | |
android: An instance of ``messaging.AndroidConfig`` (optional). | ||
webpush: An instance of ``messaging.WebpushConfig`` (optional). | ||
apns: An instance of ``messaging.ApnsConfig`` (optional). | ||
fcm_options: An instance of ``messaging.FcmOptions`` (optional). | ||
token: The registration token of the device to which the message should be sent (optional). | ||
topic: Name of the FCM topic to which the message should be sent (optional). Topic name | ||
may contain the ``/topics/`` prefix. | ||
condition: The FCM condition to which the message should be sent (optional). | ||
""" | ||
|
||
def __init__(self, data=None, notification=None, android=None, webpush=None, apns=None, | ||
token=None, topic=None, condition=None): | ||
fcm_options=None, token=None, topic=None, condition=None): | ||
self.data = data | ||
self.notification = notification | ||
self.android = android | ||
self.webpush = webpush | ||
self.apns = apns | ||
self.fcm_options = fcm_options | ||
self.token = token | ||
self.topic = topic | ||
self.condition = condition | ||
|
@@ -65,8 +67,10 @@ class MulticastMessage(object): | |
android: An instance of ``messaging.AndroidConfig`` (optional). | ||
webpush: An instance of ``messaging.WebpushConfig`` (optional). | ||
apns: An instance of ``messaging.ApnsConfig`` (optional). | ||
fcm_options: An instance of ``messaging.FcmOptions`` (optional). | ||
""" | ||
def __init__(self, tokens, data=None, notification=None, android=None, webpush=None, apns=None): | ||
def __init__(self, tokens, data=None, notification=None, android=None, webpush=None, apns=None, | ||
fcm_options=None): | ||
_Validators.check_string_list('MulticastMessage.tokens', tokens) | ||
if len(tokens) > 100: | ||
raise ValueError('MulticastMessage.tokens must not contain more than 100 tokens.') | ||
|
@@ -76,6 +80,7 @@ def __init__(self, tokens, data=None, notification=None, android=None, webpush=N | |
self.android = android | ||
self.webpush = webpush | ||
self.apns = apns | ||
self.fcm_options = fcm_options | ||
|
||
|
||
class Notification(object): | ||
|
@@ -107,16 +112,18 @@ class AndroidConfig(object): | |
data: A dictionary of data fields (optional). All keys and values in the dictionary must be | ||
strings. When specified, overrides any data fields set via ``Message.data``. | ||
notification: A ``messaging.AndroidNotification`` to be included in the message (optional). | ||
fcm_options: A ``messaging.AndroidFcmOptions`` to be included in the message (optional). | ||
""" | ||
|
||
def __init__(self, collapse_key=None, priority=None, ttl=None, restricted_package_name=None, | ||
data=None, notification=None): | ||
data=None, notification=None, fcm_options=None): | ||
self.collapse_key = collapse_key | ||
self.priority = priority | ||
self.ttl = ttl | ||
self.restricted_package_name = restricted_package_name | ||
self.data = data | ||
self.notification = notification | ||
self.fcm_options = fcm_options | ||
|
||
|
||
class AndroidNotification(object): | ||
|
@@ -165,6 +172,18 @@ def __init__(self, title=None, body=None, icon=None, color=None, sound=None, tag | |
self.channel_id = channel_id | ||
|
||
|
||
class AndroidFcmOptions(object): | ||
"""Options for features provided by the FCM SDK for Android. | ||
|
||
Args: | ||
analytics_label: contains additional options for features provided by the FCM Android SDK | ||
(optional). | ||
""" | ||
|
||
def __init__(self, analytics_label=None): | ||
self.analytics_label = analytics_label | ||
|
||
|
||
class WebpushConfig(object): | ||
"""Webpush-specific options that can be included in a message. | ||
|
||
|
@@ -279,14 +298,17 @@ class APNSConfig(object): | |
Args: | ||
headers: A dictionary of headers (optional). | ||
payload: A ``messaging.APNSPayload`` to be included in the message (optional). | ||
fcm_options: A ``messaging.APNSFcmOptions`` instance to be included in the message | ||
(optional). | ||
|
||
.. _APNS Documentation: https://developer.apple.com/library/content/documentation\ | ||
/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html | ||
""" | ||
|
||
def __init__(self, headers=None, payload=None): | ||
def __init__(self, headers=None, payload=None, fcm_options=None): | ||
self.headers = headers | ||
self.payload = payload | ||
self.fcm_options = fcm_options | ||
|
||
|
||
class APNSPayload(object): | ||
|
@@ -387,6 +409,27 @@ def __init__(self, title=None, subtitle=None, body=None, loc_key=None, loc_args= | |
self.launch_image = launch_image | ||
|
||
|
||
class APNSFcmOptions(object): | ||
"""Options for features provided by the FCM SDK for iOS. | ||
|
||
Args: | ||
analytics_label: contains additional options for features provided by the FCM iOS SDK | ||
(optional). | ||
""" | ||
|
||
def __init__(self, analytics_label=None): | ||
self.analytics_label = analytics_label | ||
|
||
class FcmOptions(object): | ||
"""Options for features provided by SDK. | ||
|
||
Args: | ||
analytics_label: contains additional options to use across all platforms (optional). | ||
""" | ||
|
||
def __init__(self, analytics_label=None): | ||
self.analytics_label = analytics_label | ||
|
||
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. One more empty line. |
||
class _Validators(object): | ||
"""A collection of data validation utilities. | ||
|
||
|
@@ -553,7 +596,7 @@ def encode_webpush(cls, webpush): | |
'headers': _Validators.check_string_dict( | ||
'WebpushConfig.headers', webpush.headers), | ||
'notification': cls.encode_webpush_notification(webpush.notification), | ||
'fcmOptions': cls.encode_webpush_fcm_options(webpush.fcm_options), | ||
'fcm_options': cls.encode_webpush_fcm_options(webpush.fcm_options), | ||
} | ||
return cls.remove_null_values(result) | ||
|
||
|
This file contains hidden or 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
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.
Add one more empty line.