wxr
2023-06-05 753e67c3705dddb8e913bd853db151f94f81d600
HDL_ON/Common/HDLCommon.cs
@@ -7,7 +7,6 @@
using HDL_ON.Entity;
using System.Threading;
using HDL_ON.DriverLayer;
namespace HDL_ON
{
    /// <summary>
@@ -259,6 +258,8 @@
        {
            try
            {
                MainPage.Log($"接收到推送");
                //Extras为空不处理
                if (string.IsNullOrEmpty(jpushMessageInfo.Extras)) return;
@@ -278,6 +279,8 @@
                    {
                        //报警推送弹窗提示
                        ShowAlarmPushMessage(jpushMessageInfo, true);
                        //萤石门锁推送
                        HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.DoorLockPush(jpushMessageInfo);
                    }
                    else if (jpushMessageInfo.messageType.Contains(PushMessageType.FLCall.ToString()))
                    {
@@ -304,6 +307,7 @@
                    }
                    else if (jpushMessageInfo.messageType.Contains(PushMessageType.HDL_INTERPHONE.ToString()))
                    {
                        if (string.IsNullOrEmpty(jpushMessageInfo.expantContent)) return;
                        
                        //字段兼容问题,只能直接取值了
@@ -385,7 +389,16 @@
                    else if (jpushMessageInfo.messageType.Contains(PushMessageType.Prompt.ToString()))
                    {
                        ShowAlarmPushMessage(jpushMessageInfo, false);
                        //萤石门锁推送
                        HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.DoorLockPush(jpushMessageInfo);
                    }
                    else if (jpushMessageInfo.messageType.Contains(PushMessageType.DOOR_BELL.ToString()))
                    {
                        //萤石门锁推送
                        HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.DoorLockPush(jpushMessageInfo);
                    }
                }
            }
            catch (Exception EX)
@@ -423,6 +436,16 @@
        /// </summary>
        public void CheckLogout()
        {
#if __IOS__
            try{
                HDL_ON_iOS.AppDelegate.rootViewController.PopToRootViewController(false);
            }catch(Exception ex){
                MainPage.Log($"回到跟类失败:{ex.Message}");
            }
#else
            //Application.Activity.StartActivity()
#endif
            //测试账号,不挤下线
            switch (UserInfo.Current.AccountString)
            {
@@ -437,7 +460,13 @@
            //账号在别处登陆,被踢下线 跳转到登录页面
            new Alert(Language.StringByID(StringId.Tip), Language.StringByID(StringId.LoggedOnOtherDevices), Language.StringByID(StringId.Close)).Show();
            try
            {
            Logout();
            }catch (Exception ex)
            {
                MainPage.Log($"挤下线异常:{ex.Message}");
            }
        }
        /// <summary>
@@ -460,8 +489,10 @@
                    UserInfo.Current.LastTime = DateTime.MinValue;
                    UserInfo.Current.SaveUserInfo();
                    DB_ResidenceData.Instance.EixtAccount();
                    MainPage.Log("退出账号清空数据");
                    //4.注销HDLSIP账号登录 2021-08-20
                    HDLLinphone.Current.LogoutAllAccount();
                    MainPage.Log("注销HDLSIP账号登录");
#if __IOS__
                    //5.全视通登出
@@ -482,6 +513,7 @@
                    {
                        if (waitPage != null)
                        {
                            waitPage.Hide();
                            waitPage.RemoveFromParent();
                            waitPage = null;
                        }
@@ -667,6 +699,7 @@
            {
                try
                {
                    var list = UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.GetVideoDoorLockLockModelsList();
                    //先获取萤石云子账号token
                    var result = new HttpServerRequest().EZGetChildToken();
                    if (result.Code == StateCode.SUCCESS)
@@ -678,7 +711,9 @@
                        {
                            if (!string.IsNullOrEmpty(ezChildAccessToken))
                            {
#if __IOS__
                                //iOS
                                //初始化萤石云SDK,中文国内key、英文海外key 开发者账号使用应用包名申请的APPKEY,不同包名应用需配置不同的APPKEY
                                EZSDK.IOS.EZSDK.SharedInstance().InitLibWithAppKey("1aa98a90489b4838b966b57018b4b04b", "1aa98a90489b4838b966b57018b4b04b");
@@ -687,12 +722,25 @@
                                EZSDK.IOS.EZSDK.SharedInstance().SetRequestHttpsHostAndPlatform(OnAppConfig.Instance.RequestHttpsHost, 1, DB_ResidenceData.Instance.CurrentRegion.id);
                                //2.设置萤石子账号的AccessToken到SDK
                                EZSDK.IOS.EZSDK.SharedInstance().SetEZAccessToken(ezChildAccessToken);
                                ////3.打开摄像头设备列表页面
                                EZSDK.IOS.EZSDK.SharedInstance().Go2EZvizMonitor();
                                //////3.打开摄像头设备列表页面
                                //EZSDK.IOS.EZSDK.SharedInstance().Go2EZvizMonitor();
                                //EZSDK.IOS.EZDeviceInfo info = new EZSDK.IOS.EZDeviceInfo();
                                //info.de
                                //EZSDK.IOS.EZSDK.Play(info);
                                //2023年03月29日13:08:35 修改
                                Foundation.NSObject[] nSObject = new Foundation.NSObject[list.Count];
                                for (int i = 0; i < list.Count; i++)
                                {
                                    string strValue = list[i];
                                    nSObject[i] = new Foundation.NSString(strValue);
                                }
                                EZSDK.IOS.EZSDK.SharedInstance().ToEZDeviceListViewWithFilterTypes(nSObject);
#else
                                //Android
                                //1.设置所需河东的token、域名地址
@@ -704,21 +752,24 @@
                                    {
                                        ((BaseActivity)Shared.Application.Activity).SetPermission(result =>
                                        {
                                            if(result)
                                            {
                                            Android.Content.Intent intent = new Android.Content.Intent();
                                            var bundle = new Android.OS.Bundle();
                                            //传递name参数为tinyphp
                                            bundle.PutString("EzChildAccessToken", ezChildAccessToken);
                                            bundle.PutString("HdlToken", UserInfo.Current.LoginTokenString);
                                            bundle.PutString("Url", OnAppConfig.Instance.RequestHttpsHost);
                                            bundle.PutString("EzvizAppKey", "1aa98a90489b4838b966b57018b4b04b");
                                            bundle.PutInt("Platform", 1);
                                            bundle.PutString("HomeId", DB_ResidenceData.Instance.CurrentRegion.id);
                                            intent.PutExtras(bundle);
                                            intent.SetComponent(new Android.Content.ComponentName(Shared.Application.Activity, "com.videogo.MainActivity"));
                                            Shared.Application.Activity.StartActivity(intent);
                                            }
                                            //2023年03月29日13:08:35 修改
                                            Com.Videogo.Hdl.HDLEzvizSdk.Instance.Init(Application.Activity.Application, ezChildAccessToken, UserInfo.Current.LoginTokenString, UserInfo.Current.RefreshToken, OnAppConfig.Instance.RequestHttpsHost, "1aa98a90489b4838b966b57018b4b04b", 1, DB_ResidenceData.Instance.CurrentRegion.id);
                                            Com.Videogo.Hdl.HDLEzvizSdk.Instance.JumpToCameraListActivity(Shared.Application.Activity, list);
                                            //if (result)
                                            //{
                                            //    Android.Content.Intent intent = new Android.Content.Intent();
                                            //    var bundle = new Android.OS.Bundle();
                                            //    //传递name参数为tinyphp
                                            //    bundle.PutString("EzChildAccessToken", ezChildAccessToken);
                                            //    bundle.PutString("HdlToken", UserInfo.Current.LoginTokenString);
                                            //    bundle.PutString("Url", OnAppConfig.Instance.RequestHttpsHost);
                                            //    bundle.PutString("EzvizAppKey", "1aa98a90489b4838b966b57018b4b04b");
                                            //    bundle.PutInt("Platform", 1);
                                            //    bundle.PutString("HomeId", DB_ResidenceData.Instance.CurrentRegion.id);
                                            //    intent.PutExtras(bundle);
                                            //    intent.SetComponent(new Android.Content.ComponentName(Shared.Application.Activity, "com.videogo.MainActivity"));
                                            //    Shared.Application.Activity.StartActivity(intent);
                                            //}
                                        }, "android.permission.RECORD_AUDIO");
                                    }