Skip to content

Commit

Permalink
Switching notifications to FCM over (now deprecated) GCM (#2276)
Browse files Browse the repository at this point in the history
* Attempt 1 at simple GCM to FCM conversion

* Finished implementing GCM to FCM conversion
  • Loading branch information
tweirtx authored and phil-lopreiato committed May 3, 2018
1 parent c6eef90 commit 714de90
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions controllers/gcm/gcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def __unicode__(self):
def json_string(self):

if not self.device_tokens or not isinstance(self.device_tokens, list):
logging.error('GCMMessage generate_json_string error. Invalid device tokens: ' + repr(self))
raise Exception('GCMMessage generate_json_string error. Invalid device tokens.')
logging.error('FCMMessage generate_json_string error. Invalid device tokens: ' + repr(self))
raise Exception('FCMMessage generate_json_string error. Invalid device tokens.')

json_dict = {}
json_dict['registration_ids'] = self.device_tokens
Expand Down Expand Up @@ -104,12 +104,11 @@ def __init__(self):
self.LOCALHOST = False
self.SERVER_KEY = Sitevar.get_by_id('gcm.serverKey')
if self.SERVER_KEY is None:
raise Exception("Missing sitevar: gcm.serverKey. Can't send GCM messages.")
raise Exception("Missing sitevar: gcm.serverKey. Can't send FCM messages.")
self.GCM_CONFIG = {'gcm_api_key': self.SERVER_KEY.contents['gcm_key']}
self.GOOGLE_LOGIN_URL = 'https://www.google.com/accounts/ClientLogin'
# Can't use https on localhost due to Google cert bug
self.GOOGLE_GCM_SEND_URL = 'https://android.apis.google.com/gcm/send'
self.GOOGLE_GCM_SEND_URL = 'https://android.googleapis.com/gcm/send'
self.GOOGLE_GCM_SEND_URL = 'https://fcm.googleapis.com/fcm'

self.GCM_QUEUE_NAME = 'gcm-retries'
self.GCM_QUEUE_CALLBACK_URL = '/gae_python_gcm/send_request'
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/authkeys.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h1>Third Party API Keys</h1>
<tr><td>Auth Key</td><td><input name="fmsapi_secret" value="{{fmsapi_secret}}" class="form-control"/></td></tr>

<tr><th>Mobile Apps</th></tr>
<tr><td>GCM Key</td><td><input name="gcm_key" value="{{gcm_key}}" class="form-control"/></td></tr>
<tr><td>FCM Key</td><td><input name="gcm_key" value="{{gcm_key}}" class="form-control"/></td></tr>
<tr><td>Web Client ID</td><td><input name="web_client_id" value="{{web_client_id}}" class="form-control"/></td></tr>
<tr><td>Android Client ID</td><td><input name="android_client_id" value="{{android_client_id}}" class="form-control"/></td></tr>
<tr><td>iOS Client ID</td><td><input name="ios_client_id" value="{{ios_client_id}}" class="form-control"/></td></tr>
Expand Down

0 comments on commit 714de90

Please sign in to comment.