Skip to content
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

Re-opened PR (#696): Add aioapns version of APNS #739

Merged
merged 31 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0a7274e
[pre-commit.ci] pre-commit autoupdate (#668)
pre-commit-ci[bot] Aug 12, 2022
b62200d
Update tox.ini (#688)
jamaalscarlett Aug 15, 2023
8a22456
Update test.yml (#689)
jamaalscarlett Aug 16, 2023
25784b2
[fix] resolve rebase conflicts - pre-commit PR
pre-commit-ci[bot] Aug 16, 2023
6f9b3ac
Expanded documentation for Web Push (#558)
nlittlejohns Aug 16, 2023
5f8d2bd
Allow APNS tokens of variable length. (#678)
Aug 19, 2023
39f8c17
Add WebPush support for Safari (#674)
blighj Oct 8, 2023
5b89f7b
Update setup.py (#693)
jamaalscarlett Oct 18, 2023
d889d36
Fixes twine reported warnings when building package. (#695)
jamaalscarlett Oct 29, 2023
9a290c3
Add aioapns version of APNS
pomali Nov 2, 2023
02da89b
remove print statements
pomali Dec 8, 2023
fa1d501
document APNS_ASYNC installation in README
pomali Mar 18, 2024
645eabe
Add FCM v1 API (#702)
ceoy Feb 14, 2024
fe35a5d
make firebase-admin an optional dependency (#707)
ceoy Feb 27, 2024
3ba6e7e
Do not import fcm module at top level in models.py
sevdog Feb 23, 2024
caba137
fix issue with overwriting default, add test case
pomali Mar 18, 2024
399c249
fix some flake8 issues, improve readme
pomali Mar 18, 2024
910c7b5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 18, 2024
73e54e5
ci(python-deps): support `python 3.10` as testing target on CI
50-Course Mar 22, 2024
3a77e6f
bump `tox` python target version to `py310`
50-Course Mar 22, 2024
079418c
Update test.yml
pomali May 22, 2024
7eaec6f
Update test.yml
pomali May 22, 2024
9733b22
Add fixes from PR suggestions, update tested environments
pomali May 22, 2024
3b0abf6
Remove python 3.6 support. (#718)
jamaalscarlett Apr 27, 2024
97fdf6a
Changed firebase-admin's deprecated send_all method for send_each (#715)
guspix Apr 28, 2024
d259c8f
add types
pomali May 22, 2024
96b946a
add err_func to enable processing errors from aioapns.APNs.send_messa…
pomali May 23, 2024
f2e7bd1
fix extras APNS_ASYNC -> apns-async
pomali May 23, 2024
906e0f7
fix NotificationResult import, add test for err_func param
pomali May 23, 2024
e448411
cleanup
pomali Jun 28, 2024
0177c58
Update `envlist` to support python 3.10 and 3.11
50-Course Oct 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v2
Expand Down
34 changes: 33 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Dependencies
- For WebPush (WP), pywebpush 1.3.0+ is required (optional). py-vapid 1.3.0+ is required for generating the WebPush private key; however this
step does not need to occur on the application server.
- For Apple Push (APNS), apns2 0.3+ is required (optional).
- For Apple Push (apns-async) using async, aioapns 3.1+ is required (optional). Installed aioapns overrides apns2 which does not support python 3.10+.
- For FCM, firebase-admin 6.2+ is required (optional).

Setup
Expand All @@ -45,7 +46,7 @@ You can install the library directly from pypi using pip:

.. code-block:: shell

$ pip install django-push-notifications[WP,APNS,FCM]
$ pip install django-push-notifications[WP,apns-async,FCM]


Edit your settings.py file:
Expand Down Expand Up @@ -207,6 +208,37 @@ JSON example:
device.send_message(data)


Web Push accepts only one variable (``message``), which is passed directly to pywebpush. This message can be a simple string, which will be used as your notification's body, or it can be contain `any data supported by pywebpush<https://github.com/web-push-libs/pywebpush>`.

Simple example:

.. code-block:: python

from push_notifications.models import WebPushDevice

device = WebPushDevice.objects.get(registration_id=wp_reg_id)

device.send_message("You've got mail")

.. note::
To customize the notification title using this method, edit the ``"TITLE DEFAULT"`` string in your ``navigatorPush.service.js`` file.

JSON example:

.. code-block:: python

import json
from push_notifications.models import WebPushDevice

device = WebPushDevice.objects.get(registration_id=wp_reg_id)

title = "Message Received"
message = "You've got mail"
data = json.dumps({"title": title, "message": message})

device.send_message(data)


Sending messages in bulk
------------------------
.. code-block:: python
Expand Down
Loading
Loading