|
@@ -67,11 +67,18 @@ 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(msg_title, msg_text, intent)
|
|
|
+ android_notification = self.android_notification(event_type, msg_title, msg_text, intent)
|
|
|
# 安卓配置
|
|
|
android = messaging.AndroidConfig(
|
|
|
data=data,
|
|
@@ -80,7 +87,7 @@ class HuaweiPushObject:
|
|
|
ttl='10000s',
|
|
|
bi_tag='the_sample_bi_tag_for_receipt_service',
|
|
|
notification=android_notification,
|
|
|
- category='DEVICE_REMINDER'
|
|
|
+ category=category
|
|
|
)
|
|
|
|
|
|
message = messaging.Message(
|
|
@@ -132,12 +139,19 @@ class HuaweiPushObject:
|
|
|
LOGGER.info('华为透传推送异常: {}'.format(repr(e)))
|
|
|
|
|
|
@staticmethod
|
|
|
- def android_notification(msg_title, msg_text, intent):
|
|
|
+ def android_notification(event_type, msg_title, msg_text, intent):
|
|
|
+ # 一键通话和视频通话使用自定义铃声
|
|
|
+ if int(event_type) in [606, 607]:
|
|
|
+ sound = '/raw/phone_call'
|
|
|
+ default_sound = False
|
|
|
+ else:
|
|
|
+ sound = '/raw/shake'
|
|
|
+ default_sound = True
|
|
|
return messaging.AndroidNotification(
|
|
|
icon='/raw/ic_launcher2',
|
|
|
color='#AACCDD',
|
|
|
- sound='/raw/shake',
|
|
|
- default_sound=True,
|
|
|
+ sound=sound,
|
|
|
+ default_sound=default_sound,
|
|
|
click_action=messaging.AndroidClickAction(
|
|
|
action_type=1,
|
|
|
intent=intent
|