|
@@ -38,16 +38,16 @@ class GatewayPushService:
|
|
|
|
|
|
# ios apns 推送
|
|
|
@staticmethod
|
|
|
- def ios_apns_push(nickname, app_bundle_id, token_val, n_time, event_type, msg_title, msg_text):
|
|
|
+ def ios_apns_push(nickname, app_bundle_id, token_val, n_time, event_type, msg_title, msg_text, launch_image=None):
|
|
|
logger = logging.getLogger('info')
|
|
|
try:
|
|
|
pem_path = os.path.join(BASE_DIR, APNS_CONFIG[app_bundle_id]['pem_path'])
|
|
|
cli = apns2.APNSClient(mode=APNS_MODE, client_cert=pem_path)
|
|
|
- alert = apns2.PayloadAlert(title=msg_title, body=msg_text)
|
|
|
+ alert = apns2.PayloadAlert(title=msg_title, body=msg_text, launch_image=launch_image)
|
|
|
push_data = {'alert': 'Motion', 'msg': '', 'sound': '', 'zpush': '1',
|
|
|
'received_at': n_time, 'event_time': n_time, 'event_type': event_type, 'nickname': nickname
|
|
|
}
|
|
|
- payload = apns2.Payload(alert=alert, custom=push_data, sound='default')
|
|
|
+ payload = apns2.Payload(alert=alert, custom=push_data, sound='default', mutable_content=True)
|
|
|
n = apns2.Notification(payload=payload, priority=apns2.PRIORITY_LOW)
|
|
|
res = cli.push(n=n, device_token=token_val, topic=app_bundle_id)
|
|
|
assert res.status_code == 200
|