|
@@ -1,6 +1,6 @@
|
|
|
import json
|
|
|
|
|
|
-from AnsjerPush.config import LOGGER, XM_PUSH_CHANNEL_ID
|
|
|
+from AnsjerPush.config import LOGGER
|
|
|
from Service.HuaweiPushService import push_admin
|
|
|
from Service.HuaweiPushService.push_admin import messaging
|
|
|
|
|
@@ -70,18 +70,11 @@ class HuaweiPushObject:
|
|
|
data = {'alert': 'Motion', 'msg': '', 'sound': 'sound.aif', 'zpush': '1', 'uid': uid,
|
|
|
'nickname': nickname, 'event_type': event_type, 'received_at': n_time, 'event_time': n_time
|
|
|
}
|
|
|
-
|
|
|
- # 一键通话和视频通话使用自定义铃声
|
|
|
- if int(event_type) in [606, 607]:
|
|
|
- category = 'VOIP'
|
|
|
- else:
|
|
|
- category = 'DEVICE_REMINDER'
|
|
|
-
|
|
|
data = json.dumps(data)
|
|
|
# 推送通知内容配置
|
|
|
intent = 'intent://com.vivo.pushvideo/detail?#Intent;scheme=vpushscheme;launchFlags=0x10000000;S.uid={};S.event_type={};S.event_time={};end'.format(
|
|
|
uid, event_type, n_time)
|
|
|
- android_notification = self.android_notification(event_type, msg_title, msg_text, intent)
|
|
|
+ android_notification = self.android_notification(msg_title, msg_text, intent)
|
|
|
# 安卓配置
|
|
|
android = messaging.AndroidConfig(
|
|
|
data=data,
|
|
@@ -90,7 +83,7 @@ class HuaweiPushObject:
|
|
|
ttl='10000s',
|
|
|
bi_tag='the_sample_bi_tag_for_receipt_service',
|
|
|
notification=android_notification,
|
|
|
- category=category
|
|
|
+ category='DEVICE_REMINDER'
|
|
|
)
|
|
|
|
|
|
message = messaging.Message(
|
|
@@ -144,21 +137,12 @@ class HuaweiPushObject:
|
|
|
LOGGER.info('华为透传推送异常: {}'.format(repr(e)))
|
|
|
|
|
|
@staticmethod
|
|
|
- def android_notification(event_type, msg_title, msg_text, intent):
|
|
|
- # 一键通话和视频通话使用自定义铃声
|
|
|
- if int(event_type) in [606, 607]:
|
|
|
- sound = '/raw/phone_call'
|
|
|
- default_sound = False
|
|
|
- channel_id = str(XM_PUSH_CHANNEL_ID['push_to_talk'])
|
|
|
- else:
|
|
|
- sound = None
|
|
|
- default_sound = True
|
|
|
- channel_id = '1'
|
|
|
+ def android_notification(msg_title, msg_text, intent):
|
|
|
return messaging.AndroidNotification(
|
|
|
icon='/raw/ic_launcher2',
|
|
|
color='#AACCDD',
|
|
|
- sound=sound,
|
|
|
- default_sound=default_sound,
|
|
|
+ sound='/raw/shake',
|
|
|
+ default_sound=True,
|
|
|
click_action=messaging.AndroidClickAction(
|
|
|
action_type=1,
|
|
|
intent=intent
|
|
@@ -167,7 +151,7 @@ class HuaweiPushObject:
|
|
|
body_loc_args=('boy', 'dog'),
|
|
|
title_loc_key='M.String.title',
|
|
|
title_loc_args=['Girl', 'Cat'],
|
|
|
- channel_id=channel_id,
|
|
|
+ channel_id='1',
|
|
|
notify_summary='',
|
|
|
multi_lang_key={'title_key': {'en': 'value1'}, 'body_key': {'en': 'value2'}},
|
|
|
style=1,
|