Skip to content

Commit 7aa1520

Browse files
authored
Add Safari like browser option (#776)
* Add Safari like browser option * Improve model and add migration
1 parent 76d5766 commit 7aa1520

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

push_notifications/conf/app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ def _validate_wp_config(self, application_id, application_config):
217217
"OPERA": "https://fcm.googleapis.com/fcm/send",
218218
"EDGE": "https://wns2-par02p.notify.windows.com/w",
219219
"FIREFOX": "https://updates.push.services.mozilla.com/wpush/v2",
220+
"SAFARI": "https://web.push.apple.com",
220221
})
221222
application_config.setdefault("ERROR_TIMEOUT", 1)
222223

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 5.1.7 on 2025-06-16 11:16
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('push_notifications', '0011_alter_apnsdevice_registration_id'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='webpushdevice',
15+
name='browser',
16+
field=models.CharField(choices=[('CHROME', 'Chrome'), ('FIREFOX', 'Firefox'), ('OPERA', 'Opera'), ('EDGE', 'Edge'), ('SAFARI', 'Safari')], default='CHROME', help_text='Currently only support to Chrome, Firefox, Edge, Safari and Opera browsers', max_length=10, verbose_name='Browser'),
17+
),
18+
]

push_notifications/models.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
("CHROME", "Chrome"),
1515
("FIREFOX", "Firefox"),
1616
("OPERA", "Opera"),
17-
("EDGE", "Edge")
17+
("EDGE", "Edge"),
18+
("SAFARI", "Safari")
1819
)
1920

2021

@@ -261,7 +262,7 @@ class WebPushDevice(Device):
261262
browser = models.CharField(
262263
verbose_name=_("Browser"), max_length=10,
263264
choices=BROWSER_TYPES, default=BROWSER_TYPES[0][0],
264-
help_text=_("Currently only support to Chrome, Firefox, Edge and Opera browsers")
265+
help_text=_("Currently only support to Chrome, Firefox, Edge, Safari and Opera browsers")
265266
)
266267
objects = WebPushDeviceManager()
267268

push_notifications/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"OPERA": PUSH_NOTIFICATIONS_SETTINGS["FCM_POST_URL"],
3838
"FIREFOX": "https://updates.push.services.mozilla.com/wpush/v2",
3939
"EDGE": "https://wns2-par02p.notify.windows.com/w",
40+
"SAFARI": "https://web.push.apple.com",
4041
})
4142
PUSH_NOTIFICATIONS_SETTINGS.setdefault("WP_PRIVATE_KEY", None)
4243
PUSH_NOTIFICATIONS_SETTINGS.setdefault("WP_CLAIMS", None)

0 commit comments

Comments
 (0)