Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf7546f5

Browse files
feat(fcm): Addlive_activity_token toAPNSConfig (#880)
* Add live_activity_token to `APNSConfig`, allowing you to specify this token for APNS messages.This change introduces:- Adding the `live_activity_token` field to the `APNSConfig` class- Updated unit test to verify that the `live_activity_token` is correctly included in the encoded message* Refactor and edit doc string---------Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
1 parent2d9b18c commitf7546f5

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

‎firebase_admin/_messaging_encoder.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,8 @@ def encode_apns(cls, apns):
529529
'APNSConfig.headers',apns.headers),
530530
'payload':cls.encode_apns_payload(apns.payload),
531531
'fcm_options':cls.encode_apns_fcm_options(apns.fcm_options),
532+
'live_activity_token':_Validators.check_string(
533+
'APNSConfig.live_activity_token',apns.live_activity_token),
532534
}
533535
returncls.remove_null_values(result)
534536

‎firebase_admin/_messaging_utils.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,15 +334,17 @@ class APNSConfig:
334334
payload: A ``messaging.APNSPayload`` to be included in the message (optional).
335335
fcm_options: A ``messaging.APNSFCMOptions`` instance to be included in the message
336336
(optional).
337+
live_activity_token: A live activity token string (optional).
337338
338339
.. _APNS Documentation: https://developer.apple.com/library/content/documentation\
339340
/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html
340341
"""
341342

342-
def__init__(self,headers=None,payload=None,fcm_options=None):
343+
def__init__(self,headers=None,payload=None,fcm_options=None,live_activity_token=None):
343344
self.headers=headers
344345
self.payload=payload
345346
self.fcm_options=fcm_options
347+
self.live_activity_token=live_activity_token
346348

347349

348350
classAPNSPayload:

‎tests/test_messaging.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,8 @@ def test_apns_config(self):
10941094
topic='topic',
10951095
apns=messaging.APNSConfig(
10961096
headers={'h1':'v1','h2':'v2'},
1097-
fcm_options=messaging.APNSFCMOptions('analytics_label_v1')
1097+
fcm_options=messaging.APNSFCMOptions('analytics_label_v1'),
1098+
live_activity_token='test_token_string'
10981099
),
10991100
)
11001101
expected= {
@@ -1107,6 +1108,7 @@ def test_apns_config(self):
11071108
'fcm_options': {
11081109
'analytics_label':'analytics_label_v1',
11091110
},
1111+
'live_activity_token':'test_token_string',
11101112
},
11111113
}
11121114
check_encoding(msg,expected)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp