wxr
2024-01-08 51f5f7a47d394163dccf2441cd04c2a19ceeda34
HDL_ON/Common/ApiUtlis.cs
@@ -104,6 +104,19 @@
                code = Ins.HttpRequest.RefreshToken();
                if (code != StateCode.SUCCESS)
                {
                    if (waitPage != null)
                    {
                        Application.RunOnMainThread(() =>
                        {
                            try
                            {
                                waitPage.Hide();
                                waitPage.RemoveFromParent();
                                waitPage = null;
                            }
                            catch { }
                        });
                    }
                    MainPage.Log($"刷新token失败");
                    return;
                }
@@ -112,6 +125,19 @@
                code = Ins.HttpRequest.GetHomePager();
                if (code != StateCode.SUCCESS)
                {
                    if (waitPage != null)
                    {
                        Application.RunOnMainThread(() =>
                        {
                            try
                            {
                                waitPage.Hide();
                                waitPage.RemoveFromParent();
                                waitPage = null;
                            }
                            catch { }
                        });
                    }
                    MainPage.Log($"刷新住宅信息失败");
                    return;
                }
@@ -120,6 +146,19 @@
                code = Ins.HttpRequest.GetUserInfo();
                if (code != StateCode.SUCCESS)
                {
                    if (waitPage != null)
                    {
                        Application.RunOnMainThread(() =>
                        {
                            try
                            {
                                waitPage.Hide();
                                waitPage.RemoveFromParent();
                                waitPage = null;
                            }
                            catch { }
                        });
                    }
                    MainPage.Log($"刷新个人信息失败");
                    return;
                }
@@ -178,7 +217,7 @@
                                FunctionList.List.ClearDatas();
                                //MainPage.Log($"============设备============开始" + FunctionList.List.Functions.Count);
                                //MainPage.Log($"读取设备信息成功");
                                //MainPage.Log($"sid列表获取====" + deviceResult.Data.ToString());
                                MainPage.Log($"sid列表获取====\r\n" , deviceResult.Data.ToString());
                                var deviceList = JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString());
                                if (deviceList == null)
                                {
@@ -298,33 +337,33 @@
                                //======================获取Sip账号并且初始化SDK可视对讲设备列表====================
                                //如果检测线程没启动,才继续下面操作 因为App有可能刚启动马上收到推送了,然后才执行到这里
                                if (HDLLinphone.Current.CheckIncomingCallThreadIsNull())
                                {
                                //if (HDLLinphone.Current.CheckIncomingCallThreadIsNull())
                                //{
                                    
                                    //当前住宅是HDL可视对讲类型的设备
                                    if (isInterphoneType_HDL)
                                    {
                                        //HDLLinphone可视对讲,获取Sip账号并初始化SDK
                                        HDLCallVideoInfo callVideoInfo = new HDLCallVideoInfo();
                                        callVideoInfo.HomeId = DB_ResidenceData.Instance.CurrentRegion.id;
                                        callVideoInfo.InterphoneType = InterphoneType.HDL.ToString();
                                        HDLLinphone.Current.GetHDLSipInfoAndInitSDK(callVideoInfo);
                                    }
                                    else if (isInterphoneType_FREEVIEW)
                                    {
                                        //HDLLinphone可视对讲,获取Sip账号并初始化SDK
                                        HDLCallVideoInfo callVideoInfo = new HDLCallVideoInfo();
                                        callVideoInfo.HomeId = DB_ResidenceData.Instance.CurrentRegion.id;
                                        callVideoInfo.InterphoneType = InterphoneType.FREEVIEW.ToString();
                                        HDLLinphone.Current.GetHDLSipInfoAndInitSDK(callVideoInfo);
                                    }
                                    else
                                    {
                                        Utlis.WriteLine("当前住宅不支持HDL可视对讲,退出登录所有账号");
                                        //当前住宅不支持HDL可视对讲
                                        HDLLinphone.Current.LogoutAllAccount();
                                    }
                                }
                                //    //当前住宅是HDL可视对讲类型的设备
                                //    if (isInterphoneType_HDL)
                                //    {
                                //        //HDLLinphone可视对讲,获取Sip账号并初始化SDK
                                //        HDLCallVideoInfo callVideoInfo = new HDLCallVideoInfo();
                                //        callVideoInfo.HomeId = DB_ResidenceData.Instance.CurrentRegion.id;
                                //        callVideoInfo.InterphoneType = InterphoneType.HDL.ToString();
                                //        HDLLinphone.Current.GetHDLSipInfoAndInitSDK(callVideoInfo);
                                //    }
                                //    else if (isInterphoneType_FREEVIEW)
                                //    {
                                //        //HDLLinphone可视对讲,获取Sip账号并初始化SDK
                                //        HDLCallVideoInfo callVideoInfo = new HDLCallVideoInfo();
                                //        callVideoInfo.HomeId = DB_ResidenceData.Instance.CurrentRegion.id;
                                //        callVideoInfo.InterphoneType = InterphoneType.FREEVIEW.ToString();
                                //        HDLLinphone.Current.GetHDLSipInfoAndInitSDK(callVideoInfo);
                                //    }
                                //    else
                                //    {
                                //        Utlis.WriteLine("当前住宅不支持HDL可视对讲,退出登录所有账号");
                                //        //当前住宅不支持HDL可视对讲
                                //        HDLLinphone.Current.LogoutAllAccount();
                                //    }
                                //}
@@ -368,6 +407,7 @@
                        }
                        //======================群控====================
                        if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl)
                        {
                            var pack = Ins.HttpRequest.GetGroupControlList();
@@ -400,6 +440,7 @@
                                                }
                                                readSidList.Clear();
                                            }
                                            //FunctionList.List.Functions.AddRange(FunctionList.List.groupControls);
                                        }
                                        if (readSidList.Count > 0)
                                        {
@@ -494,11 +535,12 @@
                        //======================安防====================
                        GetSecurityList();
                        //===================读取逻辑列表====================
                        Logic.LogicList.Clear();//主页下拉强制刷新自动化列表
                        MainView.GetLogicList();//读取自动化列表
                    })
                    { IsBackground = true }.Start();
                    //===================读取逻辑列表==========================
                    Logic.LogicList.Clear();//主页下拉强制刷新自动化列表
                    //======================注册推送====================
                    httpRequest.RegisteredPush();