settings: Add support for overriding APNS_TOPIC and ZULIP_IOS_APP_ID.

Documentation added by tabbott.
This commit is contained in:
Shikhar Varshney 2019-10-01 13:50:16 +05:30 committed by Tim Abbott
parent dbe508bb91
commit fe5d975b33
3 changed files with 8 additions and 5 deletions

View File

@ -228,6 +228,8 @@ push notifications through the new app is quite straightforward:
from Apple's developer console. Set `APNS_SANDBOX=False` and
`APNS_CERT_FILE` to be the path of your APNS certificate file in
`/etc/zulip/settings.py`.
* Set the `APNS_TOPIC` and `ZULIP_IOS_APP_ID` settings to the ID for
your app (for the official Zulip apps, they are both `org.zulip.Zulip`).
* Restart the Zulip server.
[apple-docs]: https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html

View File

@ -137,7 +137,7 @@ def send_apple_push_notification(user_id: int, devices: List[DeviceToken],
def attempt_send() -> Optional[str]:
try:
stream_id = client.send_notification_async(
device.token, payload, topic='org.zulip.Zulip',
device.token, payload, topic=settings.APNS_TOPIC,
expiration=expiration)
return client.get_notification_result(stream_id)
except HTTP20Error as e:

View File

@ -343,9 +343,13 @@ DEFAULT_SETTINGS.update({
# this is disabled in production, but we need it in development.
'POST_MIGRATION_CACHE_FLUSHING': False,
# Settings for APNS. Only needed on push.zulipchat.com.
# Settings for APNS. Only needed on push.zulipchat.com or if
# rebuilding the mobile app with a different push notifications
# server.
'APNS_CERT_FILE': None,
'APNS_SANDBOX': True,
'APNS_TOPIC': 'org.zulip.Zulip',
'ZULIP_IOS_APP_ID': 'org.zulip.Zulip',
# Max number of "remove notification" FCM/GCM messages to send separately
# in one burst; the rest are batched. Older clients ignore the batched
@ -1270,9 +1274,6 @@ LOGIN_REDIRECT_URL = '/'
# (HEARTBEAT_MIN_FREQ_SECS + 10)
POLL_TIMEOUT = 90 * 1000
# iOS App IDs
ZULIP_IOS_APP_ID = 'org.zulip.Zulip'
########################################################################
# SSO AND LDAP SETTINGS
########################################################################