From 7cfcdb7a90f59bf9001c948e166fd9af09752fe1 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期二, 24 五月 2022 17:15:18 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/release0123' into wjc

---
 HDL-ON_Android/Other/JPush/JPushReceiver.cs |  135 +++++++++++++++++++++++++-------------------
 1 files changed, 77 insertions(+), 58 deletions(-)

diff --git a/HDL-ON_Android/Other/JPush/JPushReceiver.cs b/HDL-ON_Android/Other/JPush/JPushReceiver.cs
index 4566b62..3b0cf2b 100644
--- a/HDL-ON_Android/Other/JPush/JPushReceiver.cs
+++ b/HDL-ON_Android/Other/JPush/JPushReceiver.cs
@@ -43,6 +43,8 @@
             OpenNotification(context, notificationMessage);
         }
 
+       static int msgId = 0;
+
         /// <summary>
         /// 鏀跺埌閫氱煡鍥炶皟
         /// </summary>
@@ -50,46 +52,58 @@
         /// <param name="p1"></param>
         public override void OnNotifyMessageArrived(Context context, NotificationMessage notificationMessage)
         {
-            base.OnNotifyMessageArrived(context, notificationMessage);
+            try
+            {
 
-            var pushMes = new JPushMessageInfo()
-            {
-                Title = notificationMessage.NotificationTitle,
-                Content = notificationMessage.NotificationContent,
-                Extras = notificationMessage.NotificationExtras
-            };
-
-            var jpushExpandData = GetJPushExpandData(pushMes);
-            if (jpushExpandData != null && jpushExpandData.messageType != null)
-            {
-                pushMes.messageType = jpushExpandData.messageType;
-                pushMes.expantContent = jpushExpandData.expantContent;//spk
-                pushMes.HomeId = jpushExpandData.homeId;
-                Utlis.WriteLine("PushMes messageType : " + pushMes.messageType);
-            }
-
-            Utlis.WriteLine("PushMes title : " + pushMes.Title);
-            Utlis.WriteLine("PushMes message : " + pushMes.Content);
-            Utlis.WriteLine("PushMes extras : " + pushMes.Extras);
-            Utlis.WriteLine("PushMes HomeId : " + pushMes.HomeId);
-
-            //UserInfo.Current.PushMesTitle = pushMes.Title;
-            //UserInfo.Current.PushMesMessage = pushMes.Content;
-            //UserInfo.Current.PushMesExtras = pushMes.Extras;
-            //UserInfo.Current.pushMesMessageType = pushMes.messageType;
-            //UserInfo.Current.pushMesExpantContent = pushMes.expantContent;
-            //UserInfo.Current.PushMesHomeId = pushMes.HomeId;
-            UserInfo.Current.pushMessageInfo = pushMes;
-            UserInfo.Current.inCall = DateTime.Now;
-
-            Shared.Application.RunOnMainThread(() =>
-            {
-                HDLCommon.Current.AdjustPushMessage(pushMes);
-            });
-            if (!MainPage.IsEnterBackground)
-            {
                 NotificationManager nMgr = (NotificationManager)Shared.Application.Activity.GetSystemService(Context.NotificationService);
-                nMgr.CancelAll();
+                if (msgId != 0)
+                    nMgr.Cancel(msgId);
+                msgId = notificationMessage.NotificationId;
+                base.OnNotifyMessageArrived(context, notificationMessage); Console.WriteLine("123456789ghjsdjfasdfk");
+
+                var pushMes = new JPushMessageInfo()
+                {
+                    Title = notificationMessage.NotificationTitle,
+                    Content = notificationMessage.NotificationContent,
+                    Extras = notificationMessage.NotificationExtras
+                };
+
+                var jpushExpandData = GetJPushExpandData(pushMes);
+                if (jpushExpandData != null && jpushExpandData.messageType != null)
+                {
+                    pushMes.messageType = jpushExpandData.messageType;
+                    pushMes.expantContent = jpushExpandData.expantContent;//spk
+                    pushMes.HomeId = jpushExpandData.homeId;
+                    Utlis.WriteLine("PushMes messageType : " + pushMes.messageType);
+                }
+
+                Utlis.WriteLine("PushMes title : " + pushMes.Title);
+                Utlis.WriteLine("PushMes message : " + pushMes.Content);
+                Utlis.WriteLine("PushMes extras : " + pushMes.Extras);
+                Utlis.WriteLine("PushMes HomeId : " + pushMes.HomeId);
+
+                //UserInfo.Current.PushMesTitle = pushMes.Title;
+                //UserInfo.Current.PushMesMessage = pushMes.Content;
+                //UserInfo.Current.PushMesExtras = pushMes.Extras;
+                //UserInfo.Current.pushMesMessageType = pushMes.messageType;
+                //UserInfo.Current.pushMesExpantContent = pushMes.expantContent;
+                //UserInfo.Current.PushMesHomeId = pushMes.HomeId;
+                UserInfo.Current.pushMessageInfo = pushMes;
+                if (!string.IsNullOrEmpty(pushMes.spk))//鑷爺鍙瀵硅闇�瑕佽褰曟椂闂村弽鍛�
+                    UserInfo.Current.inCall = DateTime.Now;
+
+                if (!MainPage.IsEnterBackground)
+                {
+                    //NotificationManager nMgr = (NotificationManager)Shared.Application.Activity.GetSystemService(Context.NotificationService);
+                    //nMgr.CancelAll();
+                    Shared.Application.RunOnMainThread(() =>
+                    {
+                        HDLCommon.Current.AdjustPushMessage(pushMes);
+                    });
+                }
+            }
+            catch (Exception wexx) {
+                Console.WriteLine("safsdf"+wexx.Message);
             }
         }
 
@@ -199,25 +213,30 @@
                 i.SetFlags(ActivityFlags.NewTask);
                 context.StartActivity(i);
                 //瑙f瀽msg
-                AdjustPushMessage(pushMes);
-
-                //Shared.Application.RunOnMainThread(() =>
-                //{
-                //    if (Shared.Application.Activity == null)
-                //    {
-                //        var tempIntent = new Intent(context, typeof(Shared.BaseActivity));//Intent intent=new Intent( 璧峰缁勪欢瀵硅薄 , 鐩爣 Service.class);
-                //        tempIntent.SetFlags(ActivityFlags.BroughtToFront);
-                //        context.StartActivity(tempIntent);
-
-                //        HDLCommon.Current.AdjustPushMessage(pushMes);
-                //    }
-                //    else
-                //    {
-
-                //        (Shared.Application.Activity as BaseActivity).MoveToFront();
-                //        HDLCommon.Current.AdjustPushMessage(pushMes);
-                //    }
-                //});
+                AdjustPushMessage(pushMes);
+
+                //Shared.Application.RunOnMainThread(() =>
+                //{
+                //    if (Shared.Application.Activity == null)
+                //    {
+                //        var tempIntent = new Intent(context, typeof(Shared.BaseActivity));//Intent intent=new Intent( 璧峰缁勪欢瀵硅薄 , 鐩爣 Service.class);
+                //        tempIntent.SetFlags(ActivityFlags.BroughtToFront);
+                //        context.StartActivity(tempIntent);
+
+                //        HDLCommon.Current.AdjustPushMessage(pushMes);
+                //    }
+                //    else
+                //    {
+
+                //        (Shared.Application.Activity as BaseActivity).MoveToFront();
+                //        HDLCommon.Current.AdjustPushMessage(pushMes);
+                //    }
+                //});
+                if (!MainPage.IsEnterBackground)
+                {
+                    NotificationManager nMgr = (NotificationManager)Shared.Application.Activity.GetSystemService(Context.NotificationService);
+                    nMgr.CancelAll();
+                }
             }
             catch
             {
@@ -238,7 +257,7 @@
             {
                 while (MainPage.BasePageView == null)
                 {
-                    System.Threading.Thread.Sleep(300);
+                    System.Threading.Thread.Sleep(300);
                 }
                 Shared.Application.RunOnMainThread(() =>
                 {

--
Gitblit v1.8.0