| | |
| | | #region ■ 推送处理_______________________ |
| | | /// <summary> |
| | | /// 推送消息处理 |
| | | /// 注意:Android要在主线程(UI线程)执行 |
| | | /// </summary> |
| | | /// <param name="jpushMessageInfo"></param> |
| | | public void AdjustPushMessage(JPushMessageInfo jpushMessageInfo) |
| | | { |
| | | try |
| | | { |
| | | if (jpushMessageInfo.Extras != null && jpushMessageInfo.Extras.Contains("OffLine")) |
| | | { |
| | | Shared.Application.RunOnMainThread(() => |
| | | { |
| | | ////账号在别处登陆,被踢下线 跳转到登录页面 |
| | | //new Alert(Language.StringByID(StringId.Tip), Language.StringByID(StringId.LoggedOnOtherDevices), Language.StringByID(StringId.Close)).Show(); |
| | | //退出登录操作 |
| | | CheckLogout(); |
| | | //Extras为空不处理 |
| | | if (string.IsNullOrEmpty(jpushMessageInfo.Extras)) return; |
| | | |
| | | }); |
| | | return; |
| | | if (jpushMessageInfo.Extras.Contains(PushMessageType.OffLine.ToString())) |
| | | { |
| | | CheckLogout(); |
| | | } |
| | | else |
| | | { |
| | | Shared.Application.RunOnMainThread(() => |
| | | GetPushMessageAction?.Invoke(); |
| | | |
| | | //messageType为空不处理 |
| | | if (string.IsNullOrEmpty(jpushMessageInfo.messageType)) return; |
| | | |
| | | //报警推送才弹窗提示(messageType包含Alarm关键字的) |
| | | if (jpushMessageInfo.messageType.Contains(PushMessageType.Alarm.ToString())) |
| | | { |
| | | GetPushMessageAction?.Invoke(); |
| | | //报警推送才弹窗提示(messageType包含Alarm关键字的) |
| | | if (jpushMessageInfo.messageType != null && jpushMessageInfo.messageType.Contains("Alarm")) |
| | | //报警推送弹窗提示 |
| | | ShowAlarmPushMessage(jpushMessageInfo); |
| | | } |
| | | else if (jpushMessageInfo.messageType.Contains(PushMessageType.FLCall.ToString())) |
| | | { |
| | | if (string.IsNullOrEmpty(jpushMessageInfo.expantContent)) return; |
| | | |
| | | ESVideoInfo eSVideoInfo = GetESOnVideoJson(jpushMessageInfo.expantContent); |
| | | |
| | | if (eSVideoInfo == null) return; |
| | | |
| | | if (string.IsNullOrEmpty(eSVideoInfo.uuid)) return; |
| | | |
| | | if (eSVideoInfo.uuid.Contains(",")) |
| | | { |
| | | //报警推送弹窗提示 |
| | | ShowAlarmPushMessage(jpushMessageInfo); |
| | | //new Alert(jpushMessageInfo.Title, jpushMessageInfo.Content, Language.StringByID(StringId.Close)).Show(); |
| | | var uuid = eSVideoInfo.uuid.Split(','); |
| | | eSVideoInfo.ESVideoUUID = uuid[0]; |
| | | } |
| | | else |
| | | { |
| | | eSVideoInfo.ESVideoUUID = eSVideoInfo.uuid; |
| | | } |
| | | |
| | | }); |
| | | return; |
| | | ESOnVideo.Current.ShowESvideoVideoIntercom(eSVideoInfo, "FLVI"); |
| | | |
| | | } |
| | | else if (jpushMessageInfo.messageType.Contains(PushMessageType.HDL_INTERPHONE.ToString())) |
| | | { |
| | | if (string.IsNullOrEmpty(jpushMessageInfo.expantContent)) return; |
| | | |
| | | //字段兼容问题,只能直接取值了 |
| | | var json= Newtonsoft.Json.Linq.JObject.Parse(jpushMessageInfo.expantContent); |
| | | ESVideoInfo eSVideoInfo = new ESVideoInfo();// GetESOnVideoJson(jpushMessageInfo.expantContent); |
| | | eSVideoInfo.callId = json["callId"].ToString(); |
| | | //eSVideoInfo.Lc_AccessToken = UI.UI2.PersonalCenter.PirDevice.PirSend.LcSubAccessToken;//json["subAccountToken"].ToString();// |
| | | eSVideoInfo.Lc_AccessToken = json["subAccountToken"].ToString();//2021-05-13 目前云端还没拿到Lc_AccessToken,目前没办法正常使用 |
| | | eSVideoInfo.Lc_DeviceId = json["deviceId"].ToString(); |
| | | eSVideoInfo.Lc_Location = OnAppConfig.Instance.RequestHttpsHost.Contains("China") ? 0 : 1; |
| | | eSVideoInfo.Lc_PlayToken = json["token"].ToString(); |
| | | eSVideoInfo.Lc_Psk = json["cname"].ToString(); |
| | | |
| | | if (eSVideoInfo == null) return; |
| | | |
| | | ESOnVideo.Current.ShowESvideoVideoIntercom(eSVideoInfo, "IMOUVISIAL"); |
| | | |
| | | } |
| | | } |
| | | } |
| | | catch(Exception EX) |
| | | { |
| | | Utlis.WriteLine("catch: " + EX.ToString()); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 解析丰林可视对讲推送数据 |
| | | /// </summary> |
| | | /// <param name="jsonStr"></param> |
| | | /// <returns></returns> |
| | | ESVideoInfo GetESOnVideoJson(string jsonStr) |
| | | { |
| | | try |
| | | { |
| | | if (!string.IsNullOrEmpty(jsonStr)) |
| | | { |
| | | return Newtonsoft.Json.JsonConvert.DeserializeObject<ESVideoInfo>(jsonStr); |
| | | } |
| | | return null; |
| | | } |
| | | catch |
| | | { |
| | | |
| | | return null; |
| | | } |
| | | } |
| | | |