-
-
Notifications
You must be signed in to change notification settings - Fork 623
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
Add support for content_available
for apns async
#761
Add support for content_available
for apns async
#761
Conversation
- add `content_available` argument for async version of apns. Argument is sent as `content-available` to apns - add tests for `content_available` - format `apns_async.py`
for more information, see https://pre-commit.ci
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.
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #761 +/- ##
==========================================
+ Coverage 70.39% 72.58% +2.19%
==========================================
Files 27 29 +2
Lines 1101 1244 +143
Branches 180 207 +27
==========================================
+ Hits 775 903 +128
- Misses 288 298 +10
- Partials 38 43 +5 ☔ View full report in Codecov by Sentry. |
@pomali This have some conflicts due to recent merge. Can you resolve? |
@HashimJVZ I resolved the conflicts |
Do we need to add support for both bool and int? |
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.
hi @pomali, this looks great! can we stick to supporting bool only. its an effective and concise step forward.
...
content_type: bool = None
...
@50-Course originally in apns |
Same goes for mutable-content. def dict(self) -> Dict[str, Any]:
result = {
'aps': {}
} # type: Dict[str, Any]
if self.alert is not None:
if isinstance(self.alert, PayloadAlert):
result['aps']['alert'] = self.alert.dict()
else:
result['aps']['alert'] = self.alert
if self.badge is not None:
result['aps']['badge'] = self.badge
if self.sound is not None:
result['aps']['sound'] = self.sound
if self.content_available:
result['aps']['content-available'] = 1
if self.mutable_content:
result['aps']['mutable-content'] = 1
if self.thread_id is not None:
result['aps']['thread-id'] = self.thread_id
if self.category is not None:
result['aps']['category'] = self.category
if self.url_args is not None:
result['aps']['url-args'] = self.url_args
if self.custom is not None:
result.update(self.custom)
return result In the apns_async it is request = NotificationRequest(
device_token=registration_id,
message={
"aps": {
"alert": alert,
"badge": badge,
"sound": sound,
"thread-id": thread_id,
**aps_kwargs,
},
**extra,
**message_kwargs,
},
**notification_request_kwargs_out,
) Here alert, badge, sound, and thread_id got parameters and others are passed in **aps_kwargs.
so, 2 more remaining:
|
@pomali , @50-Course aps_kwargs = {}
if mutable_content:
aps_kwargs["mutable-content"] = 1
if content_available:
aps_kwargs["content-available"] = 1 |
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.
thanks for the update @pomali... looks like we ready to roll 👍🏼 🚀
content_available
argument for async version of apns. Argument is sent ascontent-available
to apnscontent_available
apns_async.py
(similar to #760)