From 30c21abd3047624cc413f5eaacbbbb88bae46f6a Mon Sep 17 00:00:00 2001
From: wxr <wxr@hdlchina.com.cn>
Date: 星期一, 30 九月 2024 11:21:24 +0800
Subject: [PATCH] Update HomePage.cs

---
 HDL_ON/Common/HDLCommon.cs |   93 ++++++++++++++++++++++++++++++++++------------
 1 files changed, 69 insertions(+), 24 deletions(-)

diff --git a/HDL_ON/Common/HDLCommon.cs b/HDL_ON/Common/HDLCommon.cs
index 749d7df..8b23ca2 100644
--- a/HDL_ON/Common/HDLCommon.cs
+++ b/HDL_ON/Common/HDLCommon.cs
@@ -353,37 +353,47 @@
                                     }
                                 }
                             }
-                            catch (Exception ex) {
+                            catch (Exception ex)
+                            {
                                 MainPage.Log("Error", $"鑷爺鍙瀵硅閫氱煡寮傚父:{ex.StackTrace}");
                             }
 
 #if __ANDROID__
-                            Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.MissedCallsTime = 30;
-                            Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.SetMediaPlayerLooping(true);
-                            Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.PlayRingtone();
-                            new Thread(() =>
+                            try
                             {
-                                try
+                                //瀹夊崜濡傛灉璁剧疆浜嗛潤闊筹紝涓嶈兘鍝嶉搩
+                                if (Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.AudioManager.RingerMode.ToString().ToLower() == "normal")
                                 {
-                                    DateTime dateTime = DateTime.Now;
-                                    while (true)
+                                    Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.MissedCallsTime = 30;
+                                    Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.SetMediaPlayerLooping(true);
+                                    Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.PlayRingtone();
+                                    new Thread(() =>
                                     {
-                                        Thread.Sleep(1000);
-                                        if (!Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.MediaPlayerPlayingStatus || dateTime.AddSeconds(Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.MissedCallsTime) <= DateTime.Now)
+                                        try
                                         {
-                                            break;
+                                            DateTime dateTime = DateTime.Now;
+                                            while (true)
+                                            {
+                                                Thread.Sleep(1000);
+                                                if (!Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.MediaPlayerPlayingStatus || dateTime.AddSeconds(Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.MissedCallsTime) <= DateTime.Now)
+                                                {
+                                                    break;
+                                                }
+                                            }
+                                            Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.SetMediaPlayerLooping(false);
                                         }
-                                    }
-                                    Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.SetMediaPlayerLooping(false);
+                                        catch (Exception ex)
+                                        {
+                                            MainPage.Log("error", "鑷爺鍙瀵硅閾冨0鎾斁寮傚父:" + ex.Message);
+                                        }
+                                    })
+                                    { IsBackground = true }.Start();
                                 }
-                                catch (Exception ex)
-                                {
-                                    MainPage.Log("error", "鑷爺鍙瀵硅閾冨0鎾斁寮傚父:" + ex.Message);
-                                }
-                            })
-                            { IsBackground = true }.Start();
-
-                            #elif __IOS__
+                            }catch(Exception ex)
+                            {
+                                MainPage.Log("Error", $"瀹夊崜鍙瀵硅鍝嶉搩寮傚父:{ex.StackTrace}");
+                            }
+#elif __IOS__
                             SoundPlayer.Ins.PlaySound();
                             new Thread(() => {
                                 int count = 0;
@@ -417,7 +427,7 @@
                                 }
                             })
                             { IsBackground = true }.Start();
-                            #endif
+#endif
 
                             MainPage.Log("鎺ユ敹鍒版帹閫�:HDL Linphone 鐙勮�愬厠");
                             eSVideoInfo.HomeId = jpushMessageInfo.HomeId;
@@ -459,11 +469,46 @@
                     }
                     else if (jpushMessageInfo.messageType == (PushMessageType.DOOR_BELL.ToString()))
                     {
+                        try
+                        {
+                            var json = Newtonsoft.Json.Linq.JObject.Parse(jpushMessageInfo.expantContent);
+                            string interphoneTypeEnum = json["interphoneTypeEnum"].ToString();
+                            if (string.IsNullOrEmpty(interphoneTypeEnum)) return;
+                            ESVideoInfo eSVideoInfo = new ESVideoInfo();
+                            if (interphoneTypeEnum == InterphoneType.EZVIZ.ToString())
+                            {
+                                eSVideoInfo.Lc_AccessToken = json["subToken"].ToString();//"瀛愯处鍙穞oken
+                                eSVideoInfo.DeviceSerial = json["devSerial"].ToString();//璁惧搴忓垪鍙�
+                                eSVideoInfo.Lc_DeviceId = json["deviceId"].ToString();
+                                eSVideoInfo.spk = json["spk"].ToString();
+                                if (eSVideoInfo.spk == SPK.Peephole)
+                                {
+                                    eSVideoInfo.HomeId = jpushMessageInfo.HomeId;
+                                    if (json.ContainsKey("msgId") && !string.IsNullOrEmpty(json["msgId"].ToString()))
+                                    {
+                                        eSVideoInfo.msgId = json["msgId"].ToString();
+                                    }
+                                    if (json.ContainsKey("currentTime") && !string.IsNullOrEmpty(json["currentTime"].ToString()))
+                                    {
+                                        eSVideoInfo.currentTime = json["currentTime"].ToString();
+                                    }
+
+                                    if (eSVideoInfo != null)
+                                    {
+                                        //鎵撳紑鍛煎彨椤甸潰
+                                        ESOnVideo.Current.ShowESvideoVideoIntercom(eSVideoInfo, interphoneTypeEnum);
+                                        return;
+                                    }
+                                }
+                            }
+                        }
+                        catch (Exception ex)
+                        {
+                            MainPage.Log("Error", $"缁撴潫闂ㄩ搩鎺ㄩ�佹暟鎹紓甯�:{ex.Message}");
+                        }
                         //钀ょ煶闂ㄩ攣鎺ㄩ��
                         HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.DoorLockPush(jpushMessageInfo);
                     }
-
-                   
                 }
             }
             catch (Exception EX)

--
Gitblit v1.8.0