Procházet zdrojové kódy

优化谷歌推送铃声

peng před 1 rokem
rodič
revize
0721f82cae
1 změnil soubory, kde provedl 17 přidání a 11 odebrání
  1. 17 11
      Service/PushService.py

+ 17 - 11
Service/PushService.py

@@ -170,19 +170,25 @@ class PushObject:
                 sound = 'android.resource://com.ansjer.zccloud_a/raw/phone_call'
                 default_sound = False
                 android_channel_id = 'video'
+                result = push_service.notify_single_device(registration_id=token_val, message_title=msg_title,
+                                                           message_body=msg_text, data_message=push_data, sound=sound,
+                                                           android_channel_id=android_channel_id,
+                                                           click_action='android.intent.action.VIEW',
+                                                           extra_kwargs={'default_sound': default_sound,
+                                                                         'default_vibrate_timings': True,
+                                                                         'default_light_settings': True,
+                                                                         },
+                                                           )
             else:
-                sound = None  # 其他事件类型默认铃声
                 default_sound = True
-                android_channel_id = None
-            result = push_service.notify_single_device(registration_id=token_val, message_title=msg_title,
-                                                       message_body=msg_text, data_message=push_data, sound=sound,
-                                                       android_channel_id=android_channel_id,
-                                                       click_action='android.intent.action.VIEW',
-                                                       extra_kwargs={'default_sound': default_sound,
-                                                                     'default_vibrate_timings': True,
-                                                                     'default_light_settings': True,
-                                                                     },
-                                                       )
+                result = push_service.notify_single_device(registration_id=token_val, message_title=msg_title,
+                                                           message_body=msg_text, data_message=push_data,
+                                                           click_action='android.intent.action.VIEW',
+                                                           extra_kwargs={'default_sound': default_sound,
+                                                                         'default_vibrate_timings': True,
+                                                                         'default_light_settings': True,
+                                                                         },
+                                                           )
             LOGGER.info('uid:{},evnet_type:{},time:{},fcm推送结果:{}'.format(uid, event_type, n_time, result))
             return True
         except Exception as e: