wjc
2023-07-26 9508510f0b27da3278fa1161eb2ba3dd1e3e2030
HDL_ON/Common/ApiUtlis.cs
@@ -104,6 +104,11 @@
                code = Ins.HttpRequest.RefreshToken();
                if (code != StateCode.SUCCESS)
                {
                    if (waitPage != null)
                    {
                        waitPage.RemoveFromParent();
                        waitPage = null;
                    }
                    MainPage.Log($"刷新token失败");
                    return;
                }
@@ -112,6 +117,11 @@
                code = Ins.HttpRequest.GetHomePager();
                if (code != StateCode.SUCCESS)
                {
                    if (waitPage != null)
                    {
                        waitPage.RemoveFromParent();
                        waitPage = null;
                    }
                    MainPage.Log($"刷新住宅信息失败");
                    return;
                }
@@ -120,6 +130,11 @@
                code = Ins.HttpRequest.GetUserInfo();
                if (code != StateCode.SUCCESS)
                {
                    if (waitPage != null)
                    {
                        waitPage.RemoveFromParent();
                        waitPage = null;
                    }
                    MainPage.Log($"刷新个人信息失败");
                    return;
                }
@@ -178,7 +193,7 @@
                                FunctionList.List.ClearDatas();
                                //MainPage.Log($"============设备============开始" + FunctionList.List.Functions.Count);
                                //MainPage.Log($"读取设备信息成功");
                                //MainPage.Log($"sid列表获取====" + deviceResult.Data.ToString());
                                MainPage.Log($"sid列表获取====" + deviceResult.Data.ToString());
                                var deviceList = JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString());
                                if (deviceList == null)
                                {
@@ -257,8 +272,10 @@
                                    string videoList = videoInfo.Data.ToString();
                                    FunctionList.List.videoIntercom = JsonConvert.DeserializeObject<List<UI.UI2.FuntionControlView.Video.Video>>(videoList);
                                    foreach (var video in FunctionList.List.videoIntercom)
                                    for(int i =0;i< FunctionList.List.videoIntercom.Count;i++)
                                    {
                                        var video = FunctionList.List.videoIntercom[i];
                                        if (video.interphoneType == InterphoneType.IMOUVISIAL.ToString())
                                        {
                                            UI.UI2.PersonalCenter.PirDevice.PirSend.LcSubAccessToken = video.subAccountToken;
@@ -268,19 +285,27 @@
                                            isInterphoneType_HDL = true;
                                            DB_ResidenceData.Instance.SupportFacePass = true;
                                            DB_ResidenceData.Instance.SaveResidenceData();
                                            Entity.DB_ResidenceData.Instance.SupportFVDevice = true;
                                            DB_ResidenceData.Instance.SupportFVDevice = true;
                                        }
                                        else if (video.interphoneType == InterphoneType.FREEVIEW.ToString())
                                        {
#if __IOS__
                                            try
                                            {
                                                FunctionList.List.videoIntercom.Remove(video);
                                                --i;
                                            }catch(Exception ex)
                                            {
                                                MainPage.Log($"ios 全视通异常 : {ex.Message}");
                                            }
#else
                                            //为全视通可视对讲
                                            DB_ResidenceData.Instance.SupportFacePass = true;
                                            Entity.DB_ResidenceData.Instance.SupportVisitorManage = true;
                                            Entity.DB_ResidenceData.Instance.SupportFVDevice = true;
                                            //isInterphoneType_HDL = true;
                                            isInterphoneType_FREEVIEW = true;
#endif
                                        }
                                    }
                                }
@@ -290,6 +315,7 @@
                                //如果检测线程没启动,才继续下面操作 因为App有可能刚启动马上收到推送了,然后才执行到这里
                                if (HDLLinphone.Current.CheckIncomingCallThreadIsNull())
                                {
                                    //当前住宅是HDL可视对讲类型的设备
                                    if (isInterphoneType_HDL)
                                    {
@@ -301,7 +327,6 @@
                                    }
                                    else if (isInterphoneType_FREEVIEW)
                                    {
                                        //HDLLinphone可视对讲,获取Sip账号并初始化SDK
                                        HDLCallVideoInfo callVideoInfo = new HDLCallVideoInfo();
                                        callVideoInfo.HomeId = DB_ResidenceData.Instance.CurrentRegion.id;
@@ -323,23 +348,22 @@
                                {
#if __IOS__
                                    string systemVersion = UIKit.UIDevice.CurrentDevice.SystemVersion;
                                    string errorVersion = "16.2.0";
                                    if (systemVersion.CompareTo(errorVersion) < 0)///全视通不兼容ios16以上的系统,不要加载这个先
                                    {
                                        List<VisitorTempPassword> dataList = new List<VisitorTempPassword>();
                                        Dictionary<string, object> dictionary = new Dictionary<string, object>();
                                        dictionary.Add("homeId", Entity.DB_ResidenceData.Instance.CurrentRegion.id);
                                        var requestJson = HttpUtil.GetSignRequestJson(dictionary);
                                        ResponsePackNew pack = HttpUtil.RequestHttpsPost(NewAPI.Api_Post_GetExtMemberInfo, requestJson);
                                        if (pack != null)
                                        {
                                            var data = JsonConvert.DeserializeObject<FreeviewMemberInfo>(pack.Data.ToString());
                                            //登录全视通
                                            Shared.IOS.HDLFVSDK.Video.Init("", data.extUserId, DB_ResidenceData.Instance.CurrentRegion.id, "78FF1E4D-FC0A-4E71-9B79-0448E4460BD7", "T0001", "120.77.53.170:9700", "120.77.53.170:21664");
                                        }
                                    }
                                    //string systemVersion = UIKit.UIDevice.CurrentDevice.SystemVersion;
                                    //string errorVersion = "16.2.0";
                                    //if (systemVersion.CompareTo(errorVersion) < 0)///全视通不兼容ios16以上的系统,不要加载这个先
                                    //{
                                    //    List<VisitorTempPassword> dataList = new List<VisitorTempPassword>();
                                    //    Dictionary<string, object> dictionary = new Dictionary<string, object>();
                                    //    dictionary.Add("homeId", Entity.DB_ResidenceData.Instance.CurrentRegion.id);
                                    //    var requestJson = HttpUtil.GetSignRequestJson(dictionary);
                                    //    ResponsePackNew pack = HttpUtil.RequestHttpsPost(NewAPI.Api_Post_GetExtMemberInfo, requestJson);
                                    //    if (pack != null)
                                    //    {
                                    //        var data = JsonConvert.DeserializeObject<FreeviewMemberInfo>(pack.Data.ToString());
                                    //        //登录全视通
                                    //        Shared.IOS.HDLFVSDK.Video.Init("", data.extUserId, DB_ResidenceData.Instance.CurrentRegion.id, "78FF1E4D-FC0A-4E71-9B79-0448E4460BD7", "T0001", "120.77.53.170:9700", "120.77.53.170:21664");
                                    //    }
                                    //}
#endif
                                }
@@ -359,6 +383,7 @@
                        }
                        //======================群控====================
                        if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl)
                        {
                            var pack = Ins.HttpRequest.GetGroupControlList();
@@ -391,6 +416,7 @@
                                                }
                                                readSidList.Clear();
                                            }
                                            //FunctionList.List.Functions.AddRange(FunctionList.List.groupControls);
                                        }
                                        if (readSidList.Count > 0)
                                        {